LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
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
 
using PyClass = py::class_< PixelAreaBoundedField, std::shared_ptr< PixelAreaBoundedField >, BoundedField >
 
using ClsField = py::class_< TransformBoundedField, std::shared_ptr< TransformBoundedField >, BoundedField >
 

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...
 
void wrapApproximate (lsst::utils::python::WrapperCollection &wrappers)
 
void declareBackground (lsst::utils::python::WrapperCollection &wrappers)
 
void wrapBackground (lsst::utils::python::WrapperCollection &wrappers)
 
void declareBoundedField (lsst::utils::python::WrapperCollection &wrappers)
 
void wrapBoundedField (lsst::utils::python::WrapperCollection &wrappers)
 
void wrapChebyshevBoundedField (lsst::utils::python::WrapperCollection &wrappers)
 
void wrapConvolveImage (lsst::utils::python::WrapperCollection &wrappers)
 
void wrapFunction (lsst::utils::python::WrapperCollection &wrappers)
 
template<typename ReturnT >
void declarePolynomialFunctions (lsst::utils::python::WrapperCollection &wrappers, const std::string &suffix)
 
template<typename ReturnT >
void declareChebyshevFunctions (lsst::utils::python::WrapperCollection &wrappers, const std::string &suffix)
 
template<typename ReturnT >
void declareGaussianFunctions (lsst::utils::python::WrapperCollection &wrappers, const std::string &suffix)
 
template<typename ReturnT >
void declareIntegerDeltaFunctions (lsst::utils::python::WrapperCollection &wrappers, const std::string &suffix)
 
template<typename ReturnT >
void declareLanczosFunctions (lsst::utils::python::WrapperCollection &wrappers, const std::string &suffix)
 
void wrapFunctionLibrary (lsst::utils::python::WrapperCollection &wrappers)
 
void wrapGaussianProcess (lsst::utils::python::WrapperCollection &wrappers)
 
void wrapInterpolate (lsst::utils::python::WrapperCollection &wrappers)
 
void wrapKernel (lsst::utils::python::WrapperCollection &wrappers)
 
void wrapLeastSquares (lsst::utils::python::WrapperCollection &wrappers)
 
void wrapMinimize (lsst::utils::python::WrapperCollection &)
 
void wrapOffsetImage (lsst::utils::python::WrapperCollection &)
 
void wrapPixelAreaBoundedField (lsst::utils::python::WrapperCollection &)
 
void wrapProductBoundedField (lsst::utils::python::WrapperCollection &)
 
void wrapRandom (lsst::utils::python::WrapperCollection &)
 
void wrapSpatialCell (lsst::utils::python::WrapperCollection &)
 
void wrapStack (lsst::utils::python::WrapperCollection &)
 
void wrapStatistics (lsst::utils::python::WrapperCollection &)
 
void wrapTransformBoundedField (lsst::utils::python::WrapperCollection &)
 
void wrapWarpExposure (lsst::utils::python::WrapperCollection &)
 
 PYBIND11_MODULE (_math, mod)
 
template<typename ImageT >
void declareRandomImage (lsst::utils::python::WrapperCollection &wrappers)
 
void declareRandom (lsst::utils::python::WrapperCollection &wrappers)
 
template<typename Pixel >
void declareStatistics (lsst::utils::python::WrapperCollection &wrappers)
 
template<typename Pixel >
void declareStatisticsVectorOverloads (lsst::utils::python::WrapperCollection &wrappers)
 
void declareTransformBoundedField (lsst::utils::python::WrapperCollection &wrappers)
 
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

◆ ClsField

Definition at line 42 of file _transformBoundedField.cc.

◆ KernelList

Definition at line 462 of file Kernel.h.

◆ PyClass

Definition at line 35 of file _pixelAreaBoundedField.cc.

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

62  {
63  NOTHING = 0x0,
64  ERRORS = 0x1,
65  NPOINT = 0x2,
66  MEAN = 0x4,
67  STDEV = 0x8,
68  VARIANCE = 0x10,
69  MEDIAN = 0x20,
70  IQRANGE = 0x40,
71  MEANCLIP = 0x80,
72  STDEVCLIP = 0x100,
73  VARIANCECLIP = 0x200,
75  MIN = 0x400,
76  MAX = 0x800,
77  SUM = 0x1000,
78  MEANSQUARE = 0x2000,
79  ORMASK = 0x4000,
80  NCLIPPED = 0x8000,
81  NMASKED = 0x10000
82 };
@ ORMASK
get the or-mask of all pixels used.
Definition: Statistics.h:79
@ ERRORS
Include errors of requested quantities.
Definition: Statistics.h:64
@ VARIANCECLIP
estimate sample N-sigma clipped variance (N set in StatisticsControl, default=3)
Definition: Statistics.h:73
@ MEANSQUARE
find mean value of square of pixel values
Definition: Statistics.h:78
@ MIN
estimate sample minimum
Definition: Statistics.h:75
@ NCLIPPED
number of clipped points
Definition: Statistics.h:80
@ NOTHING
We don't want anything.
Definition: Statistics.h:63
@ STDEV
estimate sample standard deviation
Definition: Statistics.h:67
@ NMASKED
number of masked points
Definition: Statistics.h:81
@ STDEVCLIP
estimate sample N-sigma clipped stdev (N set in StatisticsControl, default=3)
Definition: Statistics.h:72
@ VARIANCE
estimate sample variance
Definition: Statistics.h:68
@ MEDIAN
estimate sample median
Definition: Statistics.h:69
@ MAX
estimate sample maximum
Definition: Statistics.h:76
@ SUM
find sum of pixels in the image
Definition: Statistics.h:77
@ IQRANGE
estimate sample inter-quartile range
Definition: Statistics.h:70
@ MEAN
estimate sample mean
Definition: Statistics.h:66
@ MEANCLIP
estimate sample N-sigma clipped mean (N set in StatisticsControl, default=3)
Definition: Statistics.h:71
@ NPOINT
number of sample points
Definition: Statistics.h:65

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

39  {
40  return binImage(in, binsize, binsize, flags);
41 }
std::shared_ptr< ImageT > binImage(ImageT const &inImage, int const binX, int const binY, lsst::afw::math::Property const flags=lsst::afw::math::MEAN)
Definition: binImage.cc:44

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

45  {
46  if (flags != lsst::afw::math::MEAN) {
48  (boost::format("Only afwMath::MEAN is supported, saw 0x%x") % flags).str());
49  }
50  if (binX <= 0 || binY <= 0) {
52  (boost::format("Binning must be >= 0, saw %dx%d") % binX % binY).str());
53  }
54 
55  int const outWidth = in.getWidth() / binX;
56  int const outHeight = in.getHeight() / binY;
57 
59  std::shared_ptr<ImageT>(new ImageT(lsst::geom::Extent2I(outWidth, outHeight)));
60  out->setXY0(in.getXY0());
61  *out = typename ImageT::SinglePixel(0);
62 
63  for (int oy = 0, iy = 0; oy < out->getHeight(); ++oy) {
64  for (int i = 0; i != binY; ++i, ++iy) {
65  typename ImageT::x_iterator optr = out->row_begin(oy);
66  for (typename ImageT::x_iterator iptr = in.row_begin(iy), iend = iptr + binX * outWidth;
67  iptr < iend;) {
68  typename ImageT::SinglePixel val = *iptr;
69  ++iptr;
70  for (int j = 1; j != binX; ++j, ++iptr) {
71  val += *iptr;
72  }
73  *optr += val;
74  ++optr;
75  }
76  }
77  for (typename ImageT::x_iterator ptr = out->row_begin(oy), end = out->row_end(oy); ptr != end;
78  ++ptr) {
79  *ptr /= binX * binY;
80  }
81  }
82 
83  return out;
84 }
int end
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
uint64_t * ptr
Definition: RangeSet.cc:88
Reports arguments outside the domain of an operation.
Definition: Runtime.h:57
Reports invalid arguments.
Definition: Runtime.h:66
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174
ImageT val
Definition: CR.cc:146

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

191  {
192  ConvolutionControl convolutionControl;
193  convolutionControl.setDoNormalize(doNormalize);
194  convolutionControl.setDoCopyEdge(doCopyEdge);
195  convolve(convolvedImage, inImage, kernel, convolutionControl);
196 }
void convolve(OutImageT &convolvedImage, InImageT const &inImage, KernelT const &kernel, bool doNormalize, bool doCopyEdge)

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

182  {
183  detail::basicConvolve(convolvedImage, inImage, kernel, convolutionControl);
184  setEdgePixels(convolvedImage, kernel, inImage, convolutionControl.getDoCopyEdge(),
185  typename image::detail::image_traits<OutImageT>::image_category());
186  convolvedImage.setXY0(inImage.getXY0());
187 }
void basicConvolve(OutImageT &convolvedImage, InImageT const &inImage, lsst::afw::math::Kernel const &kernel, lsst::afw::math::ConvolutionControl const &convolutionControl)
Low-level convolution function that does not set edge pixels.

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

261  {
262  typename OutImageT::SinglePixel outValue = 0;
263  for (int kRow = 0; kRow != kHeight; ++kRow) {
265  kEnd = kernelLocator + image::detail::difference_type(kWidth, 0);
266  kernelLocator != kEnd; ++inImageLocator.x(), ++kernelLocator.x()) {
267  typename Kernel::Pixel const kVal = kernelLocator[0];
268  if (kVal != 0) {
269  outValue += *inImageLocator * kVal;
270  }
271  }
272 
273  inImageLocator += image::detail::difference_type(-kWidth, 1);
274  kernelLocator += image::detail::difference_type(-kWidth, 1);
275  }
276 
277  return outValue;
278 }
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:51
float Pixel
Typedefs to be used for pixel values.
Definition: common.h:37

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

297  {
298  using k_iter = typename std::vector<Kernel::Pixel>::const_iterator;
299 
300  using OutT = typename OutImageT::SinglePixel;
301  OutT outValue = 0;
302  for (double kValY : kernelYList) {
303  OutT outValueY = 0;
304  for (k_iter kernelXIter = kernelXList.begin(), xEnd = kernelXList.end(); kernelXIter != xEnd;
305  ++kernelXIter, ++inImageLocator.x()) {
306  typename Kernel::Pixel const kValX = *kernelXIter;
307  if (kValX != 0) {
308  outValueY += *inImageLocator * kValX;
309  }
310  }
311 
312  if (kValY != 0) {
313  outValue += outValueY * kValY;
314  }
315 
316  inImageLocator += image::detail::difference_type(-kernelXList.size(), 1);
317  }
318 
319  return outValue;
320 }
T begin(T... args)
T end(T... args)
T size(T... args)

◆ declareBackground()

void lsst::afw::math::declareBackground ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 73 of file _background.cc.

73  {
74  /* Member types and enums */
75  wrappers.wrapType(py::enum_<UndersampleStyle>(wrappers.module, "UndersampleStyle"),
76  [](auto &mod, auto &enm) {
77  enm.value("THROW_EXCEPTION", UndersampleStyle::THROW_EXCEPTION);
78  enm.value("REDUCE_INTERP_ORDER", UndersampleStyle::REDUCE_INTERP_ORDER);
79  enm.value("INCREASE_NXNYSAMPLE", UndersampleStyle::INCREASE_NXNYSAMPLE);
80  enm.export_values();
81  });
82 
83  using PyBackgroundControl = py::class_<BackgroundControl, std::shared_ptr<BackgroundControl>>;
84  wrappers.wrapType(PyBackgroundControl(wrappers.module, "BackgroundControl"), [](auto &mod, auto &cls) {
85  /* Constructors */
86  cls.def(py::init<int const, int const, StatisticsControl const, Property const,
87  ApproximateControl const>(),
88  "nxSample"_a, "nySample"_a, "sctrl"_a = StatisticsControl(), "prop"_a = MEANCLIP,
89  "actrl"_a = ApproximateControl(ApproximateControl::UNKNOWN, 1));
90  cls.def(py::init<int const, int const, StatisticsControl const, std::string const &,
91  ApproximateControl const>(),
92  "nxSample"_a, "nySample"_a, "sctrl"_a, "prop"_a,
93  "actrl"_a = ApproximateControl(ApproximateControl::UNKNOWN, 1));
94  cls.def(py::init<Interpolate::Style const, int const, int const, UndersampleStyle const,
95  StatisticsControl const, Property const, ApproximateControl const>(),
96  "style"_a, "nxSample"_a = 10, "nySample"_a = 10, "undersampleStyle"_a = THROW_EXCEPTION,
97  "sctrl"_a = StatisticsControl(), "prop"_a = MEANCLIP,
98  "actrl"_a = ApproximateControl(ApproximateControl::UNKNOWN, 1));
99  cls.def(py::init<std::string const &, int const, int const, std::string const &,
100  StatisticsControl const, std::string const &, ApproximateControl const>(),
101  "style"_a, "nxSample"_a = 10, "nySample"_a = 10, "undersampleStyle"_a = "THROW_EXCEPTION",
102  "sctrl"_a = StatisticsControl(), "prop"_a = "MEANCLIP",
103  "actrl"_a = ApproximateControl(ApproximateControl::UNKNOWN, 1));
104 
105  /* Members */
106  cls.def("setNxSample", &BackgroundControl::setNxSample);
107  cls.def("setNySample", &BackgroundControl::setNySample);
108  cls.def("setInterpStyle",
109  (void (BackgroundControl::*)(Interpolate::Style const)) & BackgroundControl::setInterpStyle);
110  cls.def("setInterpStyle",
111  (void (BackgroundControl::*)(std::string const &)) & BackgroundControl::setInterpStyle);
112  cls.def("setUndersampleStyle", (void (BackgroundControl::*)(UndersampleStyle const)) &
113  BackgroundControl::setUndersampleStyle);
114  cls.def("setUndersampleStyle",
115  (void (BackgroundControl::*)(std::string const &)) & BackgroundControl::setUndersampleStyle);
116  cls.def("getNxSample", &BackgroundControl::getNxSample);
117  cls.def("getNySample", &BackgroundControl::getNySample);
118  cls.def("getInterpStyle", &BackgroundControl::getInterpStyle);
119  cls.def("getUndersampleStyle", &BackgroundControl::getUndersampleStyle);
120  cls.def("getStatisticsControl", (std::shared_ptr<StatisticsControl>(BackgroundControl::*)()) &
121  BackgroundControl::getStatisticsControl);
122  cls.def("getStatisticsProperty", &BackgroundControl::getStatisticsProperty);
123  cls.def("setStatisticsProperty",
124  (void (BackgroundControl::*)(Property)) & BackgroundControl::setStatisticsProperty);
125  cls.def("setStatisticsProperty",
126  (void (BackgroundControl::*)(std::string)) & BackgroundControl::setStatisticsProperty);
127  cls.def("setApproximateControl", &BackgroundControl::setApproximateControl);
128  cls.def("getApproximateControl", (std::shared_ptr<ApproximateControl>(BackgroundControl::*)()) &
129  BackgroundControl::getApproximateControl);
130  });
131  using PyBackground = py::class_<Background, std::shared_ptr<Background>>;
132  wrappers.wrapType(PyBackground(wrappers.module, "Background"), [](auto &mod, auto &cls) {
133  /* Members */
134  declareGetImage<float>(cls, "F");
135 
136  cls.def("getAsUsedInterpStyle", &Background::getAsUsedInterpStyle);
137  cls.def("getAsUsedUndersampleStyle", &Background::getAsUsedUndersampleStyle);
138  cls.def("getApproximate", &Background::getApproximate, "actrl"_a,
139  "undersampleStyle"_a = THROW_EXCEPTION);
140  cls.def("getBackgroundControl",
141  (std::shared_ptr<BackgroundControl>(Background::*)()) & Background::getBackgroundControl);
142  });
143 
144  using PyBackgroundMI = py::class_<BackgroundMI, std::shared_ptr<BackgroundMI>, Background>;
145  wrappers.wrapType(PyBackgroundMI(wrappers.module, "BackgroundMI"), [](auto &mod, auto &cls) {
146  /* Constructors */
147  cls.def(py::init<lsst::geom::Box2I const,
148  image::MaskedImage<typename Background::InternalPixelT> const &>(),
149  "imageDimensions"_a, "statsImage"_a);
150 
151  /* Operators */
152  cls.def("__iadd__", &BackgroundMI::operator+=);
153  cls.def("__isub__", &BackgroundMI::operator-=);
154 
155  /* Members */
156  cls.def("getStatsImage", &BackgroundMI::getStatsImage);
157  cls.def("getImageBBox", &BackgroundMI::getImageBBox);
158 
159  // Yes, really only float
160  });
161 }

