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 instFlux)
const override {
return instFlux * getValue(); }
129 double transformError(
double x,
double y,
double flux,
double fluxErr)
const override {
130 return getValue() * fluxErr;
135 return std::make_shared<FluxTransfoSpatiallyInvariant>(getValue());
140 Eigen::Ref<Eigen::VectorXd> derivatives)
const override {
142 derivatives[0] = instFlux;
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 {
214 afw::geom::Box2D
const &bbox);
217 double transform(
double x,
double y,
double instFlux)
const override;
220 double transformError(
double x,
double y,
double value,
double valueErr)
const override {
return 0; }
226 int getNpar()
const override {
return _nParameters; }
229 void offsetParams(Eigen::VectorXd
const &delta)
override;
233 return std::make_shared<PhotometryTransfoChebyshev>(ndarray::copy(_coefficients), _bbox);
238 Eigen::Ref<Eigen::VectorXd> derivatives)
const override;
241 ndarray::Array<double, 2, 2>
getCoefficients() {
return ndarray::copy(_coefficients); }
248 afw::geom::Box2D
getBBox()
const {
return _bbox; }
253 afw::geom::Box2D _bbox;
254 afw::geom::AffineTransform _toChebyshevRange;
256 ndarray::Array<double, 2, 2> _coefficients;
257 ndarray::Size _order;
258 ndarray::Size _nParameters;
267 #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 flux, double fluxErr) const override
Return the transformed valueErr at Point(x,y).
double transformError(double x, double y, double value, double valueErr) const override
Return the transformed valueErr at Point(x,y).
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).
Photometric offset independent of position, defined as (fluxMag0)^-1.
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.
Class for a simple mapping implementing a generic Gtransfo.
double transform(double x, double y, double instFlux) const override
Return the transform of value at (x,y).
MagnitudeTransfoSpatiallyInvariant(double value=0)
friend std::ostream & operator<<(std::ostream &s, PhotometryTransfo const &transfo)
FluxTransfoSpatiallyInvariant(double value=1)
virtual void computeParameterDerivatives(double x, double y, double instFlux, Eigen::Ref< Eigen::VectorXd > derivatives) const =0
Compute the derivatives with respect to the parameters (i.e.
virtual int getNpar() const =0
Return the number of parameters (used to compute chisq)
ndarray::Array< double, 2, 2 > getCoefficients()
Get a copy of the coefficients of the polynomials, as a 2d array (NOTE: layout is [y][x]) ...
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).
void computeParameterDerivatives(double x, double y, double instFlux, Eigen::Ref< Eigen::VectorXd > derivatives) const override
Compute the derivatives with respect to the parameters (i.e.
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
std::shared_ptr< PhotometryTransfo > clone() const override
return a copy (allocated by new) of the transformation.
void dump(std::ostream &stream=std::cout) const override
dumps the transfo coefficients to stream.
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.
double transformError(double x, double y, double value, double valueErr) const override
Return the transformed valueErr at Point(x,y).
T setprecision(T... args)
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).
void computeParameterDerivatives(double x, double y, double mag, Eigen::Ref< Eigen::VectorXd > derivatives) const override
Compute the derivatives with respect to the parameters (i.e.
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)