- Timestamp:
- Nov 17, 2011, 5:41:38 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111110/psphot/src/psphotOutput.c
r32348 r32685 407 407 return true; 408 408 } 409 410 // for now, let's store the detections on the readout->analysis for each readout 411 bool psphotDumpTest (pmConfig *config, const pmFPAview *view, const char *filerule) 412 { 413 static int npass = 0; 414 char filename[64]; 415 416 // XXX uncomment to disreturn true; 417 418 bool status = true; 419 420 int num = psphotFileruleCount(config, filerule); 421 422 snprintf (filename, 64, "testdump.%02d.dat", npass); 423 FILE *f = fopen (filename, "w"); 424 425 // loop over the available readouts 426 for (int i = 0; i < num; i++) { 427 428 // find the currently selected readout 429 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, i); // File of interest 430 psAssert (file, "missing file?"); 431 432 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); 433 psAssert (readout, "missing readout?"); 434 435 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 436 psAssert (detections, "missing detections?"); 437 438 psArray *sources = detections->newSources ? detections->newSources : detections->allSources; 439 psAssert (sources, "missing sources?"); 440 441 if (detections->newSources) { 442 fprintf (f, "## --- from new sources ---\n"); 443 } else { 444 fprintf (f, "## --- from all sources ---\n"); 445 } 446 447 for (int i = 0; i < sources->n; i++) { 448 pmSource *source = sources->data[i]; 449 if (!source) continue; 450 451 pmPeak *peak = source->peak; 452 if (!peak) continue; 453 454 // XXX only dump a given region 455 if (peak->xf < 20) continue; 456 if (peak->yf < 20) continue; 457 if (peak->xf > 40) continue; 458 if (peak->yf > 70) continue; 459 460 float Msum = source->moments ? source->moments->Sum : NAN; 461 float Mx = source->moments ? source->moments->Mx : NAN; 462 float My = source->moments ? source->moments->My : NAN; 463 float Npix = source->moments ? source->moments->nPixels : NAN; 464 fprintf (f, "%f %f : %f %f : %f %f\n", peak->xf, peak->yf, Mx, My, Msum, Npix); 465 } 466 } 467 fclose (f); 468 npass ++; 469 470 return true; 471 } 472 473 # if (0) 409 474 bool psphotDumpTest (pmConfig *config, const pmFPAview *view, const char *filerule, char *filename) { 410 475 … … 449 514 return true; 450 515 } 451 516 # endif
Note:
See TracChangeset
for help on using the changeset viewer.
