Changeset 23592 for trunk/psastro/src/psastroExtractStars.c
- Timestamp:
- Mar 29, 2009, 4:04:51 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroExtractStars.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroExtractStars.c
r23591 r23592 83 83 return false; 84 84 } 85 85 86 char *filename = NULL; 86 87 psStringAppend (&filename, "%s.st.fits", fileroot); 87 88 88 psFits *outStars = psFitsOpen (filename, "w"); 89 89 if (!outStars) { … … 91 91 return false; 92 92 } 93 psFree (filename); 94 95 filename = NULL; 96 psStringAppend (&filename, "%s.gh.fits", fileroot); 97 psFits *outGhosts = psFitsOpen (filename, "w"); 98 if (!outGhosts) { 99 psError(PS_ERR_IO, false, "error opening file %s\n", filename); 100 return false; 101 } 102 psFree (filename); 93 103 94 104 pmFPAview *view = pmFPAviewAlloc (0); … … 103 113 psMetadataAddF32 (phu, PS_LIST_TAIL, "EXPTIME", 0, "exptime", exptime); 104 114 psMetadataAddF32 (phu, PS_LIST_TAIL, "ZEROPT", 0, "zeropt", zeropt); 115 105 116 psFitsWriteBlank (outStars, phu, NULL); 117 psFitsWriteBlank (outGhosts, phu, NULL); 106 118 psFree (phu); 107 119 … … 145 157 psMetadataAddF32 (header, PS_LIST_TAIL, "FPA_Y", 0, "focal-plane coordinate", ref->FP->y); 146 158 psMetadataAddF32 (header, PS_LIST_TAIL, "MAG", 0, "magnitude", ref->Mag); 159 160 snprintf (extname, 80, "extname.%05d", nExt); 161 psFitsWriteImage (outStars, header, subraster, 0, extname); 162 nExt ++; 163 164 psFree (header); 165 psFree (subraster); 166 } 167 168 // select the raw objects for this readout (loaded in psastroExtract.c) 169 psArray *ghosts = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.GHOSTS"); 170 if (ghosts == NULL) { continue; } 171 172 // identify the bright stars of interest 173 for (int i = 0; i < ghosts->n; i++) { 174 pmAstromObj *ghost = ghosts->data[i]; 175 176 pmReadout *inReadout = pmFPAviewThisReadout (view, input->fpa); 177 psImage *subraster = psastroExtractStar (inReadout->image, ghost->chip->x, ghost->chip->y, 200.0, 200.0); 178 if (!subraster) continue; 179 180 // generate a (very) basic header: 181 psMetadata *header = psMetadataAlloc (); 182 psMetadataAddF32 (header, PS_LIST_TAIL, "CHIP_X", 0, "chip coordinate", ghost->chip->x); 183 psMetadataAddF32 (header, PS_LIST_TAIL, "CHIP_Y", 0, "chip coordinate", ghost->chip->y); 184 psMetadataAddF32 (header, PS_LIST_TAIL, "FPA_X", 0, "focal-plane coordinate", ghost->FP->x); 185 psMetadataAddF32 (header, PS_LIST_TAIL, "FPA_Y", 0, "focal-plane coordinate", ghost->FP->y); 186 psMetadataAddF32 (header, PS_LIST_TAIL, "FPA_X0", 0, "star focal-plane coordinate", ghost->TP->x); // note : over-loaded value 187 psMetadataAddF32 (header, PS_LIST_TAIL, "FPA_Y0", 0, "star focal-plane coordinate", ghost->TP->y); // note : over-loaded value 188 psMetadataAddF32 (header, PS_LIST_TAIL, "MAG", 0, "magnitude", ghost->Mag); 147 189 148 190 snprintf (extname, 80, "extname.%05d", nExt);
Note:
See TracChangeset
for help on using the changeset viewer.
