LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Related Functions | List of all members
lsst::afw::math::Statistics Class Referencefinal

A class to evaluate image statistics. More...

#include <Statistics.h>

Public Types

typedef std::pair< double, double > Value
 The type used to report (value, error) for desired statistics. More...
 

Public Member Functions

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
 
Statisticsoperator= (Statistics const &)=default
 
Statisticsoperator= (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)
 

Related Functions

(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...
 

Detailed Description

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.

Member Typedef Documentation

◆ Value

The type used to report (value, error) for desired statistics.

Definition at line 218 of file Statistics.h.

Constructor & Destructor Documentation

◆ Statistics() [1/5]

template<typename ImageT , typename MaskT , typename VarianceT >
lsst::afw::math::Statistics::Statistics ( ImageT const &  img,
MaskT const &  msk,
VarianceT const &  var,
int const  flags,
StatisticsControl const &  sctrl = StatisticsControl() 
)
explicit

Constructor for Statistics object.

Parameters
imgImage whose properties we want
mskMask to control which pixels are included
varVariances corresponding to values in Image
flagsDescribe what we want to calculate
sctrlControl how things are calculated
Note
Most of the actual work is done in this constructor; the results are retrieved using getValue etc.

Definition at line 773 of file Statistics.cc.

775  : _flags(flags),
776  _mean(NaN, NaN),
777  _variance(NaN, NaN),
778  _min(NaN),
779  _max(NaN),
780  _sum(NaN),
781  _meanclip(NaN, NaN),
782  _varianceclip(NaN, NaN),
783  _median(NaN, NaN),
784  _nClipped(0),
785  _nMasked(0),
786  _iqrange(NaN),
787  _sctrl(sctrl),
788  _weightsAreMultiplicative(false) {
789  doStatistics(img, msk, var, var, _flags, _sctrl);
790 }

◆ Statistics() [2/5]

template<typename ImageT , typename MaskT , typename VarianceT , typename WeightT >
lsst::afw::math::Statistics::Statistics ( ImageT const &  img,
MaskT const &  msk,
VarianceT const &  var,
WeightT const &  weights,
int const  flags,
StatisticsControl const &  sctrl = StatisticsControl() 
)
explicit
Parameters
imgImage whose properties we want
mskMask to control which pixels are included
varVariances corresponding to values in Image
weightsWeights to use corresponding to values in Image
flagsDescribe what we want to calculate
sctrlControl how things are calculated

Definition at line 822 of file Statistics.cc.

824  : _flags(flags),
825  _mean(NaN, NaN),
826  _variance(NaN, NaN),
827  _min(NaN),
828  _max(NaN),
829  _sum(NaN),
830  _meanclip(NaN, NaN),
831  _varianceclip(NaN, NaN),
832  _median(NaN, NaN),
833  _nClipped(0),
834  _nMasked(0),
835  _iqrange(NaN),
836  _sctrl(sctrl),
837  _weightsAreMultiplicative(true) {
838  if (!isEmpty(weights)) {
839  if (_sctrl.getWeightedIsSet() && !_sctrl.getWeighted()) {
840  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError,
841  "You must use the weights if you provide them");
842  }
843 
844  _sctrl.setWeighted(true);
845  }
846  doStatistics(img, msk, var, weights, _flags, _sctrl);
847 }
bool getWeightedIsSet() const noexcept
Definition: Statistics.h:139
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
void setWeighted(bool useWeights) noexcept
Definition: Statistics.h:153
bool getWeighted() const noexcept
Definition: Statistics.h:138

◆ Statistics() [3/5]

lsst::afw::math::Statistics::Statistics ( Statistics const &  )
default

◆ Statistics() [4/5]

lsst::afw::math::Statistics::Statistics ( Statistics &&  )
default

◆ ~Statistics()

lsst::afw::math::Statistics::~Statistics ( )
defaultnoexcept

◆ Statistics() [5/5]

template<>
lsst::afw::math::Statistics::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 
)

Definition at line 1070 of file Statistics.cc.