◆ declareBoundedField()

void lsst::afw::math::declareBoundedField ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 62 of file _boundedField.cc.

62  {
63  wrappers.wrapType(PyClass(wrappers.module, "BoundedField"), [](auto &mod, auto &cls) {
64  table::io::python::addPersistableMethods<BoundedField>(cls);
65 
66  cls.def(
67  "__rmul__", [](BoundedField &bf, double const scale) { return bf * scale; },
68  py::is_operator());
69  cls.def("__mul__", &BoundedField::operator*, py::is_operator());
70  cls.def("__truediv__", &BoundedField::operator/, py::is_operator());
71  cls.def("__eq__", &BoundedField::operator==, py::is_operator());
72  cls.def("__ne__", &BoundedField::operator!=, py::is_operator());
73 
74  cls.def("evaluate", (double (BoundedField::*)(double, double) const) & BoundedField::evaluate);
75  cls.def("evaluate", (ndarray::Array<double, 1, 1>(BoundedField::*)(
76  ndarray::Array<double const, 1> const &,
77  ndarray::Array<double const, 1> const &) const) &
78  BoundedField::evaluate);
79  cls.def("evaluate",
80  (double (BoundedField::*)(lsst::geom::Point2D const &) const) & BoundedField::evaluate);
81  cls.def("integrate", &BoundedField::integrate);
82  cls.def("mean", &BoundedField::mean);
83  cls.def("getBBox", &BoundedField::getBBox);
84 
85  // Pybind11 resolves overloads by picking the first one that might work
86  declareTemplates<double>(cls);
87  declareTemplates<float>(cls);
88 
89  utils::python::addOutputOp(cls, "__str__");
90  cls.def("__repr__", [](BoundedField const &self) {
92  os << "BoundedField(" << self << ")";
93  return os.str();
94  });
95  });
96 }
std::ostream * os
Definition: Schema.cc:557
An abstract base class for 2-d functions defined on an integer bounding boxes.
Definition: BoundedField.h:55
auto integrate(UnaryFunctionT func, Arg const a, Arg const b, double eps=1.0e-6)
The 1D integrator.
Definition: Integrate.h:767
py::class_< PixelAreaBoundedField, std::shared_ptr< PixelAreaBoundedField >, BoundedField > PyClass
void addOutputOp(PyClass &cls, std::string const &method)
Add __str__ or __repr__ method implemented by operator<<.
Definition: python.h:87

◆ declareChebyshevFunctions()

template<typename ReturnT >
void lsst::afw::math::declareChebyshevFunctions ( lsst::utils::python::WrapperCollection &  wrappers,
const std::string suffix 
)

Definition at line 79 of file _functionLibrary.cc.

79  {
80  /* Chebyshev1Function1 */
81 
82  wrappers.wrapType(
83  py::class_<Chebyshev1Function1<ReturnT>, std::shared_ptr<Chebyshev1Function1<ReturnT>>,
84  Function1<ReturnT>>(wrappers.module, ("Chebyshev1Function1" + suffix).c_str()),
85  [](auto &mod, auto &cls) {
86  cls.def(py::init<std::vector<double>, double, double>(), "params"_a, "minX"_a = -1,
87  "maxX"_a = 1);
88  cls.def(py::init<unsigned int, double, double>(), "order"_a, "minX"_a = -1, "maxX"_a = 1);
89 
90  cls.def("__call__", &Chebyshev1Function1<ReturnT>::operator(), "x"_a);
91  cls.def("clone", &Chebyshev1Function1<ReturnT>::clone);
92  cls.def("getMinX", &Chebyshev1Function1<ReturnT>::getMinX);
93  cls.def("getMaxX", &Chebyshev1Function1<ReturnT>::getMaxX);
94  cls.def("getOrder", &Chebyshev1Function1<ReturnT>::getOrder);
95  cls.def("isLinearCombination", &Chebyshev1Function1<ReturnT>::isLinearCombination);
96  cls.def("toString", &Chebyshev1Function1<ReturnT>::toString, "prefix"_a = "");
97 
98  /* Chebyshev1Function2 */
99  });
100  wrappers.wrapType(py::class_<Chebyshev1Function2<ReturnT>, std::shared_ptr<Chebyshev1Function2<ReturnT>>,
101  BasePolynomialFunction2<ReturnT>>(wrappers.module,
102  ("Chebyshev1Function2" + suffix).c_str()),
103  [](auto &mod, auto &cls) {
104  cls.def(py::init<std::vector<double>, lsst::geom::Box2D const &>(), "params"_a,
105  "xyRange"_a = lsst::geom::Box2D(lsst::geom::Point2D(-1.0, -1.0),
106  lsst::geom::Point2D(1.0, 1.0)));
107  cls.def(py::init<unsigned int, lsst::geom::Box2D const &>(), "order"_a,
108  "xyRange"_a = lsst::geom::Box2D(lsst::geom::Point2D(-1.0, -1.0),
109  lsst::geom::Point2D(1.0, 1.0)));
110 
111  cls.def("__call__", &Chebyshev1Function2<ReturnT>::operator(), "x"_a, "y"_a);
112  cls.def("clone", &Chebyshev1Function2<ReturnT>::clone);
113  cls.def("getXYRange", &Chebyshev1Function2<ReturnT>::getXYRange);
114  cls.def("truncate", &Chebyshev1Function2<ReturnT>::truncate, "order"_a);
115  cls.def("toString", &Chebyshev1Function2<ReturnT>::toString, "prefix"_a = "");
116  cls.def("isPersistable", &Chebyshev1Function2<ReturnT>::isPersistable);
117  });
118 };

◆ declareGaussianFunctions()

template<typename ReturnT >
void lsst::afw::math::declareGaussianFunctions ( lsst::utils::python::WrapperCollection &  wrappers,
const std::string suffix 
)

Definition at line 121 of file _functionLibrary.cc.

121  {
122  /* GaussianFunction1 */
123  wrappers.wrapType(py::class_<GaussianFunction1<ReturnT>, std::shared_ptr<GaussianFunction1<ReturnT>>,
124  Function1<ReturnT>>(wrappers.module, ("GaussianFunction1" + suffix).c_str()),
125  [](auto &mod, auto &cls) {
126  cls.def(py::init<double>(), "sigma"_a);
127 
128  cls.def("__call__", &GaussianFunction1<ReturnT>::operator(), "x"_a);
129  cls.def("clone", &GaussianFunction1<ReturnT>::clone);
130  cls.def("toString", &GaussianFunction1<ReturnT>::toString, "prefix"_a = "");
131  });
132 
133  wrappers.wrapType(py::class_<GaussianFunction2<ReturnT>, std::shared_ptr<GaussianFunction2<ReturnT>>,
134  Function2<ReturnT>>(wrappers.module, ("GaussianFunction2" + suffix).c_str()),
135  [](auto &mod, auto &cls) {
136  /* GaussianFunction2 */
137 
138  cls.def(py::init<double, double, double>(), "sigma1"_a, "sigma2"_a,
139  "angle"_a = 0.0);
140 
141  cls.def("__call__", &GaussianFunction2<ReturnT>::operator(), "x"_a, "y"_a);
142  cls.def("clone", &GaussianFunction2<ReturnT>::clone);
143  cls.def("toString", &GaussianFunction2<ReturnT>::toString, "prefix"_a = "");
144  cls.def("isPersistable", &GaussianFunction2<ReturnT>::isPersistable);
145  });
146  /* DoubleGaussianFunction2 */
147 
148  wrappers.wrapType(
149  py::class_<DoubleGaussianFunction2<ReturnT>, std::shared_ptr<DoubleGaussianFunction2<ReturnT>>,
150  Function2<ReturnT>>(wrappers.module, ("DoubleGaussianFunction2" + suffix).c_str()),
151  [](auto &mod, auto &cls) {
152  cls.def(py::init<double, double, double>(), "sigma1"_a, "sigma2"_a = 0, "ampl"_a = 0);
153 
154  cls.def("__call__", &DoubleGaussianFunction2<ReturnT>::operator(), "x"_a, "y"_a);
155  cls.def("clone", &DoubleGaussianFunction2<ReturnT>::clone);
156  cls.def("toString", &DoubleGaussianFunction2<ReturnT>::toString, "prefix"_a = "");
157  cls.def("isPersistable", &DoubleGaussianFunction2<ReturnT>::isPersistable);
158  });
159 };

◆ declareIntegerDeltaFunctions()

template<typename ReturnT >
void lsst::afw::math::declareIntegerDeltaFunctions ( lsst::utils::python::WrapperCollection &  wrappers,
const std::string suffix 
)

Definition at line 162 of file _functionLibrary.cc.

163  {
164  /* IntegerDeltaFunction1 */
165 
166  wrappers.wrapType(
167  py::class_<IntegerDeltaFunction1<ReturnT>, std::shared_ptr<IntegerDeltaFunction1<ReturnT>>,
168  Function1<ReturnT>>(wrappers.module, ("IntegerDeltaFunction1" + suffix).c_str()),
169  [](auto &mod, auto &cls) {
170  cls.def(py::init<double>(), "xo"_a);
171 
172  cls.def("__call__", &IntegerDeltaFunction1<ReturnT>::operator(), "x"_a);
173  cls.def("clone", &IntegerDeltaFunction1<ReturnT>::clone);
174  cls.def("toString", &IntegerDeltaFunction1<ReturnT>::toString, "prefix"_a = "");
175  });
176  /* IntegerDeltaFunction2 */
177 
178  wrappers.wrapType(
179  py::class_<IntegerDeltaFunction2<ReturnT>, std::shared_ptr<IntegerDeltaFunction2<ReturnT>>,
180  Function2<ReturnT>>(wrappers.module, ("IntegerDeltaFunction2" + suffix).c_str()),
181  [](auto &mod, auto &cls) {
182  cls.def(py::init<double, double>(), "xo"_a, "yo"_a);
183 
184  cls.def("__call__", &IntegerDeltaFunction2<ReturnT>::operator(), "x"_a, "y"_a);
185  cls.def("clone", &IntegerDeltaFunction2<ReturnT>::clone);
186  cls.def("toString", &IntegerDeltaFunction2<ReturnT>::toString, "prefix"_a = "");
187  });
188 };

◆ declareLanczosFunctions()

template<typename ReturnT >
void lsst::afw::math::declareLanczosFunctions ( lsst::utils::python::WrapperCollection &  wrappers,
const std::string suffix 
)

Definition at line 191 of file _functionLibrary.cc.

191  {
192  /* LanczosFunction1 */
193 
194  wrappers.wrapType(py::class_<LanczosFunction1<ReturnT>, std::shared_ptr<LanczosFunction1<ReturnT>>,
195  Function1<ReturnT>>(wrappers.module, ("LanczosFunction1" + suffix).c_str()),
196  [](auto &mod, auto &cls) {
197  cls.def(py::init<unsigned int, double>(), "n"_a, "xOffset"_a = 0.0);
198 
199  cls.def("__call__", &LanczosFunction1<ReturnT>::operator(), "x"_a);
200  cls.def("clone", &LanczosFunction1<ReturnT>::clone);
201  cls.def("getOrder", &LanczosFunction1<ReturnT>::getOrder);
202  cls.def("toString", &LanczosFunction1<ReturnT>::toString, "prefix"_a = "");
203  });
204  /* LanczosFunction2 */
205 
206  wrappers.wrapType(py::class_<LanczosFunction2<ReturnT>, std::shared_ptr<LanczosFunction2<ReturnT>>,
207  Function2<ReturnT>>(wrappers.module, ("LanczosFunction2" + suffix).c_str()),
208  [](auto &mod, auto &cls) {
209  /* LanczosFunction2 */
210  cls.def(py::init<unsigned int, double, double>(), "n"_a, "xOffset"_a = 0.0,
211  "yOffset"_a = 0.0);
212 
213  cls.def("__call__", &LanczosFunction2<ReturnT>::operator(), "x"_a, "y"_a);
214  cls.def("clone", &LanczosFunction2<ReturnT>::clone);
215  cls.def("getOrder", &LanczosFunction2<ReturnT>::getOrder);
216  cls.def("toString", &LanczosFunction2<ReturnT>::toString, "prefix"_a = "");
217  });
218 };

◆ declarePolynomialFunctions()

template<typename ReturnT >
void lsst::afw::math::declarePolynomialFunctions ( lsst::utils::python::WrapperCollection &  wrappers,
const std::string suffix 
)

Definition at line 45 of file _functionLibrary.cc.

45  {
46  /* PolynomialFunction1 */
47 
48  wrappers.wrapType(
49  py::class_<PolynomialFunction1<ReturnT>, std::shared_ptr<PolynomialFunction1<ReturnT>>,
50  Function1<ReturnT>>(wrappers.module, ("PolynomialFunction1" + suffix).c_str()),
51  [](auto &mod, auto &cls) {
52  cls.def(py::init<std::vector<double> const &>(), "params"_a);
53  cls.def(py::init<unsigned int>(), "order"_a);
54 
55  cls.def("__call__", &PolynomialFunction1<ReturnT>::operator(), "x"_a);
56  cls.def("clone", &PolynomialFunction1<ReturnT>::clone);
57  cls.def("isLinearCombination", &PolynomialFunction1<ReturnT>::isLinearCombination);
58  cls.def("getOrder", &PolynomialFunction1<ReturnT>::getOrder);
59  cls.def("toString", &PolynomialFunction1<ReturnT>::toString, "prefix"_a = "");
60  });
61  /* PolynomialFunction2 */
62  wrappers.wrapType(py::class_<PolynomialFunction2<ReturnT>, std::shared_ptr<PolynomialFunction2<ReturnT>>,
63  BasePolynomialFunction2<ReturnT>>(wrappers.module,
64  ("PolynomialFunction2" + suffix).c_str()),
65  [](auto &mod, auto &cls) {
66  cls.def(py::init<std::vector<double> const &>(), "params"_a);
67  cls.def(py::init<unsigned int>(), "order"_a);
68 
69  cls.def("__call__", &PolynomialFunction2<ReturnT>::operator(), "x"_a, "y"_a);
70  cls.def("clone", &PolynomialFunction2<ReturnT>::clone);
71  cls.def("getOrder", &PolynomialFunction2<ReturnT>::getOrder);
72  cls.def("getDFuncDParameters", &PolynomialFunction2<ReturnT>::getDFuncDParameters);
73  cls.def("toString", &PolynomialFunction2<ReturnT>::toString, "prefix"_a = "");
74  cls.def("isPersistable", &PolynomialFunction2<ReturnT>::isPersistable);
75  });
76 };

