Changeset 7332 for trunk/psastro/src/psastroAstromGuess.c
- Timestamp:
- Jun 4, 2006, 7:02:16 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroAstromGuess.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroAstromGuess.c
r7014 r7332 3 3 // XXX this function assumes the initial astrometry arrives in the form of 4 4 // XXX WCS keywords in the headers corresponding to the chips. 5 // XXX this function is both converting the header WCS astrometry terms to the fpa terms 6 // and applying the astrometry to the detected objects. 5 7 bool psastroAstromGuess (pmConfig *config) { 6 8 7 9 bool newFPA = true; 8 10 bool status = false; 11 bool isMosaic = false; 9 12 double RAmin, RAmax, RAminSky, RAmaxSky; 10 13 double DECmin, DECmax; … … 13 16 pmCell *cell = NULL; 14 17 pmReadout *readout = NULL; 18 19 // is this a mosaic astrometry analysis? 20 psMetadataLookupStr (&isMosaic, config->arguments, "MOSASTRO"); 15 21 16 22 // select the current recipe … … 30 36 double plateScale = psMetadataLookupF32 (&status, recipe, "PSASTRO.PLATE.SCALE"); 31 37 if (!status) plateScale = 1.0; 38 plateScale = 1.0; 32 39 33 40 pmFPAview *view = pmFPAviewAlloc (0); … … 41 48 pmHDU *hdu = pmFPAviewThisHDU (view, fpa); 42 49 43 pmAstromReadWCS ( &fpa->projection, &fpa->toTangentPlane, &chip->toFPA, hdu->header, plateScale);50 pmAstromReadWCS (fpa, chip, hdu->header, plateScale, isMosaic); 44 51 if (newFPA) { 45 52 newFPA = false; … … 49 56 DECmin = DECmax = fpa->projection->D; 50 57 } 51 52 // build projection inversions53 // XXX region should be set from image data54 psRegion region = {0, 0, 2000, 4500};55 fpa->fromTangentPlane = psPlaneDistortIdentity ();56 chip->fromFPA = psPlaneTransformInvert (NULL, chip->toFPA, region, 20);57 58 58 59 // apply the new WCS guess data to all of the data in the readouts … … 66 67 if (! readout->data_exists) { continue; } 67 68 68 psArray * objects = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.OBJECTS");69 if ( objects == NULL) { continue; }69 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS"); 70 if (rawstars == NULL) { continue; } 70 71 71 for (int i = 0; i < objects->n; i++) {72 pmAstromObj * object = objects->data[i];72 for (int i = 0; i < rawstars->n; i++) { 73 pmAstromObj *raw = rawstars->data[i]; 73 74 74 psPlaneTransformApply (object->FP, chip->toFPA, object->chip); 75 psPlaneDistortApply (object->TP, fpa->toTangentPlane, object->FP, 0.0, 0.0); 76 p_psDeproject (object->sky, object->TP, fpa->projection); 75 psPlaneTransformApply (raw->FP, chip->toFPA, raw->chip); 76 psPlaneDistortApply (raw->TP, fpa->toTangentPlane, raw->FP, 0.0, 0.0); 77 p_psDeproject (raw->sky, raw->TP, fpa->projection); 78 79 if (i < 0) { 80 fprintf (stderr, "up: %f,%f -> %f,%f -> %f,%f -> %f,%f\n", 81 raw->chip->x, raw->chip->y, 82 raw->FP->x, raw->FP->y, 83 raw->TP->x, raw->TP->y, 84 raw->sky->r, raw->sky->d); 85 86 psPlane *fp = psPlaneAlloc(); 87 psPlane *tp = psPlaneAlloc(); 88 psPlane *ch = psPlaneAlloc(); 89 90 p_psProject (tp, raw->sky, fpa->projection); 91 psPlaneDistortApply (fp, fpa->fromTangentPlane, tp, 0.0, 0.0); 92 psPlaneTransformApply (ch, chip->fromFPA, fp); 93 94 fprintf (stderr, "dn: %f,%f <- %f,%f <- %f,%f <- %f,%f\n", 95 ch->x, ch->y, 96 fp->x, fp->y, 97 tp->x, tp->y, 98 raw->sky->r, raw->sky->d); 99 } 77 100 78 101 // rationalize ra to sky range centered on boresite 79 while ( object->sky->r < RAminSky) object->sky->r += M_PI;80 while ( object->sky->r > RAmaxSky) object->sky->r -= M_PI;102 while (raw->sky->r < RAminSky) raw->sky->r += M_PI; 103 while (raw->sky->r > RAmaxSky) raw->sky->r -= M_PI; 81 104 82 RAmin = PS_MIN ( object->sky->r, RAmin);83 RAmax = PS_MAX ( object->sky->r, RAmax);105 RAmin = PS_MIN (raw->sky->r, RAmin); 106 RAmax = PS_MAX (raw->sky->r, RAmax); 84 107 85 DECmin = PS_MIN ( object->sky->d, DECmin);86 DECmax = PS_MAX ( object->sky->d, DECmax);108 DECmin = PS_MIN (raw->sky->d, DECmin); 109 DECmax = PS_MAX (raw->sky->d, DECmax); 87 110 } 88 111 }
Note:
See TracChangeset
for help on using the changeset viewer.
