IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27630


Ignore:
Timestamp:
Apr 6, 2010, 6:41:06 PM (16 years ago)
Author:
eugene
Message:

fixing PSPHOT.SOURCES issues

Location:
branches/eam_branches/stackphot.20100406/ppSim/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/stackphot.20100406/ppSim/src/ppSimInsertGalaxies.c

    r18011 r27630  
    7474    int dY = PM_CELL_TO_CHIP (0.0, y0Cell, yParityCell, binning);
    7575
    76     // psMetadataLookupPtr (readout->analysis, "PSPHOT.SOURCES", 0);
    77 
    78     psArray *sources = psArrayAllocEmpty (galaxies->n);
    79 
     76    pmDetections *detections = psMetadataLookupPtr (readout->analysis, "PSPHOT.DETECTIONS", 0);
     77    if (!detections) {
     78        detections = pmDetectionsAlloc();
     79        detection->allSources = psArrayAllocEmpty (galaxies->n);
     80        psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_ARRAY | PS_META_REPLACE, "psphot detections", detections);
     81    } else {
     82        psMemIncrRefCounter (detections);
     83    }
     84    psArray *sources = sources = detection->allSources;
    8085
    8186    // add sources to the readout image & weight
     
    181186    }
    182187
    183     // NOTE: readout must be part of the pmFPAfile named "PPSIM.OUTPUT"
    184     // psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY | PS_META_REPLACE, "psphot sources", sources);
     188    // XXX many leaks in here, i think
     189    psFree (detections);
    185190
    186     // XXX many leaks in here, i think
    187191    return true;
    188192}
  • branches/eam_branches/stackphot.20100406/ppSim/src/ppSimInsertStars.c

    r27533 r27630  
    145145    fclose (outfile);
    146146
    147     // NOTE: the pmFPAfile "PPSIM.OUTPUT" points at these sources
    148     psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "fake sources", sources);
    149     psFree(sources);
     147    pmDetections *detections = pmDetectionsAlloc();
     148    detection->allSources = sources;
     149
     150    // save detections on the readout->analysis
     151    if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "fake sources", detections)) {
     152        psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout");
     153        return false;
     154    }
     155    psFree(detections);
    150156
    151157    // XXX many leaks in here, i think
  • branches/eam_branches/stackphot.20100406/ppSim/src/ppSimPhotomReadout.c

    r26900 r27630  
    66    PS_ASSERT_PTR_NON_NULL (readout, NULL);
    77
    8     psArray *sources = psMetadataLookupPtr (NULL, readout->analysis, "PSPHOT.SOURCES");
     8    pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
     9    psAssert (detections, "missing detections?");
     10
     11    psArray *sources = detections->allSources;
    912    return sources;
    1013}
     
    151154
    152155    // create the exported-metadata and free local data
    153     // XXX this places the sources on readout->analysis as PSPHOT.SOURCES.  modify?
    154     // (or don't supply the sources, and do this with a different function)
    155156    psphotReadoutCleanup(config, readout, recipe, NULL, psf, NULL);
    156157
     
    167168    psAssert (forceReadout, "no forceReadout?");
    168169    pmChipSetDataStatus (forceChip, true);
    169     psMetadataAddArray (forceReadout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE, "forced photometry ", forceSources);
    170     psFree (forceSources);
     170
     171    pmDetections *detectionsForce = pmDetectionsAlloc();
     172    detectionForce->allSources = forceSources;
     173
     174    // save detections on the readout->analysis
     175    if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "force sources", detectionsForce)) {
     176        psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout");
     177        return false;
     178    }
     179    psFree(detectionsForce);
    171180
    172181    pmCell    *fakeCell    = pmFPAfileThisCell (config->files, view, "PPSIM.FAKE.SOURCES"); psAssert (fakeCell, "no cell?");
     
    179188    psAssert (fakeReadout, "no fakeReadout?");
    180189    pmChipSetDataStatus (fakeChip, true);
    181     psMetadataAddArray (fakeReadout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE, "fake photometry ", fakeSources);
     190
     191    pmDetections *detectionsFake = pmDetectionsAlloc();
     192    detectionFake->allSources = fakeSources;
     193
     194    // save detections on the readout->analysis
     195    if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "fake sources", detectionsFake)) {
     196        psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout");
     197        return false;
     198    }
     199    psFree(detectionsFake);
    182200
    183201    return true;
  • branches/eam_branches/stackphot.20100406/ppSim/src/ppSimPhotomReadoutFake.c

    r26900 r27630  
    111111    psAssert (fakeReadout, "no fakeReadout?");
    112112    pmChipSetDataStatus (fakeChip, true);
    113     psMetadataAddArray (fakeReadout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE, "fake photometry ", fakeSources);
     113
     114    pmDetections *detections = pmDetectionsAlloc();
     115    detection->allSources = fakeSources;
     116
     117    psMetadataAddArray (fakeReadout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE, "fake photometry ", detections);
     118    psFree(detections);
    114119
    115120    return true;
  • branches/eam_branches/stackphot.20100406/ppSim/src/ppSimPhotomReadoutForce.c

    r26900 r27630  
    9898
    9999    // create the exported-metadata and free local data
    100     // XXX this places the sources on readout->analysis as PSPHOT.SOURCES.  modify?
    101     // (or don't supply the sources, and do this with a different function)
    102100    psphotReadoutCleanup(config, readout, recipe, NULL, psf, NULL);
    103101
     
    111109    psAssert (forceReadout, "no forceReadout?");
    112110    pmChipSetDataStatus (forceChip, true);
    113     psMetadataAddArray (forceReadout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE, "force photometry ", forceSources);
     111
     112    pmDetections *detections = pmDetectionsAlloc();
     113    detection->allSources = forceSources;
     114    psMetadataAddArray (forceReadout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE, "force photometry ", detections);
     115    psFree(detections);
    114116
    115117    return true;
  • branches/eam_branches/stackphot.20100406/ppSim/src/ppSimUtils.c

    r24807 r27630  
    273273    PS_ASSERT_PTR_NON_NULL (readout, NULL);
    274274
    275     psArray *sources = psMetadataLookupPtr (NULL, readout->analysis, "PSPHOT.SOURCES");
     275    pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
     276    psAssert (detections, "missing detections?");
     277
     278    psArray *sources = detections->allSources;
    276279    return sources;
    277280}
Note: See TracChangeset for help on using the changeset viewer.