Changeset 23584
- Timestamp:
- Mar 29, 2009, 1:47:03 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroExtractAnalysis.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroExtractAnalysis.c
r23412 r23584 13 13 # include "psastroInternal.h" 14 14 15 # define ESCAPE { \16 psError(PS_ERR_UNKNOWN, false, "I/O failure in psastroMaskUpdate "); \15 # define ESCAPE(MSG) { \ 16 psError(PS_ERR_UNKNOWN, false, "I/O failure in psastroMaskUpdate: %s", MSG); \ 17 17 psFree (view); \ 18 18 return false; \ 19 19 } 20 20 21 # define TEST_OUTPUT 121 # define TEST_OUTPUT 0 22 22 23 23 psImage *psastroExtractStar (psImage *input, float x, float y, float dX, float dY); … … 117 117 pmFPAview *view = pmFPAviewAlloc (0); 118 118 119 // generate a (very) basic header: 120 psMetadata *phu = psMetadataAlloc (); 121 // select the filter; default to fixed photcode and mag limit otherwise 122 char *filter = psMetadataLookupStr (&status, fpa->concepts, "FPA.FILTERID"); 123 if (!status) ESCAPE("missing FPA.FILTER in concepts"); 124 125 psMetadataAddStr (phu, PS_LIST_TAIL, "FILTER", 0, "filter", filter); 126 psMetadataAddF32 (phu, PS_LIST_TAIL, "EXPTIME", 0, "exptime", exptime); 127 psMetadataAddF32 (phu, PS_LIST_TAIL, "ZEROPT", 0, "zeropt", zeropt); 128 psFitsWriteBlank (outStars, phu, NULL); 129 psFree (phu); 130 119 131 // open/load files as needed 120 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ;132 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE("failed on FPA BEFORE"); 121 133 122 134 // this loop selects the matched stars for all chips … … 126 138 if (!chip->fromFPA) { continue; } 127 139 128 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ;140 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE("failed on Chip BEFORE"); 129 141 130 142 // text output file for testing … … 164 176 165 177 pmReadout *inReadout = pmFPAviewThisReadout (view, input->fpa); 166 psImage *subraster = psastroExtractStar (inReadout->image, ref->chip->x, ref->chip->y, 100.0, 100.0);178 psImage *subraster = psastroExtractStar (inReadout->image, ref->chip->x, ref->chip->y, 200.0, 200.0); 167 179 if (!subraster) continue; 168 180 181 // generate a (very) basic header: 182 psMetadata *header = psMetadataAlloc (); 183 psMetadataAddF32 (header, PS_LIST_TAIL, "CHIP_X", 0, "chip coordinate", ref->chip->x); 184 psMetadataAddF32 (header, PS_LIST_TAIL, "CHIP_Y", 0, "chip coordinate", ref->chip->y); 185 psMetadataAddF32 (header, PS_LIST_TAIL, "FPA_X", 0, "focal-plane coordinate", ref->FP->x); 186 psMetadataAddF32 (header, PS_LIST_TAIL, "FPA_Y", 0, "focal-plane coordinate", ref->FP->y); 187 psMetadataAddF32 (header, PS_LIST_TAIL, "MAG", 0, "magnitude", ref->Mag); 188 169 189 snprintf (extname, 80, "extname.%05d", nExt); 170 psFitsWriteImage (outStars, NULL, subraster, 0, extname);190 psFitsWriteImage (outStars, header, subraster, 0, extname); 171 191 nExt ++; 172 192 193 psFree (header); 173 194 psFree (subraster); 174 195 } 175 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ;196 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE("failed on Readout AFTER");; 176 197 } 177 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ;198 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE("failed on Cell AFTER");; 178 199 } 179 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ;180 181 fclose (f);182 } 183 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ;200 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE("failed on Chip AFTER");; 201 202 if (f) fclose (f); 203 } 204 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE("failed on FPA AFTER");; 184 205 185 206 psFitsClose (outStars);
Note:
See TracChangeset
for help on using the changeset viewer.