◆ declareRandom()

void lsst::afw::math::declareRandom ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 52 of file _random.cc.

52  {
53  auto clsRandom = wrappers.wrapType(py::class_<Random>(wrappers.module, "Random"), [](auto &mod,
54  auto &cls) {
55  /* Constructors */
56  cls.def(py::init<Random::Algorithm, unsigned long>(), "algorithm"_a = Random::Algorithm::MT19937,
57  "seed"_a = 1);
58  cls.def(py::init<std::string const &, unsigned long>(), "algorithm"_a, "seed"_a = 1);
59 
60  /* Members */
61  cls.def("deepCopy", &Random::deepCopy);
62  cls.def("getAlgorithm", &Random::getAlgorithm);
63  cls.def("getAlgorithmName", &Random::getAlgorithmName);
64  cls.def_static("getAlgorithmNames", &Random::getAlgorithmNames);
65  cls.def("getSeed", &Random::getSeed);
66  cls.def("uniform", &Random::uniform);
67  cls.def("uniformPos", &Random::uniformPos);
68  cls.def("uniformInt", &Random::uniformInt);
69  cls.def("flat", &Random::flat);
70  cls.def("gaussian", &Random::gaussian);
71  cls.def("chisq", &Random::chisq);
72  cls.def("poisson", &Random::poisson);
73 
74  // getState and setState are special, their std::string cannot
75  // be converted to a Python string (needs to go to bytes instead)
76  // thus use the same solution as employed with Swig
77  cls.def("getState", [](Random &self) -> py::object {
78  std::string state = self.getState();
79  return py::reinterpret_steal<py::object>(PyBytes_FromStringAndSize(state.data(), state.size()));
80  });
81  cls.def("setState", [](Random &self, py::bytes const &state) { self.setState(state); });
82  });
83  /* Member types and enums */
84  wrappers.wrapType(py::enum_<Random::Algorithm>(clsRandom, "Algorithm"), [](auto &mod, auto &enm) {
85  enm.value("MT19937", Random::Algorithm::MT19937);
86  enm.value("RANLXS0", Random::Algorithm::RANLXS0);
87  enm.value("RANLXS1", Random::Algorithm::RANLXS1);
88  enm.value("RANLXS2", Random::Algorithm::RANLXS2);
89  enm.value("RANLXD1", Random::Algorithm::RANLXD1);
90  enm.value("RANLXD2", Random::Algorithm::RANLXD2);
91  enm.value("RANLUX", Random::Algorithm::RANLUX);
92  enm.value("RANLUX389", Random::Algorithm::RANLUX389);
93  enm.value("CMRG", Random::Algorithm::CMRG);
94  enm.value("MRG", Random::Algorithm::MRG);
95  enm.value("TAUS", Random::Algorithm::TAUS);
96  enm.value("TAUS2", Random::Algorithm::TAUS2);
97  enm.value("GFSR4", Random::Algorithm::GFSR4);
98  enm.value("NUM_ALGORITHMS", Random::Algorithm::NUM_ALGORITHMS);
99  enm.export_values();
100  });
101 }
table::Key< table::Array< std::uint8_t > > bytes
Definition: python.h:135
A class that can be used to generate sequences of random numbers according to a number of different a...
Definition: Random.h:57

◆ declareRandomImage()

template<typename ImageT >
void lsst::afw::math::declareRandomImage ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 38 of file _random.cc.

38  {
39  wrappers.wrap([](auto &mod) {
40  mod.def("randomUniformImage", (void (*)(ImageT *, Random &))randomUniformImage<ImageT>);
41  mod.def("randomUniformPosImage", (void (*)(ImageT *, Random &))randomUniformPosImage<ImageT>);
42  mod.def("randomUniformIntImage",
43  (void (*)(ImageT *, Random &, unsigned long))randomUniformIntImage<ImageT>);
44  mod.def("randomFlatImage",
45  (void (*)(ImageT *, Random &, double const, double const))randomFlatImage<ImageT>);
46  mod.def("randomGaussianImage", (void (*)(ImageT *, Random &))randomGaussianImage<ImageT>);
47  mod.def("randomChisqImage", (void (*)(ImageT *, Random &, double const))randomChisqImage<ImageT>);
48  mod.def("randomPoissonImage", (void (*)(ImageT *, Random &, double const))randomPoissonImage<ImageT>);
49  });
50 }

◆ declareStatistics()

template<typename Pixel >
void lsst::afw::math::declareStatistics ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 37 of file _statistics.cc.

37  {
38  wrappers.wrap([](auto &mod) {
39  mod.def("makeStatistics",
40  (Statistics(*)(image::Image<Pixel> const &, image::Mask<image::MaskPixel> const &, int const,
41  StatisticsControl const &))makeStatistics<Pixel>,
42  "img"_a, "msk"_a, "flags"_a, "sctrl"_a = StatisticsControl());
43  mod.def("makeStatistics",
44  (Statistics(*)(image::MaskedImage<Pixel> const &, int const,
45  StatisticsControl const &))makeStatistics<Pixel>,
46  "mimg"_a, "flags"_a, "sctrl"_a = StatisticsControl());
47  mod.def("makeStatistics",
48  (Statistics(*)(image::MaskedImage<Pixel> const &, image::Image<WeightPixel> const &,
49  int const, StatisticsControl const &))makeStatistics<Pixel>,
50  "mimg"_a, "weights"_a, "flags"_a, "sctrl"_a = StatisticsControl());
51  mod.def("makeStatistics",
52  (Statistics(*)(image::Mask<image::MaskPixel> const &, int const, StatisticsControl const &))
53  makeStatistics, // this is not a template, just a regular overload
54  "msk"_a, "flags"_a, "sctrl"_a = StatisticsControl());
55  mod.def("makeStatistics",
56  (Statistics(*)(image::Image<Pixel> const &, int const,
57  StatisticsControl const &))makeStatistics<Pixel>,
58  "img"_a, "flags"_a, "sctrl"_a = StatisticsControl());
59  });
60 }
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:77
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:73
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)
Definition: Statistics.h:359

◆ declareStatisticsVectorOverloads()

template<typename Pixel >
void lsst::afw::math::declareStatisticsVectorOverloads ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 63 of file _statistics.cc.

63  {
64  wrappers.wrap([](auto &mod) {
65  mod.def("makeStatistics",
66  (Statistics(*)(std::vector<Pixel> const &, int const,
67  StatisticsControl const &))makeStatistics<Pixel>,
68  "v"_a, "flags"_a, "sctrl"_a = StatisticsControl());
69  mod.def("makeStatistics",
70  (Statistics(*)(std::vector<Pixel> const &, std::vector<WeightPixel> const &, int const,
71  StatisticsControl const &))makeStatistics<Pixel>,
72  "v"_a, "vweights"_a, "flags"_a, "sctrl"_a = StatisticsControl());
73  });
74 }

◆ declareTransformBoundedField()

void lsst::afw::math::declareTransformBoundedField ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 44 of file _transformBoundedField.cc.

44  {
45  wrappers.wrapType(ClsField(wrappers.module, "TransformBoundedField"), [](auto &mod, auto &cls) {
46  cls.def(py::init<lsst::geom::Box2I const &, TransformBoundedField::Transform const &>(), "bbox"_a,
47  "transform"_a);
48 
49  table::io::python::addPersistableMethods<TransformBoundedField>(cls);
50 
51  cls.def("__mul__", &TransformBoundedField::operator*, py::is_operator());
52  cls.def("__eq__", &TransformBoundedField::operator==, py::is_operator());
53 
54  cls.def("getTransform", &TransformBoundedField::getTransform);
55  cls.def("evaluate", (double (BoundedField::*)(double, double) const) & BoundedField::evaluate);
56  cls.def("evaluate", (ndarray::Array<double, 1, 1>(TransformBoundedField::*)(
57  ndarray::Array<double const, 1> const &,
58  ndarray::Array<double const, 1> const &) const) &
59  TransformBoundedField::evaluate);
60  cls.def("evaluate", (double (TransformBoundedField::*)(lsst::geom::Point2D const &) const) &
61  TransformBoundedField::evaluate);
62  });
63 }
py::class_< TransformBoundedField, std::shared_ptr< TransformBoundedField >, BoundedField > ClsField

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

202  {
203  using SinglePixelT = typename ImageT::SinglePixel;
206  : 0);
207 }

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

224  {
225  using ImagePixelT = typename MaskedImageT::Image::Pixel;
226  using VariancePixelT = typename MaskedImageT::Variance::Pixel;
227 
230  : 0;
231  auto maskPixel = MaskedImageT::Mask::getPlaneBitMask("NO_DATA");
234  : 0;
235  return typename MaskedImageT::SinglePixel(imagePixel, maskPixel, variancePixel);
236 }
T infinity(T... args)
T quiet_NaN(T... args)

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

92  {
93  std::shared_ptr<ImageT> outImage(new ImageT(inImage, true)); // Output image
94 
95  if (flipLR) {
96  if (flipTB) {
97  for (int y = 0; y != inImage.getHeight(); ++y) {
98  typename ImageT::x_iterator optr =
99  outImage->x_at(inImage.getWidth() - 1, inImage.getHeight() - y - 1);
100  for (typename ImageT::x_iterator iptr = inImage.row_begin(y), end = inImage.row_end(y);
101  iptr != end; ++iptr, optr -= 1) {
102  *optr = *iptr;
103  }
104  }
105  } else {
106  for (int y = 0; y != inImage.getHeight(); ++y) {
107  typename ImageT::x_iterator optr = outImage->x_at(inImage.getWidth() - 1, y);
108  for (typename ImageT::x_iterator iptr = inImage.row_begin(y), end = inImage.row_end(y);
109  iptr != end; ++iptr, optr -= 1) {
110  *optr = *iptr;
111  }
112  }
113  }
114  } else {
115  if (flipTB) {
116  for (int y = 0; y != inImage.getHeight(); ++y) {
117  typename ImageT::x_iterator optr = outImage->row_begin(inImage.getHeight() - y - 1);
118  for (typename ImageT::x_iterator iptr = inImage.row_begin(y), end = inImage.row_end(y);
119  iptr != end; ++iptr, ++optr) {
120  *optr = *iptr;
121  }
122  }
123  } else {
124  ; // nothing to do
125  }
126  }
127 
128  return outImage;
129 }
int y
Definition: SpanSet.cc:48

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

708  {
709  using namespace details;
710 
711  integ_dbg2 << "start int1d: " << reg.Left() << ".." << reg.Right() << std::endl;
712 
713  if ((reg.Left() <= -MOCK_INF && reg.Right() > 0) || (reg.Right() >= MOCK_INF && reg.Left() < 0)) {
714  reg.AddSplit(0);
715  }
716 
717  if (reg.NSplit() > 0) {
718  std::vector<IntRegion<Arg> > children;
719  reg.SubDivide(&children);
720  integ_dbg2 << "Subdivided into " << children.size() << " children\n";
721  Arg answer = Arg();
722  Arg err = 0;
723  for (size_t i = 0; i < children.size(); i++) {
724  IntRegion<Arg> &child = children[i];
725  integ_dbg2 << "i = " << i;
726  integ_dbg2 << ": bounds = " << child.Left() << ", " << child.Right() << std::endl;
727  answer += int1d(func, child, abserr, relerr);
728  err += child.Err();
729  integ_dbg2 << "subint = " << child.Area() << " +- " << child.Err() << std::endl;
730  }
731  reg.SetArea(answer, err);
732  return answer;
733 
734  } else {
735  if (reg.Left() <= -MOCK_INF) {
736  integ_dbg2 << "left = -infinity, right = " << reg.Right() << std::endl;
737  assert(reg.Right() <= 0.0);
738  IntRegion<Arg> modreg(1.0 / (reg.Right() - 1.0), 0.0, reg.getDbgout());
739  intGKP(Aux2<UnaryFunctionT>(func), modreg, abserr, relerr);
740  reg.SetArea(modreg.Area(), modreg.Err());
741  } else if (reg.Right() >= MOCK_INF) {
742  integ_dbg2 << "left = " << reg.Left() << ", right = infinity\n";
743  assert(reg.Left() >= 0.0);
744  IntRegion<Arg> modreg(0.0, 1.0 / (reg.Left() + 1.0), reg.getDbgout());
745  intGKP(Aux1<UnaryFunctionT>(func), modreg, abserr, relerr);
746  reg.SetArea(modreg.Area(), modreg.Err());
747  } else {
748  integ_dbg2 << "left = " << reg.Left();
749  integ_dbg2 << ", right = " << reg.Right() << std::endl;
750  intGKP(func, reg, abserr, relerr);
751  }
752  integ_dbg2 << "done int1d answer = " << reg.Area();
753  integ_dbg2 << " +- " << reg.Err() << std::endl;
754  return reg.Area();
755  }
756 }
#define integ_dbg2
Definition: Integrate.h:149
T endl(T... args)
void intGKP(UnaryFunctionT func, IntRegion< Arg > &reg, Arg const epsabs, Arg const epsrel, std::map< Arg, Arg > *fxmap=nullptr)
An adaptive integration algorithm which computes the integral of f over the region reg.
Definition: Integrate.h:426
double const MOCK_INF
Definition: Integrate.h:137
Arg int1d(UnaryFunctionT func, IntRegion< Arg > &reg, Arg const &abserr=DEFABSERR, Arg const &relerr=DEFRELERR)
Front end for the 1d integrator.
Definition: Integrate.h:706

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

770  {
771  IntRegion<Arg> region(a, b);
772  return int1d(func, region, DEFABSERR, eps);
773 }
table::Key< int > b
table::Key< int > a
double const DEFABSERR
Definition: Integrate.h:238

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

781  {
782  auto outer = [func, x1, x2, eps](auto y) {
783  auto inner = [func, y](auto x) { return func(x, y); };
784  return integrate(inner, x1, x2, eps);
785  };
786  return integrate(outer, y1, y2, eps);
787 }
double x

◆ integrateTn()

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

Definition at line 289 of file ChebyshevBoundedField.cc.

289  {
290  if (n % 2 == 1)
291  return 0;
292  else
293  return 2.0 / (1.0 - double(n * n));
294 }

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

274  {
275  if (n < 1) {
276  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, "n must be greater than 0");
277  } else if (n > 4) {
278  return Interpolate::AKIMA_SPLINE;
279  } else {
280  static std::vector<Interpolate::Style> styles;
281  if (styles.empty()) {
282  styles.resize(5);
283 
284  styles[0] = Interpolate::UNKNOWN; // impossible to reach as we check for n < 1
285  styles[1] = Interpolate::CONSTANT;
286  styles[2] = Interpolate::LINEAR;
287  styles[3] = Interpolate::CUBIC_SPLINE;
288  styles[4] = Interpolate::CUBIC_SPLINE;
289  }
290  return styles[n];
291  }
292 }
T empty(T... args)
T resize(T... args)

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

313  {
314  static std::vector<int> minPoints;
315  if (minPoints.empty()) {
316  minPoints.resize(Interpolate::NUM_STYLES);
317  minPoints[Interpolate::CONSTANT] = 1;
318  minPoints[Interpolate::LINEAR] = 2;
319  minPoints[Interpolate::NATURAL_SPLINE] = 3;
320  minPoints[Interpolate::CUBIC_SPLINE] = 3;
321  minPoints[Interpolate::CUBIC_SPLINE_PERIODIC] = 3;
322  minPoints[Interpolate::AKIMA_SPLINE] = 5;
323  minPoints[Interpolate::AKIMA_SPLINE_PERIODIC] = 5;
324  }
325 
326  if (style >= 0 && style < Interpolate::NUM_STYLES) {
327  return minPoints[style];
328  } else {
329  throw LSST_EXCEPT(
330  pex::exceptions::OutOfRangeError,
331  str(boost::format("Style %d is out of range 0..%d") % style % (Interpolate::NUM_STYLES - 1)));
332  }
333 }

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

