Changeset 26386
- Timestamp:
- Dec 11, 2009, 1:59:41 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/addstar/src/psps_ids.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/src/psps_ids.c
r26384 r26386 1 1 # include "addstar.h" 2 2 3 // Compute PSPS defined IDs3 // Compute IDs for PSPS based on recipe they defined 4 4 5 5 uint64_t 6 6 CreatePSPSDetectionID(double tobs, int ccdid, int detID) 7 7 { 8 // double floor();9 8 // t0 for detection id is 2007-01-01 00:00:00 utc 10 9 double t0 = 54101.0; 11 double diff; 12 int itmp; 13 uint64_t detectid; 14 15 diff = floor( 100000. * (tobs - t0) ); 16 itmp = diff; 10 double diff = floor( 100000. * (tobs - t0) ); 11 int itmp = diff; 12 17 13 // ccdid must be < 100 18 detectid = 1000000000*((uint64_t) itmp) + 10000000 * ((uint64_t) ccdid) +14 uint64_t detectid = 1000000000*((uint64_t) itmp) + 10000000 * ((uint64_t) ccdid) + 19 15 ((uint64_t) detID); 20 16 … … 25 21 CreatePSPSObjectID(double ra, double dec) 26 22 { 23 double zh = 0.0083333; 24 double zid = (dec + 90.) / zh; // 0 - 180*60*2 = 21600 < 15 bits 25 int izone = (int) floor(zid); 26 double zresid = zid - ((float) izone); // 0.0 - 1.0 27 27 28 uint64_t part1, part2, part3; 28 double zid, zresid;29 int izone;30 double zh = 0.0083333;31 32 zid = (dec + 90.) / zh; // 0 - 180*60*2 = 21600 < 15 bits33 izone = (int) floor(zid);34 zresid = zid - ((float) izone); // 0.0 - 1.035 36 29 part1 = (uint64_t)( izone * 10000000000000) ; 37 30 part2 = ((uint64_t)(ra * 1000000.)) * 10000 ; // 0 - 360*1e6 = 3.6e8 (< 29 bits) 38 part3 = (int) (zresid * 10000.0) ; // 0 - 10000 (1 bit == 30/10000 arcsec (< 14 bits)31 part3 = (int) (zresid * 10000.0) ; // 0 - 10000 (1 bit == 30/10000 arcsec) (< 14 bits) 39 32 40 33 return part1 + part2 + part3;
Note:
See TracChangeset
for help on using the changeset viewer.
