lsst.jointcal  16.0-15-g8e16a51+13
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 override {
66  fittedStar.getFlux() -= delta;
67  }
68 
70  double computeResidual(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
71 
73  double transform(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
74 
76  double transformError(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
77 
79  double getRefError(RefStar const &refStar) const override { return refStar.getFluxErr(); }
80 
82  double computeRefResidual(FittedStar const &fittedStar, RefStar const &refStar) const override {
83  return fittedStar.getFlux() - refStar.getFlux();
84  };
85 
91  std::shared_ptr<afw::image::PhotoCalib> toPhotoCalib(CcdImage const &ccdImage) const override;
92 };
93 
95 public:
96  SimpleMagnitudeModel(CcdImageList const &ccdImageList);
97 
99  void offsetFittedStar(FittedStar &fittedStar, double delta) const override {
100  fittedStar.getMag() -= delta;
101  }
102 
104  double computeResidual(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
105 
107  double transform(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
108 
110  double transformError(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override;
111 
113  double getRefError(RefStar const &refStar) const override { return refStar.getMagErr(); }
114 
116  double computeRefResidual(FittedStar const &fittedStar, RefStar const &refStar) const override {
117  return fittedStar.getMag() - refStar.getMag();
118  };
119 
125  std::shared_ptr<afw::image::PhotoCalib> toPhotoCalib(CcdImage const &ccdImage) const override;
126 };
127 
128 } // namespace jointcal
129 } // namespace lsst
130 
131 #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.
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.
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).
Interface class for PhotometryFit.
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)