LSSTApplications  17.0+124,17.0+14,17.0+73,18.0.0+37,18.0.0+80,18.0.0-4-g68ffd23+4,18.1.0-1-g0001055+12,18.1.0-1-g03d53ef+5,18.1.0-1-g1349e88+55,18.1.0-1-g2505f39+44,18.1.0-1-g5315e5e+4,18.1.0-1-g5e4b7ea+14,18.1.0-1-g7e8fceb+4,18.1.0-1-g85f8cd4+48,18.1.0-1-g8ff0b9f+4,18.1.0-1-ga2c679d+1,18.1.0-1-gd55f500+35,18.1.0-10-gb58edde+2,18.1.0-11-g0997b02+4,18.1.0-13-gfe4edf0b+12,18.1.0-14-g259bd21+21,18.1.0-19-gdb69f3f+2,18.1.0-2-g5f9922c+24,18.1.0-2-gd3b74e5+11,18.1.0-2-gfbf3545+32,18.1.0-26-g728bddb4+5,18.1.0-27-g6ff7ca9+2,18.1.0-3-g52aa583+25,18.1.0-3-g8ea57af+9,18.1.0-3-gb69f684+42,18.1.0-3-gfcaddf3+6,18.1.0-32-gd8786685a,18.1.0-4-gf3f9b77+6,18.1.0-5-g1dd662b+2,18.1.0-5-g6dbcb01+41,18.1.0-6-gae77429+3,18.1.0-7-g9d75d83+9,18.1.0-7-gae09a6d+30,18.1.0-9-gc381ef5+4,w.2019.45
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 template <typename T, std::size_t N>
42 bool _contains(std::array<T, N> const& array, T const& value) {
43  for (T const& element : array) {
44  if (element == value) {
45  return true;
46  }
47  }
48  return false;
49 }
50 
51 } // namespace
52 
54 public:
58  if (primaryMetadata->exists(versionName)) {
59  version = primaryMetadata->getAsInt(versionName);
60  primaryMetadata->remove(versionName);
61  } else {
62  version = 0; // unversioned files are implicitly version 0
63  }
66  str(boost::format("Cannot read Exposure FITS version >= %i") %
68  }
69 
70  // Try to read WCS from image metadata, and if found, strip the keywords used
71  try {
72  wcs = afw::geom::makeSkyWcs(*imageMetadata, true);
73  } catch (lsst::pex::exceptions::TypeError const&) {
74  LOGLS_DEBUG(_log, "No WCS found in FITS metadata");
75  }
76  if (wcs && any(xy0.ne(lsst::geom::Point2I(0, 0)))) {
77  wcs = wcs->copyAtShiftedPixelOrigin(lsst::geom::Extent2D(xy0));
78  }
79 
80  // Strip LTV1, LTV2 from imageMetadata, because we don't use it internally
81  imageMetadata->remove("LTV1");
82  imageMetadata->remove("LTV2");
83 
84  if (!imageMetadata->exists("INHERIT")) {
85  // New-style exposures put everything but the Wcs in the primary HDU, use
86  // INHERIT keyword in the others. For backwards compatibility, if we don't
87  // find the INHERIT keyword, we ignore the primary HDU metadata and expect
88  // everything to be in the image HDU metadata. Note that we can't merge them,
89  // because they're probably duplicates.
90  metadata = imageMetadata;
91  } else {
92  metadata = primaryMetadata;
93  }
94 
95  filter = Filter(metadata, true);
97 
98  visitInfo = std::make_shared<VisitInfo>(*metadata);
100 
101  // Version 0 persisted Calib FLUXMAG0 in the metadata, >=1 persisted PhotoCalib as a binary table.
102  if (version == 0) {
103  photoCalib = makePhotoCalibFromMetadata(*metadata, true);
104  }
105 
106  // Strip MJD-OBS and DATE-OBS from metadata; those may be read by
107  // either SkyWcs or VisitInfo or both, so neither can strip them.
108  metadata->remove("MJD-OBS");
109  metadata->remove("DATE-OBS");
110 
111  // Strip DETSER, DETNAME; these are added when writing an Exposure
112  // with a Detector
113  metadata->remove("DETNAME");
114  metadata->remove("DETSER");
115  }
116 
117  int version;
123 };
124 
126 public:
127  enum Component {
128  PSF = 0,
136  N_ARCHIVE_COMPONENTS
137  };
138 
140  auto popInt = [&metadata](std::string const& name) {
141  // The default of zero will cause archive.get to return a
142  // null/empty pointer, just as if a null/empty pointer was
143  // originally written to the archive.
144  int r = 0;
145  if (metadata.exists(name)) {
146  r = metadata.get<int>(name);
147  // We remove metadata entries to maintaing our practice
148  // of stripped metadata entries that have been used to
149  // construct more structured components.
150  metadata.remove(name);
151  }
152  return r;
153  };
154  _hdu = popInt("AR_HDU");
155  if (_hdu == 0) {
156  _state = ArchiveState::MISSING;
157  } else {
158  --_hdu; // Switch from FITS 1-indexed convention to LSST 0-indexed convention.
159  _state = ArchiveState::PRESENT;
160  }
161  // Read in traditional components using old-style IDs, for backwards compatibility
162  _ids[PSF] = popInt("PSF_ID");
163  _ids[WCS] = popInt("SKYWCS_ID");
164  _ids[COADD_INPUTS] = popInt("COADD_INPUTS_ID");
165  _ids[AP_CORR_MAP] = popInt("AP_CORR_MAP_ID");
166  _ids[VALID_POLYGON] = popInt("VALID_POLYGON_ID");
167  _ids[TRANSMISSION_CURVE] = popInt("TRANSMISSION_CURVE_ID");
168  _ids[DETECTOR] = popInt("DETECTOR_ID");
169  _ids[PHOTOCALIB] = popInt("PHOTOCALIB_ID");
170 
171  // "Extra" components use a different keyword convention to avoid collisions with non-persistence IDs
172  std::vector<std::string> toStrip;
173  for (std::string const& headerKey : metadata) {
174  static std::string const PREFIX = "ARCHIVE_ID_";
175  if (headerKey.substr(0, PREFIX.size()) == PREFIX) {
176  std::string componentName = headerKey.substr(PREFIX.size());
177  int archiveId = metadata.get<int>(headerKey);
178  if (!_contains(_ids, archiveId)) {
179  _extraIds.emplace(componentName, archiveId);
180  }
181  toStrip.push_back(headerKey);
182  toStrip.push_back(componentName + "_ID"); // strip corresponding old-style ID, if it exists
183  }
184  }
185  for (std::string const& key : toStrip) {
186  metadata.remove(key);
187  }
188  }
189 
199  template <typename T>
201  if (!_ensureLoaded(fitsFile)) {
202  return nullptr;
203  }
204  return _archive.get<T>(_ids[c]);
205  }
206 
217  afw::fits::Fits* fitsFile) {
219 
220  if (!_ensureLoaded(fitsFile)) {
221  return result;
222  }
223 
224  // Not safe to call getAll if a component cannot be unpersisted
225  // Instead, look for the archives registered in the metadata
226  for (auto const& keyValue : _extraIds) {
227  std::string componentName = keyValue.first;
228  int archiveId = keyValue.second;
229 
230  try {
231  result.emplace(componentName, _archive.get(archiveId));
232  } catch (pex::exceptions::NotFoundError const& err) {
233  LOGLS_WARN(_log,
234  "Could not read component " << componentName << "; skipping: " << err.what());
235  }
236  }
237  return result;
238  }
239 
240 private:
241  bool _ensureLoaded(afw::fits::Fits* fitsFile) {
242  if (_state == ArchiveState::MISSING) {
243  return false;
244  }
245  if (_state == ArchiveState::PRESENT) {
246  afw::fits::HduMoveGuard guard(*fitsFile, _hdu);
248  _state = ArchiveState::LOADED;
249  }
250  assert(_state == ArchiveState::LOADED); // constructor body should guarantee it's not UNKNOWN
251  return true;
252  }
253 
254  enum class ArchiveState { UNKNOWN, MISSING, PRESENT, LOADED };
255 
256  int _hdu = 0;
257  ArchiveState _state = ArchiveState::UNKNOWN;
260  std::map<std::string, int> _extraIds;
261 };
262 
263 ExposureFitsReader::ExposureFitsReader(std::string const& fileName) : _maskedImageReader(fileName) {}
264 
265 ExposureFitsReader::ExposureFitsReader(fits::MemFileManager& manager) : _maskedImageReader(manager) {}
266 
267 ExposureFitsReader::ExposureFitsReader(fits::Fits* fitsFile) : _maskedImageReader(fitsFile) {}
268 
269 ExposureFitsReader::~ExposureFitsReader() noexcept = default;
270 
272  return _maskedImageReader.readBBox(origin);
273 }
274 
276  return _maskedImageReader.readXY0(bbox, origin);
277 }
278 
279 std::string ExposureFitsReader::readImageDType() const { return _maskedImageReader.readImageDType(); }
280 
281 std::string ExposureFitsReader::readMaskDType() const { return _maskedImageReader.readMaskDType(); }
282 
284 
286  _ensureReaders();
287  return _metadataReader->metadata;
288 }
289 
291  _ensureReaders();
292  auto r = _archiveReader->readComponent<afw::geom::SkyWcs>(_getFitsFile(), ArchiveReader::WCS);
293  if (!r) {
294  r = _metadataReader->wcs;
295  }
296  return r;
297 }
298 
300  _ensureReaders();
301  return _metadataReader->filter;
302 }
303 
305  _ensureReaders();
306  if (_metadataReader->version == 0) {
307  return _metadataReader->photoCalib;
308  } else {
309  return _archiveReader->readComponent<image::PhotoCalib>(_getFitsFile(), ArchiveReader::PHOTOCALIB);
310  }
311 }
312 
314  _ensureReaders();
315  return _archiveReader->readComponent<detection::Psf>(_getFitsFile(), ArchiveReader::PSF);
316 }
317 
319  _ensureReaders();
320  return _archiveReader->readComponent<afw::geom::polygon::Polygon>(_getFitsFile(),
322 }
323 
325  _ensureReaders();
326  return _archiveReader->readComponent<ApCorrMap>(_getFitsFile(), ArchiveReader::AP_CORR_MAP);
327 }
328 
330  _ensureReaders();
331  return _archiveReader->readComponent<CoaddInputs>(_getFitsFile(), ArchiveReader::COADD_INPUTS);
332 }
333 
335  _ensureReaders();
336  return _metadataReader->visitInfo;
337 }
338 
340  _ensureReaders();
341  return _archiveReader->readComponent<TransmissionCurve>(_getFitsFile(),
343 }
344 
346  _ensureReaders();
347  return _archiveReader->readComponent<cameraGeom::Detector>(_getFitsFile(), ArchiveReader::DETECTOR);
348 }
349 
351  _ensureReaders();
352  return _archiveReader->readExtraComponents(_getFitsFile());
353 }
354 
356  auto result = std::make_shared<ExposureInfo>();
357  result->setMetadata(readMetadata());
358  result->setFilter(readFilter());
359  result->setPhotoCalib(readPhotoCalib());
360  result->setVisitInfo(readVisitInfo());
361  // When reading an ExposureInfo (as opposed to reading individual
362  // components), we warn and try to proceed when a component is present
363  // but can't be read due its serialization factory not being set up
364  // (that's what throws the NotFoundErrors caught below).
365  try {
366  result->setPsf(readPsf());
367  } catch (pex::exceptions::NotFoundError& err) {
368  LOGLS_WARN(_log, "Could not read PSF; setting to null: " << err.what());
369  }
370  try {
371  result->setCoaddInputs(readCoaddInputs());
372  } catch (pex::exceptions::NotFoundError& err) {
373  LOGLS_WARN(_log, "Could not read CoaddInputs; setting to null: " << err.what());
374  }
375  try {
376  result->setApCorrMap(readApCorrMap());
377  } catch (pex::exceptions::NotFoundError& err) {
378  LOGLS_WARN(_log, "Could not read ApCorrMap; setting to null: " << err.what());
379  }
380  try {
381  result->setValidPolygon(readValidPolygon());
382  } catch (pex::exceptions::NotFoundError& err) {
383  LOGLS_WARN(_log, "Could not read ValidPolygon; setting to null: " << err.what());
384  }
385  try {
386  result->setTransmissionCurve(readTransmissionCurve());
387  } catch (pex::exceptions::NotFoundError& err) {
388  LOGLS_WARN(_log, "Could not read TransmissionCurve; setting to null: " << err.what());
389  }
390  try {
391  result->setDetector(readDetector());
392  } catch (pex::exceptions::NotFoundError& err) {
393  LOGLS_WARN(_log, "Could not read Detector; setting to null: " << err.what());
394  }
395  // In the case of WCS, we fall back to the metadata WCS if the one from
396  // the archive can't be read.
397  _ensureReaders();
398  result->setWcs(_metadataReader->wcs);
399  try {
400  auto wcs = _archiveReader->readComponent<afw::geom::SkyWcs>(_getFitsFile(), ArchiveReader::WCS);
401  if (!wcs) {
402  LOGLS_DEBUG(_log, "No WCS found in binary table");
403  } else {
404  result->setWcs(wcs);
405  }
406  } catch (pex::exceptions::NotFoundError& err) {
407  auto msg = str(boost::format("Could not read WCS extension; setting to null: %s") % err.what());
408  if (result->hasWcs()) {
409  msg += " ; using WCS from FITS header";
410  }
411  LOGLS_WARN(_log, msg);
412  }
413  for (auto keyValue : readExtraComponents()) {
415  std::string key = keyValue.first;
416  StorablePtr object = std::dynamic_pointer_cast<StorablePtr::element_type>(keyValue.second);
417 
418  if (object.use_count() > 0) { // Failed cast guarantees empty pointer, but not a null one
419  result->setComponent(typehandling::makeKey<StorablePtr>(key), object);
420  } else {
421  LOGLS_WARN(_log, "Data corruption: generic component " << key << " is not a Storable; skipping.");
422  }
423  }
424  return result;
425 } // namespace image
426 
427 template <typename ImagePixelT>
429  bool allowUnsafe) {
430  return _maskedImageReader.readImage<ImagePixelT>(bbox, origin, allowUnsafe);
431 }
432 
433 template <typename ImagePixelT>
434 ndarray::Array<ImagePixelT, 2, 2> ExposureFitsReader::readImageArray(lsst::geom::Box2I const& bbox,
435  ImageOrigin origin, bool allowUnsafe) {
436  return _maskedImageReader.readImageArray<ImagePixelT>(bbox, origin, allowUnsafe);
437 }
438 
439 template <typename MaskPixelT>
441  bool conformMasks, bool allowUnsafe) {
442  return _maskedImageReader.readMask<MaskPixelT>(bbox, origin, conformMasks, allowUnsafe);
443 }
444 
445 template <typename MaskPixelT>
446 ndarray::Array<MaskPixelT, 2, 2> ExposureFitsReader::readMaskArray(lsst::geom::Box2I const& bbox,
447  ImageOrigin origin, bool allowUnsafe) {
448  return _maskedImageReader.readMaskArray<MaskPixelT>(bbox, origin, allowUnsafe);
449 }
450 
451 template <typename VariancePixelT>
453  bool allowUnsafe) {
454  return _maskedImageReader.readVariance<VariancePixelT>(bbox, origin, allowUnsafe);
455 }
456 
457 template <typename VariancePixelT>
458 ndarray::Array<VariancePixelT, 2, 2> ExposureFitsReader::readVarianceArray(lsst::geom::Box2I const& bbox,
459  ImageOrigin origin,
460  bool allowUnsafe) {
461  return _maskedImageReader.readVarianceArray<VariancePixelT>(bbox, origin, allowUnsafe);
462 }
463 
464 template <typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
466  lsst::geom::Box2I const& bbox, ImageOrigin origin, bool conformMasks, bool allowUnsafe) {
467  return _maskedImageReader.read<ImagePixelT, MaskPixelT, VariancePixelT>(bbox, origin, conformMasks,
468  /* needAllHdus= */ false,
469  allowUnsafe);
470 }
471 
472 template <typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
474  ImageOrigin origin,
475  bool conformMasks,
476  bool allowUnsafe) {
477  auto mi =
478  readMaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>(bbox, origin, conformMasks, allowUnsafe);
480 }
481 
482 void ExposureFitsReader::_ensureReaders() {
483  if (!_metadataReader) {
484  auto metadataReader = std::make_unique<MetadataReader>(_maskedImageReader.readPrimaryMetadata(),
485  _maskedImageReader.readImageMetadata(),
486  _maskedImageReader.readXY0());
487  _archiveReader = std::make_unique<ArchiveReader>(*metadataReader->metadata);
488  _metadataReader = std::move(metadataReader); // deferred for exception safety
489  }
490  assert(_archiveReader); // should always be initialized with _metadataReader.
491 }
492 
493 #define INSTANTIATE(ImagePixelT) \
494  template Exposure<ImagePixelT, MaskPixel, VariancePixel> ExposureFitsReader::read( \
495  lsst::geom::Box2I const&, ImageOrigin, bool, bool); \
496  template Image<ImagePixelT> ExposureFitsReader::readImage(lsst::geom::Box2I const&, ImageOrigin, bool); \
497  template ndarray::Array<ImagePixelT, 2, 2> ExposureFitsReader::readImageArray(lsst::geom::Box2I const&, \
498  ImageOrigin, bool); \
499  template MaskedImage<ImagePixelT, MaskPixel, VariancePixel> ExposureFitsReader::readMaskedImage( \
500  lsst::geom::Box2I const&, ImageOrigin, bool, bool)
501 
503 INSTANTIATE(int);
504 INSTANTIATE(float);
505 INSTANTIATE(double);
507 
508 template Mask<MaskPixel> ExposureFitsReader::readMask(lsst::geom::Box2I const&, ImageOrigin, bool, bool);
509 template ndarray::Array<MaskPixel, 2, 2> ExposureFitsReader::readMaskArray(lsst::geom::Box2I const&,
510  ImageOrigin, bool);
511 
512 template Image<VariancePixel> ExposureFitsReader::readVariance(lsst::geom::Box2I const&, ImageOrigin, bool);
513 template ndarray::Array<VariancePixel, 2, 2> ExposureFitsReader::readVarianceArray(lsst::geom::Box2I const&,
514  ImageOrigin, bool);
515 
516 } // namespace image
517 } // namespace afw
518 } // namespace lsst
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
#define LOGLS_WARN(logger, message)
Log a warn-level message using an iostream-based interface.
Definition: Log.h:648
static std::string const & getFitsSerializationVersionName()
Get the version of FITS serialization version info name.
std::shared_ptr< T > readComponent(afw::fits::Fits *fitsFile, Component c)
Read a known component, if available.
std::shared_ptr< PhotoCalib > makePhotoCalibFromMetadata(daf::base::PropertySet &metadata, bool strip=false)
Construct a PhotoCalib from FITS FLUXMAG0/FLUXMAG0ERR keywords.
Definition: PhotoCalib.cc:596
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174
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:703
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:114
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.
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.
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.
STL class.
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).
double element[2]
Definition: BaseTable.cc:91
Reports attempts to access elements using an invalid key.
Definition: Runtime.h:151
std::map< std::string, std::shared_ptr< table::io::Persistable > > readExtraComponents()
Read the Exposure&#39;s non-standard components.
T push_back(T... args)
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:608
A base class for image defects.
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:77
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.
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:73
Key< U > key
Definition: Schema.cc:281
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.
T dynamic_pointer_cast(T... args)
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::map< std::string, std::shared_ptr< table::io::Persistable > > readExtraComponents(afw::fits::Fits *fitsFile)
Read the components that are stored using arbitrary-component support.
T size(T... args)
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
A representation of a detector in a mosaic camera.
Definition: Detector.h:181
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:506
std::string readVarianceDType() const
Read a string describing the pixel type of the on-disk image plane.
T emplace(T... args)
ndarray::Array< ImagePixelT, 2, 2 > readImageArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the image plane.
STL class.
#define INSTANTIATE(ImagePixelT)
int stripVisitInfoKeywords(daf::base::PropertySet &metadata)
Remove VisitInfo-related keywords from the metadata.
Definition: VisitInfo.cc:265
T substr(T... args)
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:75
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:55
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:58
ndarray::Array< ImagePixelT, 2, 2 > readImageArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the image plane.
py::object result
Definition: _schema.cc:429
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.