2 #ifndef LSST_JOINTCAL_PHOTOMETRY_TRANSFO_H 3 #define LSST_JOINTCAL_PHOTOMETRY_TRANSFO_H 32 virtual double transform(
double x,
double y,
double value)
const = 0;
38 virtual double transformError(
double x,
double y,
double value,
double valueErr)
const = 0;
54 virtual int getNpar()
const = 0;
64 virtual void offsetParams(Eigen::VectorXd
const &delta) = 0;
78 Eigen::Ref<Eigen::VectorXd> derivatives)
const = 0;
95 int getNpar()
const override {
return 1; }
98 void offsetParams(Eigen::VectorXd
const &delta)
override { _value -= delta[0]; };
102 Eigen::VectorXd parameters(1);
103 parameters[0] = _value;
126 double transform(
double x,
double y,
double value)
const override {
return value * getValue(); }
129 double transformError(
double x,
double y,
double value,
double valueErr)
const override {
130 return getValue() * valueErr;
135 return std::make_shared<FluxTransfoSpatiallyInvariant>(getValue());
140 Eigen::Ref<Eigen::VectorXd> derivatives)
const override {
142 derivatives[0] = value;
158 double transform(
double x,
double y,
double mag)
const override {
return mag + getValue(); }
161 double transformError(
double x,
double y,
double value,
double valueErr)
const override {
167 return std::make_shared<MagnitudeTransfoSpatiallyInvariant>(getValue());
172 Eigen::Ref<Eigen::VectorXd> derivatives)
const override {
215 afw::geom::Box2D
const &bbox);
218 double transformError(
double x,
double y,
double value,
double valueErr)
const override {
return 0; }
224 int getNpar()
const override {
return _nParameters; }
227 void offsetParams(Eigen::VectorXd
const &delta)
override;
230 ndarray::Array<double, 2, 2>
getCoefficients()
const {
return ndarray::copy(_coefficients); }
237 afw::geom::Box2D
getBBox()
const {
return _bbox; }
245 double computeChebyshev(
double x,
double y)
const;
251 void computeChebyshevDerivatives(
double x,
double y, Eigen::Ref<Eigen::VectorXd> derivatives)
const;
254 afw::geom::Box2D _bbox;
255 afw::geom::AffineTransform _toChebyshevRange;
257 ndarray::Array<double, 2, 2> _coefficients;
258 ndarray::Size _order;
259 ndarray::Size _nParameters;
277 double transform(
double x,
double y,
double value)
const override {
278 return value * computeChebyshev(x, y);
283 Eigen::Ref<Eigen::VectorXd> derivatives)
const override {
284 computeChebyshevDerivatives(x, y, derivatives);
285 derivatives *= value;
290 return std::make_shared<FluxTransfoChebyshev>(getCoefficients(), getBBox());
303 double transform(
double x,
double y,
double value)
const override {
304 return value + computeChebyshev(x, y);
309 Eigen::Ref<Eigen::VectorXd> derivatives)
const override {
311 computeChebyshevDerivatives(x, y, derivatives);
316 return std::make_shared<FluxTransfoChebyshev>(getCoefficients(), getBBox());
323 #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).
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.
Class for a simple mapping implementing a generic Gtransfo.
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.
ndarray::Array< double const, 2, 2 > coefficients
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)
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)
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)