IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 26, 2010, 5:10:34 PM (16 years ago)
Author:
eugene
Message:

various API fixes for multi-inputs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/psphot.stack.20100120/src/psphotSourceSize.c

    r26681 r26688  
    1616
    1717// local functions:
    18 bool psphotSourceSizeReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index);
    1918bool psphotSourceSizePSF (psphotSourceSizeOptions *options, psArray *sources, pmPSF *psf);
    2019bool psphotSourceClass (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf, psphotSourceSizeOptions *options);
     
    3130
    3231// for now, let's store the detections on the readout->analysis for each readout
    33 bool psphotSourceSize (pmConfig *config, const pmFPAview *view)
     32bool psphotSourceSize (pmConfig *config, const pmFPAview *view, bool getPSFsize)
    3433{
    3534    bool status = true;
     
    4443    // loop over the available readouts
    4544    for (int i = 0; i < num; i++) {
    46         if (!psphotSourceSizeReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
     45        if (!psphotSourceSizeReadout (config, view, "PSPHOT.INPUT", i, recipe, getPSFsize)) {
    4746            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
    4847            return false;
     
    5251}
    5352
    54 // XXX use an internal flag to mark sources which have already been measured
    55 bool psphotSourceSizeReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe)
     53// this function use an internal flag to mark sources which have already been measured
     54bool psphotSourceSizeReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe, bool getPSFsize)
    5655{
    5756    bool status;
     
    6766    psAssert (readout, "missing readout?");
    6867
    69     psArray *sources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");
     68    pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
     69    psAssert (detections, "missing detections?");
     70
     71    psArray *sources = detections->allSources;
    7072    psAssert (sources, "missing sources?");
    7173
     
    116118    // XXX move this to the code that generates the PSF?
    117119    // XXX store the results on pmPSF?
    118     psphotSourceSizePSF (&options, sources, psf);
     120
     121    // XXX this should only be done on the first pass (ie, if we have newSources or allSources?)
     122    if (getPSFsize) {
     123        psphotSourceSizePSF (&options, sources, psf);
     124    }
    119125
    120126    // classify the sources based on ApResid and Moments (extended sources)
     127    // NOTE: only sources not already measured !(source->tmpFlags & PM_SOURCE_TMPF_SIZE_MEASURED)
    121128    psphotSourceClass(readout, sources, recipe, psf, &options);
    122129
     130    // NOTE: only sources not already measured !(source->tmpFlags & PM_SOURCE_TMPF_SIZE_MEASURED)
    123131    psphotSourceSizeCR (readout, sources, &options);
    124132
     
    376384    for (int i = 0; i < sources->n; i++) {
    377385        pmSource *source = sources->data[i];
     386
     387        // skip source if it was already measured
     388        if (source->tmpFlags & PM_SOURCE_TMPF_SIZE_MEASURED) {
     389            psTrace("psphot", 7, "Not calculating source size since it has already been measured\n");
     390            continue;
     391        }
    378392
    379393        // Integer position of peak
Note: See TracChangeset for help on using the changeset viewer.