|
template<typename ImageT , typename MaskT , typename VarianceT > |
| Statistics (ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl()) |
| Constructor for Statistics object. More...
|
|
template<typename ImageT , typename MaskT , typename VarianceT , typename WeightT > |
| Statistics (ImageT const &img, MaskT const &msk, VarianceT const &var, WeightT const &weights, int const flags, StatisticsControl const &sctrl=StatisticsControl()) |
|
| Statistics (Statistics const &)=default |
|
| Statistics (Statistics &&)=default |
|
Statistics & | operator= (Statistics const &)=default |
|
Statistics & | operator= (Statistics &&)=default |
|
| ~Statistics () noexcept=default |
|
Value | getResult (Property const prop=NOTHING) const |
| Return the value and error in the specified statistic (e.g. More...
|
|
double | getError (Property const prop=NOTHING) const |
| Return the error in the desired property (if specified in the constructor) More...
|
|
double | getValue (Property const prop=NOTHING) const |
| Return the value of the desired property (if specified in the constructor) More...
|
|
lsst::afw::image::MaskPixel | getOrMask () const noexcept |
|
template<> |
| Statistics (image::Mask< image::MaskPixel > const &msk, image::Mask< image::MaskPixel > const &msk2, image::Mask< image::MaskPixel > const &var, int const flags, StatisticsControl const &sctrl) |
|
|
(Note that these are not member functions.)
|
template<typename Pixel > |
Statistics | makeStatistics (lsst::afw::image::Image< Pixel > const &img, lsst::afw::image::Mask< image::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl=StatisticsControl()) |
| Handle a watered-down front-end to the constructor (no variance) More...
|
|
template<typename ImageT , typename MaskT , typename VarianceT > |
Statistics | makeStatistics (ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl()) |
| Handle a straight front-end to the constructor. More...
|
|
template<typename Pixel > |
Statistics | makeStatistics (lsst::afw::image::MaskedImage< Pixel > const &mimg, int const flags, StatisticsControl const &sctrl=StatisticsControl()) |
| Handle MaskedImages, just pass the getImage() and getMask() values right on through. More...
|
|
template<typename Pixel > |
Statistics | makeStatistics (lsst::afw::image::MaskedImage< Pixel > const &mimg, lsst::afw::image::Image< WeightPixel > const &weights, int const flags, StatisticsControl const &sctrl=StatisticsControl()) |
| Handle MaskedImages, just pass the getImage() and getMask() values right on through. More...
|
|
Statistics | makeStatistics (lsst::afw::image::Mask< lsst::afw::image::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl=StatisticsControl()) |
| Specialization to handle Masks. More...
|
|
template<typename Pixel > |
Statistics | makeStatistics (lsst::afw::image::Image< Pixel > const &img, int const flags, StatisticsControl const &sctrl=StatisticsControl()) |
| The makeStatistics() overload to handle regular (non-masked) Images. More...
|
|
template<typename EntryT > |
Statistics | makeStatistics (std::vector< EntryT > const &v, int const flags, StatisticsControl const &sctrl=StatisticsControl()) |
| The makeStatistics() overload to handle std::vector<> More...
|
|
template<typename EntryT > |
Statistics | makeStatistics (std::vector< EntryT > const &v, std::vector< WeightPixel > const &vweights, int const flags, StatisticsControl const &sctrl=StatisticsControl()) |
| The makeStatistics() overload to handle std::vector<> More...
|
|
template<typename EntryT > |
Statistics | makeStatistics (lsst::afw::math::MaskedVector< EntryT > const &mv, int const flags, StatisticsControl const &sctrl=StatisticsControl()) |
| The makeStatistics() overload to handle lsst::afw::math::MaskedVector<> More...
|
|
template<typename EntryT > |
Statistics | makeStatistics (lsst::afw::math::MaskedVector< EntryT > const &mv, std::vector< WeightPixel > const &vweights, int const flags, StatisticsControl const &sctrl=StatisticsControl()) |
| The makeStatistics() overload to handle lsst::afw::math::MaskedVector<> More...
|
|
A class to evaluate image statistics
The basic strategy is to construct a Statistics object from an Image and a statement of what we want to know. The desired results can then be returned using Statistics methods. A StatisticsControl object is used to pass parameters. The statistics currently implemented are listed in the enum Properties in Statistics.h.
// sets NumSigclip (3.0), and NumIter (3) for clipping
lsst::afw::math::StatisticsControl sctrl(3.0, 3);
sctrl.setNumSigmaClip(4.0); // reset number of standard deviations for N-sigma clipping
sctrl.setNumIter(5); // reset number of iterations for N-sigma clipping
sctrl.setAndMask(0x1); // ignore pixels with these mask bits set
sctrl.setNanSafe(true); // check for NaNs & Infs, a bit slower (default=true)
lsst::afw::math::Statistics statobj =
lsst::afw::math::makeStatistics(*img, afwMath::NPOINT |
afwMath::MEAN | afwMath::MEANCLIP, sctrl);
double const n = statobj.getValue(lsst::afw::math::NPOINT);
std::pair<double, double> const mean =
statobj.getResult(lsst::afw::math::MEAN); // Returns (value, error)
double const meanError = statobj.getError(lsst::afw::math::MEAN); // just the error
- Note
- Factory function: We used a helper function,
makeStatistics
, rather that the constructor directly so that the compiler could deduce the types – cf. std::make_pair()
-
Inputs: The class Statistics is templated, and makeStatistics() can take either: (1) an image, (2) a maskedImage, or (3) a std::vector<> Overloaded makeStatistics() functions then wrap what they were passed in Image/Mask-like classes and call the Statistics constructor.
-
Clipping: The clipping is done iteratively with numSigmaClip and numIter specified in the StatisticsControl object. The first clip (ie. the first iteration) is performed at: median +/- numSigmaClip*IQ_TO_STDEV*IQR, where IQ_TO_STDEV=~0.74 is the conversion factor between the IQR and sigma for a Gaussian distribution. All subsequent iterations perform clips at mean +/- numSigmaClip*stdev.
Definition at line 215 of file Statistics.h.