LSST Applications g0265f82a02+0e5473021a,g02d81e74bb+f5613e8b4f,g1470d8bcf6+190ad2ba91,g14a832a312+311607e4ab,g2079a07aa2+86d27d4dc4,g2305ad1205+a8e3196225,g295015adf3+b67ee847e5,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g3ddfee87b4+a761f810f3,g487adcacf7+17c8fdbcbd,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+65b5bd823e,g5a732f18d5+53520f316c,g64a986408d+f5613e8b4f,g6c1bc301e9+51106c2951,g858d7b2824+f5613e8b4f,g8a8a8dda67+585e252eca,g99cad8db69+6729933424,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+ef4e3a5875,gb0e22166c9+60f28cb32d,gb6a65358fc+0e5473021a,gba4ed39666+c2a2e4ac27,gbb8dafda3b+e9bba80f27,gc120e1dc64+eee469a5e5,gc28159a63d+0e5473021a,gcf0d15dbbd+a761f810f3,gdaeeff99f8+f9a426f77a,ge6526c86ff+d4c1d4bfef,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gf1cff7945b+f5613e8b4f,w.2024.16
LSST Data Management Base Package
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
lsst::afw::image::ExposureFitsReader Class Reference

A FITS reader class for Exposures and their components. More...

#include <ExposureFitsReader.h>

Classes

class  ArchiveReader
 
class  MetadataReader
 

Public Member Functions

 ExposureFitsReader (std::string const &fileName)
 Construct a FITS reader object.
 
 ExposureFitsReader (fits::MemFileManager &manager)
 Construct a FITS reader object.
 
 ExposureFitsReader (fits::Fits *fitsFile)
 Construct a FITS reader object.
 
 ExposureFitsReader (ExposureFitsReader const &)=delete
 
 ExposureFitsReader (ExposureFitsReader &&)=delete
 
ExposureFitsReaderoperator= (ExposureFitsReader const &)=delete
 
ExposureFitsReaderoperator= (ExposureFitsReader &&)=delete
 
 ~ExposureFitsReader () noexcept
 
lsst::geom::Box2I readBBox (ImageOrigin origin=PARENT)
 Read the bounding box of the on-disk image.
 
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.
 
int readSerializationVersion ()
 Read the serialization version number from the header.
 
std::shared_ptr< daf::base::PropertyListreadMetadata ()
 Read the flexible metadata associated with the Exposure.
 
std::optional< table::RecordIdreadExposureId ()
 Read the Exposure's exposure ID, if it exists.
 
std::shared_ptr< afw::geom::SkyWcsreadWcs ()
 Read the Exposure's world coordinate system.
 
std::shared_ptr< FilterLabelreadFilter ()
 Read the Exposure's filter information.
 
std::shared_ptr< PhotoCalibreadPhotoCalib ()
 Read the Exposure's photometric calibration.
 
std::shared_ptr< detection::PsfreadPsf ()
 Read the Exposure's point-spread function.
 
std::shared_ptr< afw::geom::polygon::PolygonreadValidPolygon ()
 Read the polygon describing the region of validity for the Exposure.
 
std::shared_ptr< ApCorrMapreadApCorrMap ()
 Read the Exposure's aperture correction map.
 
std::shared_ptr< CoaddInputsreadCoaddInputs ()
 Read the Exposure's coadd input catalogs.
 
std::shared_ptr< VisitInforeadVisitInfo ()
 Read the Exposure's visit metadata.
 
std::shared_ptr< TransmissionCurvereadTransmissionCurve ()
 Read the Exposure's transmission curve.
 
std::shared_ptr< cameraGeom::DetectorreadDetector ()
 Read the Exposure's detector.
 
std::shared_ptr< typehandling::StorablereadComponent (std::string const &componentName)
 Read an arbitrary non-standard component by name.
 
std::map< std::string, std::shared_ptr< table::io::Persistable > > readExtraComponents ()
 Read the Exposure's non-standard components.
 
std::shared_ptr< ExposureInforeadExposureInfo ()
 Read the ExposureInfo containing all non-image components.
 
