2 #ifndef LSST_JOINTCAL_PHOTOMETRY_MAPPING_H 3 #define LSST_JOINTCAL_PHOTOMETRY_MAPPING_H 33 virtual unsigned getNpar()
const = 0;
74 Eigen::Ref<Eigen::VectorXd> derivatives)
const = 0;
122 return _transfo->getNpar();
128 return _transfo->transform(measuredStar.
x, measuredStar.
y, value);
133 return _transfoErrors->transformError(measuredStar.
x, measuredStar.
y, value, valueErr);
143 Eigen::Ref<Eigen::VectorXd> derivatives)
const override {
147 _transfo->computeParameterDerivatives(measuredStar.
x, measuredStar.
y, value, derivatives);
157 void offsetParams(Eigen::VectorXd
const &delta) { _transfo->offsetParams(delta); }
160 Eigen::VectorXd
getParameters()
override {
return _transfo->getParameters(); }
165 for (
unsigned k = 0; k <
getNpar(); ++k) {
166 indices[k] =
index + k;
172 stream <<
"index: " <<
index <<
" fixed: " <<
fixed <<
" transfo parameters: ";
173 _transfo->dump(stream);
197 _chipMapping(
std::
move(chipMapping)),
198 _visitMapping(
std::
move(visitMapping)) {}
201 unsigned getNpar()
const override {
return _nParChips + _nParVisits; }
205 double tempFlux = _chipMapping->getTransfo()->transform(measuredStar.
x, measuredStar.
y, instFlux);
206 return _visitMapping->getTransfo()->transform(measuredStar.
getXFocal(), measuredStar.
getYFocal(),
212 double instFluxErr)
const override;
216 _chipMapping->freezeErrorTransform();
217 _visitMapping->freezeErrorTransform();
222 Eigen::Ref<Eigen::VectorXd> derivatives)
const override;
226 Eigen::VectorXd joined(
getNpar());
227 joined << _chipMapping->getParameters(), _visitMapping->getParameters();
243 void setWhatToFit(
bool const fittingChips,
bool const fittingVisits);
247 stream <<
"index: " <<
index <<
" chipMapping: ";
248 _chipMapping->dump(stream);
249 stream <<
"visitMapping: ";
250 _visitMapping->dump(stream);
258 unsigned _nParChips, _nParVisits;
268 #endif // LSST_JOINTCAL_PHOTOMETRY_MAPPING_H virtual double transform(MeasuredStar const &measuredStar, double instFlux) const =0
Return the on-sky transformed flux for measuredStar on ccdImage.
virtual void freezeErrorTransform()=0
Once this routine has been called, the error transform is not modified by offsetParams().
std::shared_ptr< PhotometryTransfo > getTransfoErrors() const
PhotometryMapping(std::shared_ptr< PhotometryTransfo > transfo)
Value transform takes ownership of transfo, error transform aliases it.
Relates transfo(s) to their position in the fitting matrix and allows interaction with the transfo(s)...
virtual Eigen::VectorXd getParameters()=0
double transform(MeasuredStar const &measuredStar, double value) const override
Return the on-sky transformed flux for measuredStar on ccdImage.
std::shared_ptr< PhotometryMapping > getChipMapping() const
void offsetParams(Eigen::VectorXd const &delta)
Offset the transfo parameters by delta.
virtual double transformError(MeasuredStar const &measuredStar, double value, double valueErr) const =0
Return the on-sky transformed flux uncertainty for measuredStar on ccdImage.
void dump(std::ostream &stream=std::cout) const override
Dump the contents of the transfos, for debugging.
double transformError(MeasuredStar const &measuredStar, double value, double valueErr) const override
Return the on-sky transformed flux uncertainty for measuredStar on ccdImage.
Eigen::VectorXd getParameters() override
double transform(MeasuredStar const &measuredStar, double instFlux) const override
Return the on-sky transformed flux for measuredStar on ccdImage.
void freezeErrorTransform() override
Once this routine has been called, the error transform is not modified by offsetParams().
std::shared_ptr< PhotometryMapping > getVisitMapping() const
void setIndex(unsigned i)
Set the index of this mapping in the grand fit.
void getMappingIndices(std::vector< unsigned > &indices) const override
Gets how this set of parameters (of length getNpar()) map into the "grand" fit.
Class for a simple mapping implementing a generic Gtransfo.
void dump(std::ostream &stream=std::cout) const override
Dump the contents of the transfos, for debugging.
void computeParameterDerivatives(MeasuredStar const &measuredStar, double value, Eigen::Ref< Eigen::VectorXd > derivatives) const override
Compute the derivatives with respect to the parameters (i.e.
objects measured on actual images.
virtual ~PhotometryMappingBase()
ChipVisitPhotometryMapping(std::shared_ptr< PhotometryMapping > chipMapping, std::shared_ptr< PhotometryMapping > visitMapping)
unsigned getNpar() const override
Number of total parameters in this mapping.
PhotometryMappingBase & operator=(PhotometryMappingBase const &)=delete
void setFixed(bool _fixed)
Make this mapping's parameters fixed (i.e. not varied during fitting).
unsigned getIndex()
Get the index of this mapping in the grand fit.
std::shared_ptr< PhotometryTransfo > getTransfo() const
A mapping containing a single photometryTransfo.
virtual void dump(std::ostream &stream=std::cout) const =0
Dump the contents of the transfos, for debugging.
virtual void computeParameterDerivatives(MeasuredStar const &measuredStar, double instFlux, Eigen::Ref< Eigen::VectorXd > derivatives) const =0
Compute the derivatives with respect to the parameters (i.e.
virtual unsigned getNpar() const =0
Number of total parameters in this mapping.
void freezeErrorTransform() override
Once this routine has been called, the error transform is not modified by offsetParams().
virtual void getMappingIndices(std::vector< unsigned > &indices) const =0
Gets how this set of parameters (of length getNpar()) map into the "grand" fit.
A two-level photometric transform: one for the ccd and one for the visit.
unsigned getNpar() const override
Number of total parameters in this mapping.
Eigen::VectorXd getParameters() override