File ExposureInfo.h

namespace lsst

Class for a simple mapping implementing a generic AstrometryTransform.

Remove all non-astronomical counts from the Chunk Exposure’s pixels.

Forward declarations for lsst::utils::Cache

For details on the Cache class, see the Cache.h file.

It uses a template rather than a pointer so that the derived classes can use the specifics of the transform. The class simplePolyMapping overloads a few routines.

A base class for image defects

Numeric constants used by the Integrate.h integrator routines.

Compute Image Statistics

Note

Gauss-Kronrod-Patterson quadrature coefficients for use in quadpack routine qng. These coefficients were calculated with 101 decimal digit arithmetic by L. W. Fullerton, Bell Labs, Nov 1981.

Note

The Statistics class itself can only handle lsst::afw::image::MaskedImage() types. The philosophy has been to handle other types by making them look like lsst::afw::image::MaskedImage() and reusing that code. Users should have no need to instantiate a Statistics object directly, but should use the overloaded makeStatistics() factory functions.

namespace afw
namespace image
class ExposureInfo
#include <ExposureInfo.h>

A collection of all the things that make an Exposure different from a MaskedImage

The constness semantics of the things held by ExposureInfo are admittedly a bit of a mess, but they’re that way to preserve backwards compatibility for now. Eventually I’d like to make a lot of these things immutable, but in the meantime, here’s the summary:

  • Filter is held and returned by value.

  • VisitInfo is immutable and is held by a const ptr and has a setter and getter.

  • Metadata is held by non-const pointer, and you can get a non-const pointer via a const member function accessor (i.e. constness is not propagated).

  • all other types are only accessible through non-const pointers