template<typename MaskPixelT >
Mask< MaskPixelT > readMask (lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
 Read the mask plane.
 
template<typename MaskPixelT >
ndarray::Array< MaskPixelT, 2, 2 > readMaskArray (lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
 Read the mask plane.
 
template<typename ImagePixelT , typename MaskPixelT = MaskPixel, typename VariancePixelT = VariancePixel>
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.
 
template<typename ImagePixelT , typename MaskPixelT = MaskPixel, typename VariancePixelT = VariancePixel>
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::string getFileName () const
 Return the name of the file this reader targets.
 
std::string readImageDType () const
 Read a string describing the pixel type of the on-disk image plane.
 
std::string readMaskDType () const
 Read a string describing the pixel type of the on-disk image plane.
 
std::string readVarianceDType () const
 Read a string describing the pixel type of the on-disk image plane.
 
template<typename ImagePixelT >
Image< ImagePixelT > readImage (lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
 Read the image plane.
 
template<typename ImagePixelT >
ndarray::Array< ImagePixelT, 2, 2 > readImageArray (lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
 Read the image plane.
 
template<typename VariancePixelT >
Image< VariancePixelT > readVariance (lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
 Read the variance plane.
 
template<typename VariancePixelT >
ndarray::Array< VariancePixelT, 2, 2 > readVarianceArray (lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
 Read the variance plane.
 

Detailed Description

A FITS reader class for Exposures and their components.

Exception Safety
All ExposureFitsReader methods provide strong exception safety, but exceptions thrown by the internal fits::Fits object itself may change its status variable or HDU pointer; ExposureFitsReader guards against this by resetting those before any use of the Fits object.

Definition at line 44 of file ExposureFitsReader.h.

Constructor & Destructor Documentation

◆ ExposureFitsReader() [1/5]

lsst::afw::image::ExposureFitsReader::ExposureFitsReader ( std::string const & fileName)
explicit

Construct a FITS reader object.

Parameters
fileNameName of a file to open.

Definition at line 387 of file ExposureFitsReader.cc.

387: _maskedImageReader(fileName) {}

◆ ExposureFitsReader() [2/5]

lsst::afw::image::ExposureFitsReader::ExposureFitsReader ( fits::MemFileManager & manager)
explicit

Construct a FITS reader object.

Parameters
managerMemory block containing a FITS file.

Definition at line 389 of file ExposureFitsReader.cc.

389: _maskedImageReader(manager) {}

◆ ExposureFitsReader() [3/5]

lsst::afw::image::ExposureFitsReader::ExposureFitsReader ( fits::Fits * fitsFile)
explicit

Construct a FITS reader object.

Parameters
fitsFilePointer to a CFITSIO file object. Lifetime will not be managed by the Reader object.

Definition at line 391 of file ExposureFitsReader.cc.

391: _maskedImageReader(fitsFile) {}

◆ ExposureFitsReader() [4/5]

lsst::afw::image::ExposureFitsReader::ExposureFitsReader ( ExposureFitsReader const & )
delete

◆ ExposureFitsReader() [5/5]

lsst::afw::image::ExposureFitsReader::ExposureFitsReader ( ExposureFitsReader && )
delete

◆ ~ExposureFitsReader()

lsst::afw::image::ExposureFitsReader::~ExposureFitsReader ( )
defaultnoexcept

Member Function Documentation

◆ getFileName()

std::string lsst::afw::image::ExposureFitsReader::getFileName ( ) const
inline

Return the name of the file this reader targets.

Definition at line 289 of file ExposureFitsReader.h.

289{ return _maskedImageReader.getFileName(); }
std::string getFileName() const
Return the name of the file this reader targets.

◆ operator=() [1/2]

ExposureFitsReader & lsst::afw::image::ExposureFitsReader::operator= ( ExposureFitsReader && )
delete

◆ operator=() [2/2]

ExposureFitsReader & lsst::afw::image::ExposureFitsReader::operator= ( ExposureFitsReader const & )
delete

◆ read()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
template Exposure< std::uint64_t, MaskPixel, VariancePixel > lsst::afw::image::ExposureFitsReader::read ( lsst::geom::Box2I const & bbox = lsst::geom::Box2I(),
ImageOrigin origin = PARENT,
bool conformMasks = false,
bool allowUnsafe = false )

Read the full Exposure.

Parameters
bboxA bounding box used to defined a subimage, or an empty box (default) to read the whole image.
originCoordinate system convention for the given box.
conformMasksIf True, conform the global mask dict to match this file.
allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

In Python, this templated method is wrapped with an additional dtype argument to provide the type to read (for the image plane). This defaults to the type of the on-disk image.

Definition at line 625 of file ExposureFitsReader.cc.

628 {
629 auto mi =
630 readMaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>(bbox, origin, conformMasks, allowUnsafe);
631 return Exposure<ImagePixelT, MaskPixelT, VariancePixelT>(mi, readExposureInfo());
632}
AmpInfoBoxKey bbox
Definition Amplifier.cc:117
std::shared_ptr< ExposureInfo > readExposureInfo()
Read the ExposureInfo containing all non-image components.

◆ readApCorrMap()

std::shared_ptr< ApCorrMap > lsst::afw::image::ExposureFitsReader::readApCorrMap ( )

Read the Exposure's aperture correction map.

Definition at line 462 of file ExposureFitsReader.cc.

462 {
463 _ensureReaders();
464 return _archiveReader->readComponent<ApCorrMap>(_getFitsFile(), ArchiveReader::AP_CORR_MAP);
465}

◆ readBBox()

lsst::geom::Box2I lsst::afw::image::ExposureFitsReader::readBBox ( ImageOrigin origin = PARENT)

Read the bounding box of the on-disk image.

Parameters
originCoordinate system convention for the returned box. If LOCAL, the returned box will always have a minimum of (0, 0).

Definition at line 395 of file ExposureFitsReader.cc.

395 {
396 return _maskedImageReader.readBBox(origin);
397}
lsst::geom::Box2I readBBox(ImageOrigin origin=PARENT)
Read the bounding box of the on-disk image.

◆ readCoaddInputs()

std::shared_ptr< CoaddInputs > lsst::afw::image::ExposureFitsReader::readCoaddInputs ( )

Read the Exposure's coadd input catalogs.

Definition at line 467 of file ExposureFitsReader.cc.

467 {
468 _ensureReaders();
469 return _archiveReader->readComponent<CoaddInputs>(_getFitsFile(), ArchiveReader::COADD_INPUTS);
470}

◆ readComponent()

std::shared_ptr< typehandling::Storable > lsst::afw::image::ExposureFitsReader::readComponent ( std::string const & componentName)

Read an arbitrary non-standard component by name.

Definition at line 488 of file ExposureFitsReader.cc.

488 {
489 _ensureReaders();
490 return _archiveReader->readComponent<typehandling::Storable>(_getFitsFile(), componentName);
491}

◆ readDetector()

std::shared_ptr< cameraGeom::Detector > lsst::afw::image::ExposureFitsReader::readDetector ( )

Read the Exposure's detector.

Definition at line 483 of file ExposureFitsReader.cc.

483 {
484 _ensureReaders();
485 return _archiveReader->readComponent<cameraGeom::Detector>(_getFitsFile(), ArchiveReader::DETECTOR);
486}

◆ readExposureId()

std::optional< table::RecordId > lsst::afw::image::ExposureFitsReader::readExposureId ( )

Read the Exposure's exposure ID, if it exists.

Definition at line 419 of file ExposureFitsReader.cc.

419 {
420 _ensureReaders();
421 return _metadataReader->exposureId;
422}

◆ readExposureInfo()

std::shared_ptr< ExposureInfo > lsst::afw::image::ExposureFitsReader::readExposureInfo ( )

Read the ExposureInfo containing all non-image components.

Definition at line 498 of file ExposureFitsReader.cc.

498 {
499 auto result = std::make_shared<ExposureInfo>();
500 result->setMetadata(readMetadata());
501 result->setPhotoCalib(readPhotoCalib());
502 result->setVisitInfo(readVisitInfo());
503 // Override ID set in visitInfo, if necessary
504 std::optional<table::RecordId> exposureId = readExposureId();
505 if (exposureId) {
506 result->setId(*exposureId);
507 }
508 // When reading an ExposureInfo (as opposed to reading individual
509 // components), we warn and try to proceed when a component is present
510 // but can't be read due its serialization factory not being set up
511 // (that's what throws the NotFoundErrors caught below).
512 try {
513 result->setPsf(readPsf());
514 } catch (pex::exceptions::NotFoundError& err) {
515 LOGLS_WARN(_log, "Could not read PSF; setting to null: " << err.what());
516 }
517 try {
518 result->setCoaddInputs(readCoaddInputs());
519 } catch (pex::exceptions::NotFoundError& err) {
520 LOGLS_WARN(_log, "Could not read CoaddInputs; setting to null: " << err.what());
521 }
522 try {
523 result->setApCorrMap(readApCorrMap());
524 } catch (pex::exceptions::NotFoundError& err) {
525 LOGLS_WARN(_log, "Could not read ApCorrMap; setting to null: " << err.what());
526 }
527 try {
528 result->setValidPolygon(readValidPolygon());
529 } catch (pex::exceptions::NotFoundError& err) {
530 LOGLS_WARN(_log, "Could not read ValidPolygon; setting to null: " << err.what());
531 }
532 try {
533 result->setTransmissionCurve(readTransmissionCurve());
534 } catch (pex::exceptions::NotFoundError& err) {
535 LOGLS_WARN(_log, "Could not read TransmissionCurve; setting to null: " << err.what());
536 }
537 try {
538 result->setDetector(readDetector());
539 } catch (pex::exceptions::NotFoundError& err) {
540 LOGLS_WARN(_log, "Could not read Detector; setting to null: " << err.what());
541 }
542 // In the case of WCS, we fall back to the metadata WCS if the one from
543 // the archive can't be read.
544 _ensureReaders();
545 result->setWcs(_metadataReader->wcs);
546 try {
547 auto wcs = _archiveReader->readComponent<afw::geom::SkyWcs>(_getFitsFile(), ArchiveReader::WCS);
548 if (!wcs) {
549 LOGLS_DEBUG(_log, "No WCS found in binary table");
550 } else {
551 result->setWcs(wcs);
552 }
553 } catch (pex::exceptions::NotFoundError& err) {
554 auto msg = str(boost::format("Could not read WCS extension; setting to null: %s") % err.what());
555 if (result->hasWcs()) {
556 msg += " ; using WCS from FITS header";
557 }
558 LOGLS_WARN(_log, msg);
559 }
560 for (const auto& keyValue : readExtraComponents()) {
562 std::string key = keyValue.first;
563 StorablePtr object = std::dynamic_pointer_cast<StorablePtr::element_type>(keyValue.second);
564
565 if (object.use_count() > 0) { // Failed cast guarantees empty pointer, but not a null one
566 result->setComponent(typehandling::makeKey<StorablePtr>(key), object);
567 } else {
568 LOGLS_WARN(_log, "Data corruption: generic component " << key << " is not a Storable; skipping.");
569 }
570 }
571 // Convert old-style Filter to new-style FilterLabel
572 // In newer versions this is handled by readExtraComponents()
573 if (_metadataReader->version < 2 && !result->hasFilter()) {
574 result->setFilter(readFilter());
575 }
576 return result;
577} // namespace image
py::object result
Definition _schema.cc:429
#define LOGLS_WARN(logger, message)
Log a warn-level message using an iostream-based interface.
Definition Log.h:659
#define LOGLS_DEBUG(logger, message)
Log a debug-level message using an iostream-based interface.
Definition Log.h:619
std::shared_ptr< TransmissionCurve > readTransmissionCurve()
Read the Exposure's transmission curve.
std::map< std::string, std::shared_ptr< table::io::Persistable > > readExtraComponents()
Read the Exposure's non-standard components.
std::shared_ptr< detection::Psf > readPsf()
Read the Exposure's point-spread function.
std::shared_ptr< afw::geom::polygon::Polygon > readValidPolygon()
Read the polygon describing the region of validity for the Exposure.
std::shared_ptr< FilterLabel > readFilter()
Read the Exposure's filter information.
std::shared_ptr< daf::base::PropertyList > readMetadata()
Read the flexible metadata associated with the Exposure.
std::shared_ptr< PhotoCalib > readPhotoCalib()
Read the Exposure's photometric calibration.
std::optional< table::RecordId > readExposureId()
Read the Exposure's exposure ID, if it exists.
std::shared_ptr< ApCorrMap > readApCorrMap()
Read the Exposure's aperture correction map.
std::shared_ptr< CoaddInputs > readCoaddInputs()
Read the Exposure's coadd input catalogs.
std::shared_ptr< cameraGeom::Detector > readDetector()
Read the Exposure's detector.
std::shared_ptr< VisitInfo > readVisitInfo()
Read the Exposure's visit metadata.

◆ readExtraComponents()

std::map< std::string, std::shared_ptr< table::io::Persistable > > lsst::afw::image::ExposureFitsReader::readExtraComponents ( )

Read the Exposure's non-standard components.

Definition at line 493 of file ExposureFitsReader.cc.

493 {
494 _ensureReaders();
495 return _archiveReader->readExtraComponents(_getFitsFile());
496}

◆ readFilter()

std::shared_ptr< FilterLabel > lsst::afw::image::ExposureFitsReader::readFilter ( )

Read the Exposure's filter information.

Definition at line 433 of file ExposureFitsReader.cc.

433 {
434 _ensureReaders();
435 if (_metadataReader->version < 2) {
436 return _metadataReader->filterLabel;
437 } else {
438 return _archiveReader->readComponent<FilterLabel>(_getFitsFile(), ExposureInfo::KEY_FILTER.getId());
439 }
440}
static typehandling::Key< std::string, std::shared_ptr< FilterLabel const > > const KEY_FILTER
Standard key for looking up filter information.

◆ readImage()

template<typename ImagePixelT >
template Image< std::uint64_t > lsst::afw::image::ExposureFitsReader::readImage ( lsst::geom::Box2I const & bbox = lsst::geom::Box2I(),
ImageOrigin origin = PARENT,
bool allowUnsafe = false )

Read the image plane.

Parameters
bboxA bounding box used to defined a subimage, or an empty box (default) to read the whole image.
originCoordinate system convention for the given box.
allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

In Python, this templated method is wrapped with an additional dtype argument to provide the type to read. This defaults to the type of the on-disk image.

Definition at line 580 of file ExposureFitsReader.cc.

581 {
582 return _maskedImageReader.readImage<ImagePixelT>(bbox, origin, allowUnsafe);
583}
Image< ImagePixelT > readImage(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the image plane.

◆ readImageArray()

template<typename ImagePixelT >
template ndarray::Array< std::uint64_t, 2, 2 > lsst::afw::image::ExposureFitsReader::readImageArray ( lsst::geom::Box2I const & bbox = lsst::geom::Box2I(),
ImageOrigin origin = PARENT,
bool allowUnsafe = false )

Read the image plane.

Parameters
bboxA bounding box used to defined a subimage, or an empty box (default) to read the whole image.
originCoordinate system convention for the given box.
allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

In Python, this templated method is wrapped with an additional dtype argument to provide the type to read. This defaults to the type of the on-disk image.

Definition at line 586 of file ExposureFitsReader.cc.

587 {
588 return _maskedImageReader.readImageArray<ImagePixelT>(bbox, origin, allowUnsafe);
589}
ndarray::Array< ImagePixelT, 2, 2 > readImageArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the image plane.

◆ readImageDType()

std::string lsst::afw::image::ExposureFitsReader::readImageDType ( ) const

Read a string describing the pixel type of the on-disk image plane.

Returns
A string of the form [u](int|float)<bits> (e.g. "uint16", "float64").

Definition at line 408 of file ExposureFitsReader.cc.

408{ return _maskedImageReader.readImageDType(); }
std::string readImageDType() const
Read a string describing the pixel type of the on-disk image plane.

◆ readMask()

template<typename MaskPixelT >
template Mask< MaskPixel > lsst::afw::image::ExposureFitsReader::readMask ( lsst::geom::Box2I const & bbox = lsst::geom::Box2I(),
ImageOrigin origin = PARENT,
bool conformMasks = false,
bool allowUnsafe = false )

Read the mask plane.

Parameters
bboxA bounding box used to defined a subimage, or an empty box (default) to read the whole image.
originCoordinate system convention for the given box.
conformMasksIf True, conform the global mask dict to match this file.
allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

In Python, this templated method is wrapped with an additional dtype argument to provide the type to read. This defaults to the type of the on-disk image.

Definition at line 592 of file ExposureFitsReader.cc.

593 {
594 return _maskedImageReader.readMask<MaskPixelT>(bbox, origin, conformMasks, allowUnsafe);
595}
Mask< MaskPixelT > readMask(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
Read the mask plane.

◆ readMaskArray()

template<typename MaskPixelT >
template ndarray::Array< MaskPixel, 2, 2 > lsst::afw::image::ExposureFitsReader::readMaskArray ( lsst::geom::Box2I const & bbox = lsst::geom::Box2I(),
ImageOrigin origin = PARENT,
bool allowUnsafe = false )

Read the mask plane.

Parameters
bboxA bounding box used to defined a subimage, or an empty box (default) to read the whole image.
originCoordinate system convention for the given box.
allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

In Python, this templated method is wrapped with an additional dtype argument to provide the type to read. This defaults to the type of the on-disk image.

Definition at line 598 of file ExposureFitsReader.cc.

599 {
600 return _maskedImageReader.readMaskArray<MaskPixelT>(bbox, origin, allowUnsafe);
601}
ndarray::Array< MaskPixelT, 2, 2 > readMaskArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the mask plane.

◆ readMaskDType()

std::string lsst::afw::image::ExposureFitsReader::readMaskDType ( ) const

Read a string describing the pixel type of the on-disk image plane.

Returns
A string of the form [u](int|float)<bits> (e.g. "uint16", "float64").

Definition at line 410 of file ExposureFitsReader.cc.

410{ return _maskedImageReader.readMaskDType(); }
std::string readMaskDType() const
Read a string describing the pixel type of the on-disk image plane.

◆ readMaskedImage()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
template MaskedImage< std::uint64_t, MaskPixel, VariancePixel > lsst::afw::image::ExposureFitsReader::readMaskedImage ( lsst::geom::Box2I const & bbox = lsst::geom::Box2I(),
ImageOrigin origin = PARENT,
bool conformMasks = false,
bool allowUnsafe = false )

Read the MaskedImage.

Parameters
bboxA bounding box used to defined a subimage, or an empty box (default) to read the whole image.
originCoordinate system convention for the given box.
conformMasksIf True, conform the global mask dict to match this file.
allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

In Python, this templated method is wrapped with an additional dtype argument to provide the type to read (for the image plane). This defaults to the type of the on-disk image.

Definition at line 617 of file ExposureFitsReader.cc.

618 {
619 return _maskedImageReader.read<ImagePixelT, MaskPixelT, VariancePixelT>(bbox, origin, conformMasks,
620 /* needAllHdus= */ false,
621 allowUnsafe);
622}
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.

◆ readMetadata()

std::shared_ptr< daf::base::PropertyList > lsst::afw::image::ExposureFitsReader::readMetadata ( )

Read the flexible metadata associated with the Exposure.

FITS header keys used to construct other Exposure components will be stripped.

Definition at line 414 of file ExposureFitsReader.cc.

414 {
415 _ensureReaders();
416 return _metadataReader->metadata;
417}

◆ readPhotoCalib()

std::shared_ptr< PhotoCalib > lsst::afw::image::ExposureFitsReader::readPhotoCalib ( )

Read the Exposure's photometric calibration.

Definition at line 442 of file ExposureFitsReader.cc.

442 {
443 _ensureReaders();
444 if (_metadataReader->version == 0) {
445 return _metadataReader->photoCalib;
446 } else {
447 return _archiveReader->readComponent<image::PhotoCalib>(_getFitsFile(), ArchiveReader::PHOTOCALIB);
448 }
449}
The photometric calibration of an exposure.
Definition PhotoCalib.h:114

◆ readPsf()

std::shared_ptr< detection::Psf > lsst::afw::image::ExposureFitsReader::readPsf ( )

Read the Exposure's point-spread function.

Definition at line 451 of file ExposureFitsReader.cc.

451 {
452 _ensureReaders();
453 return _archiveReader->readComponent<detection::Psf>(_getFitsFile(), ArchiveReader::PSF);
454}

◆ readSerializationVersion()

int lsst::afw::image::ExposureFitsReader::readSerializationVersion ( )

Read the serialization version number from the header.

Definition at line 403 of file ExposureFitsReader.cc.

403 {
404 _ensureReaders();
405 return _metadataReader->version;
406}

◆ readTransmissionCurve()

std::shared_ptr< TransmissionCurve > lsst::afw::image::ExposureFitsReader::readTransmissionCurve ( )

Read the Exposure's transmission curve.

Definition at line 477 of file ExposureFitsReader.cc.

477 {
478 _ensureReaders();
479 return _archiveReader->readComponent<TransmissionCurve>(_getFitsFile(),
481}

◆ readValidPolygon()

std::shared_ptr< afw::geom::polygon::Polygon > lsst::afw::image::ExposureFitsReader::readValidPolygon ( )

Read the polygon describing the region of validity for the Exposure.

Definition at line 456 of file ExposureFitsReader.cc.

456 {
457 _ensureReaders();
458 return _archiveReader->readComponent<afw::geom::polygon::Polygon>(_getFitsFile(),
460}

◆ readVariance()

template<typename VariancePixelT >
template Image< VariancePixel > lsst::afw::image::ExposureFitsReader::readVariance ( lsst::geom::Box2I const & bbox = lsst::geom::Box2I(),
ImageOrigin origin = PARENT,
bool allowUnsafe = false )

Read the variance plane.

Parameters
bboxA bounding box used to defined a subimage, or an empty box (default) to read the whole image.
originCoordinate system convention for the given box.
allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

In Python, this templated method is wrapped with an additional dtype argument to provide the type to read. This defaults to the type of the on-disk image.

Definition at line 604 of file ExposureFitsReader.cc.

605 {
606 return _maskedImageReader.readVariance<VariancePixelT>(bbox, origin, allowUnsafe);
607}
Image< VariancePixelT > readVariance(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the variance plane.

◆ readVarianceArray()

template<typename VariancePixelT >
template ndarray::Array< VariancePixel, 2, 2 > lsst::afw::image::ExposureFitsReader::readVarianceArray ( lsst::geom::Box2I const & bbox = lsst::geom::Box2I(),
ImageOrigin origin = PARENT,
bool allowUnsafe = false )

Read the variance plane.

Parameters
bboxA bounding box used to defined a subimage, or an empty box (default) to read the whole image.
originCoordinate system convention for the given box.
allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

In Python, this templated method is wrapped with an additional dtype argument to provide the type to read. This defaults to the type of the on-disk image.

Definition at line 610 of file ExposureFitsReader.cc.

612 {
613 return _maskedImageReader.readVarianceArray<VariancePixelT>(bbox, origin, allowUnsafe);
614}
ndarray::Array< VariancePixelT, 2, 2 > readVarianceArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the variance plane.

◆ readVarianceDType()

std::string lsst::afw::image::ExposureFitsReader::readVarianceDType ( ) const

Read a string describing the pixel type of the on-disk image plane.

Returns
A string of the form [u](int|float)<bits> (e.g. "uint16", "float64").

Definition at line 412 of file ExposureFitsReader.cc.

412{ return _maskedImageReader.readVarianceDType(); }
std::string readVarianceDType() const
Read a string describing the pixel type of the on-disk image plane.

◆ readVisitInfo()

std::shared_ptr< VisitInfo > lsst::afw::image::ExposureFitsReader::readVisitInfo ( )

Read the Exposure's visit metadata.

Definition at line 472 of file ExposureFitsReader.cc.

472 {
473 _ensureReaders();
474 return _metadataReader->visitInfo;
475}

◆ readWcs()

std::shared_ptr< afw::geom::SkyWcs > lsst::afw::image::ExposureFitsReader::readWcs ( )

Read the Exposure's world coordinate system.

Definition at line 424 of file ExposureFitsReader.cc.

424 {
425 _ensureReaders();
426 auto r = _archiveReader->readComponent<afw::geom::SkyWcs>(_getFitsFile(), ArchiveReader::WCS);
427 if (!r) {
428 r = _metadataReader->wcs;
429 }
430 return r;
431}

◆ readXY0()

lsst::geom::Point2I lsst::afw::image::ExposureFitsReader::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.

Parameters
bboxA bounding box used to defined a subimage, or an empty
originCoordinate system convention for the given box. Ignored if bbox is empty.

Definition at line 399 of file ExposureFitsReader.cc.

399 {
400 return _maskedImageReader.readXY0(bbox, origin);
401}
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.

The documentation for this class was generated from the following files: