lsst.afw  22.0.1-33-g415537ac7+f49c5b7a45
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
lsst::afw::math Namespace Reference

Namespaces

 _background
 
 _backgroundList
 
 _chebyshevBoundedField
 
 _chebyshevBoundedFieldConfig
 
 _spatialCell
 
 _warper
 
 detail
 
 details
 

Classes

class  Approximate
 Approximate values for a MaskedImage. More...
 
class  ApproximateControl
 Control how to make an approximation. More...
 
class  BackgroundControl
 Pass parameters to a Background object. More...
 
class  Background
 A virtual base class to evaluate image background levels. More...
 
class  BackgroundMI
 A class to evaluate image background levels. More...
 
class  BoundedField
 An abstract base class for 2-d functions defined on an integer bounding boxes. More...
 
class  ChebyshevBoundedFieldControl
 A control object used when fitting ChebyshevBoundedField to data (see ChebyshevBoundedField::fit) More...
 
class  ChebyshevBoundedField
 A BoundedField based on 2-d Chebyshev polynomials of the first kind. More...
 
class  ConvolutionControl
 Parameters to control convolution. More...
 
class  Function
 Basic Function class. More...
 
class  Function1
 A Function taking one argument. More...
 
class  Function2
 A Function taking two arguments. More...
 
class  BasePolynomialFunction2
 Base class for 2-dimensional polynomials of the form: More...
 
class  NullFunction1
 a class used in function calls to indicate that no Function1 is being provided More...
 
class  NullFunction2
 a class used in function calls to indicate that no Function2 is being provided More...
 
class  IntegerDeltaFunction1
 1-dimensional integer delta function. More...
 
class  IntegerDeltaFunction2
 2-dimensional integer delta function. More...
 
class  GaussianFunction1
 1-dimensional Gaussian More...
 
class  GaussianFunction2
 2-dimensional Gaussian More...
 
class  DoubleGaussianFunction2
 double Guassian (sum of two Gaussians) More...
 
class  PolynomialFunction1
 1-dimensional polynomial function. More...
 
class  PolynomialFunction2
 2-dimensional polynomial function with cross terms More...
 
class  Chebyshev1Function1
 1-dimensional weighted sum of Chebyshev polynomials of the first kind. More...
 
class  Chebyshev1Function2
 2-dimensional weighted sum of Chebyshev polynomials of the first kind. More...
 
class  LanczosFunction1
 1-dimensional Lanczos function More...
 
class  LanczosFunction2
 2-dimensional separable Lanczos function More...
 
class  GaussianProcessTimer
 This is a structure for keeping track of how long the interpolation methods spend on different parts of the interpolation. More...
 
class  Covariogram
 The parent class of covariogram functions for use in Gaussian Process interpolation. More...
 
class  SquaredExpCovariogram
 SquaredExpCovariogram. More...
 
class  NeuralNetCovariogram
 a Covariogram that recreates a neural network with one hidden layer and infinite units in that layer More...
 
class  KdTree
 The data for GaussianProcess is stored in a KD tree to facilitate nearest-neighbor searches. More...
 
class  GaussianProcess
 Stores values of a function sampled on an image and allows you to interpolate the function to unsampled points. More...
 
struct  IntRegion
 
class  Interpolate
 
class  Kernel
 Kernels are used for convolution with MaskedImages and (eventually) Images. More...
 
class  FixedKernel
 A kernel created from an Image. More...
 
class  AnalyticKernel
 A kernel described by a function. More...
 
class  DeltaFunctionKernel
 A kernel that has only one non-zero pixel (of value 1) More...
 
class  LinearCombinationKernel
 A kernel that is a linear combination of fixed basis kernels. More...
 
class  SeparableKernel
 A kernel described by a pair of functions: func(x, y) = colFunc(x) * rowFunc(y) More...
 
class  LeastSquares
 Solver for linear least-squares problems. More...
 
class  MaskedVector
 
struct  FitResults
 Results from minimizing a function. More...
 
class  PixelAreaBoundedField
 A BoundedField that evaluate the pixel area of a SkyWcs in angular units. More...
 
class  ProductBoundedField
 A BoundedField that lazily multiplies a sequence of other BoundedFields. More...
 
class  Random
 A class that can be used to generate sequences of random numbers according to a number of different algorithms. More...
 
class  CandidateVisitor
 
class  SpatialCellCandidate
 Base class for candidate objects in a SpatialCell. More...
 
