Changeset 35592 for branches/eam_branches/ipp-20130509
- Timestamp:
- May 22, 2013, 7:29:00 AM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130509/Ohana/src/uniphot/src
- Files:
-
- 4 edited
-
initialize_fiximids.c (modified) (2 diffs)
-
load_images_fiximids.c (modified) (3 diffs)
-
update_catalog_fiximids.c (modified) (2 diffs)
-
update_dvo_fiximids.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130509/Ohana/src/uniphot/src/initialize_fiximids.c
r35591 r35592 5 5 fprintf (stderr, " options:\n"); 6 6 fprintf (stderr, " -v : verbose mode\n"); 7 fprintf (stderr, " -cpt n0000/0000.00.cpt : only repair this cpt file \n"); 8 fprintf (stderr, " -region Rmin Rmax Dmin Dmax : only repair this region\n"); 7 9 fprintf (stderr, " -update : actually write results to detections tables\n"); 8 fprintf (stderr, " -parallel : run in parallel mode\n"); 10 fprintf (stderr, " -parallel : run in parallel mode\n\n"); 11 9 12 fprintf (stderr, " -h : this help list\n"); 10 13 fprintf (stderr, " -help : this help list\n"); 11 14 fprintf (stderr, " --h : this help list\n"); 12 15 fprintf (stderr, " --help : this help list\n"); 16 13 17 fprintf (stderr, " Note that the dvo db can be specified by -D CATDIR (directory)\n"); 14 18 exit (2); … … 170 174 } 171 175 176 SINGLE_CPT = NULL; 177 if ((N = get_argument (argc, argv, "-cpt"))) { 178 remove_argument (N, &argc, argv); 179 SINGLE_CPT = strcreate (argv[N]); 180 remove_argument (N, &argc, argv); 181 } 182 172 183 // region of interest 173 184 UserPatch.Rmin = 0; -
branches/eam_branches/ipp-20130509/Ohana/src/uniphot/src/load_images_fiximids.c
r35591 r35592 1 1 # include "fiximids.h" 2 2 3 // array of mosaic definition structures 4 static off_t Nmosaic; 5 static Mosaic *mosaic; 3 off_t Nimage; 4 e_time *startImage; 5 e_time *stopImage; 6 short *photcodeImage; 6 7 7 // list of mosaic associated with each image 8 static off_t Nmosaic_for_images; // number of images (for off_ternal checks) 9 static off_t *mosaic_for_images; // array of: image -> mosaic 10 11 Image *load_images_fiximids (FITS_DB *db, off_t *Nimage) { 8 Image *load_images_fiximids (FITS_DB *db, off_t *N) { 12 9 13 10 Image *image; … … 25 22 } 26 23 24 // XXX init lookup tables 25 27 26 fprintf (stderr, "loaded "OFF_T_FMT" images\n", *Nimage); 28 27 … … 33 32 // This code is copied from relastro/src/MosaicOps.c 34 33 35 off_t getMosaicByTimes (unsigned int start, unsigned int stop, unsigned int *startMos, unsigned int *stopMos, off_t *indexMos) {34 off_t FindImageID (e_time time, short photcode) { 36 35 37 // use bisection to find the overlapping mosaic36 // use bisection to find the overlapping imagea 38 37 39 38 off_t Nlo, Nhi, N; -
branches/eam_branches/ipp-20130509/Ohana/src/uniphot/src/update_catalog_fiximids.c
r35591 r35592 7 7 8 8 found = 0; 9 for (i = 0; i < catalog[0].Naverage; i++) { 9 for (i = 0; i < catalog[0].Nmeasure; i++) { 10 11 // only do PS1 / GPC1 photcodes? 12 // XXX if (catalog[0].measure[i].photcode < 10000) continue; 13 // XXX if (catalog[0].measure[i].photcode > 10600) continue; 10 14 11 off_t m = catalog[0].average[i].measureOffset; 12 for (j = 0; j < catalog[0].average[i].Nmeasure; j++, m++) { 13 off_t ID = catalog[0].measure[m].imageID; 14 if (ID <= 0) continue; // detections with imageID == 0 do not have a valid image (eg, ref photcode) 15 // we have a measure with a given photcode and time: 16 short photcode = catalog[0].measure[i].photcode; 17 e_time time = catalog[0].measure[i].t; 15 18 16 // XXX only do GPC1 data for now 17 catalog[0].measure[m].pltscale = pltScale; 18 if (catalog[0].measure[m].photcode < 10000) continue; 19 if (catalog[0].measure[m].photcode > 10600) continue; 20 21 // index[ID] = seqN 19 off_t imageID = FindImageID (time, photcode); 20 if (imageID <= 0) continue; // detections with imageID == 0 do not have a valid image (eg, ref photcode) 22 21 23 off_t seq = index[ID]; 22 if (imageID == catalog[0].measure[i].imageID) { 23 // existing image ID is valid 24 Nvalid ++; 25 onImage[imageID] ++; 26 continue; 27 } 24 28 25 Mosaic *mosaic = getMosaicForImage(seq); 26 Coords *coords = &image[seq].coords; 27 Coords *mosaicCoords = mosaic ? &mosaic->coords : NULL; 29 // existing image ID is NOT valid 30 catalog[0].measure[i].imageID = imageID; 31 Ninvalid ++; 32 onImage[imageID] ++; 33 continue; 28 34 29 double Xccd = catalog[0].measure[m].Xccd; 30 double Yccd = catalog[0].measure[m].Yccd; 31 32 fiximids_local_astrometry (&posAngle, &pltScale, Xccd, Yccd, mosaicCoords, coords); 33 34 catalog[0].measure[m].posangle = ToShortDegrees(posAngle); 35 catalog[0].measure[m].pltscale = pltScale; 36 myAssert(isfinite(catalog[0].measure[m].posangle), "oops: fiximids made a nan"); 37 myAssert(isfinite(catalog[0].measure[m].pltscale), "oops: fiximids made a nan"); 38 found ++; 39 } 35 found ++; 40 36 } 41 37 … … 45 41 } 46 42 47 // this is basically a re-write / adaptation of pmSourceLocalAstrometry48 // posangle in degrees, plate scale in arcseconds/pixel49 int fiximids_local_astrometry (float *posAngle, float *pltScale, double x, double y, Coords *mosaic, Coords *coords) {50 51 double Lx, Mx, Po, Qo, Px, Qx, Py, Qy;52 53 // calculate the astrometry for the coordinate of interest54 XY_to_LM (&Lx, &Mx, x, y, coords);55 if (mosaic) {56 XY_to_LM (&Po, &Qo, Lx, Mx, mosaic);57 } else {58 Po = Lx;59 Qo = Mx;60 }61 62 XY_to_LM (&Lx, &Mx, x + 1.0, y, coords);63 if (mosaic) {64 XY_to_LM (&Px, &Qx, Lx, Mx, mosaic);65 } else {66 Px = Lx;67 Qx = Mx;68 }69 70 XY_to_LM (&Lx, &Mx, x, y + 1.0, coords);71 if (mosaic) {72 XY_to_LM (&Py, &Qy, Lx, Mx, mosaic);73 } else {74 Py = Lx;75 Qy = Mx;76 }77 78 // XXX units for the resulting Tangent Plane coordinates??79 80 double dPdX = Px - Po;81 double dPdY = Py - Po;82 83 double dQdX = Qx - Qo;84 double dQdY = Qy - Qo;85 86 double pltScale_x = hypot(dPdX, dQdX);87 double pltScale_y = hypot(dPdY, dQdY);88 *pltScale = 3600.0*0.5*(pltScale_x + pltScale_y);89 90 double posAngle_x, posAngle_y;91 double crossProduct = dPdX * dQdY - dPdY * dQdX;92 if (crossProduct > 0.) {93 *pltScale *= -1.0;94 posAngle_x = atan2 (dQdX, dPdX);95 posAngle_y = atan2 (dQdY, dPdY) - M_PI_2;96 } else {97 posAngle_x = atan2 (dQdX, -dPdX);98 posAngle_y = atan2 (dQdY, dPdY) - M_PI_2;99 }100 101 // with errors, these may end up on opposite sides of the M_PI boundary.102 if (posAngle_x - posAngle_y > M_PI) {103 posAngle_y += 2.0 * M_PI;104 }105 if (posAngle_y - posAngle_x > M_PI) {106 posAngle_x += 2.0 * M_PI;107 }108 *posAngle = 0.5*(posAngle_x + posAngle_y)*DEG_RAD;109 110 return TRUE;111 } -
branches/eam_branches/ipp-20130509/Ohana/src/uniphot/src/update_dvo_fiximids.c
r35591 r35592 120 120 121 121 char tmpline[1024]; 122 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 123 if (UPDATE) { snprintf (tmpline, 1024, "%s -update", command); strcpy (command, tmpline); } 122 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 123 if (SINGLE_CPT) { snprintf (tmpline, 1024, "%s -cpt %s", SINGLE_CPT, command); strcpy (command, tmpline); } 124 if (UPDATE) { snprintf (tmpline, 1024, "%s -update", command); strcpy (command, tmpline); } 124 125 125 126 if (PARALLEL_MANUAL) continue;
Note:
See TracChangeset
for help on using the changeset viewer.
