IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 17, 2011, 2:17:35 PM (15 years ago)
Author:
eugene
Message:

fix psphotStack 2nd pass (subtract 1st pass sources from the correct image); fix PS color plotting; plug a leak in psphotStack

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/psphot

  • trunk/psphot/src/psphotOutput.c

    r32348 r32695  
    407407    return true;
    408408}
     409
     410// for now, let's store the detections on the readout->analysis for each readout
     411bool psphotDumpTest (pmConfig *config, const pmFPAview *view, const char *filerule)
     412{
     413    static int npass = 0;
     414    char filename[64];
     415
     416    // XXX dump tests are disabled unless this is commented out:
     417    return true;
     418
     419    bool status = true;
     420
     421    int num = psphotFileruleCount(config, filerule);
     422
     423    snprintf (filename, 64, "testdump.%02d.dat", npass);
     424    FILE *f = fopen (filename, "w");
     425
     426    // loop over the available readouts
     427    for (int i = 0; i < num; i++) {
     428
     429        // find the currently selected readout
     430        pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, i); // File of interest
     431        psAssert (file, "missing file?");
     432
     433        pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
     434        psAssert (readout, "missing readout?");
     435
     436        pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
     437        psAssert (detections, "missing detections?");
     438
     439        psArray *sources = detections->newSources ? detections->newSources : detections->allSources;
     440        psAssert (sources, "missing sources?");
     441
     442        if (detections->newSources) {
     443            fprintf (f, "## --- from new sources ---\n");
     444        } else {
     445            fprintf (f, "## --- from all sources ---\n");
     446        }
     447
     448        for (int i = 0; i < sources->n; i++) {
     449            pmSource *source = sources->data[i];
     450            if (!source) continue;
     451
     452            pmPeak *peak = source->peak;
     453            if (!peak) continue;
     454
     455            // XXX only dump a given region
     456            // if (peak->xf < 20) continue;
     457            // if (peak->yf < 20) continue;
     458            // if (peak->xf > 40) continue;
     459            // if (peak->yf > 70) continue;
     460
     461            float Msum = source->moments ? source->moments->Sum : NAN;
     462            float Mx   = source->moments ? source->moments->Mx : NAN;
     463            float My   = source->moments ? source->moments->My : NAN;
     464            // float Npix = source->moments ? source->moments->nPixels : NAN;
     465            float Io = source->modelPSF ? source->modelPSF->params->data.F32[PM_PAR_I0] : NAN;
     466            fprintf (f, "%d %f %f  : %f %f : %f %f\n", source->imageID, peak->xf, peak->yf, Mx, My, Msum, Io);
     467        }
     468    }
     469    fclose (f);
     470    npass ++;
     471
     472    return true;
     473}
     474
     475# if (0)
    409476bool psphotDumpTest (pmConfig *config, const pmFPAview *view, const char *filerule, char *filename) {
    410477
     
    449516    return true;
    450517}
    451 
     518# endif
Note: See TracChangeset for help on using the changeset viewer.