lsst.jointcal  16.0-7-g6e35192
SimplePhotometryModel.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 #ifndef LSST_JOINTCAL_SIMPLE_PHOTOMETRY_MODEL_H
3 #define LSST_JOINTCAL_SIMPLE_PHOTOMETRY_MODEL_H
4 
5 #include <map>
6 
11 #include "lsst/jointcal/Point.h"
12 
13 namespace lsst {
14 namespace jointcal {
15 
16 class CcdImage;
17 class Point;
18 
21 public:
22  SimplePhotometryModel(CcdImageList const &ccdImageList) { _myMap.reserve(ccdImageList.size()); }
23 
29 
31  unsigned assignIndices(std::string const &whatToFit, unsigned firstIndex) override;
32 
34  void offsetParams(Eigen::VectorXd const &delta) override;
35 
37  void freezeErrorTransform() override;
38 
40  void getMappingIndices(CcdImage const &ccdImage, std::vector<unsigned> &indices) const override;
41 
43  int getTotalParameters() const override;
44 
46  void computeParameterDerivatives(MeasuredStar const &measuredStar, CcdImage const &ccdImage,
47  Eigen::VectorXd &derivatives) const override;
48 
50  void dump(std::ostream &stream = std::cout) const override;
51 
52 protected:
54  MapType _myMap;
55 
57  PhotometryMappingBase *findMapping(CcdImage const &ccdImage) const override;
58 };
59 
61 public:
62  SimpleFluxModel(CcdImageList const &ccdImageList);
63 
65  void offsetFittedStar(FittedStar &fittedStar, double delta) const { fittedStar.getFlux() -= delta; }
66 
68  double computeResidual(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
69 
71  double transform(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
72 
74  double transformError(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
75 
77  double getRefError(RefStar const &refStar) const override { return refStar.getFluxErr(); }
78 
80  double computeRefResidual(FittedStar const &fittedStar, RefStar const &refStar) const override {
81  return fittedStar.getFlux() - refStar.getFlux();
82  };
83 
89  std::shared_ptr<afw::image::PhotoCalib> toPhotoCalib(CcdImage const &ccdImage) const override;
90 };
91 
93 public:
94  SimpleMagnitudeModel(CcdImageList const &ccdImageList);
95 
97  void offsetFittedStar(FittedStar &fittedStar, double delta) const { fittedStar.getMag() -= delta; }
98 
100  double computeResidual(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
101 
103  double transform(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
104 
106  double transformError(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
107 
109  double getRefError(RefStar const &refStar) const override { return refStar.getMagErr(); }
110 
112  double computeRefResidual(FittedStar const &fittedStar, RefStar const &refStar) const override {
113  return fittedStar.getMag() - refStar.getMag();
114  };
115 
121  std::shared_ptr<afw::image::PhotoCalib> toPhotoCalib(CcdImage const &ccdImage) const override;
122 };
123 
124 } // namespace jointcal
125 } // namespace lsst
126 
127 #endif // LSST_JOINTCAL_SIMPLE_PHOTOMETRY_MODEL_H
Objects used as position anchors, typically USNO stars.
Definition: RefStar.h:16
virtual double transformError(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const =0
Return the on-sky transformed flux uncertainty for measuredStar on ccdImage.
double getFluxErr(size_t filter) const
reference fluxErr in a given filter
Definition: RefStar.h:44
virtual double computeResidual(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const =0
Relates transfo(s) to their position in the fitting matrix and allows interaction with the transfo(s)...
double computeRefResidual(FittedStar const &fittedStar, RefStar const &refStar) const override
Return the fittedStar - refStar residual appropriate for this model (e.g. flux - flux or mag - mag)...
int getTotalParameters() const override
Return the total number of parameters in this model.
virtual std::shared_ptr< afw::image::PhotoCalib > toPhotoCalib(CcdImage const &ccdImage) const =0
Return the mapping of ccdImage represented as a PhotoCalib.
SimplePhotometryModel(CcdImageList const &ccdImageList)
PhotometryMappingBase * findMapping(CcdImage const &ccdImage) const override
Return the mapping associated with this ccdImage.
void computeParameterDerivatives(MeasuredStar const &measuredStar, CcdImage const &ccdImage, Eigen::VectorXd &derivatives) const override
Compute the parametric derivatives of this model.
double computeRefResidual(FittedStar const &fittedStar, RefStar const &refStar) const override
Return the fittedStar - refStar residual appropriate for this model (e.g. flux - flux or mag - mag)...
double getRefError(RefStar const &refStar) const override
Return the refStar error appropriate for this model (e.g. fluxErr or magErr).
STL class.
void getMappingIndices(CcdImage const &ccdImage, std::vector< unsigned > &indices) const override
Get how this set of parameters (of length Npar()) map into the "grand" fit.
Class for a simple mapping implementing a generic Gtransfo.
void offsetFittedStar(FittedStar &fittedStar, double delta) const
Offset the appropriate flux or magnitude.
double getRefError(RefStar const &refStar) const override
Return the refStar error appropriate for this model (e.g. fluxErr or magErr).
std::unordered_map< CcdImageKey, std::unique_ptr< PhotometryMapping > > MapType
double getMag() const
Definition: BaseStar.h:80
objects measured on actual images.
Definition: MeasuredStar.h:19
double getFlux() const
Definition: BaseStar.h:73
unsigned assignIndices(std::string const &whatToFit, unsigned firstIndex) override
Assign indices in the full matrix to the parameters being fit in the mappings, starting at firstIndex...
T size(T... args)
double getMagErr() const
Definition: BaseStar.h:83
void offsetParams(Eigen::VectorXd const &delta) override
Offset the parameters by the provided amounts.
Interface class for PhotometryFit.
double getFlux(size_t filter) const
reference flux in a given filter
Definition: RefStar.h:42
void offsetFittedStar(FittedStar &fittedStar, double delta) const
Offset the appropriate flux or magnitude.
void dump(std::ostream &stream=std::cout) const override
Dump the contents of the transfos, for debugging.
Handler of an actual image from a single CCD.
Definition: CcdImage.h:41
STL class.
SimplePhotometryModel & operator=(SimplePhotometryModel const &)=delete
Photometric response model which has a single photometric factor per CcdImage.
The objects which have been measured several times.
Definition: FittedStar.h:37
virtual double transform(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const =0
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().
T reserve(T... args)