Changeset 6117 for trunk/psphot/src/psphotOutput.c
- Timestamp:
- Jan 20, 2006, 8:57:16 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotOutput.c (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotOutput.c
r6056 r6117 2 2 3 3 // output functions: we have several fixed modes (sx, obj, cmp) 4 void psphotOutput (pmReadout *readout, psMetadata * header, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky) {4 void psphotOutput (pmReadout *readout, psMetadata *config) { 5 5 6 6 bool status; 7 7 8 8 psTimerStart ("psphot"); 9 10 psMetadata *header = pmReadoutGetHeader (readout); 11 12 psArray *sources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES"); 13 pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF"); 9 14 10 15 char *outputMode = psMetadataLookupPtr (&status, config, "OUTPUT_MODE"); … … 29 34 return; 30 35 } 36 if (!strcasecmp (outputMode, "SX")) { 37 pmSourcesWriteSX (sources, outputFile); 38 return; 39 } 31 40 if (!strcasecmp (outputMode, "OBJ")) { 32 pmSourcesWriteOBJ ( readout, config, outputFile, sources, psf, sky);41 pmSourcesWriteOBJ (sources, outputFile); 33 42 return; 34 43 } 35 if (!strcasecmp (outputMode, " SX")) {36 pmSourcesWrite SX (readout, config, outputFile, sources, psf, sky);44 if (!strcasecmp (outputMode, "CMP")) { 45 pmSourcesWriteCMP (sources, outputFile, header); 37 46 return; 38 47 } 39 if (!strcasecmp (outputMode, "CM P")) {40 pmSourcesWriteCM P (readout, header, config, outputFile, sources, psf, sky);48 if (!strcasecmp (outputMode, "CMF")) { 49 pmSourcesWriteCMF (sources, outputFile, header); 41 50 return; 42 51 } 43 if (!strcasecmp (outputMode, " CMF")) {44 pmSourcesWrite CMF (readout, header, config, outputFile, sources, psf, sky);52 if (!strcasecmp (outputMode, "TEXT")) { 53 pmSourcesWriteText (sources, outputFile); 45 54 return; 46 55 } 47 if (!strcasecmp (outputMode, "TEXT")) {48 pmSourcesWriteText (readout, config, outputFile, sources, psf, sky);49 return;50 }51 56 52 57 psAbort ("psphot", "unknown output mode %s", outputMode); … … 54 59 55 60 // dophot-style output list with fixed line width 56 bool pmSourcesWriteOBJ (p mReadout *readout, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {61 bool pmSourcesWriteOBJ (psArray *sources, char *filename) { 57 62 58 63 int type; 59 pmModel *model;60 64 psF32 *PAR, *dPAR; 61 65 float dmag, apResid; 62 bool status;63 66 64 67 psLine *line = psLineAlloc (104); // 104 is dophot-defined line length … … 69 72 return false; 70 73 } 71 72 float RADIUS = psMetadataLookupF32 (&status, config, "AP_RADIUS");73 74 74 75 // write sources with models 75 76 for (int i = 0; i < sources->n; i++) { 76 77 pmSource *source = (pmSource *) sources->data[i]; 77 78 model = pmSourceMagnitudes (source, psf, RADIUS); 78 pmModel *model = pmModelSelect (source); 79 79 if (model == NULL) continue; 80 80 … … 106 106 107 107 // elixir-mode / sextractor-style output list with fixed line width 108 bool pmSourcesWriteSX (pmReadout *readout, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) { 109 110 pmModel *model; 108 bool pmSourcesWriteSX (psArray *sources, char *filename) { 109 111 110 psF32 *PAR, *dPAR; 112 111 float dmag; 113 bool status;114 112 115 113 psLine *line = psLineAlloc (110); // 110 is sextractor line length … … 120 118 return false; 121 119 } 122 123 float RADIUS = psMetadataLookupF32 (&status, config, "AP_RADIUS");124 120 125 121 // write sources with models 126 122 for (int i = 0; i < sources->n; i++) { 127 123 pmSource *source = (pmSource *) sources->data[i]; 128 129 model = pmSourceMagnitudes (source, psf, RADIUS); 124 pmModel *model = pmModelSelect (source); 130 125 if (model == NULL) continue; 131 126 … … 157 152 158 153 // elixir-style pseudo FITS table (header + ascii list) 159 bool pmSourcesWriteCMP (p mReadout *readout, psMetadata *header, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {154 bool pmSourcesWriteCMP (psArray *sources, char *filename, psMetadata *header) { 160 155 161 156 int i, type; 162 pmModel *model;163 157 psMetadataItem *mdi; 164 158 psF32 *PAR, *dPAR; … … 167 161 168 162 // find config information for output header 169 float RADIUS = psMetadataLookupF32 (&status, config, "AP_RADIUS"); 170 float ZERO_POINT = psMetadataLookupF32 (&status, config, "ZERO_POINT"); 163 float ZERO_POINT = psMetadataLookupF32 (&status, header, "ZERO_PT"); 171 164 if (!status) ZERO_POINT = 25.0; 172 165 173 166 // write necessary information to output header 174 psphotUpdateHeader (header, config);175 167 psMetadataAdd (header, PS_LIST_TAIL, "NSTARS", PS_DATA_S32 | PS_META_REPLACE, "NUMBER OF STARS", sources->n); 176 168 … … 200 192 for (i = 0; i < sources->n; i++) { 201 193 pmSource *source = (pmSource *) sources->data[i]; 202 203 model = pmSourceMagnitudes (source, psf, RADIUS); 194 pmModel *model = pmModelSelect (source); 204 195 if (model == NULL) continue; 205 196 … … 232 223 // this format consists of a header derived from the image header 233 224 // followed by a zero-size matrix, followed by the table data 234 bool pmSourcesWriteCMF (p mReadout *readout, psMetadata *header, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {225 bool pmSourcesWriteCMF (psArray *sources, char *filename, psMetadata *header) { 235 226 236 227 psArray *table; … … 239 230 psMetadata *theader; 240 231 int i, type; 241 pmModel *model;242 232 psF32 *PAR, *dPAR; 243 233 float dmag, lsky; … … 245 235 246 236 // find config information for output header 247 float RADIUS = psMetadataLookupF32 (&status, config, "AP_RADIUS"); 248 float ZERO_POINT = psMetadataLookupF32 (&status, config, "ZERO_POINT"); 249 250 // write necessary information to output header 251 psphotUpdateHeader (header, config); 237 float ZERO_POINT = psMetadataLookupF32 (&status, header, "ZERO_PT"); 252 238 253 239 table = psArrayAlloc (sources->n); … … 256 242 for (i = 0; i < sources->n; i++) { 257 243 pmSource *source = (pmSource *) sources->data[i]; 258 259 model = pmSourceMagnitudes (source, psf, RADIUS); 244 pmModel *model = pmModelSelect (source); 260 245 if (model == NULL) continue; 261 246 … … 309 294 /***** Text Output Methods *****/ 310 295 311 bool pmSourcesWriteText (p mReadout *readout, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky) {296 bool pmSourcesWriteText (psArray *sources, char *filename) { 312 297 313 298 char *name = (char *) psAlloc (strlen(filename) + 10); 314 299 315 300 sprintf (name, "%s.psf.dat", filename); 316 pmModelWritePSFs (sources, config, name, psf);301 pmModelWritePSFs (sources, name); 317 302 318 303 sprintf (name, "%s.ext.dat", filename); … … 330 315 331 316 // write the PSF sources to an output file 332 bool pmModelWritePSFs (psArray *sources, psMetadata *config, char *filename, pmPSF *psf) {317 bool pmModelWritePSFs (psArray *sources, char *filename) { 333 318 334 319 double dPos, dMag; … … 337 322 psF32 *PAR, *dPAR; 338 323 pmModel *model; 339 bool status;340 341 float RADIUS = psMetadataLookupF32 (&status, config, "AP_RADIUS");342 324 343 325 f = fopen (filename, "w"); … … 350 332 for (i = 0; i < sources->n; i++) { 351 333 pmSource *source = (pmSource *) sources->data[i]; 352 353 334 if (source->type != PM_SOURCE_STAR) continue; 354 model = pmSourceMagnitudes (source, psf, RADIUS);335 model = source->modelPSF; 355 336 if (model == NULL) continue; 356 337
Note:
See TracChangeset
for help on using the changeset viewer.
