gastro  0.1.0
 All Classes Files Functions Variables Pages
ccdimage.h
1 #ifndef CCDIMAGE__H
2 #define CCDIMAGE__H
3 
4 #include <string>
5 
6 #include "measuredstar.h"
7 #include <frame.h>
8 
9 
10 class ReducedImage;
11 class FitsHeader;
12 
13 
14 
15 
16 
17 void SetZpKey(const std::string &AKey);
18 
20 
21 class CcdImage : public RefCount
22 {
23  private:
24 
25  Frame imageFrame; // in pixels
26  MeasuredStarList wholeCatalog; // the catalog of measured objets
27  MeasuredStarList catalogForFit;
28 
29  // these 2 transfos are NOT updated when fitting
30  Gtransfo *readWcs; // i.e. from pix to sky
31  Gtransfo *inverseReadWcs; // i.e. from sky to pix
32 
33  // The following ones should probably be mostly removed.
34  Gtransfo *CTP2TP; // go from CommonTangentPlane to this tangent plane.
35  Gtransfo *TP2CTP; // reverse one
36  Gtransfo *pix2CommonTangentPlane;// pixels -> CTP
37  Gtransfo *pix2TP;
38 
39  Gtransfo* sky2TP;
40 
41  std::string riName;
42  std::string riDir;
43  std::string instrument;
44  int chip; // CCD number
45  int shoot; // Same value for all CcdImages from the same exposure
46  unsigned bandRank; // some incremental band indicator.
47 
48 
49  double expTime; // seconds
50  double airMass; // airmass value.
51  double fluxCoeff; // coefficient to convert ADUs to ADUs/sec at airmass 1
52  double jd; // julian date
53  double toadsZeroPoint;
54  double elixirZP;
55  double photk;
56  double photc;
57  double zp;
58  double psfzp;
59  double seeing;
60  double gfseeing;
61  double sigmaback;
62  std::string dateObs;
63  // refraction
64  double sineta,coseta,tgz,hourAngle; // eta : parallactic angle, z: zenithal angle (X = 1/cos(z))
65 
66  std::string band;
67  std::string flatName;
68  // std::string flat; // full flat name
69  // std::string baseflat; // full baseflat name
70  std::string cfhtscatter; // full scatter name
71  std::string snlsgrid; // our grid corrections
72  std::string flatcvmap; // a multiplicative map to apply to the fluxes
73  int bandIndex;
74  int index;
75  int expindex;
76 
77  Point commonTangentPoint;
78 
79  public:
80 
82  CcdImage(const ReducedImage &Ri, const Point &CommonTangentPoint, const CatalogLoader * LoadIt);
83 
85  std::string Name() const { return riName;}
86 
88  std::string Dir() const { return riDir; }
89 
91  const MeasuredStarList & WholeCatalog() const { return wholeCatalog;}
92 
94  const MeasuredStarList & CatalogForFit() const { return catalogForFit;}
95 
97  MeasuredStarList & CatalogForFit() { return catalogForFit;}
98 
100  const Gtransfo* Pix2CommonTangentPlane() const
101  { return pix2CommonTangentPlane;}
102 
104  const Gtransfo* CommonTangentPlane2TP() const
105  { return CTP2TP;}
106 
108  const Gtransfo* TP2CommonTangentPlane() const
109  { return TP2CTP;}
110 
112  const Gtransfo* Pix2TangentPlane() const
113  { return pix2TP;}
114 
116  const Gtransfo* Sky2TP() const
117  { return sky2TP;}
118 
120  int Chip() const { return chip;}
121 
123  std::string Instrument() const {return instrument;}
124 
126  unsigned BandRank() const {return bandRank;}
127 
129  double Seeing() const { return seeing;}
130 
132  double GFSeeing() const { return gfseeing;}
133 
135  double SigmaBack() const { return sigmaback;}
136 
138  int Shoot() const { return shoot;}
139 
141  double ExpTime() const { return expTime;}
142 
144  double AirMass() const {return airMass;}
145 
147  std::string DateObs() const { return dateObs; }
148 
150  double JD() const { return jd; }
151 
152 
154  double ElixirZP() const { return elixirZP;}
155 
157  double ZP() const { return zp;}
158 
160  double PSFZP() const { return psfzp;}
161 
163  double PhotK() const { return photk; }
164 
166  double PhotC() const { return photc; }
167 
169  double HourAngle() const { return hourAngle; }
170 
172  double SinEta() const { return sineta; }
173 
175  double CosEta() const { return coseta; }
176 
178  double TanZ() const { return tgz; }
179 
181  Point ParallacticVector() const {return Point(tgz*coseta, tgz*sineta);}
182 
184  double FluxCoeff() const { return fluxCoeff;}
185 
187  std::string Band() const { return band;}
188 
190  int BandIndex() const { return bandIndex; }
191 
193  std::string FlatName() const { return flatName;}
194 
196  std::string CFHTScatter() const { return cfhtscatter; }
197 
199  std::string SNLSGrid() const { return snlsgrid; }
200 
202  std::string FlatCVMap() const { return flatcvmap; }
203 
204  void SetPix2TangentPlane(const Gtransfo *);
205 
207  const Gtransfo *ReadWCS() const {return readWcs;}
208 
210  const Gtransfo *InverseReadWCS() const {return inverseReadWcs;}
211 
213  const Frame& ImageFrame() const { return imageFrame;}
214 
216  Frame RaDecFrame() const;
217 
219  // void SetFittedCcd(FittedCcd* ccd) { if(ccd) fittedccd=ccd; }
220  // FittedCcd* GetFittedCcd() { return fittedccd; }
221  // FittedCcd const* GetFittedCcd() const { return fittedccd; }
222 
224  // bool Overlaps(const CcdImage &Other) const;
225 
227  int Index() const { return index; }
228  void SetIndex(int idx) { index = idx; }
229 
231  int ExpIndex() const { return expindex; }
232  void SetExpIndex(int idx) { expindex = idx; }
233 
235  Point const& CommonTangentPoint() const { return commonTangentPoint; }
236 
237  private:
238  CcdImage(const CcdImage &); // forbid copies
239 
240 
241 };
242 
243 
244 /********* CcdImageList *************/
245 
246 #include <list>
247 #include <vector>
248 
249 class CcdImageList : public std::list<CountedRef<CcdImage> >
250 {
251  public:
253  std::vector<int> Shoots() const;
254 
256  std::list<std::string> FlatNames() const;
257 
259  std::list<std::string> DateObs() const;
260 
262  std::list<std::string> Bands() const;
263 
265  double MeanAirmass() const;
266 
268  template<class Accept> CcdImageList SubList(const Accept &OP) const
269  {
270  CcdImageList out;
271  for (const_iterator i = begin(); i != end() ; ++i)
272  if (OP(**i)) out.push_back(*i);
273  return out;
274  }
275 
276  // find the matching image. Chip==-1 means any chip
277  double AirMass(const int Shoot, const int Chip = -1) const;
278 };
279 
280 
281 typedef CcdImageList::iterator CcdImageIterator;
282 typedef CcdImageList::const_iterator CcdImageCIterator;
283 
284 
285 
286 #endif /* CCDIMAGE__H */
double ZP() const
zp from the Fits key set by SetZpKey(std::string)
Definition: ccdimage.h:157
double CosEta() const
Parallactic angle.
Definition: ccdimage.h:175
std::string SNLSGrid() const
SNLS grid.
Definition: ccdimage.h:199
double PhotK() const
absorption term
Definition: ccdimage.h:163
Frame RaDecFrame() const
Frame on sky.
Definition: ccdimage.cc:249
double ExpTime() const
Exposure time (s)
Definition: ccdimage.h:141
std::string FlatCVMap() const
correction map to convert from one set of fluxes to another
Definition: ccdimage.h:202
int Index() const
Fitted Ccd object (contain the refscale parameters)
Definition: ccdimage.h:227
double JD() const
Julian Date.
Definition: ccdimage.h:150
const Gtransfo * ReadWCS() const
the wcs read in the header. NOT updated when fitting.
Definition: ccdimage.h:207
double Seeing() const
returns seeing
Definition: ccdimage.h:129
std::string Band() const
return the CcdImage band name
Definition: ccdimage.h:187
int Shoot() const
returns shoot ID
Definition: ccdimage.h:138
std::string DateObs() const
Date Obs.
Definition: ccdimage.h:147
double SigmaBack() const
returns sigma back
Definition: ccdimage.h:135
handler of an actual image from a single CCD
Definition: ccdimage.h:21
const Gtransfo * InverseReadWCS() const
the inverse of the one above.
Definition: ccdimage.h:210
double ElixirZP() const
Elixir ZP (applies to fluxes in ADU/sec at airmass 1).
Definition: ccdimage.h:154
double TanZ() const
Parallactic angle.
Definition: ccdimage.h:178
int BandIndex() const
return the CcdImage band index. This is a static index that mostly turns a letter (e...
Definition: ccdimage.h:190
double PSFZP() const
zp from the psf zp file, returns 0 if not present
Definition: ccdimage.h:160
int ExpIndex() const
Exposure Index.
Definition: ccdimage.h:231
Point const & CommonTangentPoint() const
Common Tangent Point.
Definition: ccdimage.h:235
std::string Instrument() const
instrument (TOADINST fits pseudo-key)
Definition: ccdimage.h:123
handles the transfos to go from a given image to the system used to fit.
Definition: chip.h:21
int Chip() const
returns chip ID
Definition: ccdimage.h:120
double AirMass() const
Airmass.
Definition: ccdimage.h:144
double FluxCoeff() const
conversion from ADU to ADU/sec at airmass=1
Definition: ccdimage.h:184
A list of MeasuredStar. They are usually filled in Associations::AddImage.
Definition: measuredstar.h:105
double PhotC() const
original ZP
Definition: ccdimage.h:166
unsigned BandRank() const
some incremental band rank. Is used to incrementally index bands in a sample of input images...
Definition: ccdimage.h:126
const Frame & ImageFrame() const
Frame in pixels.
Definition: ccdimage.h:213
double GFSeeing() const
returns gfseeing
Definition: ccdimage.h:132
double SinEta() const
Parallactic angle.
Definition: ccdimage.h:172
std::string FlatName() const
Flat used to flatfield.
Definition: ccdimage.h:193
std::string CFHTScatter() const
Full path of the scatter corrections.
Definition: ccdimage.h:196