Changeset 6481 for trunk/psphot/src/psphotOutput.c
- Timestamp:
- Feb 23, 2006, 6:16:11 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotOutput.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotOutput.c
r6379 r6481 11 11 static char *extNameKey = NULL; 12 12 static char *extRoot = NULL; 13 static char *psfFile = NULL; 14 static char *psfSample = NULL; 13 15 14 16 void psphotOutputCleanup () { … … 21 23 psFree (extNameKey); 22 24 psFree (extRoot); 25 psFree (psfFile); 26 psFree (psfSample); 23 27 return; 24 28 } … … 34 38 outputMode = psMetadataLookupStr (&status, config->recipe, "OUTPUT_MODE"); 35 39 outputFormat = psMetadataLookupStr (&status, config->recipe, "OUTPUT_FORMAT"); 40 41 psfFile = psMetadataLookupStr (&status, config->recipe, "PSF_OUTPUT_FILE"); 42 psfSample = psMetadataLookupStr (&status, config->recipe, "PSF_SAMPLE_FILE"); 36 43 37 44 // rules to construct output names … … 75 82 } 76 83 84 // register background image-file names 85 psphotBackgroundNames (config->arguments); 86 77 87 // save so freeing config will not drop these references 78 88 psMemCopy (outputRoot); … … 83 93 psMemCopy (extNameKey); 84 94 psMemCopy (extRoot); 95 psMemCopy (psfFile); 96 psMemCopy (psfSample); 85 97 86 98 return; … … 165 177 char *outputFile; 166 178 167 psTimerStart ("psphot");168 169 179 psMetadata *header = pmReadoutGetHeader (readout); 170 180 … … 180 190 } 181 191 182 char *psfFile = psMetadataLookupStr (&status, arguments, "PSF_OUTPUT_FILE");183 char *psfSample = psMetadataLookupStr (&status, arguments, "PSF_SAMPLE_FILE");184 192 char *residImage = psMetadataLookupStr (&status, arguments, "RESID_IMAGE"); 185 193 … … 236 244 psF32 *PAR, *dPAR; 237 245 float dmag, apResid; 246 247 psTimerStart ("string"); 238 248 239 249 psLine *line = psLineAlloc (104); // 104 is dophot-defined line length … … 274 284 } 275 285 fclose (f); 286 psFree (line); 287 fprintf (stderr, "%f seconds for %d objects with psLine\n", psTimerMark ("string"), (int)sources->n); 288 289 psTimerStart ("string"); 290 291 f = fopen ("test.obj", "w"); 292 if (f == NULL) { 293 psLogMsg ("WriteSourceOBJ", 3, "can't open output file for output %s\n", "test.obj"); 294 return false; 295 } 296 297 char *string; 298 // write sources with models 299 for (int i = 0; i < sources->n; i++) { 300 pmSource *source = (pmSource *) sources->data[i]; 301 pmModel *model = pmModelSelect (source); 302 if (model == NULL) continue; 303 304 PAR = model->params->data.F32; 305 dPAR = model->dparams->data.F32; 306 307 dmag = dPAR[1] / PAR[1]; 308 type = pmSourceDophotType (source); 309 apResid = source->apMag - source->fitMag; 310 311 string = NULL; 312 psStringAppend (&string, "%3d", type); 313 psStringAppend (&string, "%8.2f", PAR[2]); 314 psStringAppend (&string, "%8.2f", PAR[3]); 315 psStringAppend (&string, "%8.3f", source->fitMag); 316 psStringAppend (&string, "%6.3f", dmag); 317 psStringAppend (&string, "%9.2f", PAR[0]); 318 psStringAppend (&string, "%9.3f", PAR[4]); 319 psStringAppend (&string, "%9.3f", PAR[5]); 320 psStringAppend (&string, "%7.2f", PAR[6]); 321 psStringAppend (&string, "%8.3f", 99.999); 322 psStringAppend (&string, "%8.3f", source->apMag); 323 psStringAppend (&string, "%8.2f\n", apResid); 324 fwrite (string, 1, strlen(string), f); 325 psFree (string); 326 } 327 fclose (f); 328 fprintf (stderr, "%f seconds for %d objects with psString\n", psTimerMark ("string"), (int)sources->n); 329 276 330 return true; 277 331 } … … 501 555 } 502 556 503 // write sources with models first557 // write sources with models first 504 558 for (i = 0; i < sources->n; i++) { 505 559 pmSource *source = (pmSource *) sources->data[i]; … … 525 579 fprintf (f, "%9.6f ", dPAR[j]); 526 580 } 527 fprintf (f, ": % 7.4f %2d %#5x %7.3f %7.1f %7.2f %4d %2d\n",581 fprintf (f, ": %8.4f %2d %#5x %7.3f %7.1f %7.2f %4d %2d\n", 528 582 source[0].apMag, source[0].type, source[0].mode, 529 583 log10(model[0].chisq/model[0].nDOF), … … 617 671 618 672 if (source->moments == NULL) { 619 moment = empty;673 moment = empty; 620 674 } else { 621 moment = source->moments;675 moment = source->moments; 622 676 } 623 677
Note:
See TracChangeset
for help on using the changeset viewer.
