25 #ifndef LSST_JOINTCAL_PHOTOMETRY_TRANSFO_H 26 #define LSST_JOINTCAL_PHOTOMETRY_TRANSFO_H 55 virtual double transform(
double x,
double y,
double value)
const = 0;
61 virtual double transformError(
double x,
double y,
double value,
double valueErr)
const = 0;
77 virtual int getNpar()
const = 0;
87 virtual void offsetParams(Eigen::VectorXd
const &delta) = 0;
101 Eigen::Ref<Eigen::VectorXd> derivatives)
const = 0;
121 void offsetParams(Eigen::VectorXd
const &delta)
override { _value -= delta[0]; };
125 Eigen::VectorXd parameters(1);
126 parameters[0] = _value;
149 double transform(
double x,
double y,
double value)
const override {
return value * getValue(); }
153 return getValue() * valueErr;
158 return std::make_shared<FluxTransfoSpatiallyInvariant>(getValue());
163 Eigen::Ref<Eigen::VectorXd> derivatives)
const override {
165 derivatives[0] = value;
181 double transform(
double x,
double y,
double mag)
const override {
return mag + getValue(); }
190 return std::make_shared<MagnitudeTransfoSpatiallyInvariant>(getValue());
195 Eigen::Ref<Eigen::VectorXd> derivatives)
const override {
242 double transformError(
double x,
double y,
double value,
double valueErr)
const override {
return 0; }
248 int getNpar()
const override {
return _nParameters; }
251 void offsetParams(Eigen::VectorXd
const &delta)
override;
254 ndarray::Array<double, 2, 2>
getCoefficients()
const {
return ndarray::copy(_coefficients); }
269 double computeChebyshev(
double x,
double y)
const;
275 void computeChebyshevDerivatives(
double x,
double y, Eigen::Ref<Eigen::VectorXd> derivatives)
const;
281 ndarray::Array<double, 2, 2> _coefficients;
282 ndarray::Size _order;
283 ndarray::Size _nParameters;
301 double transform(
double x,
double y,
double value)
const override {
302 return value * computeChebyshev(x, y);
307 Eigen::Ref<Eigen::VectorXd> derivatives)
const override {
308 computeChebyshevDerivatives(x, y, derivatives);
309 derivatives *= value;
314 return std::make_shared<FluxTransfoChebyshev>(getCoefficients(), getBBox());
330 double transform(
double x,
double y,
double value)
const override {
331 return value + computeChebyshev(x, y);
336 Eigen::Ref<Eigen::VectorXd> derivatives)
const override {
338 computeChebyshevDerivatives(x, y, derivatives);
343 return std::make_shared<FluxTransfoChebyshev>(getCoefficients(), getBBox());
350 #endif // LSST_JOINTCAL_PHOTOMETRY_TRANSFO_H Photometric offset independent of position, defined as -2.5 * log(flux / fluxMag0).
double transform(double x, double y, double mag) const override
Return the transform of value at (x,y).
virtual Eigen::VectorXd getParameters() const =0
Get a copy of the parameters of this model, in the same order as offsetParams.
double transformError(double x, double y, double value, double valueErr) const override
Return the transformed valueErr at Point(x,y).
A floating-point coordinate rectangle geometry.
double transform(double x, double y, double value) const override
Return the transform of value at (x,y).
ndarray::Array< double, 2, 2 > getCoefficients() const
Get a copy of the coefficients of the polynomials, as a 2d array (NOTE: layout is [y][x]) ...
virtual void dump(std::ostream &stream=std::cout) const =0
dumps the transfo coefficients to stream.
virtual double transform(double x, double y, double value) const =0
Return the transform of value at (x,y).
nth-order 2d Chebyshev photometry transfo, times the input flux.
Photometric offset independent of position, defined as (fluxMag0)^-1.
MagnitudeTransfoChebyshev(size_t order, afw::geom::Box2D const &bbox)
ndarray::Size getOrder() const
afw::geom::Box2D getBBox() const
int getNpar() const override
Return the number of parameters (used to compute chisq)
double transformError(Point const &in, double value, double valueErr) const
Return the transformed valueErr at Point(x,y).
std::shared_ptr< PhotometryTransfo > clone() const override
return a copy (allocated by new) of the transformation.
virtual std::shared_ptr< PhotometryTransfo > clone() const =0
return a copy (allocated by new) of the transformation.
std::shared_ptr< PhotometryTransfo > clone() const override
return a copy (allocated by new) of the transformation.
double transform(double x, double y, double value) const override
Return the transform of value at (x,y).
void computeParameterDerivatives(double x, double y, double value, Eigen::Ref< Eigen::VectorXd > derivatives) const override
Compute the derivatives with respect to the parameters (i.e.
A base class for image defects.
MagnitudeTransfoSpatiallyInvariant(double value=0)
friend std::ostream & operator<<(std::ostream &s, PhotometryTransfo const &transfo)
FluxTransfoSpatiallyInvariant(double value=1)
virtual int getNpar() const =0
Return the number of parameters (used to compute chisq)
void computeParameterDerivatives(double x, double y, double value, Eigen::Ref< Eigen::VectorXd > derivatives) const override
Compute the derivatives with respect to the parameters (i.e.
FluxTransfoChebyshev(size_t order, afw::geom::Box2D const &bbox)
double transformError(double x, double y, double value, double valueErr) const override
Return the transformed valueErr at Point(x,y).
virtual void offsetParams(Eigen::VectorXd const &delta)=0
Offset the parameters by some (negative) amount during fitting.
PhotometryTransfoSpatiallyInvariant(double value)
double transform(Point const &in, double value) const
Return the transformed value at Point(x,y).
FluxTransfoChebyshev(ndarray::Array< double, 2, 2 > const &coefficients, afw::geom::Box2D const &bbox)
MagnitudeTransfoChebyshev(ndarray::Array< double, 2, 2 > const &coefficients, afw::geom::Box2D const &bbox)
Eigen::VectorXd getParameters() const override
Get a copy of the parameters of this model, in the same order as offsetParams.
Photometry offset independent of position.
void dump(std::ostream &stream=std::cout) const override
dumps the transfo coefficients to stream.
double transform(double x, double y, double value) const override
Return the transform of value at (x,y).
nth-order 2d Chebyshev photometry transfo.
std::shared_ptr< PhotometryTransfo > clone() const override
return a copy (allocated by new) of the transformation.
void offsetParams(Eigen::VectorXd const &delta) override
Offset the parameters by some (negative) amount during fitting.
virtual void computeParameterDerivatives(double x, double y, double value, Eigen::Ref< Eigen::VectorXd > derivatives) const =0
Compute the derivatives with respect to the parameters (i.e.
std::shared_ptr< PhotometryTransfo > clone() const override
return a copy (allocated by new) of the transformation.
double transformError(double x, double y, double value, double valueErr) const override
Return the transformed valueErr at Point(x,y).
void computeParameterDerivatives(double x, double y, double value, Eigen::Ref< Eigen::VectorXd > derivatives) const override
Compute the derivatives with respect to the parameters (i.e.
T setprecision(T... args)
nth-order 2d Chebyshev photometry transfo, plus the input flux.
void computeParameterDerivatives(double x, double y, double value, Eigen::Ref< Eigen::VectorXd > derivatives) const override
Compute the derivatives with respect to the parameters (i.e.
A photometric transform, defined in terms of the input flux or magnitude.
virtual double transformError(double x, double y, double value, double valueErr) const =0
Return the transformed valueErr at Point(x,y).
UnaryFunctionT::result_type integrate(UnaryFunctionT func, typename UnaryFunctionT::argument_type const a, typename UnaryFunctionT::argument_type const b, double eps=1.0e-6)
The 1D integrator.
void dump(std::ostream &stream=std::cout) const override
dumps the transfo coefficients to stream.
int getNpar() const override
Return the number of parameters (used to compute chisq)
ndarray::Array< double const, 2, 2 > coefficients