IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30881


Ignore:
Timestamp:
Mar 12, 2011, 10:03:34 AM (15 years ago)
Author:
eugene
Message:

restrict the range of seeing in the input images based on a user limit and on the list statistics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/ppStack/src/ppStackPrepare.c

    r30702 r30881  
    232232    }
    233233
     234    bool mdok = false;
     235    float maxFWHM = psMetadataLookupF32(&mdok, recipe, "PSF.INPUT.MAX"); // max allowed input fwhm
     236    float clipFWHMnSig = psMetadataLookupF32(&mdok, recipe, "PSF.INPUT.CLIP.NSIGMA"); // sigma clipping of inputs
     237
    234238    psString log = psStringCopy("Input seeing FWHMs:\n"); // Log message
    235239    bool havePSFs = false;                                // Do we have any PSFs?
     
    265269        }
    266270
     271        // reject any input images which exceed the specified max FWHM
     272        if (isfinite(maxFWHM) && (options->inputSeeing->data.F32[i] > maxFWHM)) {
     273            options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PPSTACK_MASK_PSF;
     274            psLogMsg("ppStack", PS_LOG_INFO, "PSF FWHM for image %d is too large (%f vs %f maxFWHM) --- rejected.", i, options->inputSeeing->data.F32[i], maxFWHM);
     275        }
     276
    267277        psStringAppend(&log, "Input %d: %f\n", i, options->inputSeeing->data.F32[i]);
    268278    }
     
    271281    }
    272282    psFree(log);
     283
     284    // We should have the ability to filter the input list based on the seeing:
     285    // * reject above some max value and/or min value
     286    // * reject images out-of-line with the rest of the images
     287
     288    // measure stats
     289    psStats *fwhmStats = psStatsAlloc(PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV);
     290    psVectorStats (fwhmStats, options->inputSeeing, NULL, options->inputMask, 0xff);
     291    psLogMsg("ppStack", PS_LOG_INFO, "Input FWHMs : %f +/- %f", fwhmStats->clippedMean, fwhmStats->clippedStdev);
     292
     293    if (isfinite(clipFWHMnSig)) {
     294        float fwhmLimit = fwhmStats->clippedMean + clipFWHMnSig * fwhmStats->clippedStdev;
     295        fwhmLimit = isfinite(maxFWHM) ? PS_MIN (maxFWHM, fwhmLimit) : fwhmLimit;
     296        for (int i = 0; i < num; i++) {
     297            if (options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) continue;
     298            if (options->inputSeeing->data.F32[i] > fwhmLimit) {
     299                options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PPSTACK_MASK_PSF;
     300                psLogMsg("ppStack", PS_LOG_INFO, "PSF FWHM for image %d is too large (%f vs %f fwhmLimit) --- rejected.", i, options->inputSeeing->data.F32[i], fwhmLimit);
     301            }
     302        }
     303    }
    273304
    274305    // Generate target PSF
Note: See TracChangeset for help on using the changeset viewer.