lsst.jointcal  16.0-18-gdf247dd+6
CcdImage.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 #ifndef LSST_JOINTCAL_CCD_IMAGE_H
3 #define LSST_JOINTCAL_CCD_IMAGE_H
4 
5 #include <list>
6 #include <string>
7 
10 #include "lsst/afw/geom/SkyWcs.h"
14 #include "lsst/afw/geom/Box.h"
17 #include "lsst/jointcal/Gtransfo.h"
18 #include "lsst/jointcal/Frame.h"
19 
20 namespace lsst {
21 namespace jointcal {
22 
24 
25 typedef int VisitIdType;
26 typedef int CcdIdType;
28 struct CcdImageKey {
29  VisitIdType visit;
30  CcdIdType ccd;
31  bool operator!=(CcdImageKey const &right) const { return !(*this == right); }
32  bool operator==(CcdImageKey const &right) const { return (visit == right.visit) && (ccd == right.ccd); }
33 };
34 // typedef std::pair<VisitIdType, CcdIdType> CcdImageKey;
36 
41 class CcdImage {
42 public:
45  std::string const &filter, std::shared_ptr<afw::image::PhotoCalib> photoCalib,
47  std::string const &fluxField);
48 
50  CcdImage(CcdImage const &) = delete;
51  CcdImage(CcdImage &&) = delete;
52  CcdImage &operator=(CcdImage const &) = delete;
53  CcdImage &operator=(CcdImage &&) = delete;
54 
56  std::string getName() const { return _name; }
57 
63  MeasuredStarList const &getWholeCatalog() const { return _wholeCatalog; }
64 
66 
71  MeasuredStarList const &getCatalogForFit() const { return _catalogForFit; }
72  MeasuredStarList &getCatalogForFit() { return _catalogForFit; }
74 
77  getCatalogForFit().clear();
78  getWholeCatalog().copyTo(getCatalogForFit());
79  }
80 
89  std::pair<int, int> countStars() const;
90 
96  void setCommonTangentPoint(Point const &commonTangentPoint);
97 
103  Point const &getCommonTangentPoint() const { return _commonTangentPoint; }
104 
106  Gtransfo const *getPix2CommonTangentPlane() const { return _pix2CommonTangentPlane.get(); }
107 
109  Gtransfo const *getCommonTangentPlane2TP() const { return _CTP2TP.get(); }
110 
112  Gtransfo const *getTP2CommonTangentPlane() const { return _TP2CTP.get(); }
113 
115  Gtransfo const *getPix2TangentPlane() const { return _pix2TP.get(); }
116 
118  Gtransfo const *getSky2TP() const { return _sky2TP.get(); }
119 
121  CcdIdType getCcdId() const { return _ccdId; }
122 
124  VisitIdType getVisit() const { return _visit; }
125 
127 
128  CcdImageKey getHashKey() const { return CcdImageKey{_visit, _ccdId}; }
129 
131  double getAirMass() const { return _airMass; }
132 
134  double getMjd() const { return _mjd; }
135 
138 
142  lsst::afw::geom::SpherePoint getBoresightRaDec() const { return _boresightRaDec; }
143 
145  double getHourAngle() const { return _hourAngle; }
146 
148  double getSinEta() const { return _sineta; }
149 
151  double getCosEta() const { return _coseta; }
152 
154  double getTanZ() const { return _tgz; }
155 
157  Point getRefractionVector() const { return Point(_tgz * _coseta, _tgz * _sineta); }
158 
160  std::string getFilter() const { return _filter; }
161 
163  Gtransfo const *readWCS() const { return _readWcs.get(); }
164 
166  Frame const &getImageFrame() const { return _imageFrame; }
167 
168 private:
170  std::string const &fluxField);
171 
172  Frame _imageFrame; // in pixels
173 
174  MeasuredStarList _wholeCatalog; // the catalog of measured objets
175  MeasuredStarList _catalogForFit;
176 
177  std::shared_ptr<GtransfoSkyWcs> _readWcs; // apply goes from pix to sky
178 
179  // The following ones should probably be mostly removed.
180  std::shared_ptr<Gtransfo> _CTP2TP; // go from CommonTangentPlane to this tangent plane.
181  std::shared_ptr<Gtransfo> _TP2CTP; // reverse one
182  std::shared_ptr<Gtransfo> _pix2CommonTangentPlane; // pixels -> CTP
184 
186 
187  std::string _name;
188  CcdIdType _ccdId;
189  VisitIdType _visit;
190 
191  lsst::afw::geom::SpherePoint _boresightRaDec;
192  double _airMass; // airmass value.
193  double _mjd; // modified julian date
196  // refraction
197  // eta : parallactic angle, z: zenithal angle (X = 1/cos(z))
198  double _sineta, _coseta, _tgz;
199  // Local Sidereal Time and hour angle of observation
200  double _lstObs, _hourAngle;
201 
202  std::string _filter;
203 
204  Point _commonTangentPoint;
205 };
206 } // namespace jointcal
207 } // namespace lsst
208 
209 // Add our preferred hash of CcdImageKey to the std:: namespace, so it's always available "for free".
210 namespace std {
211 template <>
219  size_t operator()(lsst::jointcal::CcdImageKey const &key) const {
220  return hash<size_t>()(static_cast<size_t>(key.visit) | (static_cast<size_t>(key.ccd) << 32));
221  }
222 };
223 } // namespace std
224 
225 #endif // LSST_JOINTCAL_CCD_IMAGE_H
VisitIdType getVisit() const
returns visit ID
Definition: CcdImage.h:124
Gtransfo const * getCommonTangentPlane2TP() const
Definition: CcdImage.h:109
std::ostream & operator<<(std::ostream &out, CcdImageKey const &key)
Definition: CcdImage.cc:28
A point in a plane.
Definition: Point.h:13
bool operator==(CcdImageKey const &right) const
Definition: CcdImage.h:32
Gtransfo const * getSky2TP() const
Definition: CcdImage.h:118
double getCosEta() const
Parallactic angle.
Definition: CcdImage.h:151
std::string getName() const
Return the _name that identifies this ccdImage.
Definition: CcdImage.h:56
table::Box2IKey bbox
Gtransfo const * getPix2CommonTangentPlane() const
Definition: CcdImage.h:106
table::Key< int > detector
For hashing a ccdImage: the pair of (visit, ccd) IDs should be unique to each ccdImage.
Definition: CcdImage.h:28
double getMjd() const
Julian Date.
Definition: CcdImage.h:134
STL namespace.
CcdIdType getCcdId() const
returns ccd ID
Definition: CcdImage.h:121
Gtransfo const * getPix2TangentPlane() const
Definition: CcdImage.h:115
double getSinEta() const
Parallactic angle.
Definition: CcdImage.h:148
A list of MeasuredStar. They are usually filled in Associations::createCcdImage.
Definition: MeasuredStar.h:118
STL class.
void resetCatalogForFit()
Clear the catalog for fitting and set it to a copy of the whole catalog.
Definition: CcdImage.h:76
std::shared_ptr< afw::image::PhotoCalib > getPhotoCalib() const
Return the exposure&#39;s photometric calibration.
Definition: CcdImage.h:137
lsst::afw::geom::SpherePoint getBoresightRaDec() const
Gets the boresight RA/Dec.
Definition: CcdImage.h:142
rectangle with sides parallel to axes.
Definition: Frame.h:15
table::Key< table::Array< std::uint8_t > > wcs
MeasuredStarList & getCatalogForFit()
Gets the catalog to be used for fitting, which may have been cleaned-up.
Definition: CcdImage.h:72
Class for a simple mapping implementing a generic Gtransfo.
Gtransfo const * getTP2CommonTangentPlane() const
Definition: CcdImage.h:112
size_t operator()(lsst::jointcal::CcdImageKey const &key) const
Definition: CcdImage.h:219
Key< U > key
double getHourAngle() const
Definition: CcdImage.h:145
STL class.
double getAirMass() const
Airmass.
Definition: CcdImage.h:131
Key< int > visitInfo
double getTanZ() const
Parallactic angle.
Definition: CcdImage.h:154
Point getRefractionVector() const
Definition: CcdImage.h:157
MeasuredStarList const & getCatalogForFit() const
Gets the catalog to be used for fitting, which may have been cleaned-up.
Definition: CcdImage.h:71
a virtual (interface) class for geometric transformations.
Definition: Gtransfo.h:42
std::string getFilter() const
return the CcdImage filter name
Definition: CcdImage.h:160
Gtransfo const * readWCS() const
the wcs read in the header. NOT updated when fitting.
Definition: CcdImage.h:163
bool operator!=(CcdImageKey const &right) const
Definition: CcdImage.h:31
std::list< std::shared_ptr< CcdImage > > CcdImageList
Definition: CcdImage.h:23
int VisitIdType
Definition: CcdImage.h:25
CcdImageKey getHashKey() const
Definition: CcdImage.h:128
std::shared_ptr< afw::cameraGeom::Detector > getDetector() const
Definition: CcdImage.h:126
Handler of an actual image from a single CCD.
Definition: CcdImage.h:41
STL class.
Point const & getCommonTangentPoint() const
Gets the common tangent point, shared between all ccdImages.
Definition: CcdImage.h:103
MeasuredStarList const & getWholeCatalog() const
Gets the as-read catalog.
Definition: CcdImage.h:63
Frame const & getImageFrame() const
Frame in pixels.
Definition: CcdImage.h:166