LSSTApplications  11.0-13-gbb96280,12.1+18,12.1+7,12.1-1-g14f38d3+72,12.1-1-g16c0db7+5,12.1-1-g5961e7a+84,12.1-1-ge22e12b+23,12.1-11-g06625e2+4,12.1-11-g0d7f63b+4,12.1-19-gd507bfc,12.1-2-g7dda0ab+38,12.1-2-gc0bc6ab+81,12.1-21-g6ffe579+2,12.1-21-gbdb6c2a+4,12.1-24-g941c398+5,12.1-3-g57f6835+7,12.1-3-gf0736f3,12.1-37-g3ddd237,12.1-4-gf46015e+5,12.1-5-g06c326c+20,12.1-5-g648ee80+3,12.1-5-gc2189d7+4,12.1-6-ga608fc0+1,12.1-7-g3349e2a+5,12.1-7-gfd75620+9,12.1-9-g577b946+5,12.1-9-gc4df26a+10
LSSTDataManagementBasePackage
ExposureInfo.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*- // fixed format comment for emacs
2 /*
3  * LSST Data Management System
4  * Copyright 2008-2013 LSST Corporation.
5  *
6  * This product includes software developed by the
7  * LSST Project (http://www.lsst.org/).
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the LSST License Statement and
20  * the GNU General Public License along with this program. If not,
21  * see <http://www.lsstcorp.org/LegalNotices/>.
22  */
23 
24 #ifndef LSST_AFW_IMAGE_ExposureInfo_h_INCLUDED
25 #define LSST_AFW_IMAGE_ExposureInfo_h_INCLUDED
26 
27 #include "lsst/base.h"
28 #include "lsst/daf/base.h"
29 #include "lsst/afw/geom/Point.h"
30 #include "lsst/afw/image/Filter.h"
34 
35 namespace lsst { namespace afw {
36 
37 namespace cameraGeom {
38 class Detector;
39 }
40 
41 namespace detection {
42 class Psf;
43 }
44 
45 namespace geom { namespace polygon {
46 class Polygon;
47 }}
48 
49 namespace fits {
50 class Fits;
51 }
52 
53 namespace image {
54 
55 class Calib;
56 class Wcs;
57 class ApCorrMap;
58 class VisitInfo;
59 
83 class ExposureInfo {
84 public:
85 
87  bool hasWcs() const { return static_cast<bool>(_wcs); }
88 
90  PTR(Wcs) getWcs() { return _wcs; }
91 
93  CONST_PTR(Wcs) getWcs() const { return _wcs; }
94 
96  void setWcs(CONST_PTR(Wcs) wcs) { _wcs = _cloneWcs(wcs); }
97 
99  bool hasDetector() const { return static_cast<bool>(_detector); }
100 
103 
105  void setDetector(CONST_PTR(cameraGeom::Detector) detector) { _detector = detector; }
106 
108  Filter getFilter() const { return _filter; }
109 
111  void setFilter(Filter const& filter) { _filter = filter; }
112 
114  bool hasCalib() const { return static_cast<bool>(_calib); }
115 
117  PTR(Calib) getCalib() { return _calib; }
118 
120  CONST_PTR(Calib) getCalib() const { return _calib; }
121 
123  void setCalib(CONST_PTR(Calib) calib) { _calib = _cloneCalib(calib); }
124 
127 
129  void setMetadata(PTR(daf::base::PropertySet) metadata) { _metadata = metadata; }
130 
132  bool hasPsf() const { return static_cast<bool>(_psf); }
133 
135  PTR(detection::Psf) getPsf() const { return _psf; }
136 
139  // Psfs are immutable, so this is always safe; it'd be better to always just pass around
140  // const or non-const pointers, instead of both, but this is more backwards-compatible.
141  _psf = std::const_pointer_cast<detection::Psf>(psf);
142  }
143 
145  bool hasValidPolygon() const { return static_cast<bool>(_validPolygon);}
146 
149 
152 
154  bool hasApCorrMap() const { return static_cast<bool>(_apCorrMap); }
155 
158 
160  PTR(ApCorrMap const) getApCorrMap() const { return _apCorrMap; }
161 
163  void setApCorrMap(PTR(ApCorrMap) apCorrMap) { _apCorrMap = apCorrMap; }
164 
171  void initApCorrMap();
172 
174  bool hasCoaddInputs() const { return static_cast<bool>(_coaddInputs); }
175 
177  void setCoaddInputs(PTR(CoaddInputs) coaddInputs) { _coaddInputs = coaddInputs; }
178 
181 
184 
186  bool hasVisitInfo() const { return static_cast<bool>(_visitInfo); }
187 
189  void setVisitInfo(CONST_PTR(image::VisitInfo) const visitInfo) { _visitInfo = visitInfo; }
190 
198  explicit ExposureInfo(
199  CONST_PTR(Wcs) const & wcs = CONST_PTR(Wcs)(),
201  CONST_PTR(Calib) const & calib = CONST_PTR(Calib)(),
204  Filter const & filter = Filter(),
205  PTR(daf::base::PropertySet) const & metadata = PTR(daf::base::PropertySet)(),
206  PTR(CoaddInputs) const & coaddInputs = PTR(CoaddInputs)(),
207  PTR(ApCorrMap) const & apCorrMap = PTR(ApCorrMap)(),
208  CONST_PTR(image::VisitInfo) const & visitInfo = CONST_PTR(image::VisitInfo)()
209  );
210 
212  ExposureInfo(ExposureInfo const & other);
213 
215  ExposureInfo(ExposureInfo const & other, bool copyMetadata);
216 
218  ExposureInfo & operator=(ExposureInfo const & other);
219 
220  // Destructor defined in source file because we need access to destructors of forward-declared components
221  ~ExposureInfo();
222 
223 private:
224 
225  template <typename ImageT, typename MaskT, typename VarianceT> friend class Exposure;
226 
240  struct FitsWriteData {
245  table::io::OutputArchive archive;
246  };
247 
256  FitsWriteData _startWriteFits(geom::Point2I const & xy0=geom::Point2I()) const;
257 
271  void _finishWriteFits(fits::Fits & fitsfile, FitsWriteData const & data) const;
272 
280  void _readFits(
281  fits::Fits & fitsfile,
282  PTR(daf::base::PropertySet) metadata,
283  PTR(daf::base::PropertySet) imageMetadata
284  );
285 
286  static PTR(Calib) _cloneCalib(CONST_PTR(Calib) calib);
287  static PTR(Wcs) _cloneWcs(CONST_PTR(Wcs) wcs);
288  static PTR(ApCorrMap) _cloneApCorrMap(PTR(ApCorrMap const) apCorrMap);
289 
291  PTR(detection::Psf) _psf;
293  CONST_PTR(cameraGeom::Detector) _detector;
294  CONST_PTR(geom::polygon::Polygon) _validPolygon;
296  PTR(daf::base::PropertySet) _metadata;
300 };
301 
302 }}} // lsst::afw::image
303 
304 #endif // !LSST_AFW_IMAGE_ExposureInfo_h_INCLUDED
void setWcs(boost::shared_ptr< Wcs const > wcs)
Set the coordinate system of the exposure.
Definition: ExposureInfo.h:96
boost::shared_ptr< ApCorrMap > _apCorrMap
Definition: ExposureInfo.h:298
void setVisitInfo(boost::shared_ptr< image::VisitInfo const > const visitInfo)
Set the exposure&#39;s visit info.
Definition: ExposureInfo.h:189
boost::shared_ptr< detection::Psf > getPsf() const
Return the exposure&#39;s point-spread function.
Definition: ExposureInfo.h:135
A coordinate class intended to represent absolute positions.
void _finishWriteFits(fits::Fits &fitsfile, FitsWriteData const &data) const
Write any additional non-image HDUs to a FITS file.
boost::shared_ptr< daf::base::PropertyList > imageMetadata
Definition: ExposureInfo.h:242
boost::shared_ptr< image::VisitInfo const > getVisitInfo() const
Return the exposure&#39;s visit info.
Definition: ExposureInfo.h:183
void setCoaddInputs(boost::shared_ptr< CoaddInputs > coaddInputs)
Set the exposure&#39;s coadd provenance catalogs.
Definition: ExposureInfo.h:177
boost::shared_ptr< image::VisitInfo const > _visitInfo
Definition: ExposureInfo.h:299
void setMetadata(boost::shared_ptr< daf::base::PropertySet > metadata)
Set the flexible metadata.
Definition: ExposureInfo.h:129
Class for storing ordered metadata with comments.
Definition: PropertyList.h:82
A thin wrapper around std::map to allow aperture corrections to be attached to Exposures.
Definition: ApCorrMap.h:42
A class to contain the data, WCS, and other information needed to describe an image of the sky...
Definition: Exposure.h:46
bool hasCalib() const
Does this exposure have a Calib?
Definition: ExposureInfo.h:114
static boost::shared_ptr< Wcs > _cloneWcs(boost::shared_ptr< Wcs const > wcs)
Definition: ExposureInfo.cc:64
Information about a single exposure of an imaging camera.
Definition: VisitInfo.h:63
tbl::Key< int > wcs
bool hasValidPolygon() const
Does this exposure have a valid Polygon.
Definition: ExposureInfo.h:145
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:107
ExposureInfo(boost::shared_ptr< Wcs const > const &wcs=boost::shared_ptr< Wcs const >(), boost::shared_ptr< detection::Psf const > const &psf=boost::shared_ptr< detection::Psf const >(), boost::shared_ptr< Calib const > const &calib=boost::shared_ptr< Calib const >(), boost::shared_ptr< cameraGeom::Detector const > const &detector=boost::shared_ptr< cameraGeom::Detector const >(), boost::shared_ptr< geom::polygon::Polygon const > const &polygon=boost::shared_ptr< geom::polygon::Polygon const >(), Filter const &filter=Filter(), boost::shared_ptr< daf::base::PropertySet > const &metadata=boost::shared_ptr< daf::base::PropertySet >(), boost::shared_ptr< CoaddInputs > const &coaddInputs=boost::shared_ptr< CoaddInputs >(), boost::shared_ptr< ApCorrMap > const &apCorrMap=boost::shared_ptr< ApCorrMap >(), boost::shared_ptr< image::VisitInfo const > const &visitInfo=boost::shared_ptr< image::VisitInfo const >())
Construct an ExposureInfo from its various components.
Definition: ExposureInfo.cc:77
Point< int, 2 > Point2I
Definition: Point.h:285
bool hasCoaddInputs() const
Does this exposure have coadd provenance catalogs?
Definition: ExposureInfo.h:174
boost::shared_ptr< cameraGeom::Detector const > getDetector() const
Return the exposure&#39;s Detector information.
Definition: ExposureInfo.h:102
Describe an exposure&#39;s calibration.
Definition: Calib.h:82
static boost::shared_ptr< Calib > _cloneCalib(boost::shared_ptr< Calib const > calib)
Definition: ExposureInfo.cc:58
A simple Persistable struct containing ExposureCatalogs that record the inputs to a coadd...
Definition: CoaddInputs.h:46
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
bool hasVisitInfo() const
Does this exposure have visit info?
Definition: ExposureInfo.h:186
boost::shared_ptr< daf::base::PropertySet > _metadata
Definition: ExposureInfo.h:296
ExposureInfo & operator=(ExposureInfo const &other)
Assignment; deep-copies all components except the metadata.
boost::shared_ptr< geom::polygon::Polygon const > getValidPolygon() const
Return the valid Polygon.
Definition: ExposureInfo.h:148
A struct passed back and forth between Exposure and ExposureInfo when writing FITS files...
Definition: ExposureInfo.h:240
boost::shared_ptr< detection::Psf > _psf
Definition: ExposureInfo.h:291
void initApCorrMap()
Set the exposure&#39;s aperture correction map to a new, empty map.
boost::shared_ptr< Wcs > getWcs()
Return the coordinate system of the exposure.
Definition: ExposureInfo.h:90
void setFilter(Filter const &filter)
Set the exposure&#39;s filter.
Definition: ExposureInfo.h:111
void setDetector(boost::shared_ptr< cameraGeom::Detector const > detector)
Set the exposure&#39;s Detector information.
Definition: ExposureInfo.h:105
boost::shared_ptr< daf::base::PropertyList > maskMetadata
Definition: ExposureInfo.h:243
boost::shared_ptr< Wcs > _wcs
Definition: ExposureInfo.h:290
boost::shared_ptr< ApCorrMap > getApCorrMap()
Return the exposure&#39;s aperture correction map (null pointer if !hasApCorrMap())
Definition: ExposureInfo.h:157
Holds an integer identifier for an LSST filter.
Definition: Filter.h:108
boost::shared_ptr< cameraGeom::Detector const > _detector
Definition: ExposureInfo.h:293
void setPsf(boost::shared_ptr< detection::Psf const > psf)
Set the exposure&#39;s point-spread function.
Definition: ExposureInfo.h:138
static boost::shared_ptr< ApCorrMap > _cloneApCorrMap(boost::shared_ptr< ApCorrMap const > apCorrMap)
Definition: ExposureInfo.cc:70
Filter getFilter() const
Return the exposure&#39;s filter.
Definition: ExposureInfo.h:108
Information about a CCD or other imaging detector.
Definition: Detector.h:65
bool hasPsf() const
Does this exposure have a Psf?
Definition: ExposureInfo.h:132
void setCalib(boost::shared_ptr< Calib const > calib)
Set the Exposure&#39;s Calib object.
Definition: ExposureInfo.h:123
#define PTR(...)
Definition: base.h:41
bool hasWcs() const
Does this exposure have a Wcs?
Definition: ExposureInfo.h:87
void _readFits(fits::Fits &fitsfile, boost::shared_ptr< daf::base::PropertySet > metadata, boost::shared_ptr< daf::base::PropertySet > imageMetadata)
Read from a FITS file and metadata.
Class for storing generic metadata.
Definition: PropertySet.h:82
boost::shared_ptr< daf::base::PropertySet > getMetadata() const
Return flexible metadata.
Definition: ExposureInfo.h:126
Cartesian polygons.
Definition: Polygon.h:55
bool hasApCorrMap() const
Return true if the exposure has an aperture correction map.
Definition: ExposureInfo.h:154
boost::shared_ptr< Calib > _calib
Definition: ExposureInfo.h:292
void setApCorrMap(boost::shared_ptr< ApCorrMap > apCorrMap)
Set the exposure&#39;s aperture correction map (null pointer if !hasApCorrMap())
Definition: ExposureInfo.h:163
boost::shared_ptr< CoaddInputs > getCoaddInputs() const
Return a pair of catalogs that record the inputs, if this Exposure is a coadd (otherwise null)...
Definition: ExposureInfo.h:180
void setValidPolygon(boost::shared_ptr< geom::polygon::Polygon const > polygon)
Set the exposure&#39;s valid Polygon.
Definition: ExposureInfo.h:151
#define CONST_PTR(...)
A shared pointer to a const object.
Definition: base.h:47
boost::shared_ptr< daf::base::PropertyList > metadata
Definition: ExposureInfo.h:241
A collection of all the things that make an Exposure different from a MaskedImage.
Definition: ExposureInfo.h:83
A polymorphic base class for representing an image&#39;s Point Spread Function.
Definition: Psf.h:68
boost::shared_ptr< daf::base::PropertyList > varianceMetadata
Definition: ExposureInfo.h:244
Basic LSST definitions.
boost::shared_ptr< Calib > getCalib()
Return the exposure&#39;s photometric calibration.
Definition: ExposureInfo.h:117
bool hasDetector() const
Does this exposure have Detector information?
Definition: ExposureInfo.h:99
FitsWriteData _startWriteFits(geom::Point2I const &xy0=geom::Point2I()) const
Start the process of writing an exposure to FITS.
boost::shared_ptr< geom::polygon::Polygon const > _validPolygon
Definition: ExposureInfo.h:294
boost::shared_ptr< CoaddInputs > _coaddInputs
Definition: ExposureInfo.h:297
Class encapsulating an identifier for an LSST filter.