The setter for Wcs clones its input arguments (this is a departure from the previous behavior for Wcs but it’s safer w.r.t. aliasing and it matches the old (and current) behavior of the Exposure and ExposureInfo constructors, which clone their arguments. The setter for Psf and constructors do not clone the Psf, as Psfs are immutable and hence we don’t need to ensure strict ownership. The setter for Detector does not clone its input argument, because while it technically isn’t, we can safely consider a Detector to be immutable once it’s attached to an ExposureInfo.

Unnamed Group

static int _addToArchive(FitsWriteData &data, table::io::Persistable const &object, std::string key, std::string comment)

Add a Persistable object to FITS data.

Return

the unique ID for the object, as stored with key

Parameters
  • [out] data: the FITS output data to update

  • [in] object: the object to store

  • [in] key: the FITS header keyword to contain a unique ID for the object

  • [in] comment: the comment for key in the FITS header

Exceptions
  • lsst::pex::exceptions::InvalidParameterError: Thrown if key contains the “.” character. Does not provide exception safety; data may be corrupted in the event of an exception. No other side effects.

static int _addToArchive(FitsWriteData &data, std::shared_ptr<table::io::Persistable const> const &object, std::string key, std::string comment)

Public Functions

bool hasWcs() const

Does this exposure have a Wcs?

std::shared_ptr<geom::SkyWcs const> getWcs() const

Return the WCS of the exposure.

void setWcs(std::shared_ptr<geom::SkyWcs const> wcs)

Set the WCS of the exposure.

bool hasDetector() const

Does this exposure have Detector information?

std::shared_ptr<cameraGeom::Detector const> getDetector() const

Return the exposure’s Detector information.

void setDetector(std::shared_ptr<cameraGeom::Detector const> detector)

Set the exposure’s Detector information.

Filter getFilter() const

Return the exposure’s filter.

void setFilter(Filter const &filter)

Set the exposure’s filter.

bool hasPhotoCalib() const

Does this exposure have a photometric calibration?

std::shared_ptr<PhotoCalib const> getPhotoCalib() const

Return the exposure’s photometric calibration.

void setPhotoCalib(std::shared_ptr<PhotoCalib const> photoCalib)

Set the Exposure’s PhotoCalib object.

std::shared_ptr<daf::base::PropertySet> getMetadata() const

Return flexible metadata.

void setMetadata(std::shared_ptr<daf::base::PropertySet> metadata)

Set the flexible metadata.

bool hasPsf() const

Does this exposure have a Psf?

std::shared_ptr<detection::Psf const> getPsf() const

Return the exposure’s point-spread function.

void setPsf(std::shared_ptr<detection::Psf const> psf)

Set the exposure’s point-spread function.

bool hasValidPolygon() const

Does this exposure have a valid Polygon.

std::shared_ptr<geom::polygon::Polygon const> getValidPolygon() const

Return the valid Polygon.

void setValidPolygon(std::shared_ptr<geom::polygon::Polygon const> polygon)

Set the exposure’s valid Polygon.

bool hasApCorrMap() const

Return true if the exposure has an aperture correction map.

std::shared_ptr<ApCorrMap const> getApCorrMap() const

Return the exposure’s aperture correction map (null pointer if !hasApCorrMap())

void setApCorrMap(std::shared_ptr<ApCorrMap const> apCorrMap)

Set the exposure’s aperture correction map (null pointer if !hasApCorrMap())

void initApCorrMap()

Set the exposure’s aperture correction map to a new, empty map

Note that the ExposureInfo constructors do not create an empty aperture correction map, so this method provide a convenient way to initialize one before filling it.

bool hasCoaddInputs() const

Does this exposure have coadd provenance catalogs?

void setCoaddInputs(std::shared_ptr<CoaddInputs const> coaddInputs)

Set the exposure’s coadd provenance catalogs.

std::shared_ptr<CoaddInputs const> getCoaddInputs() const

Return a pair of catalogs that record the inputs, if this Exposure is a coadd (otherwise null).

std::shared_ptr<image::VisitInfo const> getVisitInfo() const

Return the exposure’s visit info.

bool hasVisitInfo() const

Does this exposure have visit info?

void setVisitInfo(std::shared_ptr<image::VisitInfo const> const visitInfo)

Set the exposure’s visit info.

bool hasTransmissionCurve() const

Does this exposure have a transmission curve?

std::shared_ptr<TransmissionCurve const> getTransmissionCurve() const

Return the exposure’s transmission curve.

void setTransmissionCurve(std::shared_ptr<TransmissionCurve const> tc)

Set the exposure’s transmission curve.

template<class T>
void setComponent(typehandling::Key<std::string, std::shared_ptr<T>> const &key, std::shared_ptr<T> const &object)

Add a generic component to the ExposureInfo.

If another component is already present under the key, it is overwritten. If a component of a different type is present under the same name, this method raises an exception.

Note

if object is a null pointer, then hasComponent(key) shall return false after this method returns. This is for compatibility with old ExposureInfo idioms, which often use assignment of null to indicate no data.

Template Parameters
  • T: a subclass of typehandling::Storable

Parameters
  • key: a strongly typed identifier for the component

  • object: the object to add.

Exceptions
  • pex::exceptions::TypeError: Thrown if a component of a different type is present under the requested name.

  • pex::exceptions::RuntimeError: Thrown if the insertion failed for implementation-dependent reasons. Provides basic exception safety (a pre-existing component may be removed).

template<class T>
bool hasComponent(typehandling::Key<std::string, T> const &key) const

Test whether a generic component is defined.

Provides strong exception safety.

Return

true if there is a component with key, false otherwise

Parameters
  • key: a strongly typed identifier for the component

template<class T>
std::shared_ptr<T> getComponent(typehandling::Key<std::string, std::shared_ptr<T>> const &key) const

Retrieve a generic component from the ExposureInfo.

Provides strong exception safety.

Return

the component identified by that key, or a null pointer if no such component exists.

Parameters
  • key: a strongly typed identifier for the component

template<class T>
bool removeComponent(typehandling::Key<std::string, T> const &key)

Clear a generic component from the ExposureInfo.

Provides strong exception safety.

Return

true if a component was removed, false otherwise.

Parameters
  • key: a strongly typed identifier for the component. Only components of a compatible type are removed.

ExposureInfo(std::shared_ptr<geom::SkyWcs const> const &wcs = std::shared_ptr<geom::SkyWcs const>(), std::shared_ptr<detection::Psf const> const &psf = std::shared_ptr<detection::Psf const>(), std::shared_ptr<PhotoCalib const> const &photoCalib = std::shared_ptr<PhotoCalib const>(), std::shared_ptr<cameraGeom::Detector const> const &detector = std::shared_ptr<cameraGeom::Detector const>(), std::shared_ptr<geom::polygon::Polygon const> const &polygon = std::shared_ptr<geom::polygon::Polygon const>(), Filter const &filter = Filter(), std::shared_ptr<daf::base::PropertySet> const &metadata = std::shared_ptr<daf::base::PropertySet>(), std::shared_ptr<CoaddInputs> const &coaddInputs = std::shared_ptr<CoaddInputs>(), std::shared_ptr<ApCorrMap> const &apCorrMap = std::shared_ptr<ApCorrMap>(), std::shared_ptr<image::VisitInfo const> const &visitInfo = std::shared_ptr<image::VisitInfo const>(), std::shared_ptr<TransmissionCurve const> const &transmissionCurve = std::shared_ptr<TransmissionCurve>())

Construct an ExposureInfo from its various components.

If a null PhotoCalib and/or PropertySet pointer is passed (the default), a new PhotoCalib and/or PropertyList will be created. To set these pointers to null, you must explicitly call setPhotoCalib or setMetadata after construction.

ExposureInfo(ExposureInfo const &other)

Copy constructor; shares all components except the filter.

ExposureInfo(ExposureInfo &&other)
ExposureInfo(ExposureInfo const &other, bool copyMetadata)

Copy constructor; shares everything but the filter and possibly the metadata.

ExposureInfo &operator=(ExposureInfo const &other)

Assignment; shares all components except the filter.

ExposureInfo &operator=(ExposureInfo &&other)
~ExposureInfo()

Public Static Functions

static int getFitsSerializationVersion()

Get the version of FITS serialization that this ExposureInfo understands.

static std::string const &getFitsSerializationVersionName()

Get the version of FITS serialization version info name.

Public Static Attributes

typehandling::Key<std::string, std::shared_ptr<geom::SkyWcs const>> const KEY_WCS

Standard key for looking up the Wcs.

typehandling::Key<std::string, std::shared_ptr<detection::Psf const>> const KEY_PSF

Standard key for looking up the point-spread function.

typehandling::Key<std::string, std::shared_ptr<PhotoCalib const>> const KEY_PHOTO_CALIB

Standard key for looking up the photometric calibration.

typehandling::Key<std::string, std::shared_ptr<cameraGeom::Detector const>> const KEY_DETECTOR

Standard key for looking up the detector information.

typehandling::Key<std::string, std::shared_ptr<geom::polygon::Polygon const>> const KEY_VALID_POLYGON

Standard key for looking up the valid polygon.

typehandling::Key<std::string, std::shared_ptr<CoaddInputs const>> const KEY_COADD_INPUTS

Standard key for looking up coadd provenance catalogs.

typehandling::Key<std::string, std::shared_ptr<ApCorrMap const>> const KEY_AP_CORR_MAP

Standard key for looking up the aperture correction map.

typehandling::Key<std::string, std::shared_ptr<TransmissionCurve const>> const KEY_TRANSMISSION_CURVE

Standard key for looking up the transmission curve.

Private Functions

FitsWriteData _startWriteFits(lsst::geom::Point2I const &xy0 = lsst::geom::Point2I()) const

Start the process of writing an exposure to FITS.

See

FitsWriteData

Parameters
  • [in] xy0: The origin of the exposure associated with this object, used to install a linear offset-only WCS in the FITS header.

void _finishWriteFits(fits::Fits &fitsfile, FitsWriteData const &data) const

Write any additional non-image HDUs to a FITS file.

The additional HDUs will be appended to the FITS file, and should line up with the HDU index keys included in the result of wcs.getFitsMetadata() if this is called after writing the

MaskedImage HDUs.
Parameters
  • [in] fitsfile: Open FITS object to write to. Does not need to be positioned to any particular HDU.

  • [inout] data: The data returned by this object’s _startWriteFits method.

See

FitsWriteData

template<class T>
void _setComponent(typehandling::Key<std::string, std::shared_ptr<T>> const &key, std::shared_ptr<T> const &object)

Private Members

Filter _filter
std::shared_ptr<daf::base::PropertySet> _metadata
std::shared_ptr<image::VisitInfo const> _visitInfo
std::unique_ptr<detail::StorableMap> _components

Private Static Functions

static std::shared_ptr<ApCorrMap> _cloneApCorrMap(std::shared_ptr<ApCorrMap const> apCorrMap)

Friends

friend lsst::afw::image::Exposure
struct FitsWriteData

A struct passed back and forth between Exposure and ExposureInfo when writing FITS files.

An ExposureInfo is generally held by an Exposure, and we implement much of Exposure persistence here in ExposureInfo. FITS writing needs to take place in three steps:

  1. Exposure calls ExposureInfo::_startWriteFits to generate the image headers in the form of PropertyLists. The headers include archive IDs for the components of ExposureInfo, so we have to put those in the archive at this time, and transfer the PropertyLists and archive to the Exposure for the next step.

  2. Exposure calls MaskedImage::writeFits to save the Image, Mask, and Variance HDUs along with the headers.

  3. Exposure calls ExposureInfo::_finishWriteFits to save the archive to additional table HDUs.

Public Members

std::shared_ptr<daf::base::PropertyList> metadata
std::shared_ptr<daf::base::PropertyList> imageMetadata
std::shared_ptr<daf::base::PropertyList> maskMetadata
std::shared_ptr<daf::base::PropertyList> varianceMetadata
table::io::OutputArchive archive