lsst.jointcal  16.0-20-g17d57d5+3
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, LOG_LOGGER log, double errorPedestal_ = 0)
23  : PhotometryModel(log, errorPedestal_) {
24  _myMap.reserve(ccdImageList.size());
25  }
26 
32 
34  unsigned assignIndices(std::string const &whatToFit, unsigned firstIndex) override;
35 
37  void offsetParams(Eigen::VectorXd const &delta) override;
38 
40  void freezeErrorTransform() override;
41 
43  void getMappingIndices(CcdImage const &ccdImage, std::vector<unsigned> &indices) const override;
44 
46  int getTotalParameters() const override;
47 
49  void computeParameterDerivatives(MeasuredStar const &measuredStar, CcdImage const &ccdImage,
50  Eigen::VectorXd &derivatives) const override;
51 
53  void dump(std::ostream &stream = std::cout) const override;
54 
55 protected:
57  MapType _myMap;
58 
60  PhotometryMappingBase *findMapping(CcdImage const &ccdImage) const override;
61 };
62 
64 public:
65  SimpleFluxModel(CcdImageList const &ccdImageList, double errorPedestal_ = 0);
66 
68  void offsetFittedStar(FittedStar &fittedStar, double delta) const override {
69  fittedStar.getFlux() -= delta;
70  }
71 
73  double computeResidual(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
74 
76  double transform(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
77 
79  double transformError(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
80 
82  double getRefError(RefStar const &refStar) const override { return refStar.getFluxErr(); }
83 
85  double computeRefResidual(FittedStar const &fittedStar, RefStar const &refStar) const override {
86  return fittedStar.getFlux() - refStar.getFlux();
87  };
88 
94  std::shared_ptr<afw::image::PhotoCalib> toPhotoCalib(CcdImage const &ccdImage) const override;
95 };
96 
98 public:
99  SimpleMagnitudeModel(CcdImageList const &ccdImageList, double errorPedestal_ = 0);
100 
102  void offsetFittedStar(FittedStar &fittedStar, double delta) const override {
103  fittedStar.getMag() -= delta;
104  }
105 
107  double computeResidual(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
108 
110  double transform(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
111 
113  double transformError(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
114 
116  double getRefError(RefStar const &refStar) const override { return refStar.getMagErr(); }
117 
119  double computeRefResidual(FittedStar const &fittedStar, RefStar const &refStar) const override {
120  return fittedStar.getMag() - refStar.getMag();
121  };
122 
128  std::shared_ptr<afw::image::PhotoCalib> toPhotoCalib(CcdImage const &ccdImage) const override;
129 };
130 
131 } // namespace jointcal
132 } // namespace lsst
133 
134 #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
void offsetFittedStar(FittedStar &fittedStar, double delta) const override
Offset the appropriate flux or magnitude (by -delta).
virtual double computeResidual(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const =0
Compute the residual between the model applied to a star and its associated fittedStar.
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.
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.
SimplePhotometryModel(CcdImageList const &ccdImageList, LOG_LOGGER log, double errorPedestal_=0)
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.
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)
void offsetFittedStar(FittedStar &fittedStar, double delta) const override
Offset the appropriate flux or magnitude (by -delta).
double getMagErr() const
Definition: BaseStar.h:83
void offsetParams(Eigen::VectorXd const &delta) override
Offset the parameters by the provided amounts (by -delta).
double getFlux(size_t filter) const
reference flux in a given filter
Definition: RefStar.h:42
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)