LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
CcdImage.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 /*
3  * This file is part of jointcal.
4  *
5  * Developed for the LSST Data Management System.
6  * This product includes software developed by the LSST Project
7  * (https://www.lsst.org).
8  * See the COPYRIGHT file at the top-level directory of this distribution
9  * for details of code ownership.
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  */
24 
25 #ifndef LSST_JOINTCAL_CCD_IMAGE_H
26 #define LSST_JOINTCAL_CCD_IMAGE_H
27 
28 #include <list>
29 #include <string>
30 
32 #include "lsst/afw/table/Source.h"
33 #include "lsst/afw/geom/SkyWcs.h"
37 #include "lsst/geom/Box.h"
38 #include "lsst/geom/SpherePoint.h"
41 #include "lsst/jointcal/Frame.h"
42 
43 namespace lsst {
44 namespace jointcal {
45 
47 
48 typedef int VisitIdType;
49 typedef int CcdIdType;
51 struct CcdImageKey {
54  bool operator!=(CcdImageKey const &right) const { return !(*this == right); }
55  bool operator==(CcdImageKey const &right) const { return (visit == right.visit) && (ccd == right.ccd); }
56 };
57 // typedef std::pair<VisitIdType, CcdIdType> CcdImageKey;
58 std::ostream &operator<<(std::ostream &out, CcdImageKey const &key);
59 
64 class CcdImage {
65 public:
70  std::string const &fluxField);
71 
73  CcdImage(CcdImage const &) = delete;
74  CcdImage(CcdImage &&) = delete;
75  CcdImage &operator=(CcdImage const &) = delete;
76  CcdImage &operator=(CcdImage &&) = delete;
77 
79  std::string getName() const { return _name; }
80 
86  MeasuredStarList const &getWholeCatalog() const { return _wholeCatalog; }
87 
89 
94  MeasuredStarList const &getCatalogForFit() const { return _catalogForFit; }
95  MeasuredStarList &getCatalogForFit() { return _catalogForFit; }
97 
102  }
103 
113 
119  void setCommonTangentPoint(Point const &commonTangentPoint);
120 
126  jointcal::Point const &getCommonTangentPoint() const { return _commonTangentPoint; }
127 
129  return _pixelToCommonTangentPlane;
130  }
131 
133  return _commonTangentPlaneToTangentPlane;
134  }
135 
137  return _tangentPlaneToCommonTangentPlane;
138  }
139 
140  std::shared_ptr<AstrometryTransform> const getPixelToTangentPlane() const { return _pixelToTangentPlane; }
141 
142  std::shared_ptr<AstrometryTransform> const getSkyToTangentPlane() const { return _skyToTangentPlane; }
143 
145  CcdIdType getCcdId() const { return _ccdId; }
146 
148  VisitIdType getVisit() const { return _visit; }
149 
151 
152  CcdImageKey getHashKey() const { return CcdImageKey{_visit, _ccdId}; }
153 
155  double getAirMass() const { return _airMass; }
156 
158  double getMjd() const { return _mjd; }
159 
162 
166  lsst::geom::SpherePoint getBoresightRaDec() const { return _boresightRaDec; }
167 
168  double getHourAngle() const { return _hourAngle; }
169 
170  double getLstObs() const { return _lstObs; }
171 
173  double getSinEta() const { return _sinEta; }
174 
176  double getCosEta() const { return _cosEta; }
177 
179  double getTanZ() const { return _tanZ; }
180 
182  Point getRefractionVector() const { return Point(_tanZ * _cosEta, _tanZ * _sinEta); }
183 
185  std::string getFilter() const { return _filter; }
186 
188  std::shared_ptr<AstrometryTransform> const getReadWcs() const { return _readWcs; }
189 
191  Frame const &getImageFrame() const { return _imageFrame; }
192 
193 private:
195  std::string const &fluxField);
196 
197  jointcal::Frame _imageFrame; // in pixels
198 
199  MeasuredStarList _wholeCatalog; // the catalog of measured objets
200  MeasuredStarList _catalogForFit;
201 
202  std::shared_ptr<AstrometryTransformSkyWcs> _readWcs; // apply goes from pix to sky
203 
204  // The following ones should probably be mostly removed.
205  // go from CommonTangentPlane to this tangent plane.
206  std::shared_ptr<AstrometryTransform> _commonTangentPlaneToTangentPlane;
207  std::shared_ptr<AstrometryTransform> _tangentPlaneToCommonTangentPlane; // reverse one
208  std::shared_ptr<AstrometryTransform> _pixelToCommonTangentPlane; // pixels -> CTP
209  std::shared_ptr<AstrometryTransform> _pixelToTangentPlane;
210 
211  std::shared_ptr<AstrometryTransform> _skyToTangentPlane;
212 
213  std::string _name;
214  CcdIdType _ccdId;
215  VisitIdType _visit;
216 
217  lsst::geom::SpherePoint _boresightRaDec;
218  double _airMass; // airmass value.
219  double _mjd; // modified julian date
222  // refraction
223  // eta : parallactic angle, z: zenithal angle (X = 1/cos(z))
224  double _sinEta, _cosEta, _tanZ;
225  // Local Sidereal Time and hour angle of observation
226  double _lstObs, _hourAngle;
227 
228  std::string _filter;
229 
230  jointcal::Point _commonTangentPoint;
231 };
232 } // namespace jointcal
233 } // namespace lsst
234 
235 // Add our preferred hash of CcdImageKey to the std:: namespace, so it's always available "for free".
236 namespace std {
237 template <>
246  return hash<size_t>()(static_cast<size_t>(key.visit) | (static_cast<size_t>(key.ccd) << 32));
247  }
248 };
249 } // namespace std
250 
251 #endif // LSST_JOINTCAL_CCD_IMAGE_H
lsst::jointcal::CcdImage::getHashKey
CcdImageKey getHashKey() const
Definition: CcdImage.h:152
lsst::jointcal::CcdImageKey::ccd
CcdIdType ccd
Definition: CcdImage.h:53
lsst::jointcal::CcdImage::getSkyToTangentPlane
std::shared_ptr< AstrometryTransform > const getSkyToTangentPlane() const
Definition: CcdImage.h:142
lsst::jointcal::StarList::copyTo
void copyTo(StarList< Star > &copy) const
clears copy and makes a copy of the std::list to copy
Definition: StarList.cc:68
Frame.h
std::string
STL class.
std::shared_ptr< lsst::afw::geom::SkyWcs >
std::list
STL class.
lsst.pipe.tasks.assembleCoadd.filter
filter
Definition: assembleCoadd.py:342
lsst::jointcal::CcdImage::getTanZ
double getTanZ() const
Parallactic angle.
Definition: CcdImage.h:179
lsst::jointcal::CcdImage::getHourAngle
double getHourAngle() const
Definition: CcdImage.h:168
lsst::jointcal::CcdIdType
int CcdIdType
Definition: CcdImage.h:49
AstrometryTransform.h
std::pair< int, int >
lsst::jointcal::CcdImageList
std::list< std::shared_ptr< CcdImage > > CcdImageList
Definition: CcdImage.h:46
lsst::jointcal::CcdImage::operator=
CcdImage & operator=(CcdImage &&)=delete
Box.h
wcs
table::Key< table::Array< std::uint8_t > > wcs
Definition: SkyWcs.cc:71
MeasuredStar.h
lsst::jointcal::CcdImage::CcdImage
CcdImage(CcdImage const &)=delete
No move or copy: each CCD image is unique to that ccd+visit, and Associations holds all CcdImages.
SkyWcs.h
lsst::jointcal::CcdImage::getReadWcs
std::shared_ptr< AstrometryTransform > const getReadWcs() const
the wcs read in the header. NOT updated when fitting.
Definition: CcdImage.h:188
lsst::jointcal::CcdImage::getBoresightRaDec
lsst::geom::SpherePoint getBoresightRaDec() const
Gets the boresight RA/Dec.
Definition: CcdImage.h:166
lsst::jointcal::CcdImage::operator=
CcdImage & operator=(CcdImage const &)=delete
lsst::jointcal::CcdImage::getCatalogForFit
MeasuredStarList & getCatalogForFit()
Definition: CcdImage.h:95
std::list::clear
T clear(T... args)
std::hash< lsst::jointcal::CcdImageKey >::operator()
size_t operator()(lsst::jointcal::CcdImageKey const &key) const
Definition: CcdImage.h:245
lsst::jointcal::CcdImage::getName
std::string getName() const
Return the _name that identifies this ccdImage.
Definition: CcdImage.h:79
lsst::jointcal::CcdImage::CcdImage
CcdImage(CcdImage &&)=delete
lsst::jointcal::CcdImage::getImageFrame
Frame const & getImageFrame() const
Frame in pixels.
Definition: CcdImage.h:191
lsst::jointcal::CcdImage::getRefractionVector
Point getRefractionVector() const
Definition: CcdImage.h:182
std::ostream
STL class.
lsst::jointcal::CcdImage::getWholeCatalog
MeasuredStarList const & getWholeCatalog() const
Gets the as-read catalog.
Definition: CcdImage.h:86
lsst::jointcal::operator<<
std::ostream & operator<<(std::ostream &stream, AstrometryMapping const &mapping)
Definition: AstrometryMapping.h:78
lsst::jointcal::CcdImage
Handler of an actual image from a single CCD.
Definition: CcdImage.h:64
lsst::afw::table._source.SourceCatalog
Definition: _source.py:32
PropertySet.h
lsst::jointcal::CcdImage::getCommonTangentPlaneToTangentPlane
std::shared_ptr< AstrometryTransform > const getCommonTangentPlaneToTangentPlane() const
Definition: CcdImage.h:132
lsst::jointcal::CcdImage::resetCatalogForFit
void resetCatalogForFit()
Clear the catalog for fitting and set it to a copy of the whole catalog.
Definition: CcdImage.h:99
lsst::jointcal::CcdImage::getAirMass
double getAirMass() const
Airmass.
Definition: CcdImage.h:155
lsst::jointcal::CcdImageKey::operator!=
bool operator!=(CcdImageKey const &right) const
Definition: CcdImage.h:54
lsst::jointcal::CcdImage::getSinEta
double getSinEta() const
Parallactic angle.
Definition: CcdImage.h:173
lsst::jointcal::CcdImage::getMjd
double getMjd() const
Julian Date.
Definition: CcdImage.h:158
lsst::jointcal::MeasuredStarList
A list of MeasuredStar. They are usually filled in Associations::createCcdImage.
Definition: MeasuredStar.h:146
lsst::jointcal
Definition: Associations.h:49
lsst::jointcal::CcdImage::getCosEta
double getCosEta() const
Parallactic angle.
Definition: CcdImage.h:176
Source.h
lsst::jointcal::CcdImage::getCommonTangentPoint
jointcal::Point const & getCommonTangentPoint() const
Gets the common tangent point, shared between all ccdImages.
Definition: CcdImage.h:126
lsst.pipe.tasks.assembleCoadd.ccd
ccd
Definition: assembleCoadd.py:343
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
lsst::jointcal::CcdImage::getPixelToTangentPlane
std::shared_ptr< AstrometryTransform > const getPixelToTangentPlane() const
Definition: CcdImage.h:140
photoCalib
Key< int > photoCalib
Definition: Exposure.cc:67
lsst::jointcal::CcdImage::getVisit
VisitIdType getVisit() const
returns visit ID
Definition: CcdImage.h:148
lsst::jointcal::CcdImage::getPixelToCommonTangentPlane
std::shared_ptr< AstrometryTransform > const getPixelToCommonTangentPlane() const
Definition: CcdImage.h:128
lsst::jointcal::CcdImage::getCcdId
CcdIdType getCcdId() const
returns ccd ID
Definition: CcdImage.h:145
std::right
T right(T... args)
lsst::jointcal::CcdImageKey::visit
VisitIdType visit
Definition: CcdImage.h:52
PhotoCalib.h
Implementation of the Photometric Calibration class.
lsst::jointcal::CcdImage::countStars
std::pair< int, int > countStars() const
Count the number of valid measured and reference stars that fall within this ccdImage.
Definition: CcdImage.cc:159
std
STL namespace.
detector
table::Key< int > detector
Definition: DetectorCollection.cc:172
key
Key< U > key
Definition: Schema.cc:281
lsst::jointcal::CcdImage::getLstObs
double getLstObs() const
Definition: CcdImage.h:170
lsst::geom::Box2I
An integer coordinate rectangle.
Definition: Box.h:55
lsst::jointcal::Point
A point in a plane.
Definition: Point.h:36
lsst::jointcal::CcdImage::getDetector
std::shared_ptr< afw::cameraGeom::Detector > getDetector() const
Definition: CcdImage.h:150
SpherePoint.h
lsst::jointcal::CcdImage::getCatalogForFit
MeasuredStarList const & getCatalogForFit() const
Gets the catalog to be used for fitting, which may have been cleaned-up.
Definition: CcdImage.h:94
lsst::geom::SpherePoint
Point in an unspecified spherical coordinate system.
Definition: SpherePoint.h:57
lsst::jointcal::CcdImage::getTangentPlaneToCommonTangentPlane
std::shared_ptr< AstrometryTransform > const getTangentPlaneToCommonTangentPlane() const
Definition: CcdImage.h:136
lsst::jointcal::CcdImageKey
For hashing a ccdImage: the pair of (visit, ccd) IDs should be unique to each ccdImage.
Definition: CcdImage.h:51
lsst::jointcal::CcdImage::getFilter
std::string getFilter() const
return the CcdImage filter name
Definition: CcdImage.h:185
lsst.pipe.tasks.assembleCoadd.visit
visit
Definition: assembleCoadd.py:343
lsst::jointcal::VisitIdType
int VisitIdType
Definition: CcdImage.h:48
lsst::jointcal::CcdImage::getPhotoCalib
std::shared_ptr< afw::image::PhotoCalib > getPhotoCalib() const
Return the exposure's photometric calibration.
Definition: CcdImage.h:161
lsst::jointcal::CcdImage::setCommonTangentPoint
void setCommonTangentPoint(Point const &commonTangentPoint)
Sets the common tangent point and computes necessary transforms.
Definition: CcdImage.cc:174
lsst::jointcal::CcdImageKey::operator==
bool operator==(CcdImageKey const &right) const
Definition: CcdImage.h:55
lsst::afw::table::SortedCatalogT
Custom catalog class for record/table subclasses that are guaranteed to have an ID,...
Definition: fwd.h:63
Detector.h
visitInfo
Key< int > visitInfo
Definition: Exposure.cc:70
lsst::jointcal::CcdImage::CcdImage
CcdImage(afw::table::SourceCatalog &record, std::shared_ptr< lsst::afw::geom::SkyWcs > wcs, std::shared_ptr< lsst::afw::image::VisitInfo > visitInfo, lsst::geom::Box2I const &bbox, std::string const &filter, std::shared_ptr< afw::image::PhotoCalib > photoCalib, std::shared_ptr< afw::cameraGeom::Detector > detector, int visit, int ccd, std::string const &fluxField)
Definition: CcdImage.cc:111
lsst::jointcal::Frame
rectangle with sides parallel to axes.
Definition: Frame.h:38
bbox
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
std::hash
VisitInfo.h