IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 10, 2010, 7:36:29 PM (16 years ago)
Author:
eugene
Message:

updates from eam_branches/20091201 (substantially changes to the psphotReadout APIs to support future stack photometry; improvements to the CR masking code)

File:
1 edited

Legend:

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

    r26453 r26894  
    66//#define TESTING
    77
     8
     9# if 0
    810
    911// Calculate the limiting magnitude for an image
     
    3335
    3436    psKernel *kernel = psImageSmoothKernel(smoothSigma, smoothNsigma); // Kernel used for smoothing
    35     psKernel *newCovar = psImageCovarianceCalculate(kernel, ro->covariance); // Covariance matrix
     37    *covarFactor = psImageCovarianceCalculateFactor(kernel, ro->covariance);
    3638    psFree(kernel);
    37     *covarFactor = psImageCovarianceFactor(newCovar); // Variance factor
    38     psFree(newCovar);
    3939
    4040    psStats *stats = psStatsAlloc(PS_STAT_ROBUST_MEDIAN); // Statistics for variance
     
    152152}
    153153
     154# endif
     155
     156bool psphotEfficiency (pmConfig *config, const pmFPAview *view)
     157{
     158    bool status = true;
     159
     160    // select the appropriate recipe information
     161    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     162    psAssert (recipe, "missing recipe?");
     163
     164    int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
     165    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
     166
     167    // loop over the available readouts
     168    for (int i = 0; i < num; i++) {
     169        if (!psphotEfficiencyReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
     170            psError (PSPHOT_ERR_CONFIG, false, "failed to measure detection efficiency for PSPHOT.INPUT entry %d", i);
     171            return false;
     172        }
     173    }
     174    return true;
     175}
    154176
    155177// Determine detection efficiency
    156 bool psphotEfficiency(pmConfig *config, pmReadout *readout, const pmFPAview *view, const pmPSF *psf,
    157                 psMetadata *recipe, const psArray *realSources)
     178bool psphotEfficiencyReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe)
    158179{
     180# if 0
     181    bool status = true;
     182
     183    psTimerStart("psphot.fake");
     184
     185    // find the currently selected readout
     186    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     187    psAssert (file, "missing file?");
     188
     189    pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
     190    psAssert (readout, "missing readout?");
     191
     192    pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
     193    psAssert (detections, "missing detections?");
     194
     195    psArray *realSources = detections->allSources;
     196    psAssert (realSources, "missing sources?");
     197
     198    // XXX do we need to skip this step if we do not have a psf?
     199    pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF");
     200    psAssert (psf, "missing psf?");
     201
    159202    PM_ASSERT_READOUT_NON_NULL(readout, false);
    160203    PM_ASSERT_READOUT_IMAGE(readout, false);
    161204    PS_ASSERT_PTR_NON_NULL(psf, false);
    162205    PS_ASSERT_METADATA_NON_NULL(recipe, false);
    163     PS_ASSERT_ARRAY_NON_NULL(realSources, false);
    164 
    165     psTimerStart("psphot.fake");
    166206
    167207    // Collect recipe information
     
    206246    // remove all sources, adding noise for subtracted sources
    207247    psphotRemoveAllSources(realSources, recipe);
    208     //    psphotAddNoise(readout, realSources, recipe);
     248    // psphotAddNoise(readout, realSources, recipe);
    209249
    210250
     
    480520    psLogMsg("psphot", PS_LOG_INFO, "Detection efficiency: %lf sec\n", psTimerClear("psphot.fake"));
    481521
     522# endif
    482523
    483524    return true;
Note: See TracChangeset for help on using the changeset viewer.