LSSTApplications  17.0+11,17.0+34,17.0+56,17.0+57,17.0+59,17.0+7,17.0-1-g377950a+33,17.0.1-1-g114240f+2,17.0.1-1-g4d4fbc4+28,17.0.1-1-g55520dc+49,17.0.1-1-g5f4ed7e+52,17.0.1-1-g6dd7d69+17,17.0.1-1-g8de6c91+11,17.0.1-1-gb9095d2+7,17.0.1-1-ge9fec5e+5,17.0.1-1-gf4e0155+55,17.0.1-1-gfc65f5f+50,17.0.1-1-gfc6fb1f+20,17.0.1-10-g87f9f3f+1,17.0.1-11-ge9de802+16,17.0.1-16-ga14f7d5c+4,17.0.1-17-gc79d625+1,17.0.1-17-gdae4c4a+8,17.0.1-2-g26618f5+29,17.0.1-2-g54f2ebc+9,17.0.1-2-gf403422+1,17.0.1-20-g2ca2f74+6,17.0.1-23-gf3eadeb7+1,17.0.1-3-g7e86b59+39,17.0.1-3-gb5ca14a,17.0.1-3-gd08d533+40,17.0.1-30-g596af8797,17.0.1-4-g59d126d+4,17.0.1-4-gc69c472+5,17.0.1-6-g5afd9b9+4,17.0.1-7-g35889ee+1,17.0.1-7-gc7c8782+18,17.0.1-9-gc4bbfb2+3,w.2019.22
LSSTDataManagementBasePackage
ExposureFitsReader.cc
Go to the documentation of this file.
1 /*
2  * Developed for the LSST Data Management System.
3  * This product includes software developed by the LSST Project
4  * (https://www.lsst.org).
5  * See the COPYRIGHT file at the top-level directory of this distribution
6  * for details of code ownership.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #include "lsst/log/Log.h"
23 
26 #include "lsst/afw/geom/SkyWcs.h"
29 #include "lsst/afw/detection/Psf.h"
32 
33 namespace lsst {
34 namespace afw {
35 namespace image {
36 
37 namespace {
38 
39 LOG_LOGGER _log = LOG_GET("afw.image.fits.ExposureFitsReader");
40 
41 } // namespace
42 
44 public:
48  if (primaryMetadata->exists(versionName)) {
49  version = primaryMetadata->getAsInt(versionName);
50  primaryMetadata->remove(versionName);
51  } else {
52  version = 0; // unversioned files are implicitly version 0
53  }
56  str(boost::format("Cannot read Exposure FITS version >= %i") %
58  }
59 
60  // Try to read WCS from image metadata, and if found, strip the keywords used
61  try {
62  wcs = afw::geom::makeSkyWcs(*imageMetadata, true);
64  LOGLS_DEBUG(_log, "No WCS found in FITS metadata");
65  }
66  if (wcs && any(xy0.ne(lsst::geom::Point2I(0, 0)))) {
67  wcs = wcs->copyAtShiftedPixelOrigin(lsst::geom::Extent2D(xy0));
68  }
69 
70  // Strip LTV1, LTV2 from imageMetadata, because we don't use it internally
71  imageMetadata->remove("LTV1");
72  imageMetadata->remove("LTV2");
73 
74  if (!imageMetadata->exists("INHERIT")) {
75  // New-style exposures put everything but the Wcs in the primary HDU, use
76  // INHERIT keyword in the others. For backwards compatibility, if we don't
77  // find the INHERIT keyword, we ignore the primary HDU metadata and expect
78  // everything to be in the image HDU metadata. Note that we can't merge them,
79  // because they're probably duplicates.
80  metadata = imageMetadata;
81  } else {
82  metadata = primaryMetadata;
83  }
84 
85  filter = Filter(metadata, true);
87 
88  visitInfo = std::make_shared<VisitInfo>(*metadata);
90 
91  // Version 0 persisted Calib FLUXMAG0 in the metadata, >=1 persisted PhotoCalib as a binary table.
92  if (version == 0) {
93  photoCalib = makePhotoCalibFromMetadata(*metadata, true);
94  }
95 
96  // Strip MJD-OBS and DATE-OBS from metadata; those may be read by
97  // either SkyWcs or VisitInfo or both, so neither can strip them.
98  metadata->remove("MJD-OBS");
99  metadata->remove("DATE-OBS");
100 
101  // Strip DETSER, DETNAME; these are added when writing an Exposure
102  // with a Detector
103  metadata->remove("DETNAME");
104  metadata->remove("DETSER");
105  }
106 
107  int version;
113 };
114 
116 public:
117  enum Component {
118  PSF = 0,
126  N_ARCHIVE_COMPONENTS
127  };
128 
130  auto popInt = [&metadata](std::string const& name) {
131  // The default of zero will cause archive.get to return a
132  // null/empty pointer, just as if a null/empty pointer was
133  // originally written to the archive.
134  int r = 0;
135  if (metadata.exists(name)) {
136  r = metadata.get<int>(name);
137  // We remove metadata entries to maintaing our practice
138  // of stripped metadata entries that have been used to
139  // construct more structured components.
140  metadata.remove(name);
141  }
142  return r;
143  };
144  _hdu = popInt("AR_HDU");
145  if (_hdu == 0) {
146  _state = ArchiveState::MISSING;
147  } else {
148  --_hdu; // Switch from FITS 1-indexed convention to LSST 0-indexed convention.
149  _state = ArchiveState::PRESENT;
150  }
151  _ids[PSF] = popInt("PSF_ID");
152  _ids[WCS] = popInt("SKYWCS_ID");
153  _ids[COADD_INPUTS] = popInt("COADD_INPUTS_ID");
154  _ids[AP_CORR_MAP] = popInt("AP_CORR_MAP_ID");
155  _ids[VALID_POLYGON] = popInt("VALID_POLYGON_ID");
156  _ids[TRANSMISSION_CURVE] = popInt("TRANSMISSION_CURVE_ID");
157  _ids[DETECTOR] = popInt("DETECTOR_ID");
158  _ids[PHOTOCALIB] = popInt("PHOTOCALIB_ID");
159  }
160 
161  template <typename T>
163  if (!_ensureLoaded(fitsFile)) {
164  return nullptr;
165  }
166  return _archive.get<T>(_ids[c]);
167  }
168 
169 private:
170  bool _ensureLoaded(afw::fits::Fits* fitsFile) {
171  if (_state == ArchiveState::MISSING) {
172  return false;
173  }
174  if (_state == ArchiveState::PRESENT) {
175  afw::fits::HduMoveGuard guard(*fitsFile, _hdu);
177  _state = ArchiveState::LOADED;
178  }
179  assert(_state == ArchiveState::LOADED); // constructor body should guarantee it's not UNKNOWN
180  return true;
181  }
182 
183  enum class ArchiveState { UNKNOWN, MISSING, PRESENT, LOADED };
184 
185  int _hdu = 0;
186  ArchiveState _state = ArchiveState::UNKNOWN;
189 };
190 
191 ExposureFitsReader::ExposureFitsReader(std::string const& fileName) : _maskedImageReader(fileName) {}
192 
193 ExposureFitsReader::ExposureFitsReader(fits::MemFileManager& manager) : _maskedImageReader(manager) {}
194 
195 ExposureFitsReader::ExposureFitsReader(fits::Fits* fitsFile) : _maskedImageReader(fitsFile) {}
196 
197 ExposureFitsReader::~ExposureFitsReader() noexcept = default;
198 
200  return _maskedImageReader.readBBox(origin);
201 }
202 
204  return _maskedImageReader.readXY0(bbox, origin);
205 }
206 
207 std::string ExposureFitsReader::readImageDType() const { return _maskedImageReader.readImageDType(); }
208 
209 std::string ExposureFitsReader::readMaskDType() const { return _maskedImageReader.readMaskDType(); }
210 
212 
214  _ensureReaders();
215  return _metadataReader->metadata;
216 }
217 
219  _ensureReaders();
220  auto r = _archiveReader->readComponent<afw::geom::SkyWcs>(_getFitsFile(), ArchiveReader::WCS);
221  if (!r) {
222  r = _metadataReader->wcs;
223  }
224  return r;
225 }
226 
228  _ensureReaders();
229  return _metadataReader->filter;
230 }
231 
233  _ensureReaders();
234  if (_metadataReader->version == 0) {
235  return _metadataReader->photoCalib;
236  } else {
237  return _archiveReader->readComponent<image::PhotoCalib>(_getFitsFile(), ArchiveReader::PHOTOCALIB);
238  }
239 }
240 
242  _ensureReaders();
243  return _archiveReader->readComponent<detection::Psf>(_getFitsFile(), ArchiveReader::PSF);
244 }
245 
247  _ensureReaders();
248  return _archiveReader->readComponent<afw::geom::polygon::Polygon>(_getFitsFile(),
250 }
251 
253  _ensureReaders();
254  return _archiveReader->readComponent<ApCorrMap>(_getFitsFile(), ArchiveReader::AP_CORR_MAP);
255 }
256 
258  _ensureReaders();
259  return _archiveReader->readComponent<CoaddInputs>(_getFitsFile(), ArchiveReader::COADD_INPUTS);
260 }
261 
263  _ensureReaders();
264  return _metadataReader->visitInfo;
265 }
266 
268  _ensureReaders();
269  return _archiveReader->readComponent<TransmissionCurve>(_getFitsFile(),
271 }
272 
274  _ensureReaders();
275  return _archiveReader->readComponent<cameraGeom::Detector>(_getFitsFile(), ArchiveReader::DETECTOR);
276 }
277 
279  auto result = std::make_shared<ExposureInfo>();
280  result->setMetadata(readMetadata());
281  result->setFilter(readFilter());
282  result->setPhotoCalib(readPhotoCalib());
283  result->setVisitInfo(readVisitInfo());
284  // When reading an ExposureInfo (as opposed to reading individual
285  // components), we warn and try to proceed when a component is present
286  // but can't be read due its serialization factory not being set up
287  // (that's what throws the NotFoundErrors caught below).
288  try {
289  result->setPsf(readPsf());
290  } catch (pex::exceptions::NotFoundError& err) {
291  LOGLS_WARN(_log, "Could not read PSF; setting to null: " << err.what());
292  }
293  try {
294  result->setCoaddInputs(readCoaddInputs());
295  } catch (pex::exceptions::NotFoundError& err) {
296  LOGLS_WARN(_log, "Could not read CoaddInputs; setting to null: " << err.what());
297  }
298  try {
299  result->setApCorrMap(readApCorrMap());
300  } catch (pex::exceptions::NotFoundError& err) {
301  LOGLS_WARN(_log, "Could not read ApCorrMap; setting to null: " << err.what());
302  }
303  try {
304  result->setValidPolygon(readValidPolygon());
305  } catch (pex::exceptions::NotFoundError& err) {
306  LOGLS_WARN(_log, "Could not read ValidPolygon; setting to null: " << err.what());
307  }
308  try {
309  result->setTransmissionCurve(readTransmissionCurve());
310  } catch (pex::exceptions::NotFoundError& err) {
311  LOGLS_WARN(_log, "Could not read TransmissionCurve; setting to null: " << err.what());
312  }
313  try {
314  result->setDetector(readDetector());
315  } catch (pex::exceptions::NotFoundError& err) {
316  LOGLS_WARN(_log, "Could not read Detector; setting to null: " << err.what());
317  }
318  // In the case of WCS, we fall back to the metadata WCS if the one from
319  // the archive can't be read.
320  _ensureReaders();
321  result->setWcs(_metadataReader->wcs);
322  try {
323  auto wcs = _archiveReader->readComponent<afw::geom::SkyWcs>(_getFitsFile(), ArchiveReader::WCS);
324  if (!wcs) {
325  LOGLS_DEBUG(_log, "No WCS found in binary table");
326  } else {
327  result->setWcs(wcs);
328  }
329  } catch (pex::exceptions::NotFoundError& err) {
330  auto msg = str(boost::format("Could not read WCS extension; setting to null: %s") % err.what());
331  if (result->hasWcs()) {
332  msg += " ; using WCS from FITS header";
333  }
334  LOGLS_WARN(_log, msg);
335  }
336  return result;
337 } // namespace image
338 
339 template <typename ImagePixelT>
341  bool allowUnsafe) {
342  return _maskedImageReader.readImage<ImagePixelT>(bbox, origin, allowUnsafe);
343 }
344 
345 template <typename ImagePixelT>
346 ndarray::Array<ImagePixelT, 2, 2> ExposureFitsReader::readImageArray(lsst::geom::Box2I const& bbox,
347  ImageOrigin origin, bool allowUnsafe) {
348  return _maskedImageReader.readImageArray<ImagePixelT>(bbox, origin, allowUnsafe);
349 }
350 
351 template <typename MaskPixelT>
353  bool conformMasks, bool allowUnsafe) {
354  return _maskedImageReader.readMask<MaskPixelT>(bbox, origin, conformMasks, allowUnsafe);
355 }
356 
357 template <typename MaskPixelT>
358 ndarray::Array<MaskPixelT, 2, 2> ExposureFitsReader::readMaskArray(lsst::geom::Box2I const& bbox,
359  ImageOrigin origin, bool allowUnsafe) {
360  return _maskedImageReader.readMaskArray<MaskPixelT>(bbox, origin, allowUnsafe);
361 }
362 
363 template <typename VariancePixelT>
365  bool allowUnsafe) {
366  return _maskedImageReader.readVariance<VariancePixelT>(bbox, origin, allowUnsafe);
367 }
368 
369 template <typename VariancePixelT>
370 ndarray::Array<VariancePixelT, 2, 2> ExposureFitsReader::readVarianceArray(lsst::geom::Box2I const& bbox,
371  ImageOrigin origin,
372  bool allowUnsafe) {
373  return _maskedImageReader.readVarianceArray<VariancePixelT>(bbox, origin, allowUnsafe);
374 }
375 
376 template <typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
378  lsst::geom::Box2I const& bbox, ImageOrigin origin, bool conformMasks, bool allowUnsafe) {
379  return _maskedImageReader.read<ImagePixelT, MaskPixelT, VariancePixelT>(bbox, origin, conformMasks,
380  /* needAllHdus= */ false,
381  allowUnsafe);
382 }
383 
384 template <typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
386  ImageOrigin origin,
387  bool conformMasks,
388  bool allowUnsafe) {
389  auto mi =
390  readMaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>(bbox, origin, conformMasks, allowUnsafe);
392 }
393 
394 void ExposureFitsReader::_ensureReaders() {
395  if (!_metadataReader) {
396  auto metadataReader = std::make_unique<MetadataReader>(_maskedImageReader.readPrimaryMetadata(),
397  _maskedImageReader.readImageMetadata(),
398  _maskedImageReader.readXY0());
399  _archiveReader = std::make_unique<ArchiveReader>(*metadataReader->metadata);
400  _metadataReader = std::move(metadataReader); // deferred for exception safety
401  }
402  assert(_archiveReader); // should always be initialized with _metadataReader.
403 }
404 
405 #define INSTANTIATE(ImagePixelT) \
406  template Exposure<ImagePixelT, MaskPixel, VariancePixel> ExposureFitsReader::read( \
407  lsst::geom::Box2I const&, ImageOrigin, bool, bool); \
408  template Image<ImagePixelT> ExposureFitsReader::readImage(lsst::geom::Box2I const&, ImageOrigin, bool); \
409  template ndarray::Array<ImagePixelT, 2, 2> ExposureFitsReader::readImageArray(lsst::geom::Box2I const&, \
410  ImageOrigin, bool); \
411  template MaskedImage<ImagePixelT, MaskPixel, VariancePixel> ExposureFitsReader::readMaskedImage( \
412  lsst::geom::Box2I const&, ImageOrigin, bool, bool)
413 
415 INSTANTIATE(int);
416 INSTANTIATE(float);
417 INSTANTIATE(double);
419 
420 template Mask<MaskPixel> ExposureFitsReader::readMask(lsst::geom::Box2I const&, ImageOrigin, bool, bool);
421 template ndarray::Array<MaskPixel, 2, 2> ExposureFitsReader::readMaskArray(lsst::geom::Box2I const&,
422  ImageOrigin, bool);
423 
424 template Image<VariancePixel> ExposureFitsReader::readVariance(lsst::geom::Box2I const&, ImageOrigin, bool);
425 template ndarray::Array<VariancePixel, 2, 2> ExposureFitsReader::readVarianceArray(lsst::geom::Box2I const&,
426  ImageOrigin, bool);
427 
428 } // namespace image
429 } // namespace afw
430 } // namespace lsst
#define LOGLS_WARN(logger, message)
Log a warn-level message using an iostream-based interface.
Definition: Log.h:633
static std::string const & getFitsSerializationVersionName()
Get the version of FITS serialization version info name.
Definition: ExposureInfo.cc:52
std::shared_ptr< T > readComponent(afw::fits::Fits *fitsFile, Component c)
std::shared_ptr< PhotoCalib > makePhotoCalibFromMetadata(daf::base::PropertySet &metadata, bool strip=false)
Construct a PhotoCalib from FITS FLUXMAG0/FLUXMAG0ERR keywords.
Definition: PhotoCalib.cc:626
lsst::geom::Box2I readBBox(ImageOrigin origin=PARENT)
Read the bounding box of the on-disk image.
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixel...
Definition: SkyWcs.h:117
A spatially-varying transmission curve as a function of wavelength.
#define LOG_LOGGER
Definition: Log.h:688
std::shared_ptr< daf::base::PropertyList > metadata
std::shared_ptr< ExposureInfo > readExposureInfo()
Read the ExposureInfo containing all non-image components.
CoordinateExpr< N > ne(Point< T, N > const &other) const noexcept
Definition: Point.cc:83
lsst::geom::Box2I readBBox(ImageOrigin origin=PARENT)
Read the bounding box of the on-disk image.
Image< VariancePixelT > readVariance(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the variance plane.
The photometric calibration of an exposure.
Definition: PhotoCalib.h:116
Class for storing ordered metadata with comments.
Definition: PropertyList.h:68
A thin wrapper around std::map to allow aperture corrections to be attached to Exposures.
Definition: ApCorrMap.h:45
A class to contain the data, WCS, and other information needed to describe an image of the sky...
Definition: Exposure.h:72
std::string readVarianceDType() const
Read a string describing the pixel type of the on-disk image plane.
std::shared_ptr< CoaddInputs > readCoaddInputs()
Read the Exposure&#39;s coadd input catalogs.
ndarray::Array< MaskPixelT, 2, 2 > readMaskArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the mask plane.
py::object result
Definition: schema.cc:418
Image< VariancePixelT > readVariance(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the variance plane.
int stripFilterKeywords(std::shared_ptr< lsst::daf::base::PropertySet > metadata)
Remove Filter-related keywords from the metadata.
Definition: Filter.cc:132
ndarray::Array< VariancePixelT, 2, 2 > readVarianceArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the variance plane.
std::shared_ptr< VisitInfo > readVisitInfo()
Read the Exposure&#39;s visit metadata.
Image< ImagePixelT > readImage(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the image plane.
static int getFitsSerializationVersion()
Get the version of FITS serialization that this ExposureInfo understands.
Definition: ExposureInfo.cc:44
ExposureFitsReader(std::string const &fileName)
Construct a FITS reader object.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:297
std::shared_ptr< PhotoCalib > readPhotoCalib()
Read the Exposure&#39;s photometric calibration.
Rotation angle is unknown.
table::Key< table::Array< std::uint8_t > > wcs
Definition: SkyWcs.cc:71
Image< ImagePixelT > readImage(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the image plane.
bool any(CoordinateExpr< N > const &expr) noexcept
Return true if any elements are true.
std::string readImageDType() const
Read a string describing the pixel type of the on-disk image plane.
A simple Persistable struct containing ExposureCatalogs that record the inputs to a coadd...
Definition: CoaddInputs.h:49
STL class.
LSST DM logging module built on log4cxx.
Filter readFilter()
Read the Exposure&#39;s filter.
virtual void remove(std::string const &name)
Remove all values for a property name (possibly hierarchical).
Reports attempts to access elements using an invalid key.
Definition: Runtime.h:151
virtual char const * what(void) const noexcept
Return a character string summarizing this exception.
Definition: Exception.cc:99
std::shared_ptr< afw::geom::polygon::Polygon > readValidPolygon()
Read the polygon describing the region of validity for the Exposure.
#define LOGLS_DEBUG(logger, message)
Log a debug-level message using an iostream-based interface.
Definition: Log.h:593
A base class for image defects.
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:78
Lifetime-management for memory that goes into FITS memory files.
Definition: fits.h:121
std::string readImageDType() const
Read a string describing the pixel type of the on-disk image plane.
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:74
std::shared_ptr< daf::base::PropertyList > readPrimaryMetadata()
Read the FITS header of one of the HDUs.
bool exists(std::string const &name) const
Determine if a name (possibly hierarchical) exists.
table::Box2IKey bbox
Definition: Detector.cc:169
T move(T... args)
std::string readMaskDType() const
Read a string describing the pixel type of the on-disk image plane.
Holds an integer identifier for an LSST filter.
Definition: Filter.h:141
std::shared_ptr< afw::geom::SkyWcs > readWcs()
Read the Exposure&#39;s world coordinate system.
std::shared_ptr< io::OutputArchive > _archive
Definition: Exposure.cc:217
Mask< MaskPixelT > readMask(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
Read the mask plane.
ndarray::Array< VariancePixelT, 2, 2 > readVarianceArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the variance plane.
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > read(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool needAllHdus=false, bool allowUnsafe=false)
Read the full MaskedImage.
std::shared_ptr< ApCorrMap > readApCorrMap()
Read the Exposure&#39;s aperture correction map.
std::string readMaskDType() const
Read a string describing the pixel type of the on-disk image plane.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
T get(std::string const &name) const
Get the last value for a property name (possibly hierarchical).
Definition: PropertyList.cc:61
Information about a CCD or other imaging detector.
Definition: Detector.h:62
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > readMaskedImage(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
Read the MaskedImage.
static InputArchive readFits(fits::Fits &fitsfile)
Read an object from an already open FITS object.
std::shared_ptr< SkyWcs > makeSkyWcs(daf::base::PropertySet &metadata, bool strip=false)
Construct a SkyWcs from FITS keywords.
Definition: SkyWcs.cc:486
std::string readVarianceDType() const
Read a string describing the pixel type of the on-disk image plane.
ndarray::Array< ImagePixelT, 2, 2 > readImageArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the image plane.
#define INSTANTIATE(ImagePixelT)
int stripVisitInfoKeywords(daf::base::PropertySet &metadata)
Remove VisitInfo-related keywords from the metadata.
Definition: VisitInfo.cc:267
lsst::geom::Point2I readXY0(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT)
Read the image origin from the on-disk image or a subimage thereof.
Cartesian polygons.
Definition: Polygon.h:59
std::shared_ptr< cameraGeom::Detector > readDetector()
Read the Exposure&#39;s detector.
ndarray::Array< MaskPixelT, 2, 2 > readMaskArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the mask plane.
Exposure< ImagePixelT, MaskPixelT, VariancePixelT > read(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
Read the full Exposure.
std::shared_ptr< daf::base::PropertyList > readMetadata()
Read the flexible metadata associated with the Exposure.
std::shared_ptr< daf::base::PropertyList > readImageMetadata()
Read the FITS header of one of the HDUs.
std::shared_ptr< detection::Psf > readPsf()
Read the Exposure&#39;s point-spread function.
Mask< MaskPixelT > readMask(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
Read the mask plane.
A multi-catalog archive object used to load table::io::Persistable objects.
Definition: InputArchive.h:31
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
Reports errors from accepting an object of an unexpected or inappropriate type.
Definition: Runtime.h:167
#define LOG_GET(logger)
Returns a Log object associated with logger.
Definition: Log.h:75
A polymorphic base class for representing an image&#39;s Point Spread Function.
Definition: Psf.h:76
MetadataReader(std::shared_ptr< daf::base::PropertyList > primaryMetadata, std::shared_ptr< daf::base::PropertyList > imageMetadata, lsst::geom::Point2I const &xy0)
std::shared_ptr< TransmissionCurve > readTransmissionCurve()
Read the Exposure&#39;s transmission curve.
An integer coordinate rectangle.
Definition: Box.h:54
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:59
ndarray::Array< ImagePixelT, 2, 2 > readImageArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the image plane.
RAII scoped guard for moving the HDU in a Fits object.
Definition: fits.h:724
Implementation of the Photometric Calibration class.
lsst::geom::Point2I readXY0(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT)
Read the image origin from the on-disk image or a subimage thereof.