lsst.jointcal  master-g9041cab851
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
PhotometryMapping.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 #ifndef LSST_JOINTCAL_PHOTOMETRY_MAPPING_H
3 #define LSST_JOINTCAL_PHOTOMETRY_MAPPING_H
4 
5 #include <memory>
6 
8 #include "lsst/jointcal/Point.h"
10 
11 namespace lsst {
12 namespace jointcal {
13 
14 class Point;
15 
17 public:
18  explicit PhotometryMapping(PhotometryTransfo const &_transfo) : index(-1), transfo(_transfo.clone()) {}
19 
21  PhotometryMapping(PhotometryMapping const &) = delete;
25 
27  unsigned getNpar() const { return transfo->getNpar(); }
28 
29  /*
30  * Sets how this set of parameters (of length getNpar()) map into the "grand" fit.
31  * Expects that indices has enough space reserved.
32  */
33  void setMappingIndices(std::vector<unsigned> &indices) const {
34  indices.reserve(getNpar());
35  for (unsigned k = 0; k < getNpar(); ++k) {
36  indices[k] = index + k;
37  }
38  }
39 
46  void computeTransformAndDerivatives(Point const &where, double &out, Eigen::MatrixX2d &H) const;
47 
49  void transformPosAndErrors(Point const &where, double &out) const;
50 
51  void offsetParams(const double *delta) { transfo->offsetParams(delta); }
52 
54  unsigned getIndex() { return index; }
55 
57  void setIndex(unsigned i) { index = i; }
58 
59  PhotometryTransfo const &getTransfo() { return *(transfo.get()); }
60 
61 protected:
62  // Start index of this mapping in the "grand" fit
63  unsigned index;
64 
65  // the actual transformation to be fit
66  std::shared_ptr<PhotometryTransfo> transfo;
67 };
68 
69 } // namespace jointcal
70 } // namespace lsst
71 
72 #endif // LSST_JOINTCAL_PHOTOMETRY_MAPPING_H
PhotometryMapping(PhotometryTransfo const &_transfo)
A point in a plane.
Definition: Point.h:13
PhotometryMapping & operator=(PhotometryMapping const &)=delete
void setIndex(unsigned i)
Set the index of this mapping in the grand fit.
PhotometryTransfo const & getTransfo()
void transformPosAndErrors(Point const &where, double &out) const
The same as above but without the parameter derivatives (used to evaluate chi^2)
void computeTransformAndDerivatives(Point const &where, double &out, Eigen::MatrixX2d &H) const
Applies the mapping and evaluates the derivatives with respect to the fitted parameters.
unsigned getIndex()
Get the index of this mapping in the grand fit.
std::shared_ptr< PhotometryTransfo > transfo
Eigen::Matrix< double, Eigen::Dynamic, 2 > MatrixX2d
Definition: Eigenstuff.h:9
void offsetParams(const double *delta)
unsigned getNpar() const
Number of total parameters in this mapping.
void setMappingIndices(std::vector< unsigned > &indices) const