gastro  0.1.0
 All Classes Files Functions Variables Pages
photomfit.h
1 #ifndef PHOTOMFIT__H
2 #define PHOTOMFIT__H
3 
4 #include <iostream>
5 
6 #include "ccdimage.h"
7 #include "fittedstar.h"
8 #include <map>
9 
10 #include "refzp.h"
11 
12 class Associations;
13 
14 
15 class PhotomParam : public RefCount
16 {
17  public :
18  double fluxScale;
19  int index;
20 
21  PhotomParam(const double &FS) : fluxScale(FS), index(-1) {};
22  void SetIndex(const int I) { index=I;}
23  int Index() const { return index;}
24 
25 };
26 
27 #include <list>
28 typedef std::list<CountedRef<PhotomParam> > PhotomParamList;
29 
30 class PhotomFit
31 {
32 private :
33  RefZP refZP ;
34  std::string photomBand;
35  Associations &assoc;
36  double zpRef;
37  CcdImageList refCcds;
38  CcdImageList otherCcds;
39  CcdImageList ccdImageList;
40  FittedStarList &fittedStarList;
41  PhotomParamList photomParamList;
42  int nParTot;
43  double chi2_measured, chi2_ref;
44  int n_measured, n_ref;
45 
46  // pseudo pointer from CcdImage's to PhotomParam's
47  std::map<const CcdImage *, PhotomParam*> imageParamMap;
48  void SetPhotomParam(const CcdImage &C, PhotomParam &P);
49 
50  void init(); // routine to be called by different constructors
51 
52 
53 public :
54 
55  PhotomFit(Associations &A, const RefZP &R);
56 
57  PhotomFit(Associations &A);
58 
59  bool Minimize(const int MaxIter);
60 
61  PhotomParam& GetPhotomParam(const CcdImage &C) const;
62 
63  CcdImageList const& GetCcdImageList() const { return ccdImageList; }
64 
65  double ComputeChi2();
66  void PrintChi2(const std::string &Message) const;
67 
68  void RemoveOutliers(const double &NSigCut);
69  void DumpFluxScales(const std::string &FileNamePattern) const;
70  void WriteCatalog(const std::string &FileName) const;
71 
72  void SaveResults(const std::string &Pattern);
73 
74  private :
75 
76  template <class Op> void loop_on_measurements(CcdImageList &List, Op &);
77 
78  void update_fluxes();
79  void SetMags();
80 
81 };
82 
83 
84 #endif /* PHOTOMFIT__H */
A list of FittedStar s. Such a list is typically constructed by Associations.
Definition: fittedstar.h:158
The class that implements the relations between MeasuredStar and FittedStar.
Definition: associations.h:17
handler of an actual image from a single CCD
Definition: ccdimage.h:21