1073  : _flags(flags),
1074  _mean(NaN, NaN),
1075  _variance(NaN, NaN),
1076  _min(NaN),
1077  _max(NaN),
1078  _meanclip(NaN, NaN),
1079  _varianceclip(NaN, NaN),
1080  _median(NaN, NaN),
1081  _nClipped(0),
1082  _iqrange(NaN),
1083  _sctrl(sctrl) {
1084  if ((flags & ~(NPOINT | SUM)) != 0x0) {
1086  "Statistics<Mask> only supports NPOINT and SUM");
1087  }
1088 
1089  typedef image::Mask<image::MaskPixel> Mask;
1090 
1091  _n = msk.getWidth() * msk.getHeight();
1092  if (_n == 0) {
1093  throw LSST_EXCEPT(pexExceptions::InvalidParameterError, "Image contains no pixels");
1094  }
1095 
1096  // Check that an int's large enough to hold the number of pixels
1097  assert(msk.getWidth() * static_cast<double>(msk.getHeight()) < std::numeric_limits<int>::max());
1098 
1099  image::MaskPixel sum = 0x0;
1100  for (int y = 0; y != msk.getHeight(); ++y) {
1101  for (Mask::x_iterator ptr = msk.row_begin(y), end = msk.row_end(y); ptr != end; ++ptr) {
1102  sum |= (*ptr)[0];
1103  }
1104  }
1105  _sum = sum;
1106 }
uint64_t * ptr
Definition: RangeSet.cc:88
int getHeight() const
Return the number of rows in the image.
Definition: ImageBase.h:335
int y
Definition: SpanSet.cc:49
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y&#39;th row.
Definition: ImageBase.h:438
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:77
number of sample points
Definition: Statistics.h:66
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
int getWidth() const
Return the number of columns in the image.
Definition: ImageBase.h:333
Reports invalid arguments.
Definition: Runtime.h:66
x_iterator row_end(int y) const
Return an x_iterator to the end of the y&#39;th row.
Definition: ImageBase.h:441
find sum of pixels in the image
Definition: Statistics.h:78
int end

Member Function Documentation

◆ getError()

double lsst::afw::math::Statistics::getError ( Property const  prop = NOTHING) const

Return the error in the desired property (if specified in the constructor)

Parameters
propthe afw::math::Property to retrieve. If NOTHING (default) and you only asked for one property in the constructor, that property's error is returned
Note
You may have needed to specify ERROR to the ctor

Definition at line 1058 of file Statistics.cc.

