IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 29, 2006, 10:50:09 AM (20 years ago)
Author:
eugene
Message:

added breakpoints, better exit handling on psphotReadout

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotReadout.c

    r7731 r7758  
    88    // find the currently selected readout
    99    pmReadout  *readout = pmFPAfileThisReadout (config->files, view, "PSPHOT.INPUT");
     10
     11    // optional break-point for processing
     12    char *breakPt = psMetadataLookupStr (NULL, recipe, "BREAK_POINT");
    1013
    1114    // XXX does this need to invoke I/O?
     
    3437    // limit moments analysis by S/N?
    3538    psArray *sources = psphotSourceStats (readout, recipe, peaks);
     39    psFree (peaks);
     40
     41    if (!strcasecmp (breakPt, "PEAKS")) {
     42        psphotReadoutCleanup (config, readout, recipe, NULL, sources);
     43        return true;
     44    }
    3645
    3746    // classify sources based on moments, brightness
    3847    // faint sources not classified?
    3948    if (!psphotRoughClass (sources, recipe)) {
    40         psFree (peaks);
    4149        psFree (sources);
    4250        psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");
     
    4452        pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND");
    4553        return false;
     54    }
     55    if (!strcasecmp (breakPt, "MOMENTS")) {
     56        psphotReadoutCleanup (config, readout, recipe, NULL, sources);
     57        return true;
    4658    }
    4759
     
    5163    // use bright stellar objects to measure PSF
    5264    pmPSF *psf = psphotChoosePSF (readout, sources, recipe);
    53     psphotPSFstats (readout, recipe, psf);
     65    if (!strcasecmp (breakPt, "PSFMODEL")) {
     66        psphotReadoutCleanup (config, readout, recipe, psf, sources);
     67        return true;
     68    }
    5469
    5570    // linear PSF fit to peaks
    5671    psphotEnsemblePSF (readout, sources, recipe, psf, FALSE);
     72    if (!strcasecmp (breakPt, "ENSEMBLE")) {
     73        psphotReadoutCleanup (config, readout, recipe, psf, sources);
     74        return true;
     75    }
    5776
    5877    // non-linear PSF and EXT fit to brighter sources
     
    8099    psphotMagnitudes (sources, recipe, psf);
    81100
    82     // create an output header with stats results
    83     psMetadata *header = psphotDefineHeader (recipe);
    84 
    85101    // replace background in residual image
    86102    psphotSkyReplace (config, view);
     
    89105    psphotSourceFreePixels (sources);
    90106    // psphotSaveImage (NULL, readout->image, "resid.fits");
     107
     108    // create the exported-metadata and free local data
     109    psphotReadoutCleanup (config, readout, recipe, psf, sources);
     110    return true;
     111}
     112
     113bool psphotReadoutCleanup (pmConfig *config, pmReadout *readout, psMetadata *recipe, pmPSF *psf, psArray *sources) {
     114
     115    // use the psf-model to measure FWHM stats
     116    if (psf) {
     117        psphotPSFstats (readout, recipe, psf);
     118    } else {
     119        psphotMomentsStats (readout, recipe, sources);
     120    }
     121
     122    // create an output header with stats results
     123    psMetadata *header = psphotDefineHeader (recipe);
    91124
    92125    // save the results of the analysis
     
    99132    pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND");
    100133
    101     // free up the local copies of the data
    102     psFree (peaks);
    103     psFree (sources);
    104134    psFree (psf);
    105135    psFree (header);
     136    psFree (sources);
     137
    106138    return true;
    107139}
Note: See TracChangeset for help on using the changeset viewer.