- Timestamp:
- Mar 15, 2009, 4:56:07 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/eam_branch_20090312/psastro/src/psastroExtractDataLoad.c
r23322 r23335 29 29 pmChip *chip; 30 30 31 bool newFPA = true; 32 double RAmin = +FLT_MAX; 33 double RAmax = -FLT_MAX; 34 double DECmin = +FLT_MAX; 35 double DECmax = -FLT_MAX; 36 37 double RAminSky = NAN; 38 double RAmaxSky = NAN; 39 31 40 psTimerStart ("psastro"); 32 41 … … 48 57 pmFPAfile *astrom = psMetadataLookupPtr (NULL, config->files, "PSASTRO.EXTRACT.ASTROM"); 49 58 if (!astrom) psAbort ("PSASTRO.EXTRACT.ASTROM not listed in config->files"); 59 pmFPA *fpa = astrom->fpa; 50 60 51 61 pmFPAfileActivate(config->files, false, NULL); … … 76 86 } 77 87 88 // apply the header astrometry to the astrometry structures 78 89 while ((chip = pmFPAviewNextChip (view, astrom->fpa, 1)) != NULL) { 79 90 psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 80 91 if (!chip->process || !chip->file_exists || !chip->data_exists) { continue; } 92 93 if (newFPA) { 94 newFPA = false; 95 while (fpa->toSky->R < 0) fpa->toSky->R += 2.0*M_PI; 96 while (fpa->toSky->R > 2.0*M_PI) fpa->toSky->R -= 2.0*M_PI; 97 RAminSky = fpa->toSky->R - M_PI; 98 RAmaxSky = fpa->toSky->R + M_PI; 99 } 81 100 82 101 // read WCS data from the corresponding header … … 96 115 } 97 116 } 117 118 // determine RA,DEC of 4 corners, use to find RA_MIN,MAX, DEC_MIN,MAX 119 psRegion *region = pmChipPixels (chip); 120 psPlane ptCH[4], ptFP, ptTP; 121 psSphere ptSky; 122 ptCH[0].x = region->x0; 123 ptCH[0].y = region->y0; 124 ptCH[1].x = region->x1; 125 ptCH[1].y = region->y0; 126 ptCH[2].x = region->x1; 127 ptCH[2].y = region->y1; 128 ptCH[3].x = region->x0; 129 ptCH[3].y = region->y1; 130 psFree (region); 131 132 for (int i = 0; i < 4; i++) { 133 psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH[i]); 134 psPlaneTransformApply (&ptTP, fpa->toTPA, &ptFP); 135 psDeproject (&ptSky, &ptTP, fpa->toSky); 136 137 // rationalize ra to sky range centered on boresite 138 while (ptSky.r < RAminSky) ptSky.r += 2.0*M_PI; 139 while (ptSky.r > RAmaxSky) ptSky.r -= 2.0*M_PI; 140 141 RAmin = PS_MIN (ptSky.r, RAmin); 142 RAmax = PS_MAX (ptSky.r, RAmax); 143 144 DECmin = PS_MIN (ptSky.d, DECmin); 145 DECmax = PS_MAX (ptSky.d, DECmax); 146 147 psLogMsg ("psastro", 2, "chip %d (corner %d) : %f %f -> %f %f -> %f %f -> %f %f\n", 148 view->chip, i, ptCH[i].x, ptCH[i].y, ptFP.x, ptFP.y, ptTP.x, ptTP.y, 149 DEG_RAD*ptSky.r, DEG_RAD*ptSky.d); 150 } 98 151 } 99 152 psLogMsg ("psastro", 3, "convert wcs terms to internal format : %f sec\n", psTimerMark ("psastro")); 153 154 psLogMsg ("psastro", 2, "loaded raw data from %f,%f to %f,%f\n", 155 DEG_RAD*RAmin, DEG_RAD*DECmin, 156 DEG_RAD*RAmax, DEG_RAD*DECmax); 157 158 psMetadataAddF32 (recipe, PS_LIST_TAIL, "RA_MIN", PS_META_REPLACE, "", RAmin); 159 psMetadataAddF32 (recipe, PS_LIST_TAIL, "RA_MAX", PS_META_REPLACE, "", RAmax); 160 psMetadataAddF32 (recipe, PS_LIST_TAIL, "DEC_MIN", PS_META_REPLACE, "", DECmin); 161 psMetadataAddF32 (recipe, PS_LIST_TAIL, "DEC_MAX", PS_META_REPLACE, "", DECmax); 100 162 101 163 psFree (view);
Note:
See TracChangeset
for help on using the changeset viewer.