class  SpatialCellImageCandidate
 Base class for candidate objects in a SpatialCell that are able to return an Image of some sort (e.g. More...
 
class  SpatialCellCandidateIterator
 An iterator that only returns usable members of the SpatialCell. More...
 
class  SpatialCell
 Class to ensure constraints for spatial modeling. More...
 
class  SpatialCellSet
 A collection of SpatialCells covering an entire image. More...
 
class  StatisticsControl
 Pass parameters to a Statistics object. More...
 
class  Statistics
 A class to evaluate image statistics. More...
 
class  infinite_iterator
 This iterator will never increment. More...
 
class  MaskImposter
 A Mask wrapper to provide an infinite_iterator for Mask::row_begin(). More...
 
class  ImageImposter
 A vector wrapper to provide a vector with the necessary methods and typedefs to be processed by Statistics as though it were an Image. More...
 
struct  is_analyticKernel
 traits class to determine if a Kernel is represented as an analytic function More...
 
struct  is_analyticKernel< KernelT * >
 
struct  is_analyticKernel< std::shared_ptr< KernelT > >
 
struct  is_analyticKernel< AnalyticKernel >
 
struct  generic_kernel_tag
 Tags carrying information about Kernels Kernel with no special properties. More...
 
struct  deltafunction_kernel_tag
 Kernel has only one non-zero pixel. More...
 
struct  kernel_traits
 template trait class with information about Kernels More...
 
class  TransformBoundedField
 A BoundedField based on geom::Transform<Poin2Endpoint, GenericEndpoint<1>>. More...
 
class  LanczosWarpingKernel
 Lanczos warping: accurate but slow and can introduce ringing artifacts. More...
 
class  BilinearWarpingKernel
 Bilinear warping: fast; good for undersampled data. More...
 
class  NearestWarpingKernel
 Nearest neighbor warping: fast; good for undersampled data. More...
 
class  WarpingControl
 Parameters to control convolution. More...
 
class  InterpolateConstant
 
class  InterpolateGsl
 

Typedefs

using KernelList = std::vector< std::shared_ptr< Kernel > >
 
using WeightPixel = lsst::afw::image::VariancePixel
 

Enumerations

enum  UndersampleStyle { THROW_EXCEPTION , REDUCE_INTERP_ORDER , INCREASE_NXNYSAMPLE }
 
enum  Property {
  NOTHING = 0x0 , ERRORS = 0x1 , NPOINT = 0x2 , MEAN = 0x4 ,
  STDEV = 0x8 , VARIANCE = 0x10 , MEDIAN = 0x20 , IQRANGE = 0x40 ,
  MEANCLIP = 0x80 , STDEVCLIP = 0x100 , VARIANCECLIP = 0x200 , MIN = 0x400 ,
  MAX = 0x800 , SUM = 0x1000 , MEANSQUARE = 0x2000 , ORMASK = 0x4000 ,
  NCLIPPED = 0x8000 , NMASKED = 0x10000
}
 control what is calculated More...
 

Functions

template<typename PixelT >
std::shared_ptr< Approximate< PixelT > > makeApproximate (std::vector< double > const &x, std::vector< double > const &y, image::MaskedImage< PixelT > const &im, lsst::geom::Box2I const &bbox, ApproximateControl const &ctrl)
 Construct a new Approximate object, inferring the type from the type of the given MaskedImage. More...
 
UndersampleStyle stringToUndersampleStyle (std::string const &style)
 Conversion function to switch a string to an UndersampleStyle. More...
 
template<typename ImageT >
std::shared_ptr< BackgroundmakeBackground (ImageT const &img, BackgroundControl const &bgCtrl)
 A convenience function that uses function overloading to make the correct type of Background. More...
 
std::shared_ptr< BoundedFieldoperator* (double const scale, std::shared_ptr< BoundedField const > bf)
 
template<typename OutImageT , typename InImageT >
void scaledPlus (OutImageT &outImage, double c1, InImageT const &inImage1, double c2, InImageT const &inImage2)
 Compute the scaled sum of two images. More...
 
template<typename OutImageT , typename InImageT >
OutImageT::SinglePixel convolveAtAPoint (typename InImageT::const_xy_locator inImageLocator, image::Image< Kernel::Pixel >::const_xy_locator kernelLocator, int kWidth, int kHeight)
 Apply convolution kernel to an image at one point. More...
 
template<typename OutImageT , typename InImageT >
OutImageT::SinglePixel convolveAtAPoint (typename InImageT::const_xy_locator inImageLocator, std::vector< Kernel::Pixel > const &kernelXList, std::vector< Kernel::Pixel > const &kernelYList)
 Apply separable convolution kernel to an image at one point. More...
 
template<typename OutImageT , typename InImageT , typename KernelT >
void convolve (OutImageT &convolvedImage, InImageT const &inImage, KernelT const &kernel, ConvolutionControl const &convolutionControl=ConvolutionControl())
 Convolve an Image or MaskedImage with a Kernel, setting pixels of an existing output image. More...
 
template<typename ImageT >
ImageT::SinglePixel edgePixel (lsst::afw::image::detail::Image_tag)
 Return an off-the-edge pixel appropriate for a given Image type. More...
 
template<typename MaskedImageT >
MaskedImageT::SinglePixel edgePixel (lsst::afw::image::detail::MaskedImage_tag)
 Return an off-the-edge pixel appropriate for a given MaskedImage type. More...
 
template<typename UnaryFunctionT , typename Arg >
Arg int1d (UnaryFunctionT func, IntRegion< Arg > &reg, Arg const &abserr=DEFABSERR, Arg const &relerr=DEFRELERR)
 Front end for the 1d integrator. More...
 
template<typename UnaryFunctionT , typename Arg >
auto integrate (UnaryFunctionT func, Arg const a, Arg const b, double eps=1.0e-6)
 The 1D integrator. More...
 
template<typename BinaryFunctionT , typename X , typename Y >
auto integrate2d (BinaryFunctionT func, X x1, X x2, Y y1, Y y2, double eps=1.0e-6)
 The 2D integrator. More...
 
std::shared_ptr< InterpolatemakeInterpolate (std::vector< double > const &x, std::vector< double > const &y, Interpolate::Style const style=Interpolate::AKIMA_SPLINE)
 A factory function to make Interpolate objects. More...
 
std::shared_ptr< InterpolatemakeInterpolate (ndarray::Array< double const, 1 > const &x, ndarray::Array< double const, 1 > const &y, Interpolate::Style const style=Interpolate::AKIMA_SPLINE)
 
Interpolate::Style stringToInterpStyle (std::string const &style)
 Conversion function to switch a string to an Interpolate::Style. More...
 
Interpolate::Style lookupMaxInterpStyle (int const n)
 Get the highest order Interpolation::Style available for 'n' points. More...
 
int lookupMinInterpPoints (Interpolate::Style const style)
 Get the minimum number of points needed to use the requested interpolation style. More...
 
void printKernel (lsst::afw::math::Kernel const &kernel, bool doNormalize, double x=0, double y=0, std::string pixelFmt="%7.3f")
 Print the pixel values of a Kernel to std::cout. More...
 
template<typename ReturnT >
FitResults minimize (lsst::afw::math::Function1< ReturnT > const &function, std::vector< double > const &initialParameterList, std::vector< double > const &stepSizeList, std::vector< double > const &measurementList, std::vector< double > const &varianceList, std::vector< double > const &xPositionList, double errorDef)
 Find the minimum of a function(x) More...
 
template<typename ReturnT >
FitResults minimize (lsst::afw::math::Function2< ReturnT > const &function, std::vector< double > const &initialParameterList, std::vector< double > const &stepSizeList, std::vector< double > const &measurementList, std::vector< double > const &varianceList, std::vector< double > const &xPositionList, std::vector< double > const &yPositionList, double errorDef)
 Find the minimum of a function(x, y) More...
 
template<typename ImageT >
std::shared_ptr< ImageT > offsetImage (ImageT const &image, float dx, float dy, std::string const &algorithmName="lanczos5", unsigned int buffer=0)
 Return an image offset by (dx, dy) using the specified algorithm. More...
 
template<typename ImageT >
std::shared_ptr< ImageT > rotateImageBy90 (ImageT const &image, int nQuarter)
 Rotate an image by an integral number of quarter turns. More...
 
template<typename ImageT >
std::shared_ptr< ImageT > flipImage (ImageT const &inImage, bool flipLR, bool flipTB)
 Flip an image left–right and/or top–bottom. More...
 
template<typename ImageT >
std::shared_ptr< ImageT > binImage (ImageT const &inImage, int const binX, int const binY, lsst::afw::math::Property const flags=lsst::afw::math::MEAN)
 
template<typename ImageT >
std::shared_ptr< ImageT > binImage (ImageT const &inImage, int const binsize, lsst::afw::math::Property const flags=lsst::afw::math::MEAN)
 
template<typename ImageT >
void randomUniformImage (ImageT *image, Random &rand)
 Set image to random numbers uniformly distributed in the range [0, 1) More...
 
template<typename ImageT >
void randomUniformPosImage (ImageT *image, Random &rand)
 Set image to random numbers uniformly distributed in the range (0, 1) More...
 
template<typename ImageT >
void randomUniformIntImage (ImageT *image, Random &rand, unsigned long n)
 Set image to random integers uniformly distributed in the range 0 ... More...
 
template<typename ImageT >
void randomFlatImage (ImageT *image, Random &rand, double const a, double const b)
 Set image to random numbers uniformly distributed in the range [a, b) More...
 
template<typename ImageT >
void randomGaussianImage (ImageT *image, Random &rand)
 Set image to random numbers with a gaussian N(0, 1) distribution. More...
 
template<typename ImageT >
void randomChisqImage (ImageT *image, Random &rand, double const nu)
 Set image to random numbers with a chi^2_{nu} distribution. More...
 
template<typename ImageT >
void randomPoissonImage (ImageT *image, Random &rand, double const mu)
 Set image to random numbers with a Poisson distribution with mean mu (n.b. More...
 
template<typename PixelT >
std::shared_ptr< lsst::afw::image::Image< PixelT > > statisticsStack (std::vector< std::shared_ptr< lsst::afw::image::Image< PixelT >>> &images, Property flags, StatisticsControl const &sctrl=StatisticsControl(), std::vector< lsst::afw::image::VariancePixel > const &wvector=std::vector< lsst::afw::image::VariancePixel >(0))
 A function to compute some statistics of a stack of Images. More...
 
template<typename PixelT >
void statisticsStack (lsst::afw::image::Image< PixelT > &out, std::vector< std::shared_ptr< lsst::afw::image::Image< PixelT >>> &images, Property flags, StatisticsControl const &sctrl=StatisticsControl(), std::vector< lsst::afw::image::VariancePixel > const &wvector=std::vector< lsst::afw::image::VariancePixel >(0))
 @ brief compute statistical stack of Image. More...
 
template<typename PixelT >
std::shared_ptr< lsst::afw::image::MaskedImage< PixelT > > statisticsStack (std::vector< std::shared_ptr< lsst::afw::image::MaskedImage< PixelT >>> &images, Property flags, StatisticsControl const &sctrl, std::vector< lsst::afw::image::VariancePixel > const &wvector, image::MaskPixel clipped, std::vector< std::pair< image::MaskPixel, image::MaskPixel >> const &maskMap)
 A function to compute some statistics of a stack of Masked Images. More...
 
template<typename PixelT >
std::shared_ptr< lsst::afw::image::MaskedImage< PixelT > > statisticsStack (std::vector< std::shared_ptr< lsst::afw::image::MaskedImage< PixelT >>> &images, Property flags, StatisticsControl const &sctrl=StatisticsControl(), std::vector< lsst::afw::image::VariancePixel > const &wvector=std::vector< lsst::afw::image::VariancePixel >(0), image::MaskPixel clipped=0, image::MaskPixel excuse=0)
 A function to compute some statistics of a stack of Masked Images. More...
 
template<typename PixelT >
void statisticsStack (lsst::afw::image::MaskedImage< PixelT > &out, std::vector< std::shared_ptr< lsst::afw::image::MaskedImage< PixelT >>> &images, Property flags, StatisticsControl const &sctrl, std::vector< lsst::afw::image::VariancePixel > const &wvector, image::MaskPixel clipped, std::vector< std::pair< image::MaskPixel, image::MaskPixel >> const &maskMap)
 A function to compute some statistics of a stack of Masked Images. More...
 
template<typename PixelT >
void statisticsStack (lsst::afw::image::MaskedImage< PixelT > &out, std::vector< std::shared_ptr< lsst::afw::image::MaskedImage< PixelT >>> &images, Property flags, StatisticsControl const &sctrl=StatisticsControl(), std::vector< lsst::afw::image::VariancePixel > const &wvector=std::vector< lsst::afw::image::VariancePixel >(0), image::MaskPixel clipped=0, image::MaskPixel excuse=0)
 @ brief compute statistical stack of MaskedImage. More...
 
template<typename PixelT >
std::vector< PixelT > statisticsStack (std::vector< std::vector< PixelT >> &vectors, Property flags, StatisticsControl const &sctrl=StatisticsControl(), std::vector< lsst::afw::image::VariancePixel > const &wvector=std::vector< lsst::afw::image::VariancePixel >(0))
 A function to compute some statistics of a stack of std::vectors. More...
 
template<typename PixelT >
std::shared_ptr< lsst::afw::image::MaskedImage< PixelT > > statisticsStack (lsst::afw::image::Image< PixelT > const &image, Property flags, char dimension, StatisticsControl const &sctrl=StatisticsControl())
 A function to compute statistics on the rows or columns of an image. More...
 
template<typename PixelT >
std::shared_ptr< lsst::afw::image::MaskedImage< PixelT > > statisticsStack (lsst::afw::image::MaskedImage< PixelT > const &image, Property flags, char dimension, StatisticsControl const &sctrl=StatisticsControl())
 A function to compute statistics on the rows or columns of an image. More...
 
Property stringToStatisticsProperty (std::string const property)
 Conversion function to switch a string to a Property (see Statistics.h) More...
 
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...
 
std::shared_ptr< SeparableKernelmakeWarpingKernel (std::string name)
 Return a warping kernel given its name. More...
 
template<typename DestExposureT , typename SrcExposureT >
int warpExposure (DestExposureT &destExposure, SrcExposureT const &srcExposure, WarpingControl const &control, typename DestExposureT::MaskedImageT::SinglePixel padValue=lsst::afw::math::edgePixel< typename DestExposureT::MaskedImageT >(typename lsst::afw::image::detail::image_traits< typename DestExposureT::MaskedImageT >::image_category()))
 Warp (remap) one exposure to another. More...
 
template<typename DestImageT , typename SrcImageT >
int warpImage (DestImageT &destImage, geom::SkyWcs const &destWcs, SrcImageT const &srcImage, geom::SkyWcs const &srcWcs, WarpingControl const &control, typename DestImageT::SinglePixel padValue=lsst::afw::math::edgePixel< DestImageT >(typename lsst::afw::image::detail::image_traits< DestImageT >::image_category()))
 Warp an Image or MaskedImage to a new Wcs. More...
 
template<typename DestImageT , typename SrcImageT >
int warpImage (DestImageT &destImage, SrcImageT const &srcImage, geom::TransformPoint2ToPoint2 const &srcToDest, WarpingControl const &control, typename DestImageT::SinglePixel padValue=lsst::afw::math::edgePixel< DestImageT >(typename lsst::afw::image::detail::image_traits< DestImageT >::image_category()))
 A variant of warpImage that uses a Transform<Point2Endpoint, Point2Endpoint> instead of a pair of WCS to describe the transformation. More...
 
template<typename DestImageT , typename SrcImageT >
int warpCenteredImage (DestImageT &destImage, SrcImageT const &srcImage, lsst::geom::LinearTransform const &linearTransform, lsst::geom::Point2D const &centerPosition, WarpingControl const &control, typename DestImageT::SinglePixel padValue=lsst::afw::math::edgePixel< DestImageT >(typename lsst::afw::image::detail::image_traits< DestImageT >::image_category()))
 Warp an image with a LinearTranform about a specified point. More...
 
double integrateTn (int n)
 
template<typename OutImageT , typename InImageT , typename KernelT >
void convolve (OutImageT &convolvedImage, InImageT const &inImage, KernelT const &kernel, bool doNormalize, bool doCopyEdge)
 
template<typename PixelT >
std::shared_ptr< image::MaskedImage< PixelT > > statisticsStack (std::vector< std::shared_ptr< image::MaskedImage< PixelT >>> &images, Property flags, StatisticsControl const &sctrl, WeightVector const &wvector, image::MaskPixel clipped, image::MaskPixel excuse)
 
template<typename PixelT >
std::shared_ptr< image::MaskedImage< PixelT > > statisticsStack (std::vector< std::shared_ptr< image::MaskedImage< PixelT >>> &images, Property flags, StatisticsControl const &sctrl, WeightVector const &wvector, image::MaskPixel clipped, std::vector< std::pair< image::MaskPixel, image::MaskPixel >> const &maskMap)
 
template<typename PixelT >
void statisticsStack (image::MaskedImage< PixelT > &out, std::vector< std::shared_ptr< image::MaskedImage< PixelT >>> &images, Property flags, StatisticsControl const &sctrl, WeightVector const &wvector, image::MaskPixel clipped, image::MaskPixel excuse)
 
template<typename PixelT >
void statisticsStack (image::MaskedImage< PixelT > &out, std::vector< std::shared_ptr< image::MaskedImage< PixelT >>> &images, Property flags, StatisticsControl const &sctrl, WeightVector const &wvector, image::MaskPixel clipped, std::vector< std::pair< image::MaskPixel, image::MaskPixel >> const &maskMap)
 
template<typename PixelT >
std::shared_ptr< image::Image< PixelT > > statisticsStack (std::vector< std::shared_ptr< image::Image< PixelT >>> &images, Property flags, StatisticsControl const &sctrl, WeightVector const &wvector)
 
template<typename PixelT >
void statisticsStack (image::Image< PixelT > &out, std::vector< std::shared_ptr< image::Image< PixelT >>> &images, Property flags, StatisticsControl const &sctrl, WeightVector const &wvector)
 
template<typename PixelT >
std::vector< PixelT > statisticsStack (std::vector< std::vector< PixelT >> &vectors, Property flags, StatisticsControl const &sctrl, WeightVector const &wvector)
 
template<typename PixelT >
std::shared_ptr< image::MaskedImage< PixelT > > statisticsStack (image::Image< PixelT > const &image, Property flags, char dimension, StatisticsControl const &sctrl)
 A function to compute statistics on the rows or columns of an image. More...
 
template<typename PixelT >
std::shared_ptr< image::MaskedImage< PixelT > > statisticsStack (image::MaskedImage< PixelT > const &image, Property flags, char dimension, StatisticsControl const &sctrl)
 A function to compute statistics on the rows or columns of an image. More...
 

Variables

template<typename T >
constexpr bool IS_NOTHROW_INIT = noexcept(static_cast<T>(1.0))
 Test that a Function's return value is nothrow-castable to T. More...
 
double const MOCK_INF = 1.e10
 
double const DEFABSERR = 1.e-15
 
double const DEFRELERR = 1.e-6
 
generic_kernel_tag generic_kernel_tag_
 Used as default value in argument lists. More...
 
deltafunction_kernel_tag deltafunction_kernel_tag_
 Used as default value in argument lists. More...
 

Typedef Documentation

◆ KernelList

Definition at line 462 of file Kernel.h.

◆ WeightPixel

Definition at line 57 of file Statistics.h.

Enumeration Type Documentation

◆ Property

control what is calculated

Enumerator
NOTHING 

We don't want anything.

ERRORS 

Include errors of requested quantities.

NPOINT 

number of sample points

MEAN 

estimate sample mean

STDEV 

estimate sample standard deviation

VARIANCE 

estimate sample variance

MEDIAN 

estimate sample median

IQRANGE 

estimate sample inter-quartile range

MEANCLIP 

estimate sample N-sigma clipped mean (N set in StatisticsControl, default=3)

STDEVCLIP 

estimate sample N-sigma clipped stdev (N set in StatisticsControl, default=3)

VARIANCECLIP 

estimate sample N-sigma clipped variance (N set in StatisticsControl, default=3)

MIN 

estimate sample minimum

MAX 

estimate sample maximum

SUM 

find sum of pixels in the image

MEANSQUARE 

find mean value of square of pixel values

ORMASK 

get the or-mask of all pixels used.

NCLIPPED 

number of clipped points

NMASKED 

number of masked points

Definition at line 62 of file Statistics.h.

◆ UndersampleStyle

Enumerator
THROW_EXCEPTION 
REDUCE_INTERP_ORDER 
INCREASE_NXNYSAMPLE 

Definition at line 47 of file Background.h.

Function Documentation

◆ binImage() [1/2]

template<typename ImageT >
std::shared_ptr< ImageT > lsst::afw::math::binImage ( ImageT const &  inImage,
int const  binsize,
lsst::afw::math::Property const  flags = lsst::afw::math::MEAN 
)
Parameters
inImageThe image to bin
binsizeOutput pixels are binsize*binsize input pixels
flagshow to generate super-pixels

Definition at line 39 of file binImage.cc.

◆ binImage() [2/2]

template<typename ImageT >
std::shared_ptr< ImageT > lsst::afw::math::binImage ( ImageT const &  inImage,
int const  binX,
int const  binY,
lsst::afw::math::Property const  flags = lsst::afw::math::MEAN 
)
Parameters
inImageThe image to bin
binXOutput pixels are binX*binY input pixels
binYOutput pixels are binX*binY input pixels
flagshow to generate super-pixels

Definition at line 44 of file binImage.cc.

◆ convolve() [1/2]

template<typename OutImageT , typename InImageT , typename KernelT >
void lsst::afw::math::convolve ( OutImageT &  convolvedImage,
InImageT const &  inImage,
KernelT const &  kernel,
bool  doNormalize,
bool  doCopyEdge 
)

Definition at line 190 of file ConvolveImage.cc.

◆ convolve() [2/2]

template<typename OutImageT , typename InImageT , typename KernelT >
void lsst::afw::math::convolve ( OutImageT &  convolvedImage,
InImageT const &  inImage,
KernelT const &  kernel,
ConvolutionControl const &  convolutionControl = ConvolutionControl() 
)

Convolve an Image or MaskedImage with a Kernel, setting pixels of an existing output image.

Various convolution kernels are available, including:

If a kernel is spatially varying, its spatial model is computed at each pixel position on the image (pixel position, not pixel index). At present (2009-09-24) this position is computed relative to the lower left corner of the sub-image, but it will almost certainly change to be the lower left corner of the parent image.

All convolution is performed in real space. This allows convolution to handle masked pixels and spatially varying kernels. Although convolution of an Image with a spatially invariant kernel could, in fact, be performed in Fourier space, the code does not do this.

Note that mask bits are smeared by convolution; all nonzero pixels in the kernel smear the mask, even pixels that have very small values. Larger kernels smear the mask more and are also slower to convolve. Use the smallest kernel that will do the job.

convolvedImage has a border of edge pixels which cannot be computed normally. Normally these pixels are set to the standard edge pixel, as returned by edgePixel(). However, if your code cannot handle nans in the image or infs in the variance, you may set doCopyEdge true, in which case the edge pixels are set to the corresponding pixels of the input image and (if there is a mask) the mask EDGE bit is set.

The border of edge pixels has size:

  • kernel.getCtr().getX() along the left edge
  • kernel.getCtr().getY() along the bottom edge
  • kernel.getWidth() - 1 - kernel.getCtr().getX() along the right edge
  • kernel.getHeight() - 1 - kernel.getCtr().getY() along the top edge You can obtain a bounding box for the good pixels in the convolved image from a bounding box for the entire image using the Kernel method shrinkBBox.

Convolution has been optimized for the various kinds of kernels, as follows (listed approximately in order of decreasing speed):

  • DeltaFunctionKernel convolution is a simple image shift.
  • SeparableKernel convolution is performed by convolving the input by one of the two functions, then the result by the other function. Thus convolution with a kernel of size nCols x nRows becomes convolution with a kernel of size nCols x 1, followed by convolution with a kernel of size 1 x nRows.
  • Convolution with spatially invariant versions of the other kernels is performed by computing the kernel image once and convolving with that. The code has been optimized for cache performance and so should be fairly efficient.
  • Convolution with a spatially varying LinearCombinationKernel is performed by convolving the image by each basis kernel and combining the result by solving the spatial model. This will be efficient provided the kernel does not contain too many or very large basis kernels.
  • Convolution with spatially varying AnalyticKernel is likely to be slow. The code simply computes the output one pixel at a time by computing the AnalyticKernel at that point and applying it to the input image. This is not favorable for cache performance (especially for large kernels) but avoids recomputing the AnalyticKernel. It is probably possible to do better.

Additional convolution functions include:

afw/examples offers programs that time convolution including timeConvolve and timeSpatiallyVaryingConvolve.

Parameters
[out]convolvedImageconvolved image; must be the same size as inImage
[in]inImageimage to convolve
[in]kernelconvolution kernel
[in]convolutionControlconvolution control parameters
Exceptions
lsst::pex::exceptions::InvalidParameterErrorif convolvedImage is not the same size as inImage
lsst::pex::exceptions::InvalidParameterErrorif inImage is smaller than kernel in columns and/or rows.
std::bad_allocwhen allocation of memory fails

Definition at line 181 of file ConvolveImage.cc.

◆ convolveAtAPoint() [1/2]

template<typename OutImageT , typename InImageT >
OutImageT::SinglePixel lsst::afw::math::convolveAtAPoint ( typename InImageT::const_xy_locator  inImageLocator,
image::Image< Kernel::Pixel >::const_xy_locator  kernelLocator,
int  kWidth,
int  kHeight 
)
inline

Apply convolution kernel to an image at one point.

Note
This subroutine sacrifices convenience for performance. The user is expected to figure out the kernel center and adjust the supplied pixel accessors accordingly. For an example of how to do this see convolve().
Parameters
inImageLocatorlocator for image pixel that overlaps pixel (0,0) of kernel (the origin of the kernel, not its center)
kernelLocatorlocator for (0,0) pixel of kernel (the origin of the kernel, not its center)
kWidthnumber of columns in kernel
kHeightnumber of rows in kernel

Definition at line 259 of file ConvolveImage.h.

◆ convolveAtAPoint() [2/2]

template<typename OutImageT , typename InImageT >
OutImageT::SinglePixel lsst::afw::math::convolveAtAPoint ( typename InImageT::const_xy_locator  inImageLocator,
std::vector< Kernel::Pixel > const &  kernelXList,
std::vector< Kernel::Pixel > const &  kernelYList 
)
inline

Apply separable convolution kernel to an image at one point.

Note
This subroutine sacrifices convenience for performance. The user is expected to figure out the kernel center and adjust the supplied pixel accessors accordingly. For an example of how to do this see convolve().
Parameters
inImageLocatorlocator for image pixel that overlaps pixel (0,0) of kernel (the origin of the kernel, not its center)
kernelXListkernel column vector
kernelYListkernel row vector

Definition at line 295 of file ConvolveImage.h.

◆ edgePixel() [1/2]

template<typename ImageT >
ImageT::SinglePixel lsst::afw::math::edgePixel ( lsst::afw::image::detail::Image_tag  )

Return an off-the-edge pixel appropriate for a given Image type.

The value is quiet_NaN if that exists for the pixel type, else 0

Definition at line 200 of file ConvolveImage.h.

◆ edgePixel() [2/2]

template<typename MaskedImageT >
MaskedImageT::SinglePixel lsst::afw::math::edgePixel ( lsst::afw::image::detail::MaskedImage_tag  )

Return an off-the-edge pixel appropriate for a given MaskedImage type.

The components are:

  • image = quiet_NaN if that exists for the pixel type, else 0
  • mask = NO_DATA bit set
  • variance = infinity if that exists for the pixel type, else 0
Exceptions
lsst::pex::exceptions::LogicErrorThrown if the global mask plane dictionary does not have a NO_DATA bit.

Definition at line 221 of file ConvolveImage.h.

◆ flipImage()

template<typename ImageT >
std::shared_ptr< ImageT > lsst::afw::math::flipImage ( ImageT const &  inImage,
bool  flipLR,
bool  flipTB 
)

Flip an image left–right and/or top–bottom.

Parameters
inImageThe image to flip
flipLRFlip left <--> right?
flipTBFlip top <--> bottom?

Definition at line 92 of file rotateImage.cc.

◆ int1d()

template<typename UnaryFunctionT , typename Arg >
Arg lsst::afw::math::int1d ( UnaryFunctionT  func,
IntRegion< Arg > &  reg,
Arg const &  abserr = DEFABSERR,
Arg const &  relerr = DEFRELERR 
)
inline

Front end for the 1d integrator.

Definition at line 706 of file Integrate.h.

◆ integrate()

template<typename UnaryFunctionT , typename Arg >
auto lsst::afw::math::integrate ( UnaryFunctionT  func,
Arg const  a,
Arg const  b,
double  eps = 1.0e-6 
)

The 1D integrator.

Note
This simply wraps the int1d function above and handles the instantiation of the intRegion.

Definition at line 767 of file Integrate.h.

◆ integrate2d()

template<typename BinaryFunctionT , typename X , typename Y >
auto lsst::afw::math::integrate2d ( BinaryFunctionT  func,
x1,
x2,
y1,
y2,
double  eps = 1.0e-6 
)

The 2D integrator.

Definition at line 781 of file Integrate.h.

◆ integrateTn()

double lsst::afw::math::integrateTn ( int  n)

Definition at line 289 of file ChebyshevBoundedField.cc.

◆ lookupMaxInterpStyle()

Interpolate::Style lsst::afw::math::lookupMaxInterpStyle ( int const  n)

Get the highest order Interpolation::Style available for 'n' points.

Parameters
nNumber of points

Definition at line 274 of file Interpolate.cc.

◆ lookupMinInterpPoints()

int lsst::afw::math::lookupMinInterpPoints ( Interpolate::Style const  style)

Get the minimum number of points needed to use the requested interpolation style.

Parameters
styleThe style in question

Definition at line 313 of file Interpolate.cc.

◆ makeApproximate()

template<typename PixelT >
std::shared_ptr< Approximate< PixelT > > lsst::afw::math::makeApproximate ( std::vector< double > const &  x,
std::vector< double > const &  y,
image::MaskedImage< PixelT > const &  im,
lsst::geom::Box2I const &  bbox,
ApproximateControl const &  ctrl 
)

Construct a new Approximate object, inferring the type from the type of the given MaskedImage.

Parameters
xthe x-values of points
ythe y-values of points
imThe values at (x, y)
bboxRange where approximation should be valid
ctrldesired approximation algorithm

Definition at line 279 of file Approximate.cc.

◆ makeBackground()

template<typename ImageT >
std::shared_ptr<Background> lsst::afw::math::makeBackground ( ImageT const &  img,
BackgroundControl const &  bgCtrl 
)

A convenience function that uses function overloading to make the correct type of Background.

cf. std::make_pair()

Definition at line 526 of file Background.h.

◆ makeInterpolate() [1/2]

std::shared_ptr< Interpolate > lsst::afw::math::makeInterpolate ( ndarray::Array< double const, 1 > const &  x,
ndarray::Array< double const, 1 > const &  y,
Interpolate::Style const  style = Interpolate::AKIMA_SPLINE 
)

Definition at line 352 of file Interpolate.cc.

◆ makeInterpolate() [2/2]

std::shared_ptr< Interpolate > lsst::afw::math::makeInterpolate ( std::vector< double > const &  x,
std::vector< double > const &  y,
Interpolate::Style const  style = Interpolate::AKIMA_SPLINE 
)

A factory function to make Interpolate objects.

Parameters
xthe x-values of points
ythe values at x[]
styledesired interpolator
Examples
splineInterpolate.cc.

Definition at line 342 of file Interpolate.cc.

◆ makeStatistics() [1/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() 
)

Handle a straight front-end to the constructor.

Definition at line 371 of file Statistics.h.

◆ makeStatistics() [2/10]

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.

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

Definition at line 425 of file Statistics.h.

◆ makeStatistics() [3/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() 
)

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

Examples
imageStatistics.cc.

Definition at line 359 of file Statistics.h.

◆ makeStatistics() [4/10]

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

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 1104 of file Statistics.cc.

◆ makeStatistics() [5/10]

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.

Definition at line 381 of file Statistics.h.

◆ makeStatistics() [6/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() 
)

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

Definition at line 396 of file Statistics.h.

◆ makeStatistics() [7/10]

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

Parameters
mvMaskedVector
flagsDescribe what we want to calculate
sctrlControl calculation

Definition at line 508 of file Statistics.h.

◆ makeStatistics() [8/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() 
)

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

Parameters
mvMaskedVector
vweightsweights
flagsDescribe what we want to calculate
sctrlControl calculation

Definition at line 525 of file Statistics.h.

◆ makeStatistics() [9/10]

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

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 474 of file Statistics.h.

◆ makeStatistics() [10/10]

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

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

Definition at line 489 of file Statistics.h.

◆ makeWarpingKernel()

std::shared_ptr< SeparableKernel > lsst::afw::math::makeWarpingKernel ( std::string  name)

Return a warping kernel given its name.

Intended for use with warpImage() and warpExposure().

Allowed names are:

A warping kernel is a subclass of SeparableKernel with the following properties (though for the sake of speed few, if any, of these are enforced):

  • Width and height are even. This is unusual for a kernel, but it is more efficient because if the extra pixel was included it would always have value 0.
  • The center pixels should be adjacent to the kernel center. Again, this avoids extra pixels that are sure to have value 0.
  • It has two parameters: fractional x and fractional row position on the source image. The fractional position is the offset of the pixel position on the source from the center of a nearby source pixel:
    • The pixel whose center is just below or to the left of the source position: 0 <= fractional x and y < 0 and the kernel center is the default (size-1)/2.
    • The pixel whose center is just above or to the right of the source position: -1.0 < fractional x and y <= 0 and the kernel center must be set to (size+1)/2.

Definition at line 224 of file warpExposure.cc.

◆ minimize() [1/2]

template<typename ReturnT >
FitResults lsst::afw::math::minimize ( lsst::afw::math::Function1< ReturnT > const &  function,
std::vector< double > const &  initialParameterList,
std::vector< double > const &  stepSizeList,
std::vector< double > const &  measurementList,
std::vector< double > const &  varianceList,
std::vector< double > const &  xPositionList,
double  errorDef 
)

Find the minimum of a function(x)

Parameters
functionfunction(x) to be minimized
initialParameterListinitial guess for parameters
stepSizeListstep size for each parameter; use 0.0 to fix a parameter
measurementListmeasured values
varianceListvariance for each measurement
xPositionListx position of each measurement
errorDefwhat is this?
Returns
true if minimum is valid, false otherwise

Uses the Minuit fitting package with a standard definition of chiSq (see MinimizerFunctionBase1).

Exceptions
lsst::pex::exceptions::InvalidParameterErrorif any input vector is the wrong length

To do:

  • Document stepSizeList better
  • Document errorDef
  • Compute stepSize automatically? (if so, find a different way to fix parameters)

Definition at line 176 of file minimize.cc.

◆ minimize() [2/2]

template<typename ReturnT >
FitResults lsst::afw::math::minimize ( lsst::afw::math::Function2< ReturnT > const &  function,
std::vector< double > const &  initialParameterList,
std::vector< double > const &  stepSizeList,
std::vector< double > const &  measurementList,
std::vector< double > const &  varianceList,
std::vector< double > const &  xPositionList,
std::vector< double > const &  yPositionList,
double  errorDef 
)

Find the minimum of a function(x, y)

Uses the Minuit fitting package with a standard definition of chiSq. (see MinimizerFunctionBase2).

Parameters
functionfunction(x,y) to be minimized
initialParameterListinitial guess for parameters
stepSizeListstep size for each parameter; use 0.0 to fix a parameter
measurementListmeasured values
varianceListvariance for each measurement
xPositionListx position of each measurement
yPositionListy position of each measurement
errorDefwhat is this?
Returns
true if minimum is valid, false otherwise
Exceptions
lsst::pex::exceptions::InvalidParameterErrorif any input vector is the wrong length

To do:

  • Document stepSizeList better
  • Document errorDef
  • Compute stepSize automatically? (if so, find a different way to fix parameters)

Definition at line 230 of file minimize.cc.

◆ offsetImage()

template<typename ImageT >
std::shared_ptr< ImageT > lsst::afw::math::offsetImage ( ImageT const &  image,
float  dx,
float  dy,
std::string const &  algorithmName = "lanczos5",
unsigned int  buffer = 0 
)

Return an image offset by (dx, dy) using the specified algorithm.

Parameters
imageThe image to offset
dxmove the image this far in the column direction
dymove the image this far in the row direction
algorithmNameType of resampling Kernel to use
bufferWidth of buffer (border) around kernel image to allow for warping edge effects (pixels). Values < 0 are treated as 0. This is only used during computation; the final image has the same dimensions as the kernel.
Note
The image pixels are always offset by a fraction of a pixel and the image origin (XY0) picks is modified to handle the integer portion of the offset. In the special case that the offset in both x and y lies in the range (-1, 1) the origin is not changed. Otherwise the pixels are shifted by (-0.5, 0.5] pixels and the origin shifted accordingly.
Exceptions
lsst::pex::exceptions::InvalidParameterErrorif the algorithm is invalid

Definition at line 41 of file offsetImage.cc.

◆ operator*()

std::shared_ptr< BoundedField > lsst::afw::math::operator* ( double const  scale,
std::shared_ptr< BoundedField const >  bf 
)

Definition at line 254 of file BoundedField.cc.

◆ printKernel()

void lsst::afw::math::printKernel ( lsst::afw::math::Kernel const &  kernel,
bool  doNormalize,
double  x = 0,
double  y = 0,
std::string  pixelFmt = "%7.3f" 
)

Print the pixel values of a Kernel to std::cout.

Rows increase upward and columns to the right; thus the lower left pixel is (0,0).

Parameters
kernelthe kernel
doNormalizeif true, normalize kernel
xx at which to evaluate kernel
yy at which to evaluate kernel
pixelFmtformat for pixel values

Definition at line 38 of file KernelFunctions.cc.

◆ randomChisqImage()

template<typename ImageT >
void lsst::afw::math::randomChisqImage ( ImageT *  image,
Random rand,
double const  nu 
)

Set image to random numbers with a chi^2_{nu} distribution.

Parameters
[out]imageThe image to set
[in,out]randdefinition of random number algorithm, seed, etc.
[in]nunumber of degrees of freedom

Definition at line 135 of file RandomImage.cc.

◆ randomFlatImage()

template<typename ImageT >
void lsst::afw::math::randomFlatImage ( ImageT *  image,
Random rand,
double const  a,
double const  b 
)

Set image to random numbers uniformly distributed in the range [a, b)

Parameters
[out]imageThe image to set
[in,out]randdefinition of random number algorithm, seed, etc.
[in]a(inclusive) lower limit for random variates
[in]b(exclusive) upper limit for random variates

Definition at line 125 of file RandomImage.cc.

◆ randomGaussianImage()

template<typename ImageT >
void lsst::afw::math::randomGaussianImage ( ImageT *  image,
Random rand 
)

Set image to random numbers with a gaussian N(0, 1) distribution.

Parameters
[out]imageThe image to set
[in,out]randdefinition of random number algorithm, seed, etc.

Definition at line 130 of file RandomImage.cc.

◆ randomPoissonImage()

template<typename ImageT >
void lsst::afw::math::randomPoissonImage ( ImageT *  image,
Random rand,
double const  mu 
)

Set image to random numbers with a Poisson distribution with mean mu (n.b.

not per-pixel)

Parameters
[out]imageThe image to set
[in,out]randdefinition of random number algorithm, seed, etc.
[in]mumean of distribution

Definition at line 140 of file RandomImage.cc.

◆ randomUniformImage()

template<typename ImageT >
void lsst::afw::math::randomUniformImage ( ImageT *  image,
Random rand 
)

Set image to random numbers uniformly distributed in the range [0, 1)

Parameters
[out]imageThe image to set
[in,out]randdefinition of random number algorithm, seed, etc.

Definition at line 110 of file RandomImage.cc.

◆ randomUniformIntImage()

template<typename ImageT >
void lsst::afw::math::randomUniformIntImage ( ImageT *  image,
Random rand,
unsigned long  n 
)

Set image to random integers uniformly distributed in the range 0 ...

n - 1

Parameters
[out]imageThe image to set
[in,out]randdefinition of random number algorithm, seed, etc.
[in]n(exclusive) upper limit for random variates

Definition at line 120 of file RandomImage.cc.

◆ randomUniformPosImage()

template<typename ImageT >
void lsst::afw::math::randomUniformPosImage ( ImageT *  image,
Random rand 
)

Set image to random numbers uniformly distributed in the range (0, 1)

Parameters
[out]imageThe image to set
[in,out]randdefinition of random number algorithm, seed, etc.

Definition at line 115 of file RandomImage.cc.

◆ rotateImageBy90()

template<typename ImageT >
std::shared_ptr< ImageT > lsst::afw::math::rotateImageBy90 ( ImageT const &  image,
int  nQuarter 
)

Rotate an image by an integral number of quarter turns.

Parameters
imageThe image to rotate
nQuarterthe desired number of quarter turns

Definition at line 39 of file rotateImage.cc.

◆ scaledPlus()

template<typename OutImageT , typename InImageT >
void lsst::afw::math::scaledPlus ( OutImageT &  outImage,
double  c1,
InImageT const &  inImage1,
double  c2,
InImageT const &  inImage2 
)

Compute the scaled sum of two images.

outImage = c1 inImage1 + c2 inImage2

For example to linearly interpolate between two images set: c1 = 1.0 - fracDist c2 = fracDist where fracDist is the fractional distance of outImage from inImage1: location of outImage - location of inImage1 fracDist = ----------------------------------------— location of inImage2 - location of inImage1

Parameters
[out]outImageoutput image
[in]c1coefficient for image 1
[in]inImage1input image 1
[in]c2coefficient for image 2
[in]inImage2input image 2
Exceptions
lsst::pex::exceptions::InvalidParameterErrorif outImage is not same dimensions as inImage1 and inImage2.

Definition at line 153 of file ConvolveImage.cc.

◆ statisticsStack() [1/18]

template<typename PixelT >
void lsst::afw::math::statisticsStack ( image::Image< PixelT > &  out,
std::vector< std::shared_ptr< image::Image< PixelT >>> &  images,
Property  flags,
StatisticsControl const &  sctrl,
WeightVector const &  wvector 
)

Definition at line 359 of file Stack.cc.

◆ statisticsStack() [2/18]

template<typename PixelT >
std::shared_ptr<image::MaskedImage<PixelT> > lsst::afw::math::statisticsStack ( image::Image< PixelT > const &  image,
Property  flags,
char  dimension,
StatisticsControl const &  sctrl 
)

A function to compute statistics on the rows or columns of an image.

Definition at line 444 of file Stack.cc.

◆ statisticsStack() [3/18]

template<typename PixelT >
void lsst::afw::math::statisticsStack ( image::MaskedImage< PixelT > &  out,
std::vector< std::shared_ptr< image::MaskedImage< PixelT >>> &  images,
Property  flags,
StatisticsControl const &  sctrl,
WeightVector const &  wvector,
image::MaskPixel  clipped,
image::MaskPixel  excuse 
)

Definition at line 250 of file Stack.cc.

◆ statisticsStack() [4/18]

template<typename PixelT >
void lsst::afw::math::statisticsStack ( image::MaskedImage< PixelT > &  out,
std::vector< std::shared_ptr< image::MaskedImage< PixelT >>> &  images,
Property  flags,
StatisticsControl const &  sctrl,
WeightVector const &  wvector,
image::MaskPixel  clipped,
std::vector< std::pair< image::MaskPixel, image::MaskPixel >> const &  maskMap 
)

Definition at line 277 of file Stack.cc.

◆ statisticsStack() [5/18]

template<typename PixelT >
std::shared_ptr<image::MaskedImage<PixelT> > lsst::afw::math::statisticsStack ( image::MaskedImage< PixelT > const &  image,
Property  flags,
char  dimension,
StatisticsControl const &  sctrl 
)

A function to compute statistics on the rows or columns of an image.

Definition at line 487 of file Stack.cc.

◆ statisticsStack() [6/18]

template<typename PixelT >
void lsst::afw::math::statisticsStack ( lsst::afw::image::Image< PixelT > &  out,
std::vector< std::shared_ptr< lsst::afw::image::Image< PixelT >>> &  images,
Property  flags,
StatisticsControl const &  sctrl = StatisticsControl(),
std::vector< lsst::afw::image::VariancePixel > const &  wvector = std::vectorlsst::afw::image::VariancePixel >(0) 
)

@ brief compute statistical stack of Image.

Write to output image in-situ

Parameters
outOutput image
imagesImages to process
flagsstatistics requested
sctrlControl structure
wvectorvector containing weights

◆ statisticsStack() [7/18]

template<typename PixelT >
std::shared_ptr<lsst::afw::image::MaskedImage<PixelT> > lsst::afw::math::statisticsStack ( lsst::afw::image::Image< PixelT > const &  image,
Property  flags,
char  dimension,
StatisticsControl const &  sctrl = StatisticsControl() 
)

A function to compute statistics on the rows or columns of an image.

Definition at line 444 of file Stack.cc.

◆ statisticsStack() [8/18]

template<typename PixelT >
void lsst::afw::math::statisticsStack ( lsst::afw::image::MaskedImage< PixelT > &  out,
std::vector< std::shared_ptr< lsst::afw::image::MaskedImage< PixelT >>> &  images,
Property  flags,
StatisticsControl const &  sctrl,
std::vector< lsst::afw::image::VariancePixel > const &  wvector,
image::MaskPixel  clipped,
std::vector< std::pair< image::MaskPixel, image::MaskPixel >> const &  maskMap 
)

A function to compute some statistics of a stack of Masked Images.

Parameters
[out]outOutput MaskedImage.
[in]imagesMaskedImages to process.
[in]flagsStatistics requested.
[in]sctrlControl structure.
[in]wvectorVector of weights.
[in]clippedMask to set for pixels that were clipped (NOT rejected due to masks).
[in]maskMapVector of pairs of mask pixel values; any pixel on an input with any of the bits in .first will result in all of the bits in .second being set on the corresponding pixel on the output.

If none of the input images are valid for some pixel, the afwMath::StatisticsControl::getNoGoodPixelsMask() bit(s) are set.

All the work is done in the function computeMaskedImageStack.

◆ statisticsStack() [9/18]

template<typename PixelT >
void lsst::afw::math::statisticsStack ( lsst::afw::image::MaskedImage< PixelT > &  out,
std::vector< std::shared_ptr< lsst::afw::image::MaskedImage< PixelT >>> &  images,
Property  flags,
StatisticsControl const &  sctrl = StatisticsControl(),
std::vector< lsst::afw::image::VariancePixel > const &  wvector = std::vectorlsst::afw::image::VariancePixel >(0),
image::MaskPixel  clipped = 0,
image::MaskPixel  excuse = 0 
)

@ brief compute statistical stack of MaskedImage.

Write to output image in-situ

Parameters
outOutput image
imagesMaskedImages to process
flagsstatistics requested
sctrlcontrol structure
wvectorvector containing weights
clippedbitmask to set if any input was clipped or masked
excusebitmask to excuse from marking as clipped

◆ statisticsStack() [10/18]

template<typename PixelT >
std::shared_ptr<lsst::afw::image::MaskedImage<PixelT> > lsst::afw::math::statisticsStack ( lsst::afw::image::MaskedImage< PixelT > const &  image,
Property  flags,
char  dimension,
StatisticsControl const &  sctrl = StatisticsControl() 
)

A function to compute statistics on the rows or columns of an image.

Definition at line 487 of file Stack.cc.

◆ statisticsStack() [11/18]

template<typename PixelT >
std::shared_ptr<image::Image<PixelT> > lsst::afw::math::statisticsStack ( std::vector< std::shared_ptr< image::Image< PixelT >>> &  images,
Property  flags,
StatisticsControl const &  sctrl,
WeightVector const &  wvector 
)

Definition at line 347 of file Stack.cc.

◆ statisticsStack() [12/18]

template<typename PixelT >
std::shared_ptr<image::MaskedImage<PixelT> > lsst::afw::math::statisticsStack ( std::vector< std::shared_ptr< image::MaskedImage< PixelT >>> &  images,
Property  flags,
StatisticsControl const &  sctrl,
WeightVector const &  wvector,
image::MaskPixel  clipped,
image::MaskPixel  excuse 
)

Definition at line 222 of file Stack.cc.

◆ statisticsStack() [13/18]

template<typename PixelT >
std::shared_ptr<image::MaskedImage<PixelT> > lsst::afw::math::statisticsStack ( std::vector< std::shared_ptr< image::MaskedImage< PixelT >>> &  images,
Property  flags,
StatisticsControl const &  sctrl,
WeightVector const &  wvector,
image::MaskPixel  clipped,
std::vector< std::pair< image::MaskPixel, image::MaskPixel >> const &  maskMap 
)

Definition at line 236 of file Stack.cc.

◆ statisticsStack() [14/18]

template<typename PixelT >
std::shared_ptr<lsst::afw::image::Image<PixelT> > lsst::afw::math::statisticsStack ( std::vector< std::shared_ptr< lsst::afw::image::Image< PixelT >>> &  images,
Property  flags,
StatisticsControl const &  sctrl = StatisticsControl(),
std::vector< lsst::afw::image::VariancePixel > const &  wvector = std::vectorlsst::afw::image::VariancePixel >(0) 
)

A function to compute some statistics of a stack of Images.

Parameters
imagesImages to process
flagsstatistics requested
sctrlControl structure
wvectorvector containing weights

◆ statisticsStack() [15/18]

template<typename PixelT >
std::shared_ptr<lsst::afw::image::MaskedImage<PixelT> > lsst::afw::math::statisticsStack ( std::vector< std::shared_ptr< lsst::afw::image::MaskedImage< PixelT >>> &  images,
Property  flags,
StatisticsControl const &  sctrl,
std::vector< lsst::afw::image::VariancePixel > const &  wvector,
image::MaskPixel  clipped,
std::vector< std::pair< image::MaskPixel, image::MaskPixel >> const &  maskMap 
)

A function to compute some statistics of a stack of Masked Images.

Parameters
[in]imagesMaskedImages to process.
[in]flagsStatistics requested.
[in]sctrlControl structure.
[in]wvectorVector of weights.
[in]clippedMask to set for pixels that were clipped (NOT rejected due to masks).
[in]maskMapVector of pairs of mask pixel values; any pixel on an input with any of the bits in .first will result in all of the bits in .second being set on the corresponding pixel on the output.

If none of the input images are valid for some pixel, the afwMath::StatisticsControl::getNoGoodPixelsMask() bit(s) are set.

All the work is done in the function computeMaskedImageStack.

◆ statisticsStack() [16/18]

template<typename PixelT >
std::shared_ptr<lsst::afw::image::MaskedImage<PixelT> > lsst::afw::math::statisticsStack ( std::vector< std::shared_ptr< lsst::afw::image::MaskedImage< PixelT >>> &  images,
Property  flags,
StatisticsControl const &  sctrl = StatisticsControl(),
std::vector< lsst::afw::image::VariancePixel > const &  wvector = std::vectorlsst::afw::image::VariancePixel >(0),
image::MaskPixel  clipped = 0,
image::MaskPixel  excuse = 0 
)

A function to compute some statistics of a stack of Masked Images.

If none of the input images are valid for some pixel, the afwMath::StatisticsControl::getNoGoodPixelsMask() bit(s) are set.

Delegates to the more general version of statisticsStack taking a maskMap.

Parameters
imagesMaskedImages to process
flagsstatistics requested
sctrlcontrol structure
wvectorvector containing weights
clippedbitmask to set if any input was clipped or masked
excusebitmask to excuse from marking as clipped

◆ statisticsStack() [17/18]

template<typename PixelT >
std::vector<PixelT> lsst::afw::math::statisticsStack ( std::vector< std::vector< PixelT >> &  vectors,
Property  flags,
StatisticsControl const &  sctrl,
WeightVector const &  wvector 
)

Definition at line 424 of file Stack.cc.

◆ statisticsStack() [18/18]

template<typename PixelT >
std::vector<PixelT> lsst::afw::math::statisticsStack ( std::vector< std::vector< PixelT >> &  vectors,
Property  flags,
StatisticsControl const &  sctrl = StatisticsControl(),
std::vector< lsst::afw::image::VariancePixel > const &  wvector = std::vectorlsst::afw::image::VariancePixel >(0) 
)

A function to compute some statistics of a stack of std::vectors.

Parameters
vectorsVectors to process
flagsstatistics requested
sctrlcontrol structure
wvectorvector containing weights

◆ stringToInterpStyle()

Interpolate::Style lsst::afw::math::stringToInterpStyle ( std::string const &  style)

Conversion function to switch a string to an Interpolate::Style.

Parameters
styledesired type of interpolation

Definition at line 256 of file Interpolate.cc.

◆ stringToStatisticsProperty()

Property lsst::afw::math::stringToStatisticsProperty ( std::string const  property)

Conversion function to switch a string to a Property (see Statistics.h)

Definition at line 738 of file Statistics.cc.

◆ stringToUndersampleStyle()

UndersampleStyle lsst::afw::math::stringToUndersampleStyle ( std::string const &  style)

Conversion function to switch a string to an UndersampleStyle.

Definition at line 117 of file Background.cc.

◆ warpCenteredImage()

template<typename DestImageT , typename SrcImageT >
int lsst::afw::math::warpCenteredImage ( DestImageT &  destImage,
SrcImageT const &  srcImage,
lsst::geom::LinearTransform const &  linearTransform,
lsst::geom::Point2D const &  centerPosition,
WarpingControl const &  control,
typename DestImageT::SinglePixel  padValue = lsst::afw::math::edgePixel<DestImageT>(                typename lsst::afw::image::detail::image_traits<DestImageT>::image_category()) 
)

Warp an image with a LinearTranform about a specified point.

This enables warping an image of e.g. a PSF without translating the centroid.

Parameters
destImageremapped image
srcImagesource image
linearTransformlinear transformation to apply
centerPositionpixel position for location of linearTransform
controlcontrol parameters
padValueuse this value for undefined (edge) pixels

Definition at line 663 of file warpExposure.cc.

◆ warpExposure()

template<typename DestExposureT , typename SrcExposureT >
int lsst::afw::math::warpExposure ( DestExposureT &  destExposure,
SrcExposureT const &  srcExposure,
WarpingControl const &  control,
typename DestExposureT::MaskedImageT::SinglePixel  padValue = lsst::afw::math::edgePixel<typename DestExposureT::MaskedImageT>(                        typename lsst::afw::image::detail::image_traits<                                typename DestExposureT::MaskedImageT>::image_category()) 
)

Warp (remap) one exposure to another.

This is a convenience wrapper around warpImage().

Parameters
destExposureRemapped exposure. Wcs and xy0 are read, MaskedImage is set, and PhotoCalib, Filter and VisitInfo are copied from srcExposure. All other attributes are left alone (including Detector and Psf)
srcExposureSource exposure
controlcontrol parameters
padValueuse this value for undefined (edge) pixels

Definition at line 393 of file warpExposure.cc.

◆ warpImage() [1/2]

template<typename DestImageT , typename SrcImageT >
int lsst::afw::math::warpImage ( DestImageT &  destImage,
geom::SkyWcs const &  destWcs,
SrcImageT const &  srcImage,
geom::SkyWcs const &  srcWcs,
WarpingControl const &  control,
typename DestImageT::SinglePixel  padValue = lsst::afw::math::edgePixel<DestImageT>(                      typename lsst::afw::image::detail::image_traits<DestImageT>::image_category()) 
)

Warp an Image or MaskedImage to a new Wcs.

See also convenience function warpExposure() to warp an Exposure.

Edge pixels are set to padValue; these are pixels that cannot be computed because they are too near the edge of srcImage or miss srcImage entirely.

Returns
the number of valid pixels in destImage (those that are not edge pixels).

Algorithm Without Interpolation:

For each integer pixel position in the remapped Exposure:

  • The associated pixel position on srcImage is determined using the destination and source WCS
  • The warping kernel's parameters are set based on the fractional part of the pixel position on srcImage
  • The warping kernel is applied to srcImage at the integer portion of the pixel position to compute the remapped pixel value
  • A flux-conservation factor is determined from the source and destination WCS and is applied to the remapped pixel

The scaling of intensity for relative area of source and destination uses two minor approximations:

  • The area of the sky marked out by a pixel on the destination image corresponds to a parallellogram on the source image.
  • The area varies slowly enough across the image that we can get away with computing the source area shifted by half a pixel up and to the left of the true area.

Algorithm With Interpolation:

Interpolation simply reduces the number of times WCS is used to map between destination and source pixel position. This computation is only made at a grid of points on the destination image, separated by interpLen pixels along rows and columns. All other source pixel positions are determined by linear interpolation between those grid points. Everything else remains the same.

Exceptions
lsst::pex::exceptions::InvalidParameterErrorif destImage overlaps srcImage
std::bad_allocwhen allocation of CPU memory fails
Todo:
Should support an additional color-based position correction in the remapping (differential chromatic refraction). This can be done either object-by-object or pixel-by-pixel.
Todo:
Need to deal with oversampling and/or weight maps. If done we can use faster kernels than sinc.
Warning
The code that tests for image overlap is not guranteed to work correctly, based on the C++ standard. It is, in theory, possible for the code to report a "false positive", meaning that it may claim that images overlap when they do not. We don't believe that any of our current compilers have this problem. If, in the future, this becomes a problem then we will probably have to remove the test and rely on users being careful.
Parameters
destImageremapped image
destWcsWCS of remapped image
srcImagesource image
srcWcsWCS of source image
controlcontrol parameters
padValueuse this value for undefined (edge) pixels

Definition at line 438 of file warpExposure.cc.

◆ warpImage() [2/2]

template<typename DestImageT , typename SrcImageT >
int lsst::afw::math::warpImage ( DestImageT &  destImage,
SrcImageT const &  srcImage,
geom::TransformPoint2ToPoint2 const &  srcToDest,
WarpingControl const &  control,
typename DestImageT::SinglePixel  padValue = lsst::afw::math::edgePixel<DestImageT>(                      typename lsst::afw::image::detail::image_traits<DestImageT>::image_category()) 
)

A variant of warpImage that uses a Transform<Point2Endpoint, Point2Endpoint> instead of a pair of WCS to describe the transformation.

Parameters
[in,out]destImageDestination image; all pixels are set
[in]srcImageSource image
[in]srcToDestTransformation from source to destination pixels, in parent coordinates; the inverse must be defined (and is the only direction used). makeWcsPairTransform(srcWcs, destWcs) is one way to compute this transform.
[in]controlWarning control parameters
[in]padValueValue used for pixels in the destination image that are outside the region of pixels that can be computed from the source image
Returns
the number of good pixels

Definition at line 446 of file warpExposure.cc.

Variable Documentation

◆ DEFABSERR

double const lsst::afw::math::DEFABSERR = 1.e-15

Definition at line 238 of file Integrate.h.

◆ DEFRELERR

double const lsst::afw::math::DEFRELERR = 1.e-6

Definition at line 239 of file Integrate.h.

◆ deltafunction_kernel_tag_

deltafunction_kernel_tag lsst::afw::math::deltafunction_kernel_tag_

Used as default value in argument lists.

Definition at line 43 of file Kernel.cc.

◆ generic_kernel_tag_

generic_kernel_tag lsst::afw::math::generic_kernel_tag_

Used as default value in argument lists.

Definition at line 42 of file Kernel.cc.

◆ IS_NOTHROW_INIT

template<typename T >
constexpr bool lsst::afw::math::IS_NOTHROW_INIT = noexcept(static_cast<T>(1.0))
constexpr

Test that a Function's return value is nothrow-castable to T.

std::complex is an example of a numeric type that does not satisfy this requirement.

Definition at line 51 of file Function.h.

◆ MOCK_INF

double const lsst::afw::math::MOCK_INF = 1.e10

Definition at line 137 of file Integrate.h.