IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 14, 2006, 6:33:17 AM (20 years ago)
Author:
eugene
Message:

mods to change from threshold above sky to S/N thresholds

File:
1 edited

Legend:

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

    r6399 r6427  
    44bool psphotReadout (pmReadout *readout, psMetadata *config) {
    55
    6     psArray     *sources = NULL;
    7     psArray     *peaks   = NULL;
    8     pmPSF       *psf    = NULL;
    9     psStats     *sky     = NULL;
     6    psArray     *sources  = NULL;
     7    psArray     *peaks    = NULL;
     8    psImage     *skymodel = NULL;
     9    pmPSF       *psf      = NULL;
    1010    bool         status;
    11     psPolynomial2D *model = NULL;
    1211
    13     psphotImageMedian (readout, config, sky);
    14 
    15     // measure image stats for initial guess
    16     sky = psphotImageStats (readout, config);
    17 
    18     // generate a background model (currently, 2D polynomial)
    19     // XXX this should be available to be re-added to the original image
    20     model = psphotImageBackground (readout, config, sky);
     12    // generate a background model (median, smoothed image)
     13    skymodel = psphotImageMedian (readout, config);
    2114
    2215    // find the peaks in the image
    23     peaks = psphotFindPeaks (readout, config, sky);
     16    peaks = psphotFindPeaks (readout, config);
    2417
    2518    // construct sources and measure basic stats
     
    3023
    3124    // mark blended peaks PS_SOURCE_BLEND
    32     psphotBasicDeblend (sources, config, sky);
     25    psphotBasicDeblend (sources, config);
    3326
    3427    // use bright stellar objects to measure PSF
    35     psf = psphotChoosePSF (config, sources, sky);
     28    psf = psphotChoosePSF (config, sources);
    3629
    37     // XXX change FITMODE to a string
     30    // select analysis method
    3831    char *FITMODE = psMetadataLookupStr (&status, config, "FITMODE");
    3932    if (!strcasecmp(FITMODE, "ENSEMBLE")) {
    40         psphotEnsemblePSF (readout, config, sources, psf, sky);
    41     }
    42 
    43     if (!strcasecmp(FITMODE, "FULL")) {
    44         psphotEnsemblePSF (readout, config, sources, psf, sky);
    45         psphotFullFit (readout, config, sources, psf, sky);
    46         psphotReplaceUnfit (sources);
    47         psphotApResid (readout, sources, config, psf);
     33        psphotEnsemblePSF (readout, config, sources, psf);
    4834    }
    4935
    5036    if (!strcasecmp(FITMODE, "BLEND")) {
    51         psphotEnsemblePSF (readout, config, sources, psf, sky);
    52         psphotBlendFit (readout, config, sources, psf, sky);
     37        psphotEnsemblePSF (readout, config, sources, psf);
     38        psphotBlendFit (readout, config, sources, psf);
    5339        psphotReplaceUnfit (sources);
    5440        psphotApResid (readout, sources, config, psf);
    55     }
    56 
    57     if (!strcasecmp(FITMODE, "BASIC")) {
    58         psphotApplyPSF (readout, config, sources, psf, sky);
    59         psphotFitExtended (readout, config, sources, sky);
    6041    }
    6142
     
    6546    psphotUpdateHeader (header, config);
    6647
     48    // psphotSkyReplace (readout, skymodel);
     49
    6750    // need to do something with the sources, psf, and sky
    6851    status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES",   PS_DATA_ARRAY,   "psphot sources", sources);
    6952    status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.PSF",       PS_DATA_UNKNOWN, "psphot psf", psf);
    70     status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SKY.MEAN",  PS_DATA_F32,     "psphot sky mean", sky->sampleMean);
    71     status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SKY.SIGMA", PS_DATA_F32,     "psphot sky stdev", sky->sampleStdev);
     53    // XXX : replace? status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SKY.MEAN",  PS_DATA_F32,     "psphot sky mean", sky->sampleMean);
     54    // XXX : replace? status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SKY.SIGMA", PS_DATA_F32,     "psphot sky stdev", sky->sampleStdev);
    7255
    7356    // free up the local copies of the data
    7457    psFree (psf);
    75     psFree (sky);
    76     psFree (model);
    7758    psFree (peaks);
    7859    psFree (sources);
     60    psFree (skymodel);
    7961
    8062    return true;
    8163}
     64
     65
     66// XXX Deprecate or allow these versions?
     67# if (0)
     68    if (!strcasecmp(FITMODE, "FULL")) {
     69        psphotEnsemblePSF (readout, config, sources, psf);
     70        psphotFullFit (readout, config, sources, psf);
     71        psphotReplaceUnfit (sources);
     72        psphotApResid (readout, sources, config, psf);
     73    }
     74
     75    if (!strcasecmp(FITMODE, "BASIC")) {
     76        psphotApplyPSF (readout, config, sources, psf);
     77        psphotFitExtended (readout, config, sources);
     78    }
     79
     80# endif
Note: See TracChangeset for help on using the changeset viewer.