File Function.h¶
-
namespace
lsst
Class for a simple mapping implementing a generic AstrometryTransform.
Remove all non-astronomical counts from the Chunk Exposure’s pixels.
Forward declarations for lsst::utils::Cache
For details on the Cache class, see the Cache.h file.
It uses a template rather than a pointer so that the derived classes can use the specifics of the transform. The class simplePolyMapping overloads a few routines.
A base class for image defects
Numeric constants used by the Integrate.h integrator routines.
Compute Image Statistics
- Note
Gauss-Kronrod-Patterson quadrature coefficients for use in quadpack routine qng. These coefficients were calculated with 101 decimal digit arithmetic by L. W. Fullerton, Bell Labs, Nov 1981.
- Note
The Statistics class itself can only handle lsst::afw::image::MaskedImage() types. The philosophy has been to handle other types by making them look like lsst::afw::image::MaskedImage() and reusing that code. Users should have no need to instantiate a Statistics object directly, but should use the overloaded makeStatistics() factory functions.
-
namespace
afw
-
namespace
math
Variables
-
template<typename
ReturnT
>
classBasePolynomialFunction2
: public lsst::afw::math::Function2<ReturnT> - #include <Function.h>
Base class for 2-dimensional polynomials of the form:
f(x,y) = c0 f0(x) f0(y) (0th order) + c1 f1(x) f0(x) + c2 f0(x) f1(y) (1st order) + c3 f2(x) f0(y) + c4 f1(x) f1(y) + c5 f0(x) f2(y) (2nd order) + ...
and typically f0(x) = 1
Subclassed by lsst::afw::math::Chebyshev1Function2< ReturnT >, lsst::afw::math::PolynomialFunction2< ReturnT >
Public Functions
-
BasePolynomialFunction2
(unsigned int order) - Parameters
order
: order of polynomial (0 for constant)
Construct a polynomial function of specified order.
The polynomial will have (order + 1) * (order + 2) / 2 coefficients
The parameters are initialized to zero.
-
BasePolynomialFunction2
(std::vector<double> params) - Parameters
params
: polynomial coefficients
Construct a polynomial function with specified parameters.
The order of the polynomial is determined from the length of the params vector (see orderFromNParameters) and only certain lengths are suitable: 1, 3, 6, 10, 15…
- Exceptions
lsst::pex::exceptions::InvalidParameterError
: if params length is unsuitable
-
BasePolynomialFunction2
(BasePolynomialFunction2 const&)
-
BasePolynomialFunction2
(BasePolynomialFunction2&&)
-
BasePolynomialFunction2 &
operator=
(BasePolynomialFunction2 const&)
-
BasePolynomialFunction2 &
operator=
(BasePolynomialFunction2&&)
-
~BasePolynomialFunction2
()
-
int
getOrder
() const Get the polynomial order
-
bool
isLinearCombination
() const Is the function a linear combination of its parameters?
- Return
true if the function can be expressed as: sum over i of parameter_i * function_i(args)
- Warning
: subclasses must override if true.
-
std::vector<double>
getDFuncDParameters
(double x, double y) const Return the derivative of the Function with respect to its parameters
Because this is a polynomial, c0 F0(x,y) + c1 F1(x,y) + c2 F2(x,y) + … we can set ci = 0 for all i except the parameter of interest and evaluate. This isn’t necessarily the most efficient algorithm, but it’s general, and you can override it if it isn’t suitable for your particular subclass.
Public Static Functions
-
static int
nParametersFromOrder
(int order) Compute number of parameters from polynomial order.
- Exceptions
lsst::pex::exceptions::InvalidParameterError
: if order < 0
-
static int
orderFromNParameters
(int nParameters) Compute polynomial order from the number of parameters
Only certain values of nParameters are acceptable, including: nParameters order 1 0 3 1 6 2 10 3 15 4 …
- Exceptions
lsst::pex::exceptions::InvalidParameterError
: if nParameters is invalid
Protected Functions
-
BasePolynomialFunction2
()
Protected Attributes
-
int
_order
order of polynomial
-
-
template<typename
ReturnT
>
classFunction
: public lsst::afw::table::io::PersistableFacade<Function<ReturnT>>, public lsst::afw::table::io::Persistable - #include <Function.h>
Basic Function class.
Function objects are functions whose parameters may be read and changed using getParameters and setParameters. They were designed for use with the Kernel class.
These are simple functors with the restrictions that:
Function arguments and parameters are double precision
The return type is templated
To create a function for a particular equation, subclass Function or (much more likely) Function1 or Function2. Your subclass must:
Have one or more constructors, all of which must initialize _params
Define operator() with code to compute the function using this->_params or this->getParams() to reference the parameters
If the function is a linear combination of parameters then override the function isLinearCombination.
If you wish to cache any information you may use the _isCacheValid flag; this is automatically set false whenever parameters are changed.
Design Notes: The reason these functions exist (rather than using a pre-existing function class, such as Functor in VisualWorkbench) is because the Kernel class requires function objects with a standard interface for setting and getting function parameters.
The reason isLinearCombination exists is to support refactoring LinearCombinationKernels.
Subclassed by lsst::afw::math::Function1< ReturnT >, lsst::afw::math::Function2< ReturnT >
Public Functions
-
Function
(unsigned int nParams) - Parameters
nParams
: number of function parameters
Construct a Function given the number of function parameters.
The function parameters are initialized to 0.
-
Function
(std::vector<double> const ¶ms) - Parameters
params
: function parameters
Construct a Function given the function parameters.
-
Function
(Function const&)
-
Function
(Function&&)
-
Function &
operator=
(Function const&)
-
Function &
operator=
(Function&&)
-
~Function
()
-
unsigned int
getNParameters
() const Return the number of function parameters
- Return
the number of function parameters
-
virtual double
getParameter
(unsigned int ind) const - Parameters
ind
: index of parameter
Get one function parameter without range checking
- Return
the specified function parameter
-
std::vector<double> const &
getParameters
() const Return all function parameters
- Return
the function parameters as a vector
-
virtual bool
isLinearCombination
() const Is the function a linear combination of its parameters?
- Return
true if the function can be expressed as: sum over i of parameter_i * function_i(args)
- Warning
: subclasses must override if true.
-
void
setParameter
(unsigned int ind, double newValue) - Parameters
ind
: index of parameternewValue
: new value for parameter
Set one function parameter without range checking
-
void
setParameters
(std::vector<double> const ¶ms) - Parameters
params
: vector of function parameters
Set all function parameters
- Exceptions
lsst::pex::exceptions::InvalidParameterError
: if the wrong number of parameters is supplied.
Protected Functions
-
std::string
getPythonModule
() const Return the fully-qualified Python module that should be imported to guarantee that its factory is registered.
Must be less than ArchiveIndexSchema::MAX_MODULE_LENGTH characters.
Will be ignored if empty.
-
Function
()
-
template<typename
ReturnT
>
classFunction1
: public lsst::afw::table::io::PersistableFacade<Function1<ReturnT>>, public lsst::afw::math::Function<ReturnT> - #include <Function.h>
A Function taking one argument.
Subclass and override operator() to do useful work.
Subclassed by lsst::afw::math::Chebyshev1Function1< ReturnT >, lsst::afw::math::GaussianFunction1< ReturnT >, lsst::afw::math::IntegerDeltaFunction1< ReturnT >, lsst::afw::math::LanczosFunction1< ReturnT >, lsst::afw::math::NullFunction1< ReturnT >, lsst::afw::math::PolynomialFunction1< ReturnT >
Public Functions
-
Function1
(unsigned int nParams) - Parameters
nParams
: number of function parameters
Construct a Function1 given the number of function parameters.
The function parameters are initialized to 0.
-
Function1
(std::vector<double> const ¶ms) - Parameters
params
: function parameters
Construct a Function1 given the function parameters.
-
Function1
(Function1 const&)
-
Function1
(Function1&&)
-
Function1 &
operator=
(Function1 const&)
-
Function1 &
operator=
(Function1&&)
-
~Function1
()
-
virtual std::shared_ptr<Function1<ReturnT>>
clone
() const = 0 Return a pointer to a deep copy of this function
This function exists instead of a copy constructor so one can obtain a copy of an actual function instead of a useless copy of the base class.
Every concrete subclass must override this method.
- Return
a pointer to a deep copy of the function
-
virtual ReturnT
operator()
(double x) const = 0
-
std::string
toString
(std::string const& = "") const Return a string representation of the function
- Return
a string representation of the function
-
virtual void
computeCache
(int const n)
Protected Functions
-
Function1
()
-
-
template<typename
ReturnT
>
classFunction2
: public lsst::afw::table::io::PersistableFacade<Function2<ReturnT>>, public lsst::afw::math::Function<ReturnT> - #include <Function.h>
A Function taking two arguments.
Subclass and override operator() to do useful work.
Subclassed by lsst::afw::math::BasePolynomialFunction2< ReturnT >, lsst::afw::math::DoubleGaussianFunction2< ReturnT >, lsst::afw::math::GaussianFunction2< ReturnT >, lsst::afw::math::IntegerDeltaFunction2< ReturnT >, lsst::afw::math::LanczosFunction2< ReturnT >, lsst::afw::math::NullFunction2< ReturnT >
Public Functions
-
Function2
(unsigned int nParams) - Parameters
nParams
: number of function parameters
Construct a Function2 given the number of function parameters.
The function parameters are initialized to 0.
-
Function2
(std::vector<double> const ¶ms) - Parameters
params
: function parameters
Construct a Function2 given the function parameters.
The number of function parameters is set to the length of params.
-
Function2
(Function2 const&)
-
Function2
(Function2&&)
-
Function2 &
operator=
(Function2 const&)
-
Function2 &
operator=
(Function2&&)
-
~Function2
()
-
virtual std::shared_ptr<Function2<ReturnT>>
clone
() const = 0 Return a pointer to a deep copy of this function
This function exists instead of a copy constructor so one can obtain a copy of an actual function instead of a useless copy of the base class.
Every non-virtual function must override this method.
- Return
a pointer to a deep copy of the function
-
virtual ReturnT
operator()
(double x, double y) const = 0
Protected Functions
-
Function2
()
-
-
template<typename
ReturnT
>
classNullFunction1
: public lsst::afw::math::Function1<ReturnT> - #include <Function.h>
a class used in function calls to indicate that no Function1 is being provided
Public Functions
-
NullFunction1
()
-
std::shared_ptr<Function1<ReturnT>>
clone
() const Return a pointer to a deep copy of this function
This function exists instead of a copy constructor so one can obtain a copy of an actual function instead of a useless copy of the base class.
Every concrete subclass must override this method.
- Return
a pointer to a deep copy of the function
Private Functions
-
ReturnT
operator()
(double) const¶
-
-
template<typename
ReturnT
>
classNullFunction2
: public lsst::afw::math::Function2<ReturnT> - #include <Function.h>
a class used in function calls to indicate that no Function2 is being provided
Public Functions
-
NullFunction2
()
-
std::shared_ptr<Function2<ReturnT>>
clone
() const Return a pointer to a deep copy of this function
This function exists instead of a copy constructor so one can obtain a copy of an actual function instead of a useless copy of the base class.
Every non-virtual function must override this method.
- Return
a pointer to a deep copy of the function
Private Functions
-
ReturnT
operator()
(double, double) const¶
-
-
template<typename
-
namespace