1058 { return getResult(prop).second; }
Value getResult(Property const prop=NOTHING) const
Return the value and error in the specified statistic (e.g.
Definition: Statistics.cc:931

◆ getOrMask()

lsst::afw::image::MaskPixel lsst::afw::math::Statistics::getOrMask ( ) const
inlinenoexcept

Definition at line 283 of file Statistics.h.

283 { return _allPixelOrMask; }

◆ getResult()

std::pair< double, double > lsst::afw::math::Statistics::getResult ( Property const  prop = NOTHING) const

Return the value and error in the specified statistic (e.g.

MEAN)

Parameters
propthe afw::math::Property to retrieve. If NOTHING (default) and you only asked for one property (and maybe its error) in the constructor, that property is returned
Note
Only quantities requested in the constructor may be retrieved; in particular errors may not be available if you didn't specify ERROR in the constructor
See also
getValue and getError
Todo:
uncertainties on MEANCLIP,STDEVCLIP are sketchy. _n != _nClip

Definition at line 931 of file Statistics.cc.

931  {
932  // if iProp == NOTHING try to return their heart's delight, as specified in the constructor
933  Property const prop = static_cast<Property>(((iProp == NOTHING) ? _flags : iProp) & ~ERRORS);
934 
935  if (!(prop & _flags)) { // we didn't calculate it
937  (boost::format("You didn't ask me to calculate %d") % prop).str());
938  }
939 
940  Value ret(NaN, NaN);
941  switch (prop) {
942  case NPOINT:
943  ret.first = static_cast<double>(_n);
944  if (_flags & ERRORS) {
945  ret.second = 0;
946  }
947  break;
948 
949  case NCLIPPED:
950  ret.first = static_cast<double>(_nClipped);
951  if (_flags & ERRORS) {
952  ret.second = 0;
953  }
954  break;
955 
956  case NMASKED:
957  ret.first = static_cast<double>(_nMasked);
958  if (_flags & ERRORS) {
959  ret.second = 0;
960  }
961  break;
962 
963  case SUM:
964  ret.first = static_cast<double>(_sum);
965  if (_flags & ERRORS) {
966  ret.second = 0;
967  }
968  break;
969 
970  // == means ==
971  case MEAN:
972  ret.first = _mean.first;
973  if (_flags & ERRORS) {
974  ret.second = ::sqrt(_mean.second);
975  }
976  break;
977  case MEANCLIP:
978  ret.first = _meanclip.first;
979  if (_flags & ERRORS) {
980  ret.second = ::sqrt(_meanclip.second);
981  }
982  break;
983 
984  // == stdevs & variances ==
985  case VARIANCE:
986  ret.first = _variance.first;
987  if (_flags & ERRORS) {
988  ret.second = ::sqrt(_variance.second);
989  }
990  break;
991  case STDEV:
992  ret.first = sqrt(_variance.first);
993  if (_flags & ERRORS) {
994  ret.second = 0.5 * ::sqrt(_variance.second) / ret.first;
995  }
996  break;
997  case VARIANCECLIP:
998  ret.first = _varianceclip.first;
999  if (_flags & ERRORS) {
1000  ret.second = ret.second;
1001  }
1002  break;
1003  case STDEVCLIP:
1004  ret.first = sqrt(_varianceclip.first);
1005  if (_flags & ERRORS) {
1006  ret.second = 0.5 * ::sqrt(_varianceclip.second) / ret.first;
1007  }
1008  break;
1009 
1010  case MEANSQUARE:
1011  ret.first = (_n - 1) / static_cast<double>(_n) * _variance.first + ::pow(_mean.first, 2);
1012  if (_flags & ERRORS) {
1013  ret.second = ::sqrt(2 * ::pow(ret.first / _n, 2)); // assumes Gaussian
1014  }
1015  break;
1016 
1017  // == other stats ==
1018  case MIN:
1019  ret.first = _min;
1020  if (_flags & ERRORS) {
1021  ret.second = 0;
1022  }
1023  break;
1024  case MAX:
1025  ret.first = _max;
1026  if (_flags & ERRORS) {
1027  ret.second = 0;
1028  }
1029  break;
1030  case MEDIAN:
1031  ret.first = _median.first;
1032  if (_flags & ERRORS) {
1033  ret.second = sqrt(geom::HALFPI * _variance.first / _n); // assumes Gaussian
1034  }
1035  break;
1036  case IQRANGE:
1037  ret.first = _iqrange;
1038  if (_flags & ERRORS) {
1039  ret.second = NaN; // we're not estimating this properly
1040  }
1041  break;
1042 
1043  // no-op to satisfy the compiler
1044  case ERRORS:
1045  break;
1046  // default: redundant as 'ret' is initialized to NaN, NaN
1047  default: // we must have set prop to _flags
1048  assert(iProp == 0);
1049  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError,
1050  "getValue() may only be called without a parameter"
1051  " if you asked for only one statistic");
1052  }
1053  return ret;
1054 }
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174
estimate sample minimum
Definition: Statistics.h:76
number of clipped points
Definition: Statistics.h:81
estimate sample standard deviation
Definition: Statistics.h:68
find mean value of square of pixel values
Definition: Statistics.h:79
estimate sample maximum
Definition: Statistics.h:77
We don&#39;t want anything.
Definition: Statistics.h:64
Include errors of requested quantities.
Definition: Statistics.h:65
number of masked points
Definition: Statistics.h:82
estimate sample N-sigma clipped stdev (N set in StatisticsControl, default=3)
Definition: Statistics.h:73
std::pair< double, double > Value
The type used to report (value, error) for desired statistics.
Definition: Statistics.h:218
estimate sample median
Definition: Statistics.h:70
estimate sample N-sigma clipped mean (N set in StatisticsControl, default=3)
Definition: Statistics.h:72
estimate sample N-sigma clipped variance (N set in StatisticsControl, default=3)
Definition: Statistics.h:74
number of sample points
Definition: Statistics.h:66
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
estimate sample inter-quartile range
Definition: Statistics.h:71
double constexpr HALFPI
Definition: Angle.h:41
T pow(T... args)
estimate sample mean
Definition: Statistics.h:67
estimate sample variance
Definition: Statistics.h:69
Reports invalid arguments.
Definition: Runtime.h:66
T sqrt(T... args)
find sum of pixels in the image
Definition: Statistics.h:78
Property
control what is calculated
Definition: Statistics.h:63

◆ getValue()

double lsst::afw::math::Statistics::getValue ( Property const  prop = NOTHING) const

Return the value of the desired property (if specified in the constructor)

Parameters
propthe afw::math::Property to retrieve. If NOTHING (default) and you only asked for one property in the constructor, that property is returned

Definition at line 1056 of file Statistics.cc.