283  {
284  switch (ctrl.getStyle()) {
285  case ApproximateControl::CHEBYSHEV:
287  new ApproximateChebyshev<PixelT>(x, y, im, bbox, ctrl));
288  default:
290  str(boost::format("Unknown ApproximationStyle: %d") % ctrl.getStyle()));
291  }
292 }
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117

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

526  {
527  return std::shared_ptr<Background>(new BackgroundMI(img, bgCtrl));
528 }

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

354  {
355  return makeInterpolate(std::vector<double>(x.begin(), x.end()), std::vector<double>(y.begin(), y.end()),
356  style);
357 }
std::shared_ptr< Interpolate > 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.
Definition: Interpolate.cc:342

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

343  {
344  switch (style) {
345  case Interpolate::CONSTANT:
346  return std::shared_ptr<Interpolate>(new InterpolateConstant(x, y, style));
347  default: // use GSL
348  return std::shared_ptr<Interpolate>(new InterpolateGsl(x, y, style));
349  }
350 }

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

372  {
373  return Statistics(img, msk, var, flags, sctrl);
374 }

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

429  {
430  // make a phony mask that will be compiled out
431  MaskImposter<lsst::afw::image::MaskPixel> const msk;
432  MaskImposter<WeightPixel> const var;
433  return Statistics(img, msk, var, flags, sctrl);
434 }

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

361  {
362  MaskImposter<WeightPixel> var;
363  return Statistics(img, msk, var, flags, sctrl);
364 }

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

1105  {
1106  return Statistics(msk, msk, msk, flags, sctrl);
1107 }

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

382  {
383  if (sctrl.getWeighted() || sctrl.getCalcErrorFromInputVariance()) {
384  return Statistics(*mimg.getImage(), *mimg.getMask(), *mimg.getVariance(), flags, sctrl);
385  } else {
386  MaskImposter<WeightPixel> var;
387  return Statistics(*mimg.getImage(), *mimg.getMask(), var, flags, sctrl);
388  }
389 }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage's variance.
Definition: MaskedImage.h:1051
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage's mask.
Definition: MaskedImage.h:1030
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage's image.
Definition: MaskedImage.h:1018

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

398  {
399  if (sctrl.getWeighted() || sctrl.getCalcErrorFromInputVariance() ||
400  (!sctrl.getWeightedIsSet() && (weights.getWidth() != 0 && weights.getHeight() != 0))) {
401  return Statistics(*mimg.getImage(), *mimg.getMask(), *mimg.getVariance(), weights, flags, sctrl);
402  } else {
403  MaskImposter<WeightPixel> var;
404  return Statistics(*mimg.getImage(), *mimg.getMask(), var, weights, flags, sctrl);
405  }
406 }
int getWidth() const
Return the number of columns in the image.
Definition: ImageBase.h:294
int getHeight() const
Return the number of rows in the image.
Definition: ImageBase.h:296

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

511  {
512  if (sctrl.getWeighted() || sctrl.getCalcErrorFromInputVariance()) {
513  return Statistics(*mv.getImage(), *mv.getMask(), *mv.getVariance(), flags, sctrl);
514  } else {
515  MaskImposter<WeightPixel> var;
516  return Statistics(*mv.getImage(), *mv.getMask(), var, flags, sctrl);
517  }
518 }
lsst::afw::image::MaskedImage< EntryT >::VariancePtr getVariance() const
Definition: MaskedVector.h:94
lsst::afw::image::MaskedImage< EntryT >::ImagePtr getImage() const
Definition: MaskedVector.h:88
lsst::afw::image::MaskedImage< EntryT >::MaskPtr getMask() const
Definition: MaskedVector.h:91

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

529  {
530  ImageImposter<WeightPixel> weights(vweights);
531 
532  if (sctrl.getWeighted() || sctrl.getCalcErrorFromInputVariance()) {
533  return Statistics(*mv.getImage(), *mv.getMask(), *mv.getVariance(), weights, flags, sctrl);
534  } else {
535  MaskImposter<WeightPixel> var;
536  return Statistics(*mv.getImage(), *mv.getMask(), var, weights, flags, sctrl);
537  }
538 }

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

477  {
478  ImageImposter<EntryT> img(v); // wrap the vector in a fake image
479  MaskImposter<lsst::afw::image::MaskPixel> msk; // instantiate a fake mask that will be compiled out.
480  MaskImposter<WeightPixel> var;
481  return Statistics(img, msk, var, flags, sctrl);
482 }

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

493  {
494  ImageImposter<EntryT> img(v); // wrap the vector in a fake image
495  MaskImposter<lsst::afw::image::MaskPixel> msk; // instantiate a fake mask that will be compiled out.
496  MaskImposter<WeightPixel> var;
497 
498  ImageImposter<WeightPixel> weights(vweights);
499 
500  return Statistics(img, msk, var, weights, flags, sctrl);
501 }

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

224  {
225  using KernelPtr = std::shared_ptr<SeparableKernel>;
226  std::smatch matches;
227  static const std::regex LanczosRE("lanczos(\\d+)");
228  if (name == "bilinear") {
229  return KernelPtr(new BilinearWarpingKernel());
230  } else if (std::regex_match(name, matches, LanczosRE)) {
231  std::string orderStr(matches[1].first, matches[1].second);
232  int order = std::stoi(orderStr);
233  return KernelPtr(new LanczosWarpingKernel(order));
234  } else if (name == "nearest") {
235  return KernelPtr(new NearestWarpingKernel());
236  } else {
237  throw LSST_EXCEPT(pexExcept::InvalidParameterError, "unknown warping kernel name: \"" + name + "\"");
238  }
239 }
table::Key< std::string > name
Definition: Amplifier.cc:116
T regex_match(T... args)
T stoi(T... args)
table::Key< int > order

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

179  {
180  unsigned int const nParameters = function.getNParameters();
181  if (initialParameterList.size() != nParameters) {
182  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, "initialParameterList is the wrong length");
183  }
184  if (stepSizeList.size() != nParameters) {
185  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, "stepSizeList is the wrong length");
186  }
187  unsigned int const nMeasurements = measurementList.size();
188  if (varianceList.size() != nMeasurements) {
189  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, "varianceList is the wrong length");
190  }
191  if (xPositionList.size() != nMeasurements) {
192  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, "xPositionList is the wrong length");
193  }
194 
195  MinimizerFunctionBase1<ReturnT> minimizerFunc(function, measurementList, varianceList, xPositionList,
196  errorDef);
197 
198  ROOT::Minuit2::MnUserParameters fitPar;
199  std::vector<std::string> paramNames;
200  for (unsigned int i = 0; i < nParameters; ++i) {
201  paramNames.push_back((boost::format("p%d") % i).str());
202  fitPar.Add(paramNames[i].c_str(), initialParameterList[i], stepSizeList[i]);
203  }
204 
205  ROOT::Minuit2::MnMigrad migrad(minimizerFunc, fitPar);
206  ROOT::Minuit2::FunctionMinimum min = migrad();
207  ROOT::Minuit2::MnMinos minos(minimizerFunc, min);
208 
209  FitResults fitResults;
210  fitResults.chiSq = min.Fval();
211  fitResults.isValid = min.IsValid() && std::isfinite(fitResults.chiSq);
212  if (!fitResults.isValid) {
213  LOGL_WARN("lsst.afw.math.minimize", "Fit failed to converge");
214  }
215 
216  for (unsigned int i = 0; i < nParameters; ++i) {
217  fitResults.parameterList.push_back(min.UserState().Value(paramNames[i].c_str()));
218  if (fitResults.isValid) {
219  fitResults.parameterErrorList.push_back(minos(i));
220  } else {
221  double e = min.UserState().Error(paramNames[i].c_str());
222  std::pair<double, double> ep(-1 * e, e);
223  fitResults.parameterErrorList.push_back(ep);
224  }
225  }
226  return fitResults;
227 }
int min
#define LOGL_WARN(logger, message...)
Log a warn-level message using a varargs/printf style interface.
Definition: Log.h:547
T isfinite(T... args)
T push_back(T... args)

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

233  {
234  unsigned int const nParameters = function.getNParameters();
235  if (initialParameterList.size() != nParameters) {
236  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, "initialParameterList is the wrong length");
237  }
238  if (stepSizeList.size() != nParameters) {
239  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, "stepSizeList is the wrong length");
240  }
241  unsigned int const nMeasurements = measurementList.size();
242  if (varianceList.size() != nMeasurements) {
243  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, "varianceList is the wrong length");
244  }
245  if (xPositionList.size() != nMeasurements) {
246  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, "xPositionList is the wrong length");
247  }
248  if (yPositionList.size() != nMeasurements) {
249  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, "yPositionList is the wrong length");
250  }
251 
252  MinimizerFunctionBase2<ReturnT> minimizerFunc(function, measurementList, varianceList, xPositionList,
253  yPositionList, errorDef);
254 
255  ROOT::Minuit2::MnUserParameters fitPar;
256  std::vector<std::string> paramNames;
257  for (unsigned int i = 0; i < nParameters; ++i) {
258  paramNames.push_back((boost::format("p%d") % i).str());
259  fitPar.Add(paramNames[i].c_str(), initialParameterList[i], stepSizeList[i]);
260  }
261 
262  ROOT::Minuit2::MnMigrad migrad(minimizerFunc, fitPar);
263  ROOT::Minuit2::FunctionMinimum min = migrad();
264  ROOT::Minuit2::MnMinos minos(minimizerFunc, min);
265 
266  FitResults fitResults;
267  fitResults.chiSq = min.Fval();
268  fitResults.isValid = min.IsValid() && std::isfinite(fitResults.chiSq);
269  if (!fitResults.isValid) {
270  LOGL_WARN("lsst.afw.math.minimize", "Fit failed to converge");
271  }
272 
273  for (unsigned int i = 0; i < nParameters; ++i) {
274  fitResults.parameterList.push_back(min.UserState().Value(paramNames[i].c_str()));
275  if (fitResults.isValid) {
276  fitResults.parameterErrorList.push_back(minos(i));
277  } else {
278  double e = min.UserState().Error(paramNames[i].c_str());
279  std::pair<double, double> ep(-1 * e, e);
280  fitResults.parameterErrorList.push_back(ep);
281  }
282  }
283  return fitResults;
284 }

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

44  {
45  std::shared_ptr<SeparableKernel> offsetKernel = makeWarpingKernel(algorithmName);
46 
47  std::shared_ptr<ImageT> buffImage;
48  if (buffer > 0) {
49  // Paste input image into buffered image
50  lsst::geom::Extent2I const& dims = inImage.getDimensions();
51  std::shared_ptr<ImageT> buffered(new ImageT(dims.getX() + 2 * buffer, dims.getY() + 2 * buffer));
52  buffImage = buffered;
53  lsst::geom::Box2I box(lsst::geom::Point2I(buffer, buffer), dims);
54  buffImage->assign(inImage, box);
55  } else {
56  buffImage = std::make_shared<ImageT>(inImage);
57  }
58 
59  if (offsetKernel->getWidth() > buffImage->getWidth() ||
60  offsetKernel->getHeight() > buffImage->getHeight()) {
62  (boost::format("Image of size %dx%d is too small to offset using a %s kernel"
63  "(minimum %dx%d)") %
64  buffImage->getWidth() % buffImage->getHeight() % algorithmName %
65  offsetKernel->getWidth() % offsetKernel->getHeight())
66  .str());
67  }
68 
69  // std::shared_ptr<ImageT> convImage(new ImageT(buffImage, true)); // output image, a deep copy
70  std::shared_ptr<ImageT> convImage(new ImageT(buffImage->getDimensions())); // Convolved image
71 
72  int dOrigX, dOrigY;
73  double fracX, fracY;
74  // If the offset in both axes is in (-1, 1) use it as is, and don't shift the origin
75  if (dx > -1 && dx < 1 && dy > -1 && dy < 1) {
76  dOrigX = 0;
77  dOrigY = 0;
78  fracX = dx;
79  fracY = dy;
80  } else {
81  dOrigX = static_cast<int>(std::floor(dx + 0.5));
82  dOrigY = static_cast<int>(std::floor(dy + 0.5));
83  fracX = dx - dOrigX;
84  fracY = dy - dOrigY;
85  }
86 
87  // We seem to have to pass -fracX, -fracY to setKernelParameters, for reasons RHL doesn't understand
88  double dKerX = -fracX;
89  double dKerY = -fracY;
90 
91  //
92  // If the shift is -ve, the generated shift kernel (e.g. Lanczos5) is quite asymmetric, with the
93  // largest coefficients to the left of centre. We therefore move the centre of calculated shift kernel
94  // one to the right to center up the largest coefficients
95  //
96  if (dKerX < 0) {
97  offsetKernel->setCtr(offsetKernel->getCtr() + lsst::geom::Extent2I(1, 0));
98  }
99  if (dKerY < 0) {
100  offsetKernel->setCtr(offsetKernel->getCtr() + lsst::geom::Extent2I(0, 1));
101  }
102 
103  offsetKernel->setKernelParameters(std::make_pair(dKerX, dKerY));
104 
105  ConvolutionControl convolutionControl;
106  convolutionControl.setDoNormalize(true);
107  convolutionControl.setDoCopyEdge(true);
108  convolve(*convImage, *buffImage, *offsetKernel, convolutionControl);
109 
110  std::shared_ptr<ImageT> outImage;
111  if (buffer > 0) {
112  lsst::geom::Box2I box(lsst::geom::Point2I(buffer, buffer), inImage.getDimensions());
113  std::shared_ptr<ImageT> out(new ImageT(*convImage, box, afwImage::LOCAL, true));
114  outImage = out;
115  } else {
116  outImage = convImage;
117  }
118 
119  // adjust the origin; do this after convolution since convolution also sets XY0
120  outImage->setXY0(lsst::geom::Point2I(inImage.getX0() + dOrigX, inImage.getY0() + dOrigY));
121 
122  return outImage;
123 }
An integer coordinate rectangle.
Definition: Box.h:55
Reports attempts to exceed implementation-defined length limits for some classes.
Definition: Runtime.h:76
T floor(T... args)
T make_pair(T... args)
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.
std::shared_ptr< SeparableKernel > makeWarpingKernel(std::string name)
Return a warping kernel given its name.
Extent< int, 2 > Extent2I
Definition: Extent.h:397

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

254  {
255  return *bf * scale;
256 }
def scale(algorithm, min, max=None, frame=None)
Definition: ds9.py:108

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

38  {
39  using Pixel = Kernel::Pixel;
40 
41  image::Image<Pixel> kImage(kernel.getDimensions());
42  double kSum = kernel.computeImage(kImage, doNormalize, xPos, yPos);
43 
44  for (int y = kImage.getHeight() - 1; y >= 0; --y) {
45  for (image::Image<Pixel>::const_x_iterator ptr = kImage.row_begin(y); ptr != kImage.row_end(y);
46  ++ptr) {
47  std::cout << boost::format(pixelFmt) % *ptr << " ";
48  }
50  }
51 
52  if (doNormalize && std::abs(static_cast<double>(kSum) - 1.0) > 1.0e-5) {
53  std::cout << boost::format("Warning! Sum of all pixels = %9.5f != 1.0\n") % kSum;
54  }
56 }
Angle abs(Angle const &a)
Definition: Angle.h:106

