gastro  0.1.0
 All Classes Files Functions Variables Pages
photmodel.h
1 // -*- C++ -*-
2 //
3 // photometric calibration model.
4 //
5 #ifndef PHOTMODEL_H
6 #define PHOTMODEL_H
7 
8 #include <vector>
9 #include "matvect.h"
10 
11 
12 class Associations;
13 class MeasuredStar;
14 class FittedStar;
15 class CcdImage;
16 
17 
18 
26 class CCDgStars
27 {
28 public:
29  CCDgStars(unsigned int nstarmax=2000,
30  unsigned int nccdmax=35);
31 
32  ~CCDgStars() {}
33 
35  // bool InitModel(PhotFitter const&, Vect& pars);
36 
45  void InitPars(Vect& pars) const;
46 
48  int NGroups() const { return 2; }
49 
51  unsigned int GroupIndex(int igroup) const;
52 
54  unsigned int Size(int igroup=-1) const;
55 
57  unsigned int NPar(int igroup=-1) const;
58 
59  // //! return the numbers of FITTED parameters
60  // unsigned int NFittedPars(int igroup=-1) const;
61 
63  unsigned int NFittedPhotFactors() const { return nfpf_; }
64 
66  unsigned int NFittedStars() const { return nfs_; }
67 
71  bool CanCompute(const MeasuredStar& var, Vect& pars) const;
72 
74  void InitIndexTables(Vect const& pars);
75 
77  bool Compute(const MeasuredStar& var, const Vect& pars,
78  double& val, Vect& deriv) const;
79 
81  void SetRefCCD(unsigned int ccd, double scale=1.);
82  void ReleaseRefCCD(unsigned int ccd);
83  void SetExclCCD(unsigned int ccd);
84 
85  // void SetRefStar(unsigned int star, double refflux);
86  // void SetExclStar(unsigned int star);
87 
91  int GetPhotFactorIndex(MeasuredStar const&) const;
92 
96  int GetStarFluxIndex(MeasuredStar const&) const;
97 
100  Vect const& pars,
101  Vect const& epars) const;
102 
103 private:
104  // bool hasref_;
105 
106  unsigned int nfpf_;
107  unsigned int nfs_;
108  unsigned int nstarmax_;
109  unsigned int nccdmax_;
110 
111  Vect ref_ccd_;
112  Vect excl_ccd_;
113 
114  // Vect ref_star_;
115  // Vect excl_star_;
116 
117  Vect fitted_ccd_;
118  Vect fitted_star_;
119 
120  Vect photfactindex_;
121  Vect starindex_;
122 };
123 
124 
125 
133 {
134 public:
135  CCDgExpStars(unsigned int nstarmax=2000,
136  unsigned int nccdmax=36,
137  unsigned int nexpmax=1000);
138 
139  ~CCDgExpStars() {}
140 
143  // bool InitFit(PhotFitter const&, Vect& pars);
144 
146  void InitPars(Vect& pars) const;
147 
149  int NGroups() const { return 3; }
150 
152  unsigned int GroupIndex(int igroup) const;
153 
155  unsigned int Size(int igroup=-1) const;
156 
158  unsigned int NPar(int igroup=-1) const;
159 
161  unsigned int NFittedCCDPhotFactors() const { return nfccdpf_; }
162 
164  unsigned int NFittedStars() const { return nfs_; }
165 
167  unsigned int NFittedExposurePhotFactors() const { return nfexppf_; }
168 
172  bool CanCompute(const MeasuredStar& var, Vect& par) const;
173 
175  void InitIndexTables(Vect const& pars);
176 
178  bool Compute(const MeasuredStar& var, const Vect& pars,
179  double& val, Vect& deriv) const;
180 
182  void SetRefCCD(unsigned int ccd, double scale=1.);
183  // void SetExclCCD(unsigned int ccd);
184  void SetRefExp(CcdImage const&, double scale=1.);
185  void SetRefExp(int expindex, double scale=1.);
186  // void SetExclExposure(CcdImage const&);
187  void SetRefStar(FittedStar const&, double flux);
188  // void SetExclStar(FittedStar const&);
189 
191  int GetCcdPhotFactorIndex(MeasuredStar const&) const;
192  int GetExpPhotFactorIndex(MeasuredStar const&) const;
193  int GetStarFluxIndex(MeasuredStar const&) const;
194 
196  void UpdateFittedStar(FittedStar& fs,
197  Vect const& pars,
198  Vect const& epars) const;
199 
200 private:
201  unsigned int nfs_;
202  unsigned int nfccdpf_;
203  unsigned int nfexppf_;
204 
205  unsigned int nstarmax_;
206  unsigned int nccdmax_;
207  unsigned int nexpmax_;
208 
209  Vect ref_ccd_;
210  Vect ref_star_;
211  Vect ref_exp_;
212  // Vect excl_ccd_;
213  // Vect excl_star_;
214  // Vect excl_exp_;
215 
216  Vect ccd_pf_idx_;
217  Vect exp_pf_idx_;
218  Vect star_idx_;
219 };
220 
221 
222 
223 
230 class ExpStars
231 {
232 public:
233  ExpStars(unsigned int nstarmax,
234  unsigned int nccdimmax);
235 
236  ~ExpStars() { }
237 
239  void InitPars(Vect& pars) const;
240 
242  int NGroups() const { return 2; }
243 
245  unsigned int GroupIndex(int igroup) const;
246 
248  unsigned int Size(int igroup=-1) const;
249 
251  unsigned int NPar(int igroup=-1) const;
252 
254  unsigned int NFittedPhotFactors() const { return nfpf_; }
255 
257  unsigned int NFittedStars() const { return nfs_; }
258 
262  bool CanCompute(const MeasuredStar& var, Vect& pars) const;
263 
265  void InitIndexTables(Vect const& pars);
266 
268  bool Compute(const MeasuredStar& var, const Vect& pars,
269  double& val, Vect& deriv) const;
270 
272  void SetRefExp(CcdImage const&, double scale=1.);
273  void SetRefExp(unsigned int expindex, double scale=1.);
274 
276  int GetPhotFactorIndex(MeasuredStar const&) const;
277  int GetStarFluxIndex(MeasuredStar const&) const;
278 
280  void UpdateFittedStar(FittedStar& fs,
281  Vect const& pars,
282  Vect const& epars) const;
283 
284 private:
285  unsigned int nfpf_;
286  unsigned int nfs_;
287 
288  unsigned int nstarmax_;
289  unsigned int nexpmax_;
290 
291 
292  Vect ref_exp_;
293  // Vect ref_star_;
294 
295  Vect exp_idx_;
296  Vect star_idx_;
297 };
298 
299 
300 #endif
301 
unsigned int NPar(int igroup=-1) const
return the total number of parameters
Definition: photmodel.cc:376
unsigned int Size(int igroup=-1) const
return the max size of the model
Definition: photmodel.cc:61
Another model, to see whether we improve the situation by adding one scale per exposure, in addition to fitting one scale per CCD.
Definition: photmodel.h:132
bool Compute(const MeasuredStar &var, const Vect &pars, double &val, Vect &deriv) const
main method: compute the model value and its derivatives
Definition: photmodel.cc:144
This is the simplest model: we fit one scale per CCD and we do not align the exposures.
Definition: photmodel.h:26
bool CanCompute(const MeasuredStar &var, Vect &pars) const
set the pars(i) to 1 (if the corresponding par is a ref) or 2 (if the corresponding par is fitted) le...
Definition: photmodel.cc:79
bool Compute(const MeasuredStar &var, const Vect &pars, double &val, Vect &deriv) const
main method: compute the model values and its derivatives
Definition: photmodel.cc:772
unsigned int NFittedStars() const
number of fitted stars
Definition: photmodel.h:257
unsigned int NPar(int igroup=-1) const
return the size of the parameter std::list
Definition: photmodel.cc:69
void SetRefExp(CcdImage const &, double scale=1.)
declare a CCD (on a given exposure) as REF
Definition: photmodel.cc:832
bool CanCompute(const MeasuredStar &var, Vect &pars) const
set the pars(i) to 1 if the corresponding par is a ref to 2 if the corresponding par is fitted leave ...
Definition: photmodel.cc:714
int NGroups() const
return the size of the parameter std::list
Definition: photmodel.h:149
void InitPars(Vect &pars) const
Initialize the fit from the PhotFitter information.
Definition: photmodel.cc:37
unsigned int NPar(int igroup=-1) const
total number of parameters
Definition: photmodel.cc:705
unsigned int NFittedCCDPhotFactors() const
return the total number of fitted CCD (global) photometric factors
Definition: photmodel.h:161
void InitIndexTables(Vect const &pars)
Init the index tables.
Definition: photmodel.cc:116
int GetPhotFactorIndex(MeasuredStar const &) const
indexing methods
Definition: photmodel.cc:847
The class that implements the relations between MeasuredStar and FittedStar.
Definition: associations.h:17
void SetRefCCD(unsigned int ccd, double scale=1.)
Declare a CCD (on a given exposure) as a ref.
Definition: photmodel.cc:567
unsigned int Size(int igroup=-1) const
return the max size of the model
Definition: photmodel.cc:697
handler of an actual image from a single CCD
Definition: ccdimage.h:21
unsigned int NFittedPhotFactors() const
number of photometric factors
Definition: photmodel.h:254
void UpdateFittedStar(FittedStar &fs, Vect const &pars, Vect const &epars) const
update the internal parameters of the fitted star
Definition: photmodel.cc:290
void UpdateFittedStar(FittedStar &fs, Vect const &pars, Vect const &epars) const
update the measurements
Definition: photmodel.cc:870
void InitIndexTables(Vect const &pars)
init the index tables
Definition: photmodel.cc:438
void InitIndexTables(Vect const &pars)
Init the index tables.
Definition: photmodel.cc:747
int NGroups() const
parameter groups
Definition: photmodel.h:48
void UpdateFittedStar(FittedStar &fs, Vect const &pars, Vect const &epars) const
update the internal parameters of the fitted star
Definition: photmodel.cc:639
unsigned int NFittedExposurePhotFactors() const
return the number of exposure photometric factors
Definition: photmodel.h:167
unsigned int NFittedPhotFactors() const
return the total number of fitted phot factors
Definition: photmodel.h:63
unsigned int GroupIndex(int igroup) const
group index
Definition: photmodel.cc:689
int GetCcdPhotFactorIndex(MeasuredStar const &) const
indexing methods
Definition: photmodel.cc:605
The objects which have been measured several times. The MeasuredStar s measuring the same object in d...
Definition: fittedstar.h:37
Another model, were we fit juste one scale per exposure.
Definition: photmodel.h:230
unsigned int GroupIndex(int igroup) const
group index
Definition: photmodel.cc:52
int NGroups() const
parameter groups
Definition: photmodel.h:242
bool CanCompute(const MeasuredStar &var, Vect &par) const
set the pars(i) to 1 if the corresponding par is a reference 2 if the corresponding par can be fitted...
Definition: photmodel.cc:386
unsigned int NFittedStars() const
return the total number of fitted stars
Definition: photmodel.h:66
objects measured on actual images. Coordinates and uncertainties are expressed in pixel image frame...
Definition: measuredstar.h:21
void InitPars(Vect &pars) const
initialize the fit – determine the total number fitted parameters
Definition: photmodel.cc:676
int GetPhotFactorIndex(MeasuredStar const &) const
return the ccdimage photometric factor index in the parameter std::vector we give the measured star b...
Definition: photmodel.cc:266
unsigned int Size(int igroup=-1) const
return the max size of the model
Definition: photmodel.cc:366
void SetRefCCD(unsigned int ccd, double scale=1.)
Declare a given CCD as reference.
Definition: photmodel.cc:238
unsigned int GroupIndex(int igroup) const
group index
Definition: photmodel.cc:356
int GetStarFluxIndex(MeasuredStar const &) const
return the star flux index in the parameter std::vector we give the measured star in arg because we m...
Definition: photmodel.cc:277
void InitPars(Vect &pars) const
initialize the fit parameters w/ info found in the fitter –or maybe just in the associations ...
Definition: photmodel.cc:342
unsigned int NFittedStars() const
return the total number of fitted stars
Definition: photmodel.h:164
bool Compute(const MeasuredStar &var, const Vect &pars, double &val, Vect &deriv) const
main method compute the model values and its derivatives
Definition: photmodel.cc:477