Changeset 6056 for trunk/psphot/src/psphotOutput.c
- Timestamp:
- Jan 19, 2006, 2:55:33 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotOutput.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotOutput.c
r5993 r6056 2 2 3 3 // output functions: we have several fixed modes (sx, obj, cmp) 4 void psphotOutput ( eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky) {4 void psphotOutput (pmReadout *readout, psMetadata *header, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky) { 5 5 6 6 bool status; … … 13 13 char *psfFile = psMetadataLookupPtr (&status, config, "PSF_OUTPUT_FILE"); 14 14 15 if (residImage != NULL) psphotSaveImage ( imdata->header, imdata->image, residImage);16 psphotSamplePSFs (config, psf, imdata->image);15 if (residImage != NULL) psphotSaveImage (header, readout->image, residImage); 16 psphotSamplePSFs (config, psf, readout->image); 17 17 18 18 if (psfFile != NULL) { … … 30 30 } 31 31 if (!strcasecmp (outputMode, "OBJ")) { 32 pmSourcesWriteOBJ ( imdata, config, outputFile, sources, psf, sky);32 pmSourcesWriteOBJ (readout, config, outputFile, sources, psf, sky); 33 33 return; 34 34 } 35 35 if (!strcasecmp (outputMode, "SX")) { 36 pmSourcesWriteSX ( imdata, config, outputFile, sources, psf, sky);36 pmSourcesWriteSX (readout, config, outputFile, sources, psf, sky); 37 37 return; 38 38 } 39 39 if (!strcasecmp (outputMode, "CMP")) { 40 pmSourcesWriteCMP ( imdata, config, outputFile, sources, psf, sky);40 pmSourcesWriteCMP (readout, header, config, outputFile, sources, psf, sky); 41 41 return; 42 42 } 43 43 if (!strcasecmp (outputMode, "CMF")) { 44 pmSourcesWriteCMF ( imdata, config, outputFile, sources, psf, sky);44 pmSourcesWriteCMF (readout, header, config, outputFile, sources, psf, sky); 45 45 return; 46 46 } 47 47 if (!strcasecmp (outputMode, "TEXT")) { 48 pmSourcesWriteText ( imdata, config, outputFile, sources, psf, sky);48 pmSourcesWriteText (readout, config, outputFile, sources, psf, sky); 49 49 return; 50 50 } … … 54 54 55 55 // dophot-style output list with fixed line width 56 bool pmSourcesWriteOBJ ( eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {56 bool pmSourcesWriteOBJ (pmReadout *readout, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) { 57 57 58 58 int type; … … 106 106 107 107 // elixir-mode / sextractor-style output list with fixed line width 108 bool pmSourcesWriteSX ( eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {108 bool pmSourcesWriteSX (pmReadout *readout, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) { 109 109 110 110 pmModel *model; … … 157 157 158 158 // elixir-style pseudo FITS table (header + ascii list) 159 bool pmSourcesWriteCMP ( eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {159 bool pmSourcesWriteCMP (pmReadout *readout, psMetadata *header, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) { 160 160 161 161 int i, type; … … 172 172 173 173 // write necessary information to output header 174 psphotUpdateHeader ( imdata->header, config);175 psMetadataAdd ( imdata->header, PS_LIST_TAIL, "NSTARS", PS_DATA_S32 | PS_META_REPLACE, "NUMBER OF STARS", sources->n);174 psphotUpdateHeader (header, config); 175 psMetadataAdd (header, PS_LIST_TAIL, "NSTARS", PS_DATA_S32 | PS_META_REPLACE, "NUMBER OF STARS", sources->n); 176 176 177 177 // create file, write-out header … … 179 179 180 180 // set NAXIS to 0 : CFITSIO requires isolated header to have NAXIS = 0 181 mdi = psMetadataLookup ( imdata->header, "NAXIS");181 mdi = psMetadataLookup (header, "NAXIS"); 182 182 mdi->data.S32 = 0; 183 183 mdi->type = PS_DATA_S32; 184 184 185 // psMetadataAdd ( imdata->header, PS_LIST_HEAD, "NAXIS", PS_DATA_S32 | PS_META_REPLACE, "", 0);186 psFitsWriteHeader ( imdata->header, fits);185 // psMetadataAdd (header, PS_LIST_HEAD, "NAXIS", PS_DATA_S32 | PS_META_REPLACE, "", 0); 186 psFitsWriteHeader (header, fits); 187 187 psFitsClose (fits); 188 188 … … 232 232 // this format consists of a header derived from the image header 233 233 // followed by a zero-size matrix, followed by the table data 234 bool pmSourcesWriteCMF ( eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {234 bool pmSourcesWriteCMF (pmReadout *readout, psMetadata *header, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) { 235 235 236 236 psArray *table; … … 249 249 250 250 // write necessary information to output header 251 psphotUpdateHeader ( imdata->header, config);251 psphotUpdateHeader (header, config); 252 252 253 253 table = psArrayAlloc (sources->n); … … 286 286 287 287 // write the correct number of sources in the header 288 psMetadataAdd ( imdata->header, PS_LIST_TAIL, "NSTARS", PS_DATA_S32 | PS_META_REPLACE, "NUMBER OF STARS", table->n);289 psMetadataAdd ( imdata->header, PS_LIST_TAIL, "EXTEND", PS_DATA_BOOL | PS_META_REPLACE, "this file has extensions", true);288 psMetadataAdd (header, PS_LIST_TAIL, "NSTARS", PS_DATA_S32 | PS_META_REPLACE, "NUMBER OF STARS", table->n); 289 psMetadataAdd (header, PS_LIST_TAIL, "EXTEND", PS_DATA_BOOL | PS_META_REPLACE, "this file has extensions", true); 290 290 291 291 // set NAXIS to 0 (we don't write out the data array) 292 mdi = psMetadataLookup ( imdata->header, "NAXIS");292 mdi = psMetadataLookup (header, "NAXIS"); 293 293 mdi->data.S32 = 0; 294 294 mdi->type = PS_DATA_S32; … … 300 300 // write out the header and table 301 301 psFits *fits = psFitsOpen (filename, "w"); 302 psFitsWriteHeader ( imdata->header, fits);302 psFitsWriteHeader (header, fits); 303 303 psFitsWriteTable (fits, theader, table); 304 304 psFitsClose (fits); … … 309 309 /***** Text Output Methods *****/ 310 310 311 bool pmSourcesWriteText ( eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky) {311 bool pmSourcesWriteText (pmReadout *readout, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky) { 312 312 313 313 char *name = (char *) psAlloc (strlen(filename) + 10);
Note:
See TracChangeset
for help on using the changeset viewer.