◆ PYBIND11_MODULE()

lsst::afw::math::PYBIND11_MODULE ( _math  ,
mod   
)

Definition at line 51 of file _math.cc.

51  {
52  lsst::utils::python::WrapperCollection wrappers(mod, "lsst.afw.math");
53  wrapApproximate(wrappers);
54  wrapBackground(wrappers);
55  wrapBoundedField(wrappers);
56  wrapChebyshevBoundedField(wrappers);
57  wrapConvolveImage(wrappers);
58  wrapFunction(wrappers);
59  wrapFunctionLibrary(wrappers);
60  wrapGaussianProcess(wrappers);
61  wrapInterpolate(wrappers);
62  wrapKernel(wrappers);
63  wrapLeastSquares(wrappers);
64  wrapMinimize(wrappers);
65  wrapOffsetImage(wrappers);
66  wrapPixelAreaBoundedField(wrappers);
67  wrapProductBoundedField(wrappers);
68  wrapRandom(wrappers);
69  wrapSpatialCell(wrappers);
70  wrapStack(wrappers);
71  wrapStatistics(wrappers);
72  wrapTransformBoundedField(wrappers);
73  wrapWarpExposure(wrappers);
74  wrappers.finish();
75 }
void wrapBoundedField(lsst::utils::python::WrapperCollection &wrappers)
void wrapKernel(lsst::utils::python::WrapperCollection &wrappers)
Definition: _kernel.cc:39
void wrapInterpolate(lsst::utils::python::WrapperCollection &wrappers)
Definition: _interpolate.cc:38
void wrapTransformBoundedField(lsst::utils::python::WrapperCollection &)
void wrapConvolveImage(lsst::utils::python::WrapperCollection &wrappers)
void wrapChebyshevBoundedField(lsst::utils::python::WrapperCollection &wrappers)
void wrapStatistics(lsst::utils::python::WrapperCollection &)
Definition: _statistics.cc:144
void wrapBackground(lsst::utils::python::WrapperCollection &wrappers)
Definition: _background.cc:162
void wrapGaussianProcess(lsst::utils::python::WrapperCollection &wrappers)
void wrapLeastSquares(lsst::utils::python::WrapperCollection &wrappers)
void wrapApproximate(lsst::utils::python::WrapperCollection &wrappers)
Definition: _approximate.cc:83
void wrapRandom(lsst::utils::python::WrapperCollection &)
Definition: _random.cc:103
void wrapOffsetImage(lsst::utils::python::WrapperCollection &)
Definition: _offsetImage.cc:74
void wrapProductBoundedField(lsst::utils::python::WrapperCollection &)
void wrapSpatialCell(lsst::utils::python::WrapperCollection &)
void wrapFunctionLibrary(lsst::utils::python::WrapperCollection &wrappers)
void wrapStack(lsst::utils::python::WrapperCollection &)
Definition: _stack.cc:113
void wrapMinimize(lsst::utils::python::WrapperCollection &)
Definition: _minimize.cc:60
void wrapWarpExposure(lsst::utils::python::WrapperCollection &)
void wrapPixelAreaBoundedField(lsst::utils::python::WrapperCollection &)
void wrapFunction(lsst::utils::python::WrapperCollection &wrappers)
Definition: _function.cc:142

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

135  {
136  lsst::afw::image::for_each_pixel(*image, do_chisq<typename ImageT::Pixel>(rand, nu));
137 }
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
void for_each_pixel(Image< LhsT > &lhs, pixelOp0< LhsT > const &func)
Set each pixel in an Image<LhsT> to func()

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

125  {
126  lsst::afw::image::for_each_pixel(*image, do_flat<typename ImageT::Pixel>(rand, a, b));
127 }

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

130  {
131  lsst::afw::image::for_each_pixel(*image, do_gaussian<typename ImageT::Pixel>(rand));
132 }

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

140  {
141  lsst::afw::image::for_each_pixel(*image, do_poisson<typename ImageT::Pixel>(rand, mu));
142 }

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

110  {
111  lsst::afw::image::for_each_pixel(*image, do_uniform<typename ImageT::Pixel>(rand));
112 }

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

120  {
121  lsst::afw::image::for_each_pixel(*image, do_uniformInt<typename ImageT::Pixel>(rand, n));
122 }

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

115  {
116  lsst::afw::image::for_each_pixel(*image, do_uniformPos<typename ImageT::Pixel>(rand));
117 }

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

39  {
40  std::shared_ptr<ImageT> outImage; // output image
41 
42  while (nQuarter < 0) {
43  nQuarter += 4;
44  }
45 
46  switch (nQuarter % 4) {
47  case 0:
48  outImage.reset(new ImageT(inImage, true)); // a deep copy of inImage
49  break;
50  case 1:
51  outImage.reset(new ImageT(lsst::geom::Extent2I(inImage.getHeight(), inImage.getWidth())));
52 
53  for (int y = 0; y != inImage.getHeight(); ++y) {
54  typename ImageT::y_iterator optr = outImage->col_begin(inImage.getHeight() - y - 1);
55  for (typename ImageT::x_iterator iptr = inImage.row_begin(y), end = inImage.row_end(y);
56  iptr != end; ++iptr, ++optr) {
57  *optr = *iptr;
58  }
59  }
60 
61  break;
62  case 2:
63  outImage.reset(new ImageT(inImage.getDimensions()));
64 
65  for (int y = 0; y != inImage.getHeight(); ++y) {
66  typename ImageT::x_iterator optr =
67  outImage->x_at(inImage.getWidth() - 1, inImage.getHeight() - y - 1);
68  for (typename ImageT::x_iterator iptr = inImage.row_begin(y), end = inImage.row_end(y);
69  iptr != end; ++iptr, optr -= 1) {
70  *optr = *iptr;
71  }
72  }
73  break;
74  case 3:
75  outImage.reset(new ImageT(lsst::geom::Extent2I(inImage.getHeight(), inImage.getWidth())));
76 
77  for (int y = 0; y != inImage.getHeight(); ++y) {
78  typename ImageT::y_iterator optr = outImage->y_at(y, inImage.getWidth() - 1);
79  for (typename ImageT::x_iterator iptr = inImage.row_begin(y), end = inImage.row_end(y);
80  iptr != end; ++iptr, optr -= 1) {
81  *optr = *iptr;
82  }
83  }
84 
85  break;
86  }
87 
88  return outImage;
89 }
T reset(T... args)

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

154  {
155  if (outImage.getDimensions() != inImage1.getDimensions()) {
157  os << "outImage dimensions = ( " << outImage.getWidth() << ", " << outImage.getHeight() << ") != ("
158  << inImage1.getWidth() << ", " << inImage1.getHeight() << ") = inImage1 dimensions";
160  } else if (inImage1.getDimensions() != inImage2.getDimensions()) {
162  os << "inImage1 dimensions = ( " << inImage1.getWidth() << ", " << inImage1.getHeight() << ") != ("
163  << inImage2.getWidth() << ", " << inImage2.getHeight() << ") = inImage2 dimensions";
165  }
166 
167  using InConstXIter = typename InImageT::const_x_iterator;
168  using OutXIter = typename OutImageT::x_iterator;
169  for (int y = 0; y != inImage1.getHeight(); ++y) {
170  InConstXIter const end1 = inImage1.row_end(y);
171  InConstXIter inIter1 = inImage1.row_begin(y);
172  InConstXIter inIter2 = inImage2.row_begin(y);
173  OutXIter outIter = outImage.row_begin(y);
174  for (; inIter1 != end1; ++inIter1, ++inIter2, ++outIter) {
175  *outIter = (*inIter1 * c1) + (*inIter2 * c2);
176  }
177  }
178 }

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

360  {
361  checkObjectsAndWeights(images, wvector);
362  checkOnlyOneFlag(flags);
363  checkImageSizes(out, images);
364 
365  if (wvector.empty()) {
366  return computeImageStack<PixelT, false>(out, images, flags, sctrl);
367  } else {
368  return computeImageStack<PixelT, true>(out, images, flags, sctrl, wvector);
369  }
370 }

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

445  {
446  int x0 = image.getX0();
447  int y0 = image.getY0();
448  using MImage = image::MaskedImage<PixelT>;
450 
451  // do each row or column, one at a time
452  // - create a subimage with a bounding box, and get the stats and assign the value to the output image
453  if (dimension == 'x') {
454  imgOut = std::shared_ptr<MImage>(new MImage(lsst::geom::Extent2I(1, image.getHeight())));
455  int y = y0;
456  typename MImage::y_iterator oEnd = imgOut->col_end(0);
457  for (typename MImage::y_iterator oPtr = imgOut->col_begin(0); oPtr != oEnd; ++oPtr, ++y) {
460  image::Image<PixelT> subImage(image, bbox);
461  Statistics stat = makeStatistics(subImage, flags | ERRORS, sctrl);
462  *oPtr = typename image::MaskedImage<PixelT>::Pixel(stat.getValue(), 0x0,
463  stat.getError() * stat.getError());
464  }
465 
466  } else if (dimension == 'y') {
467  imgOut = std::shared_ptr<MImage>(new MImage(lsst::geom::Extent2I(image.getWidth(), 1)));
468  int x = x0;
469  typename MImage::x_iterator oEnd = imgOut->row_end(0);
470  for (typename MImage::x_iterator oPtr = imgOut->row_begin(0); oPtr != oEnd; ++oPtr, ++x) {
473  image::Image<PixelT> subImage(image, bbox);
474  Statistics stat = makeStatistics(subImage, flags | ERRORS, sctrl);
475  *oPtr = typename image::MaskedImage<PixelT>::Pixel(stat.getValue(), 0x0,
476  stat.getError() * stat.getError());
477  }
478  } else {
480  "Can only run statisticsStack in x or y for single image.");
481  }
482 
483  return imgOut;
484 }
lsst::afw::image::pixel::Pixel< ImagePixelT, MaskPixelT, VariancePixelT > Pixel
A Pixel in the MaskedImage.
Definition: MaskedImage.h:111

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

253  {
254  checkObjectsAndWeights(images, wvector);
255  checkOnlyOneFlag(flags);
256  checkImageSizes(out, images);
257 
258  if (sctrl.getWeighted()) {
259  if (wvector.empty()) {
260  return computeMaskedImageStack<PixelT, true, true>(out, images, flags, sctrl, clipped,
261  excuse); // use variance
262  } else {
263  return computeMaskedImageStack<PixelT, true, false>(out, images, flags, sctrl, clipped, excuse,
264  wvector); // use wvector
265  }
266  } else {
267  if (!wvector.empty()) {
268  LOGL_WARN(_log,
269  "Weights passed on to statisticsStack are ignored as sctrl.getWeighted() is False."
270  "Set sctrl.setWeighted(True) for them to be used.");
271  }
272  return computeMaskedImageStack<PixelT, false, false>(out, images, flags, sctrl, clipped, excuse);
273  }
274 }

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

280  {
281  checkObjectsAndWeights(images, wvector);
282  checkOnlyOneFlag(flags);
283  checkImageSizes(out, images);
284 
285  if (sctrl.getWeighted()) {
286  if (wvector.empty()) {
287  return computeMaskedImageStack<PixelT, true, true>(out, images, flags, sctrl, clipped,
288  maskMap); // use variance
289  } else {
290  return computeMaskedImageStack<PixelT, true, false>(out, images, flags, sctrl, clipped, maskMap,
291  wvector); // use wvector
292  }
293  } else {
294  return computeMaskedImageStack<PixelT, false, false>(out, images, flags, sctrl, clipped, maskMap);
295  }
296 }

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

489  {
490  int const x0 = image.getX0();
491  int const y0 = image.getY0();
492  using MImage = image::MaskedImage<PixelT>;
494 
495  // do each row or column, one at a time
496  // - create a subimage with a bounding box, and get the stats and assign the value to the output image
497  if (dimension == 'x') {
498  imgOut = std::shared_ptr<MImage>(new MImage(lsst::geom::Extent2I(1, image.getHeight())));
499  int y = 0;
500  typename MImage::y_iterator oEnd = imgOut->col_end(0);
501  for (typename MImage::y_iterator oPtr = imgOut->col_begin(0); oPtr != oEnd; ++oPtr, ++y) {
505  Statistics stat = makeStatistics(subImage, flags | ERRORS, sctrl);
506  *oPtr = typename image::MaskedImage<PixelT>::Pixel(stat.getValue(), 0x0,
507  stat.getError() * stat.getError());
508  }
509 
510  } else if (dimension == 'y') {
511  imgOut = std::shared_ptr<MImage>(new MImage(lsst::geom::Extent2I(image.getWidth(), 1)));
512  int x = 0;
513  typename MImage::x_iterator oEnd = imgOut->row_end(0);
514  for (typename MImage::x_iterator oPtr = imgOut->row_begin(0); oPtr != oEnd; ++oPtr, ++x) {
518  Statistics stat = makeStatistics(subImage, flags | ERRORS, sctrl);
519  *oPtr = typename image::MaskedImage<PixelT>::Pixel(stat.getValue(), 0x0,
520  stat.getError() * stat.getError());
521  }
522  } else {
524  "Can only run statisticsStack in x or y for single image.");
525  }
526 
527  return imgOut;
528 }

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

445  {
446  int x0 = image.getX0();
447  int y0 = image.getY0();
448  using MImage = image::MaskedImage<PixelT>;
450 
451  // do each row or column, one at a time
452  // - create a subimage with a bounding box, and get the stats and assign the value to the output image
453  if (dimension == 'x') {
454  imgOut = std::shared_ptr<MImage>(new MImage(lsst::geom::Extent2I(1, image.getHeight())));
455  int y = y0;
456  typename MImage::y_iterator oEnd = imgOut->col_end(0);
457  for (typename MImage::y_iterator oPtr = imgOut->col_begin(0); oPtr != oEnd; ++oPtr, ++y) {
460  image::Image<PixelT> subImage(image, bbox);
461  Statistics stat = makeStatistics(subImage, flags | ERRORS, sctrl);
462  *oPtr = typename image::MaskedImage<PixelT>::Pixel(stat.getValue(), 0x0,
463  stat.getError() * stat.getError());
464  }
465 
466  } else if (dimension == 'y') {
467  imgOut = std::shared_ptr<MImage>(new MImage(lsst::geom::Extent2I(image.getWidth(), 1)));
468  int x = x0;
469  typename MImage::x_iterator oEnd = imgOut->row_end(0);
470  for (typename MImage::x_iterator oPtr = imgOut->row_begin(0); oPtr != oEnd; ++oPtr, ++x) {
473  image::Image<PixelT> subImage(image, bbox);
474  Statistics stat = makeStatistics(subImage, flags | ERRORS, sctrl);
475  *oPtr = typename image::MaskedImage<PixelT>::Pixel(stat.getValue(), 0x0,
476  stat.getError() * stat.getError());
477  }
478  } else {
480  "Can only run statisticsStack in x or y for single image.");
481  }
482 
483  return imgOut;
484 }

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

489  {
490  int const x0 = image.getX0();
491  int const y0 = image.getY0();
492  using MImage = image::MaskedImage<PixelT>;
494 
495  // do each row or column, one at a time
496  // - create a subimage with a bounding box, and get the stats and assign the value to the output image
497  if (dimension == 'x') {
498  imgOut = std::shared_ptr<MImage>(new MImage(lsst::geom::Extent2I(1, image.getHeight())));
499  int y = 0;
500  typename MImage::y_iterator oEnd = imgOut->col_end(0);
501  for (typename MImage::y_iterator oPtr = imgOut->col_begin(0); oPtr != oEnd; ++oPtr, ++y) {
505  Statistics stat = makeStatistics(subImage, flags | ERRORS, sctrl);
506  *oPtr = typename image::MaskedImage<PixelT>::Pixel(stat.getValue(), 0x0,
507  stat.getError() * stat.getError());
508  }
509 
510  } else if (dimension == 'y') {
511  imgOut = std::shared_ptr<MImage>(new MImage(lsst::geom::Extent2I(image.getWidth(), 1)));
512  int x = 0;
513  typename MImage::x_iterator oEnd = imgOut->row_end(0);
514  for (typename MImage::x_iterator oPtr = imgOut->row_begin(0); oPtr != oEnd; ++oPtr, ++x) {
518  Statistics stat = makeStatistics(subImage, flags | ERRORS, sctrl);
519  *oPtr = typename image::MaskedImage<PixelT>::Pixel(stat.getValue(), 0x0,
520  stat.getError() * stat.getError());
521  }
522  } else {
524  "Can only run statisticsStack in x or y for single image.");
525  }
526 
527  return imgOut;
528 }

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

349  {
350  if (images.size() == 0) {
351  throw LSST_EXCEPT(pexExcept::LengthError, "Please specify at least one image to stack");
352  }
353  std::shared_ptr<image::Image<PixelT>> out(new image::Image<PixelT>(images[0]->getDimensions()));
354  statisticsStack(*out, images, flags, sctrl, wvector);
355  return out;
356 }
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.
Definition: Stack.cc:487

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

225  {
226  if (images.size() == 0) {
227  throw LSST_EXCEPT(pexExcept::LengthError, "Please specify at least one image to stack");
228  }
230  new image::MaskedImage<PixelT>(images[0]->getDimensions()));
231  statisticsStack(*out, images, flags, sctrl, wvector, clipped, excuse);
232  return out;
233 }

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

239  {
240  if (images.size() == 0) {
241  throw LSST_EXCEPT(pexExcept::LengthError, "Please specify at least one image to stack");
242  }
244  new image::MaskedImage<PixelT>(images[0]->getDimensions()));
245  statisticsStack(*out, images, flags, sctrl, wvector, clipped, maskMap);
246  return out;
247 }

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

426  {
427  checkObjectsAndWeights(vectors, wvector);
428  checkOnlyOneFlag(flags);
429 
430  if (wvector.empty()) {
431  return computeVectorStack<PixelT, false>(vectors, flags, sctrl);
432  } else {
433  return computeVectorStack<PixelT, true>(vectors, flags, sctrl, wvector);
434  }
435 }

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

256  {
257  static std::map<std::string, Interpolate::Style> gslInterpTypeStrings;
258  if (gslInterpTypeStrings.empty()) {
259  gslInterpTypeStrings["CONSTANT"] = Interpolate::CONSTANT;
260  gslInterpTypeStrings["LINEAR"] = Interpolate::LINEAR;
261  gslInterpTypeStrings["CUBIC_SPLINE"] = Interpolate::CUBIC_SPLINE;
262  gslInterpTypeStrings["NATURAL_SPLINE"] = Interpolate::NATURAL_SPLINE;
263  gslInterpTypeStrings["CUBIC_SPLINE_PERIODIC"] = Interpolate::CUBIC_SPLINE_PERIODIC;
264  gslInterpTypeStrings["AKIMA_SPLINE"] = Interpolate::AKIMA_SPLINE;
265  gslInterpTypeStrings["AKIMA_SPLINE_PERIODIC"] = Interpolate::AKIMA_SPLINE_PERIODIC;
266  }
267 
268  if (gslInterpTypeStrings.find(style) == gslInterpTypeStrings.end()) {
269  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError, "Interp style not found: " + style);
270  }
271  return gslInterpTypeStrings[style];
272 }
T find(T... args)

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

738  {
739  static std::map<std::string, Property> statisticsProperty;
740  if (statisticsProperty.size() == 0) {
741  statisticsProperty["NOTHING"] = NOTHING;
742  statisticsProperty["ERRORS"] = ERRORS;
743  statisticsProperty["NPOINT"] = NPOINT;
744  statisticsProperty["MEAN"] = MEAN;
745  statisticsProperty["STDEV"] = STDEV;
746  statisticsProperty["VARIANCE"] = VARIANCE;
747  statisticsProperty["MEDIAN"] = MEDIAN;
748  statisticsProperty["IQRANGE"] = IQRANGE;
749  statisticsProperty["MEANCLIP"] = MEANCLIP;
750  statisticsProperty["STDEVCLIP"] = STDEVCLIP;
751  statisticsProperty["VARIANCECLIP"] = VARIANCECLIP;
752  statisticsProperty["MIN"] = MIN;
753  statisticsProperty["MAX"] = MAX;
754  statisticsProperty["SUM"] = SUM;
755  statisticsProperty["MEANSQUARE"] = MEANSQUARE;
756  statisticsProperty["ORMASK"] = ORMASK;
757  statisticsProperty["NCLIPPED"] = NCLIPPED;
758  statisticsProperty["NMASKED"] = NMASKED;
759  }
760  return statisticsProperty[property];
761 }

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

117  {
118  static std::map<std::string, UndersampleStyle> undersampleStrings;
119  if (undersampleStrings.size() == 0) {
120  undersampleStrings["THROW_EXCEPTION"] = THROW_EXCEPTION;
121  undersampleStrings["REDUCE_INTERP_ORDER"] = REDUCE_INTERP_ORDER;
122  undersampleStrings["INCREASE_NXNYSAMPLE"] = INCREASE_NXNYSAMPLE;
123  }
124 
125  if (undersampleStrings.find(style) == undersampleStrings.end()) {
126  throw LSST_EXCEPT(ex::InvalidParameterError, "Understample style not defined: " + style);
127  }
128  return undersampleStrings[style];
129 }

◆ 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 666 of file warpExposure.cc.

669  {
670  // force src and dest to be the same size and xy0
671  if ((destImage.getWidth() != srcImage.getWidth()) || (destImage.getHeight() != srcImage.getHeight()) ||
672  (destImage.getXY0() != srcImage.getXY0())) {
673  std::ostringstream errStream;
674  errStream << "src and dest images must have same size and xy0.";
676  }
677 
678  // set the xy0 coords to 0,0 to make life easier
679  SrcImageT srcImageCopy(srcImage, true);
680  srcImageCopy.setXY0(0, 0);
681  destImage.setXY0(0, 0);
682  lsst::geom::Extent2D cLocal =
683  lsst::geom::Extent2D(centerPosition) - lsst::geom::Extent2D(srcImage.getXY0());
684 
685  // for the affine transform, the centerPosition will not only get sheared, but also
686  // moved slightly. So we'll include a translation to move it back by an amount
687  // centerPosition - translatedCenterPosition
688  lsst::geom::AffineTransform affTran(linearTransform, cLocal - linearTransform(cLocal));
690 
691 // now warp
692 #if 0
693  static float t = 0.0;
694  float t_before = 1.0*clock()/CLOCKS_PER_SEC;
695  int n = warpImage(destImage, srcImageCopy, affTran, control, padValue);
696  float t_after = 1.0*clock()/CLOCKS_PER_SEC;
697  float dt = t_after - t_before;
698  t += dt;
699  std::cout <<srcImage.getWidth()<<"x"<<srcImage.getHeight()<<": "<< dt <<" "<< t <<std::endl;
700 #else
701  int n = warpImage(destImage, srcImageCopy, *affineTransform22, control, padValue);
702 #endif
703 
704  // fix the origin and we're done.
705  destImage.setXY0(srcImage.getXY0());
706 
707  return n;
708 }
An affine coordinate transformation consisting of a linear transformation and an offset.
T clock(T... args)
std::shared_ptr< TransformPoint2ToPoint2 > makeTransform(lsst::geom::AffineTransform const &affine)
Wrap an lsst::geom::AffineTransform as a Transform.
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.
Extent< double, 2 > Extent2D
Definition: Extent.h:400
T str(T... args)

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

394  {
395  if (!destExposure.hasWcs()) {
396  throw LSST_EXCEPT(pexExcept::InvalidParameterError, "destExposure has no Wcs");
397  }
398  if (!srcExposure.hasWcs()) {
399  throw LSST_EXCEPT(pexExcept::InvalidParameterError, "srcExposure has no Wcs");
400  }
401  typename DestExposureT::MaskedImageT mi = destExposure.getMaskedImage();
402  if (srcExposure.getInfo()->hasId()) {
403  destExposure.getInfo()->setId(srcExposure.getInfo()->getId());
404  }
405  destExposure.setPhotoCalib(srcExposure.getPhotoCalib());
406  destExposure.setFilterLabel(srcExposure.getFilterLabel());
407  destExposure.getInfo()->setVisitInfo(srcExposure.getInfo()->getVisitInfo());
408  return warpImage(mi, *destExposure.getWcs(), srcExposure.getMaskedImage(), *srcExposure.getWcs(), control,
409  padValue);
410 }

◆ 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 441 of file warpExposure.cc.

443  {
444  auto srcToDest = geom::makeWcsPairTransform(srcWcs, destWcs);
445  return warpImage(destImage, srcImage, *srcToDest, control, padValue);
446 }
std::shared_ptr< TransformPoint2ToPoint2 > makeWcsPairTransform(SkyWcs const &src, SkyWcs const &dst)
A Transform obtained by putting two SkyWcs objects "back to back".
Definition: SkyWcs.cc:146

◆ 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 449 of file warpExposure.cc.

451  {
452  if (imagesOverlap(destImage, srcImage)) {
453  throw LSST_EXCEPT(pexExcept::InvalidParameterError, "destImage overlaps srcImage; cannot warp");
454  }
455  if (destImage.getBBox(image::LOCAL).isEmpty()) {
456  return 0;
457  }
458  // if src image is too small then don't try to warp
459  std::shared_ptr<SeparableKernel> warpingKernelPtr = control.getWarpingKernel();
460  try {
461  warpingKernelPtr->shrinkBBox(srcImage.getBBox(image::LOCAL));
463  for (int y = 0, height = destImage.getHeight(); y < height; ++y) {
464  for (typename DestImageT::x_iterator destPtr = destImage.row_begin(y), end = destImage.row_end(y);
465  destPtr != end; ++destPtr) {
466  *destPtr = padValue;
467  }
468  }
469  return 0;
470  }
471  int interpLength = control.getInterpLength();
472 
473  std::shared_ptr<LanczosWarpingKernel const> const lanczosKernelPtr =
474  std::dynamic_pointer_cast<LanczosWarpingKernel>(warpingKernelPtr);
475 
476  int numGoodPixels = 0;
477 
478  // compute a transform from local destination pixels to parent source pixels
479  auto const parentDestToParentSrc = srcToDest.inverted();
480  std::vector<double> const localDestToParentDestVec = {static_cast<double>(destImage.getX0()),
481  static_cast<double>(destImage.getY0())};
482  auto const localDestToParentDest = geom::TransformPoint2ToPoint2(ast::ShiftMap(localDestToParentDestVec));
483  auto const localDestToParentSrc = localDestToParentDest.then(*parentDestToParentSrc);
484 
485  // Get the source MaskedImage and a pixel accessor to it.
486  int const srcWidth = srcImage.getWidth();
487  int const srcHeight = srcImage.getHeight();
488  LOGL_DEBUG("TRACE2.lsst.afw.math.warp", "source image width=%d; height=%d", srcWidth, srcHeight);
489 
490  int const destWidth = destImage.getWidth();
491  int const destHeight = destImage.getHeight();
492  LOGL_DEBUG("TRACE2.lsst.afw.math.warp", "remap image width=%d; height=%d", destWidth, destHeight);
493 
494  // Set each pixel of destExposure's MaskedImage
495  LOGL_DEBUG("TRACE3.lsst.afw.math.warp", "Remapping masked image");
496 
497  int const maxCol = destWidth - 1;
498  int const maxRow = destHeight - 1;
499 
500  detail::WarpAtOnePoint<DestImageT, SrcImageT> warpAtOnePoint(srcImage, control, padValue);
501 
502  if (interpLength > 0) {
503  // Use interpolation. Note that 1 produces the same result as no interpolation
504  // but uses this code branch, thus providing an easy way to compare the two branches.
505 
506  // Estimate for number of horizontal interpolation band edges, to reserve memory in vectors
507  int const numColEdges = 2 + ((destWidth - 1) / interpLength);
508 
509  // A list of edge column indices for interpolation bands;
510  // starts at -1, increments by interpLen (except the final interval), and ends at destWidth-1
511  std::vector<int> edgeColList;
512  edgeColList.reserve(numColEdges);
513 
514  // A list of 1/column width for horizontal interpolation bands; the first value is garbage.
515  // The inverse is used for speed because the values are always multiplied.
516  std::vector<double> invWidthList;
517  invWidthList.reserve(numColEdges);
518 
519  // Compute edgeColList and invWidthList
520  edgeColList.push_back(-1);
521  invWidthList.push_back(0.0);
522  for (int prevEndCol = -1; prevEndCol < maxCol; prevEndCol += interpLength) {
523  int endCol = prevEndCol + interpLength;
524  if (endCol > maxCol) {
525  endCol = maxCol;
526  }
527  edgeColList.push_back(endCol);
528  assert(endCol - prevEndCol > 0);
529  invWidthList.push_back(1.0 / static_cast<double>(endCol - prevEndCol));
530  }
531  assert(edgeColList.back() == maxCol);
532 
533  // A list of delta source positions along the edge columns of the horizontal interpolation bands
534  std::vector<lsst::geom::Extent2D> yDeltaSrcPosList(edgeColList.size());
535 
536  // A cache of pixel positions on the source corresponding to the previous or current row
537  // of the destination image.
538  // The first value is for column -1 because the previous source position is used to compute relative
539  // area To simplify the indexing, use an iterator that starts at begin+1, thus: srcPosView =
540  // srcPosList.begin() + 1 srcPosView[col-1] and lower indices are for this row srcPosView[col] and
541  // higher indices are for the previous row
542  std::vector<lsst::geom::Point2D> srcPosList(1 + destWidth);
543  std::vector<lsst::geom::Point2D>::iterator const srcPosView = srcPosList.begin() + 1;
544 
545  std::vector<lsst::geom::Point2D> endColPosList;
546  endColPosList.reserve(numColEdges);
547 
548  // Initialize srcPosList for row -1
549  for (int endCol : edgeColList) {
550  endColPosList.emplace_back(lsst::geom::Point2D(endCol, -1));
551  }
552  auto rightSrcPosList = localDestToParentSrc->applyForward(endColPosList);
553  srcPosView[-1] = rightSrcPosList[0];
554  for (int colBand = 1, endBand = edgeColList.size(); colBand < endBand; ++colBand) {
555  int const prevEndCol = edgeColList[colBand - 1];
556  int const endCol = edgeColList[colBand];
557  lsst::geom::Point2D leftSrcPos = srcPosView[prevEndCol];
558 
559  lsst::geom::Extent2D xDeltaSrcPos =
560  (rightSrcPosList[colBand] - leftSrcPos) * invWidthList[colBand];
561 
562  for (int col = prevEndCol + 1; col <= endCol; ++col) {
563  srcPosView[col] = srcPosView[col - 1] + xDeltaSrcPos;
564  }
565  }
566 
567  int endRow = -1;
568  while (endRow < maxRow) {
569  // Next horizontal interpolation band
570 
571  int prevEndRow = endRow;
572  endRow = prevEndRow + interpLength;
573  if (endRow > maxRow) {
574  endRow = maxRow;
575  }
576  assert(endRow - prevEndRow > 0);
577  double interpInvHeight = 1.0 / static_cast<double>(endRow - prevEndRow);
578 
579  // Set yDeltaSrcPosList for this horizontal interpolation band
580  std::vector<lsst::geom::Point2D> destRowPosList;
581  destRowPosList.reserve(edgeColList.size());
582  for (int endCol : edgeColList) {
583  destRowPosList.emplace_back(lsst::geom::Point2D(endCol, endRow));
584  }
585  auto bottomSrcPosList = localDestToParentSrc->applyForward(destRowPosList);
586  for (int colBand = 0, endBand = edgeColList.size(); colBand < endBand; ++colBand) {
587  int endCol = edgeColList[colBand];
588  yDeltaSrcPosList[colBand] =
589  (bottomSrcPosList[colBand] - srcPosView[endCol]) * interpInvHeight;
590  }
591 
592  for (int row = prevEndRow + 1; row <= endRow; ++row) {
593  typename DestImageT::x_iterator destXIter = destImage.row_begin(row);
594  srcPosView[-1] += yDeltaSrcPosList[0];
595  for (int colBand = 1, endBand = edgeColList.size(); colBand < endBand; ++colBand) {
596  // Next vertical interpolation band
597 
598  int const prevEndCol = edgeColList[colBand - 1];
599  int const endCol = edgeColList[colBand];
600 
601  // Compute xDeltaSrcPos; remember that srcPosView contains
602  // positions for this row in prevEndCol and smaller indices,
603  // and positions for the previous row for larger indices (including endCol)
604  lsst::geom::Point2D leftSrcPos = srcPosView[prevEndCol];
605  lsst::geom::Point2D rightSrcPos = srcPosView[endCol] + yDeltaSrcPosList[colBand];
606  lsst::geom::Extent2D xDeltaSrcPos = (rightSrcPos - leftSrcPos) * invWidthList[colBand];
607 
608  for (int col = prevEndCol + 1; col <= endCol; ++col, ++destXIter) {
609  lsst::geom::Point2D leftSrcPos = srcPosView[col - 1];
610  lsst::geom::Point2D srcPos = leftSrcPos + xDeltaSrcPos;
611  double relativeArea = computeRelativeArea(srcPos, leftSrcPos, srcPosView[col]);
612 
613  srcPosView[col] = srcPos;
614 
615  if (warpAtOnePoint(
616  destXIter, srcPos, relativeArea,
617  typename image::detail::image_traits<DestImageT>::image_category())) {
618  ++numGoodPixels;
619  }
620  } // for col
621  } // for col band
622  } // for row
623  } // while next row band
624 
625  } else {
626  // No interpolation
627 
628  // prevSrcPosList = source positions from the previous row; these are used to compute pixel area;
629  // to begin, compute sources positions corresponding to destination row = -1
631  destPosList.reserve(1 + destWidth);
632  for (int col = -1; col < destWidth; ++col) {
633  destPosList.emplace_back(lsst::geom::Point2D(col, -1));
634  }
635  auto prevSrcPosList = localDestToParentSrc->applyForward(destPosList);
636 
637  for (int row = 0; row < destHeight; ++row) {
638  destPosList.clear();
639  for (int col = -1; col < destWidth; ++col) {
640  destPosList.emplace_back(lsst::geom::Point2D(col, row));
641  }
642  auto srcPosList = localDestToParentSrc->applyForward(destPosList);
643 
644  typename DestImageT::x_iterator destXIter = destImage.row_begin(row);
645  for (int col = 0; col < destWidth; ++col, ++destXIter) {
646  // column index = column + 1 because the first entry in srcPosList is for column -1
647  auto srcPos = srcPosList[col + 1];
648  double relativeArea =
649  computeRelativeArea(srcPos, prevSrcPosList[col], prevSrcPosList[col + 1]);
650 
651  if (warpAtOnePoint(destXIter, srcPos, relativeArea,
652  typename image::detail::image_traits<DestImageT>::image_category())) {
653  ++numGoodPixels;
654  }
655  } // for col
656  // move points from srcPosList to prevSrcPosList (we don't care about what ends up in srcPosList
657  // because it will be reallocated anyway)
658  swap(srcPosList, prevSrcPosList);
659  } // for row
660  } // if interp
661 
662  return numGoodPixels;
663 }
#define LOGL_DEBUG(logger, message...)
Log a debug-level message using a varargs/printf style interface.
Definition: Log.h:515
T back(T... args)
ShiftMap is a linear Mapping which shifts each axis by a specified constant value.
Definition: ShiftMap.h:40
void swap(PolymorphicValue &lhs, PolymorphicValue &rhs) noexcept
Swap specialization for PolymorphicValue.
T clear(T... args)
T emplace_back(T... args)
Transform< Point2Endpoint, Point2Endpoint > TransformPoint2ToPoint2
Definition: Transform.h:300
bool imagesOverlap(ImageBase< T1 > const &image1, ImageBase< T2 > const &image2)
Return true if the pixels for two images or masks overlap in memory.
Definition: Image.cc:692
T reserve(T... args)
int row
Definition: CR.cc:145
int col
Definition: CR.cc:144
table::Key< int > interpLength

◆ wrapApproximate()

void lsst::afw::math::wrapApproximate ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 83 of file _approximate.cc.

83  {
84  wrappers.addSignatureDependency("lsst.afw.image");
85  declareApproximate(wrappers);
86 }

◆ wrapBackground()

void lsst::afw::math::wrapBackground ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 162 of file _background.cc.

162  {
163  // FIXME: review when lsst.afw.image is converted to python wrappers
164  wrappers.addInheritanceDependency("lsst.afw.image.image");
165  declareBackground(wrappers);
166  declareMakeBackground<image::Image<float>>(wrappers);
167  declareMakeBackground<image::MaskedImage<float>>(wrappers);
168  wrappers.wrap(
169  [](auto &mod) { mod.def("stringToUndersampleStyle", stringToUndersampleStyle, "style"_a); });
170 }
void declareBackground(lsst::utils::python::WrapperCollection &wrappers)
Definition: _background.cc:73
UndersampleStyle stringToUndersampleStyle(std::string const &style)
Conversion function to switch a string to an UndersampleStyle.
Definition: Background.cc:117

◆ wrapBoundedField()

void lsst::afw::math::wrapBoundedField ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 97 of file _boundedField.cc.

97  {
98  wrappers.addSignatureDependency("lsst.afw.table.io");
99  declareBoundedField(wrappers);
100 }
void declareBoundedField(lsst::utils::python::WrapperCollection &wrappers)

◆ wrapChebyshevBoundedField()

void lsst::afw::math::wrapChebyshevBoundedField ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 86 of file _chebyshevBoundedField.cc.

86  {
87  wrappers.addSignatureDependency("lsst.afw.image");
88  declareChebyshevBoundedField(wrappers);
89 }

◆ wrapConvolveImage()

void lsst::afw::math::wrapConvolveImage ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 94 of file _convolveImage.cc.

94  {
95  wrappers.addSignatureDependency("lsst.afw.image");
96  declareConvolveImage(wrappers);
97  declareAll<double, double>(wrappers);
98  declareAll<double, float>(wrappers);
99  declareAll<double, int>(wrappers);
100  declareAll<double, std::uint16_t>(wrappers);
101  declareAll<float, float>(wrappers);
102  declareAll<float, int>(wrappers);
103  declareAll<float, std::uint16_t>(wrappers);
104  declareAll<int, int>(wrappers);
105  declareAll<std::uint16_t, std::uint16_t>(wrappers);
106 }

◆ wrapFunction()

void lsst::afw::math::wrapFunction ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 142 of file _function.cc.

142  {
143  wrappers.addSignatureDependency("lsst.afw.table.io");
144  declareAllFunctions<float>(wrappers, "F");
145  declareAllFunctions<double>(wrappers, "D");
146 }

◆ wrapFunctionLibrary()

void lsst::afw::math::wrapFunctionLibrary ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 220 of file _functionLibrary.cc.

220  {
221  wrappers.addInheritanceDependency("lsst.geom");
222  declarePolynomialFunctions<float>(wrappers, "F");
223  declareChebyshevFunctions<float>(wrappers, "F");
224  declareGaussianFunctions<float>(wrappers, "F");
225  declareIntegerDeltaFunctions<float>(wrappers, "F");
226  declareLanczosFunctions<float>(wrappers, "F");
227 
228  declarePolynomialFunctions<double>(wrappers, "D");
229  declareChebyshevFunctions<double>(wrappers, "D");
230  declareGaussianFunctions<double>(wrappers, "D");
231  declareIntegerDeltaFunctions<double>(wrappers, "D");
232  declareLanczosFunctions<double>(wrappers, "D");
233 }

◆ wrapGaussianProcess()

void lsst::afw::math::wrapGaussianProcess ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 153 of file _gaussianProcess.cc.

153  {
154  declareCovariograms<double>(wrappers, "D");
155  declareGaussianProcess<double>(wrappers, "D");
156  declareKdTree<double>(wrappers, "D");
157 }

◆ wrapInterpolate()

void lsst::afw::math::wrapInterpolate ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 38 of file _interpolate.cc.

38  {
39  using PyClass = py::class_<Interpolate, std::shared_ptr<Interpolate>>;
40 
41  auto clsInterpolate = wrappers.wrapType(PyClass(wrappers.module, "Interpolate"), [](auto &mod,
42  auto &cls) {
43  cls.def("interpolate", [](Interpolate &t, double const x) {
44  /*
45  We use a lambda function here because interpolate (with a double) is a virtual function
46  and therefor cannot be wrapped directly.
47  */
48  return t.interpolate(x);
49  });
50 
51  cls.def("interpolate", (std::vector<double>(Interpolate::*)(std::vector<double> const &) const) &
52  Interpolate::interpolate);
53  cls.def("interpolate",
54  (ndarray::Array<double, 1>(Interpolate::*)(ndarray::Array<double const, 1> const &) const) &
55  Interpolate::interpolate);
56 
57  mod.def("makeInterpolate",
60  "x"_a, "y"_a, "style"_a = Interpolate::AKIMA_SPLINE);
61  mod.def("makeInterpolate",
62  (std::shared_ptr<Interpolate>(*)(ndarray::Array<double const, 1> const &,
63  ndarray::Array<double const, 1> const &y,
65  "x"_a, "y"_a, "style"_a = Interpolate::AKIMA_SPLINE);
66 
67  mod.def("stringToInterpStyle", stringToInterpStyle, "style"_a);
68  mod.def("lookupMaxInterpStyle", lookupMaxInterpStyle, "n"_a);
69  mod.def("lookupMinInterpPoints", lookupMinInterpPoints, "style"_a);
70  });
71  wrappers.wrapType(py::enum_<Interpolate::Style>(clsInterpolate, "Style"), [](auto &mod, auto &enm) {
72  enm.value("UNKNOWN", Interpolate::Style::UNKNOWN);
73  enm.value("CONSTANT", Interpolate::Style::CONSTANT);
74  enm.value("LINEAR", Interpolate::Style::LINEAR);
75  enm.value("NATURAL_SPLINE", Interpolate::Style::NATURAL_SPLINE);
76  enm.value("CUBIC_SPLINE", Interpolate::Style::CUBIC_SPLINE);
77  enm.value("CUBIC_SPLINE_PERIODIC", Interpolate::Style::CUBIC_SPLINE_PERIODIC);
78  enm.value("AKIMA_SPLINE", Interpolate::Style::AKIMA_SPLINE);
79  enm.value("AKIMA_SPLINE_PERIODIC", Interpolate::Style::AKIMA_SPLINE_PERIODIC);
80  enm.value("NUM_STYLES", Interpolate::Style::NUM_STYLES);
81  enm.export_values();
82  });
83 }
Interpolate::Style lookupMaxInterpStyle(int const n)
Get the highest order Interpolation::Style available for 'n' points.
Definition: Interpolate.cc:274
int lookupMinInterpPoints(Interpolate::Style const style)
Get the minimum number of points needed to use the requested interpolation style.
Definition: Interpolate.cc:313
Interpolate::Style stringToInterpStyle(std::string const &style)
Conversion function to switch a string to an Interpolate::Style.
Definition: Interpolate.cc:256

◆ wrapKernel()

void lsst::afw::math::wrapKernel ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 39 of file _kernel.cc.

39  {
40  using PyKernel = py::class_<Kernel, std::shared_ptr<Kernel>>;
41 
42  wrappers.addSignatureDependency("lsst.afw.table");
43  wrappers.addSignatureDependency("lsst.afw.table.io");
44 
45  wrappers.wrapType(PyKernel(wrappers.module, "Kernel"), [](auto &mod, auto &cls) {
46  lsst::afw::table::io::python::addPersistableMethods<Kernel>(cls);
47 
48  cls.def("clone", &Kernel::clone);
49  cls.def("resized", &Kernel::resized, "width"_a, "height"_a);
50  cls.def("computeImage", &Kernel::computeImage, "image"_a, "doNormalize"_a, "x"_a = 0.0, "y"_a = 0.0);
51  cls.def("getDimensions", &Kernel::getDimensions);
52  cls.def("setDimensions", &Kernel::setDimensions);
53  cls.def("setWidth", &Kernel::setWidth);
54  cls.def("setHeight", &Kernel::setHeight);
55  cls.def("getWidth", &Kernel::getWidth);
56  cls.def("getHeight", &Kernel::getHeight);
57  cls.def("getCtr", &Kernel::getCtr);
58  cls.def("getBBox", &Kernel::getBBox);
59  cls.def("getNKernelParameters", &Kernel::getNKernelParameters);
60  cls.def("getNSpatialParameters", &Kernel::getNSpatialParameters);
61  cls.def("getSpatialFunction", &Kernel::getSpatialFunction);
62  cls.def("getSpatialFunctionList", &Kernel::getSpatialFunctionList);
63  cls.def("getKernelParameter", &Kernel::getKernelParameter);
64  cls.def("getKernelParameters", &Kernel::getKernelParameters);
65  cls.def("growBBox", &Kernel::growBBox);
66  cls.def("shrinkBBox", &Kernel::shrinkBBox);
67  cls.def("setCtr", &Kernel::setCtr);
68  cls.def("getSpatialParameters", &Kernel::getSpatialParameters);
69  cls.def("isSpatiallyVarying", &Kernel::isSpatiallyVarying);
70  cls.def("setKernelParameters",
71  (void (Kernel::*)(std::vector<double> const &)) & Kernel::setKernelParameters);
72  cls.def("setKernelParameters",
73  (void (Kernel::*)(std::pair<double, double> const &)) & Kernel::setKernelParameters);
74  cls.def("setSpatialParameters", &Kernel::setSpatialParameters);
75  cls.def("computeKernelParametersFromSpatialModel", &Kernel::computeKernelParametersFromSpatialModel);
76  cls.def("toString", &Kernel::toString, "prefix"_a = "");
77  cls.def("computeCache", &Kernel::computeCache);
78  cls.def("getCacheSize", &Kernel::getCacheSize);
79  });
80 
81  using PyFixedKernel = py::class_<FixedKernel, std::shared_ptr<FixedKernel>, Kernel>;
82  wrappers.wrapType(PyFixedKernel(wrappers.module, "FixedKernel"), [](auto &mod, auto &cls) {
83  cls.def(py::init<>());
84  cls.def(py::init<lsst::afw::image::Image<Kernel::Pixel> const &>(), "image"_a);
85  cls.def(py::init<lsst::afw::math::Kernel const &, lsst::geom::Point2D const &>(), "kernel"_a,
86  "pos"_a);
87  cls.def("clone", &FixedKernel::clone);
88  cls.def("resized", &FixedKernel::resized, "width"_a, "height"_a);
89  cls.def("toString", &FixedKernel::toString, "prefix"_a = "");
90  cls.def("getSum", &FixedKernel::getSum);
91  cls.def("isPersistable", &FixedKernel::isPersistable);
92  });
93 
94  using PyAnalyticKernel = py::class_<AnalyticKernel, std::shared_ptr<AnalyticKernel>, Kernel>;
95  wrappers.wrapType(PyAnalyticKernel(wrappers.module, "AnalyticKernel"), [](auto &mod, auto &cls) {
96  cls.def(py::init<>());
97  // Workaround for NullSpatialFunction and py::arg not playing well with Citizen (TODO: no longer
98  // needed?)
99  cls.def(py::init<int, int, AnalyticKernel::KernelFunction const &>(), "width"_a, "height"_a,
100  "kernelFunction"_a);
101  cls.def(py::init<int, int, AnalyticKernel::KernelFunction const &, Kernel::SpatialFunction const &>(),
102  "width"_a, "height"_a, "kernelFunction"_a, "spatialFunction"_a);
103  cls.def(py::init<int, int, AnalyticKernel::KernelFunction const &,
104  std::vector<Kernel::SpatialFunctionPtr> const &>(),
105  "width"_a, "height"_a, "kernelFunction"_a, "spatialFunctionList"_a);
106  cls.def("clone", &AnalyticKernel::clone);
107  cls.def("resized", &AnalyticKernel::resized, "width"_a, "height"_a);
108  cls.def("computeImage", &AnalyticKernel::computeImage, "image"_a, "doNormalize"_a, "x"_a = 0.0,
109  "y"_a = 0.0);
110  cls.def("getKernelParameters", &AnalyticKernel::getKernelParameters);
111  cls.def("getKernelFunction", &AnalyticKernel::getKernelFunction);
112  cls.def("toString", &AnalyticKernel::toString, "prefix"_a = "");
113  cls.def("isPersistable", &AnalyticKernel::isPersistable);
114  });
115 
116  using PyDeltaFunctionKernel =
117  py::class_<DeltaFunctionKernel, std::shared_ptr<DeltaFunctionKernel>, Kernel>;
118  wrappers.wrapType(
119  PyDeltaFunctionKernel(wrappers.module, "DeltaFunctionKernel"), [](auto &mod, auto &cls) {
120  cls.def(py::init<int, int, lsst::geom::Point2I const &>(), "width"_a, "height"_a, "point"_a);
121  cls.def("clone", &DeltaFunctionKernel::clone);
122  cls.def("resized", &DeltaFunctionKernel::resized, "width"_a, "height"_a);
123  cls.def("getPixel", &DeltaFunctionKernel::getPixel);
124  cls.def("toString", &DeltaFunctionKernel::toString, "prefix"_a = "");
125  cls.def("isPersistable", &DeltaFunctionKernel::isPersistable);
126  });
127 
128  using PyLinearCombinationKernel =
129  py::class_<LinearCombinationKernel, std::shared_ptr<LinearCombinationKernel>, Kernel>;
130  wrappers.wrapType(
131  PyLinearCombinationKernel(wrappers.module, "LinearCombinationKernel"), [](auto &mod, auto &cls) {
132  cls.def(py::init<>());
133  cls.def(py::init<KernelList const &, std::vector<double> const &>(), "kernelList"_a,
134  "kernelParameters"_a);
135  cls.def(py::init<KernelList const &, Kernel::SpatialFunction const &>(), "kernelList"_a,
136  "spatialFunction"_a);
137  cls.def(py::init<KernelList const &, std::vector<Kernel::SpatialFunctionPtr> const &>(),
138  "kernelList"_a, "spatialFunctionList"_a);
139  cls.def("clone", &LinearCombinationKernel::clone);
140  cls.def("resized", &LinearCombinationKernel::resized, "width"_a, "height"_a);
141  cls.def("getKernelParameters", &LinearCombinationKernel::getKernelParameters);
142  cls.def("getKernelList", &LinearCombinationKernel::getKernelList);
143  cls.def("getKernelSumList", &LinearCombinationKernel::getKernelSumList);
144  cls.def("getNBasisKernels", &LinearCombinationKernel::getNBasisKernels);
145  cls.def("checkKernelList", &LinearCombinationKernel::checkKernelList);
146  cls.def("isDeltaFunctionBasis", &LinearCombinationKernel::isDeltaFunctionBasis);
147  cls.def("refactor", &LinearCombinationKernel::refactor);
148  cls.def("toString", &LinearCombinationKernel::toString, "prefix"_a = "");
149  cls.def("isPersistable", &LinearCombinationKernel::isPersistable);
150  });
151 
152  using PySeparableKernel = py::class_<SeparableKernel, std::shared_ptr<SeparableKernel>, Kernel>;
153  wrappers.wrapType(PySeparableKernel(wrappers.module, "SeparableKernel"), [](auto &mod, auto &cls) {
154  cls.def(py::init<>());
155  // Workaround for NullSpatialFunction and py::arg not playing well with Citizen (TODO: no longer
156  // needed?)
157  cls.def(py::init<int, int, SeparableKernel::KernelFunction const &,
158  SeparableKernel::KernelFunction const &>(),
159  "width"_a, "height"_a, "kernelColFunction"_a, "kernelRowFunction"_a);
160  cls.def(py::init<int, int, SeparableKernel::KernelFunction const &,
161  SeparableKernel::KernelFunction const &, Kernel::SpatialFunction const &>(),
162  "width"_a, "height"_a, "kernelColFunction"_a, "kernelRowFunction"_a, "spatialFunction"_a);
163  cls.def(py::init<int, int, SeparableKernel::KernelFunction const &,
164  SeparableKernel::KernelFunction const &,
165  std::vector<Kernel::SpatialFunctionPtr> const &>(),
166  "width"_a, "height"_a, "kernelColFunction"_a, "kernelRowFunction"_a, "spatialFunctionList"_a);
167  cls.def("clone", &SeparableKernel::clone);
168  cls.def("resized", &SeparableKernel::resized, "width"_a, "height"_a);
169  cls.def("computeVectors", &SeparableKernel::computeVectors);
170  cls.def("getKernelParameter", &SeparableKernel::getKernelParameter);
171  cls.def("getKernelParameters", &SeparableKernel::getKernelParameters);
172  cls.def("getKernelColFunction", &SeparableKernel::getKernelColFunction);
173  cls.def("getKernelRowFunction", &SeparableKernel::getKernelRowFunction);
174  cls.def("toString", &SeparableKernel::toString, "prefix"_a = "");
175  cls.def("computeCache", &SeparableKernel::computeCache);
176  cls.def("getCacheSize", &SeparableKernel::getCacheSize);
177  });
178 }
Kernels are used for convolution with MaskedImages and (eventually) Images.
Definition: Kernel.h:110

◆ wrapLeastSquares()

void lsst::afw::math::wrapLeastSquares ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 80 of file _leastSquares.cc.

80  {
81  declareLeastSquares<double, double, 0, 0>(wrappers);
82 }

◆ wrapMinimize()

void lsst::afw::math::wrapMinimize ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 60 of file _minimize.cc.

60  {
61  declareMinimize(wrappers);
62  declareFitResults<double>(wrappers);
63  declareFitResults<float>(wrappers);
64 }

◆ wrapOffsetImage()

void lsst::afw::math::wrapOffsetImage ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 74 of file _offsetImage.cc.

74  {
76  wrappers.addSignatureDependency("lsst.afw.image");
77 
78  declareOffsetImage<lsst::afw::image::Image<int>>(wrappers);
79  declareOffsetImage<lsst::afw::image::Image<float>>(wrappers);
80  declareOffsetImage<lsst::afw::image::Image<double>>(wrappers);
81  declareOffsetImage<lsst::afw::image::MaskedImage<int>>(wrappers);
82  declareOffsetImage<lsst::afw::image::MaskedImage<float>>(wrappers);
83  declareOffsetImage<lsst::afw::image::MaskedImage<double>>(wrappers);
84 
85  declareRotateImageBy90<lsst::afw::image::Image<std::uint16_t>>(wrappers);
86  declareRotateImageBy90<lsst::afw::image::Image<int>>(wrappers);
87  declareRotateImageBy90<lsst::afw::image::Image<float>>(wrappers);
88  declareRotateImageBy90<lsst::afw::image::Image<double>>(wrappers);
89  declareRotateImageBy90<lsst::afw::image::MaskedImage<std::uint16_t>>(wrappers);
90  declareRotateImageBy90<lsst::afw::image::MaskedImage<int>>(wrappers);
91  declareRotateImageBy90<lsst::afw::image::MaskedImage<float>>(wrappers);
92  declareRotateImageBy90<lsst::afw::image::MaskedImage<double>>(wrappers);
93  declareRotateImageBy90<lsst::afw::image::Mask<MaskPixel>>(wrappers);
94 
95  declareFlipImage<lsst::afw::image::Image<std::uint16_t>>(wrappers);
96  declareFlipImage<lsst::afw::image::Image<int>>(wrappers);
97  declareFlipImage<lsst::afw::image::Image<float>>(wrappers);
98  declareFlipImage<lsst::afw::image::Image<double>>(wrappers);
99  declareFlipImage<lsst::afw::image::MaskedImage<std::uint16_t>>(wrappers);
100  declareFlipImage<lsst::afw::image::MaskedImage<int>>(wrappers);
101  declareFlipImage<lsst::afw::image::MaskedImage<float>>(wrappers);
102  declareFlipImage<lsst::afw::image::MaskedImage<double>>(wrappers);
103  declareFlipImage<lsst::afw::image::Mask<MaskPixel>>(wrappers);
104 
105  declareBinImage<lsst::afw::image::Image<std::uint16_t>>(wrappers);
106  declareBinImage<lsst::afw::image::Image<int>>(wrappers);
107  declareBinImage<lsst::afw::image::Image<float>>(wrappers);
108  declareBinImage<lsst::afw::image::Image<double>>(wrappers);
109  declareBinImage<lsst::afw::image::MaskedImage<std::uint16_t>>(wrappers);
110  declareBinImage<lsst::afw::image::MaskedImage<int>>(wrappers);
111  declareBinImage<lsst::afw::image::MaskedImage<float>>(wrappers);
112  declareBinImage<lsst::afw::image::MaskedImage<double>>(wrappers);
113 }
std::int32_t MaskPixel
default type for Masks and MaskedImage Masks

◆ wrapPixelAreaBoundedField()

void lsst::afw::math::wrapPixelAreaBoundedField ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 37 of file _pixelAreaBoundedField.cc.

37  {
38  wrappers.wrapType(PyClass(wrappers.module, "PixelAreaBoundedField"), [](auto &mod, auto &cls) {
39  cls.def(py::init<lsst::geom::Box2I const &, std::shared_ptr<afw::geom::SkyWcs const>,
40  lsst::geom::AngleUnit const &, double>(),
41  "bbox"_a, "skyWcs"_a, "unit"_a = lsst::geom::radians, "scaling"_a = 1.0);
42  // All other operations are wrapped by the BoundedField base class.
43  });
44 }

◆ wrapProductBoundedField()

void lsst::afw::math::wrapProductBoundedField ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 37 of file _productBoundedField.cc.

37  {
38  wrappers.wrapType(PyClass(wrappers.module, "ProductBoundedField"), [](auto &mod, auto &cls) {
39  cls.def(py::init<std::vector<std::shared_ptr<BoundedField const>>>());
40  // All other operations are wrapped by the BoundedField base class.
41  });
42 }

◆ wrapRandom()

void lsst::afw::math::wrapRandom ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 103 of file _random.cc.

103  {
104  wrappers.addSignatureDependency("lsst.afw.image");
105  declareRandom(wrappers);
106  declareRandomImage<lsst::afw::image::Image<double>>(wrappers);
107  declareRandomImage<lsst::afw::image::Image<float>>(wrappers);
108 }
void declareRandom(lsst::utils::python::WrapperCollection &wrappers)
Definition: _random.cc:52

◆ wrapSpatialCell()

void lsst::afw::math::wrapSpatialCell ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 262 of file _spatialCell.cc.

262  {
263  declareSpatialCellCandidate(wrappers);
264  declareSpatialCellCandidateIterator(wrappers);
265  declareSpatialCell(wrappers);
266  declareSpatialCellSet(wrappers);
267  declareCandidateVisitor(wrappers);
268  declareSpatialCellImageCandidate(wrappers);
269  /* Test Members */
270  declareTestClasses(wrappers);
271 }

◆ wrapStack()

void lsst::afw::math::wrapStack ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 113 of file _stack.cc.

113  {
114  wrappers.addSignatureDependency("lsst.afw.image");
115  declareStatisticsStack<float>(wrappers);
116  declareStatisticsStack<double>(wrappers);
117 }

◆ wrapStatistics()

void lsst::afw::math::wrapStatistics ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 144 of file _statistics.cc.

144  {
145  wrappers.addSignatureDependency("lsst.afw.image");
146  declareStatistics(wrappers);
147  declareStatistics<unsigned short>(wrappers);
148  declareStatistics<double>(wrappers);
149  declareStatistics<float>(wrappers);
150  declareStatistics<int>(wrappers);
151  // Declare vector overloads separately to prevent casting errors
152  // that otherwise (mysteriously) occur when overloads are tried
153  // in order.
154  declareStatisticsVectorOverloads<unsigned short>(wrappers);
155  declareStatisticsVectorOverloads<double>(wrappers);
156  declareStatisticsVectorOverloads<float>(wrappers);
157  declareStatisticsVectorOverloads<int>(wrappers);
158 }
void declareStatistics(lsst::utils::python::WrapperCollection &wrappers)
Definition: _statistics.cc:37

◆ wrapTransformBoundedField()

void lsst::afw::math::wrapTransformBoundedField ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 64 of file _transformBoundedField.cc.

64  {
65  wrappers.addSignatureDependency("lsst.afw.table.io");
67 }
void declareTransformBoundedField(lsst::utils::python::WrapperCollection &wrappers)

◆ wrapWarpExposure()

void lsst::afw::math::wrapWarpExposure ( lsst::utils::python::WrapperCollection &  wrappers)

Definition at line 168 of file _warpExposure.cc.

168  {
169  wrappers.addSignatureDependency("lsst.afw.image");
170  wrappers.addSignatureDependency("lsst.afw.geom.skyWcs");
171 
172  declareWarpExposure(wrappers);
173  declareWarpingKernel<LanczosWarpingKernel>(wrappers, "LanczosWarpingKernel");
174  declareSimpleWarpingKernel<BilinearWarpingKernel>(wrappers, "BilinearWarpingKernel");
175  declareSimpleWarpingKernel<NearestWarpingKernel>(wrappers, "NearestWarpingKernel");
176  declareWarpingFunctions<double, double>(wrappers);
177  declareWarpingFunctions<double, float>(wrappers);
178  declareWarpingFunctions<double, int>(wrappers);
179  declareWarpingFunctions<double, std::uint16_t>(wrappers);
180  declareWarpingFunctions<float, float>(wrappers);
181  declareWarpingFunctions<float, int>(wrappers);
182  declareWarpingFunctions<float, std::uint16_t>(wrappers);
183  declareWarpingFunctions<int, int>(wrappers);
184  declareWarpingFunctions<std::uint16_t, std::uint16_t>(wrappers);
185 }

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.