1056 { return getResult(prop).first; }
Value getResult(Property const prop=NOTHING) const
Return the value and error in the specified statistic (e.g.
Definition: Statistics.cc:931

◆ operator=() [1/2]

Statistics& lsst::afw::math::Statistics::operator= ( Statistics const &  )
default

◆ operator=() [2/2]

Statistics& lsst::afw::math::Statistics::operator= ( Statistics &&  )
default

Friends And Related Function Documentation

◆ makeStatistics() [1/10]

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() 
)
related

Handle a watered-down front-end to the constructor (no variance)

Examples:
imageStatistics.cc.

Definition at line 354 of file Statistics.h.

356  {
357  MaskImposter<WeightPixel> var;
358  return Statistics(img, msk, var, flags, sctrl);
359 }
Statistics(ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Constructor for Statistics object.
Definition: Statistics.cc:773

◆ makeStatistics() [2/10]

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() 
)
related

Handle a straight front-end to the constructor.

Definition at line 366 of file Statistics.h.

367  {
368  return Statistics(img, msk, var, flags, sctrl);
369 }
Statistics(ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Constructor for Statistics object.
Definition: Statistics.cc:773

◆ makeStatistics() [3/10]

template<typename Pixel >
Statistics makeStatistics ( lsst::afw::image::MaskedImage< Pixel > const &  mimg,
int const  flags,
StatisticsControl const &  sctrl = StatisticsControl() 
)
related

Handle MaskedImages, just pass the getImage() and getMask() values right on through.

Definition at line 376 of file Statistics.h.

377  {
378  if (sctrl.getWeighted() || sctrl.getCalcErrorFromInputVariance()) {
379  return Statistics(*mimg.getImage(), *mimg.getMask(), *mimg.getVariance(), flags, sctrl);
380  } else {
381  MaskImposter<WeightPixel> var;
382  return Statistics(*mimg.getImage(), *mimg.getMask(), var, flags, sctrl);
383  }
384 }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1090
Statistics(ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Constructor for Statistics object.
Definition: Statistics.cc:773
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1057
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1069

◆ makeStatistics() [4/10]

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() 
)
related

Handle MaskedImages, just pass the getImage() and getMask() values right on through.

Definition at line 391 of file Statistics.h.

393  {
394  if (sctrl.getWeighted() || sctrl.getCalcErrorFromInputVariance() ||
395  (!sctrl.getWeightedIsSet() && (weights.getWidth() != 0 && weights.getHeight() != 0))) {
396  return Statistics(*mimg.getImage(), *mimg.getMask(), *mimg.getVariance(), weights, flags, sctrl);
397  } else {
398  MaskImposter<WeightPixel> var;
399  return Statistics(*mimg.getImage(), *mimg.getMask(), var, weights, flags, sctrl);
400  }
401 }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1090
int getHeight() const
Return the number of rows in the image.
Definition: ImageBase.h:335
Statistics(ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Constructor for Statistics object.
Definition: Statistics.cc:773
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1057
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1069
int getWidth() const
Return the number of columns in the image.
Definition: ImageBase.h:333

◆ makeStatistics() [5/10]

Statistics makeStatistics ( lsst::afw::image::Mask< lsst::afw::image::MaskPixel > const &  msk,
int const  flags,
StatisticsControl const &  sctrl = StatisticsControl() 
)
related

Specialization to handle Masks.

Parameters
mskImage (or MaskedImage) whose properties we want
flagsDescribe what we want to calculate
sctrlControl how things are calculated

Definition at line 1113 of file Statistics.cc.

1114  {
1115  return Statistics(msk, msk, msk, flags, sctrl);
1116 }
Statistics(ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Constructor for Statistics object.
Definition: Statistics.cc:773

◆ makeStatistics() [6/10]

template<typename Pixel >
Statistics makeStatistics ( lsst::afw::image::Image< Pixel > const &  img,
int const  flags,
StatisticsControl const &  sctrl = StatisticsControl() 
)
related

The makeStatistics() overload to handle regular (non-masked) Images.

Parameters
imgImage (or Image) whose properties we want
flagsDescribe what we want to calculate
sctrlControl calculation

Definition at line 420 of file Statistics.h.

424  {
425  // make a phony mask that will be compiled out
426  MaskImposter<lsst::afw::image::MaskPixel> const msk;
427  MaskImposter<WeightPixel> const var;
428  return Statistics(img, msk, var, flags, sctrl);
429 }
Statistics(ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Constructor for Statistics object.
Definition: Statistics.cc:773

◆ makeStatistics() [7/10]

template<typename EntryT >
Statistics makeStatistics ( std::vector< EntryT > const &  v,
int const  flags,
StatisticsControl const &  sctrl = StatisticsControl() 
)
related

The makeStatistics() overload to handle std::vector<>

Parameters
vImage (or MaskedImage) whose properties we want
flagsDescribe what we want to calculate
sctrlControl calculation

Definition at line 469 of file Statistics.h.

472  {
473  ImageImposter<EntryT> img(v); // wrap the vector in a fake image
474  MaskImposter<lsst::afw::image::MaskPixel> msk; // instantiate a fake mask that will be compiled out.
475  MaskImposter<WeightPixel> var;
476  return Statistics(img, msk, var, flags, sctrl);
477 }
Statistics(ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Constructor for Statistics object.
Definition: Statistics.cc:773

◆ makeStatistics() [8/10]

template<typename EntryT >
Statistics makeStatistics ( std::vector< EntryT > const &  v,
std::vector< WeightPixel > const &  vweights,
int const  flags,
StatisticsControl const &  sctrl = StatisticsControl() 
)
related

The makeStatistics() overload to handle std::vector<>

Parameters
vImage (or MaskedImage) whose properties we want
vweightsWeights
flagsDescribe what we want to calculate
sctrlControl calculation

Definition at line 484 of file Statistics.h.

488  {
489  ImageImposter<EntryT> img(v); // wrap the vector in a fake image
490  MaskImposter<lsst::afw::image::MaskPixel> msk; // instantiate a fake mask that will be compiled out.
491  MaskImposter<WeightPixel> var;
492 
493  ImageImposter<WeightPixel> weights(vweights);
494 
495  return Statistics(img, msk, var, weights, flags, sctrl);
496 }
Statistics(ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Constructor for Statistics object.
Definition: Statistics.cc:773

◆ makeStatistics() [9/10]

template<typename EntryT >
Statistics makeStatistics ( lsst::afw::math::MaskedVector< EntryT > const &  mv,
int const  flags,
StatisticsControl const &  sctrl = StatisticsControl() 
)
related

The makeStatistics() overload to handle lsst::afw::math::MaskedVector<>

Parameters
mvMaskedVector
flagsDescribe what we want to calculate
sctrlControl calculation

Definition at line 503 of file Statistics.h.

506  {
507  if (sctrl.getWeighted() || sctrl.getCalcErrorFromInputVariance()) {
508  return Statistics(*mv.getImage(), *mv.getMask(), *mv.getVariance(), flags, sctrl);
509  } else {
510  MaskImposter<WeightPixel> var;
511  return Statistics(*mv.getImage(), *mv.getMask(), var, flags, sctrl);
512  }
513 }
lsst::afw::image::MaskedImage< EntryT >::ImagePtr getImage() const
Definition: MaskedVector.h:88
Statistics(ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Constructor for Statistics object.
Definition: Statistics.cc:773
lsst::afw::image::MaskedImage< EntryT >::VariancePtr getVariance() const
Definition: MaskedVector.h:94
lsst::afw::image::MaskedImage< EntryT >::MaskPtr getMask() const
Definition: MaskedVector.h:91

◆ makeStatistics() [10/10]

template<typename EntryT >
Statistics makeStatistics ( lsst::afw::math::MaskedVector< EntryT > const &  mv,
std::vector< WeightPixel > const &  vweights,
int const  flags,
StatisticsControl const &  sctrl = StatisticsControl() 
)
related

The makeStatistics() overload to handle lsst::afw::math::MaskedVector<>

Parameters
mvMaskedVector
vweightsweights
flagsDescribe what we want to calculate
sctrlControl calculation

Definition at line 520 of file Statistics.h.

524  {
525  ImageImposter<WeightPixel> weights(vweights);
526 
527  if (sctrl.getWeighted() || sctrl.getCalcErrorFromInputVariance()) {
528  return Statistics(*mv.getImage(), *mv.getMask(), *mv.getVariance(), weights, flags, sctrl);
529  } else {
530  MaskImposter<WeightPixel> var;
531  return Statistics(*mv.getImage(), *mv.getMask(), var, weights, flags, sctrl);
532  }
533 }
lsst::afw::image::MaskedImage< EntryT >::ImagePtr getImage() const
Definition: MaskedVector.h:88
Statistics(ImageT const &img, MaskT const &msk, VarianceT const &var, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Constructor for Statistics object.
Definition: Statistics.cc:773
lsst::afw::image::MaskedImage< EntryT >::VariancePtr getVariance() const
Definition: MaskedVector.h:94
lsst::afw::image::MaskedImage< EntryT >::MaskPtr getMask() const
Definition: MaskedVector.h:91

The documentation for this class was generated from the following files: