lsst.afw  22.0.1-27-ga185acb71+cd0c1e0a06
Functions | Variables
lsst::afw::geom::detail Namespace Reference

Functions

std::shared_ptr< ast::FrameSetreadFitsWcs (daf::base::PropertySet &metadata, bool strip=true)
 Read a FITS convention WCS FrameSet from FITS metadata. More...
 
std::shared_ptr< ast::FrameDictreadLsstSkyWcs (daf::base::PropertySet &metadata, bool strip=true)
 Read an LSST celestial WCS FrameDict from a FITS header. More...
 
std::shared_ptr< daf::base::PropertyListgetPropertyListFromFitsChan (ast::FitsChan &fitsChan)
 Copy values from an AST FitsChan into a PropertyList. More...
 
ast::FitsChan getFitsChanFromPropertyList (daf::base::PropertySet &metadata, std::set< std::string > const &excludeNames={}, std::string options="")
 Construct AST FitsChan from PropertyList. More...
 
template<class Transform >
std::shared_ptr< TransformreadStream (std::istream &is)
 Deserialize a Transform from an input stream. More...
 
template<class Transform >
void writeStream (Transform const &transform, std::ostream &os)
 Serialize a Transform to an output stream. More...
 

Variables

constexpr int serializationVersion = 1
 version of serialization used when writing (older versions may also be supported when reading) More...
 

Function Documentation

◆ getFitsChanFromPropertyList()

ast::FitsChan lsst::afw::geom::detail::getFitsChanFromPropertyList ( daf::base::PropertySet metadata,
std::set< std::string > const &  excludeNames = {},
std::string  options = "" 
)

Construct AST FitsChan from PropertyList.

Parameters
[in]metadataMetadata to transfer; if this is a PropertyList then the order of items is preserved.
[in]excludeNamesNames of entries to exclude from the returned header string.
[in]optionsOptions string to pass to ast::FitsChan constructor.
Returns
an ast::FitsChan representing this PropertyList

Definition at line 321 of file frameSetUtils.cc.

◆ getPropertyListFromFitsChan()

std::shared_ptr< daf::base::PropertyList > lsst::afw::geom::detail::getPropertyListFromFitsChan ( ast::FitsChan fitsChan)

Copy values from an AST FitsChan into a PropertyList.

Warning
COMMENT and HISTORY cards are treated as string values
Exceptions
lsst::pex::exceptions::TypeErrorif fitsChan contains cards whose type is not supported by PropertyList: complex numbers, or cards with no value

Definition at line 256 of file frameSetUtils.cc.

◆ readFitsWcs()

std::shared_ptr< ast::FrameSet > lsst::afw::geom::detail::readFitsWcs ( daf::base::PropertySet metadata,
bool  strip = true 
)

Read a FITS convention WCS FrameSet from FITS metadata.

The resulting FrameSet may be any kind of WCS supported by FITS; if it is a celestial WCS then 1,1 will be the lower left corner of the image (the FITS convention, not the LSST convention).

This routine replaces RADECSYS with RADESYS if the former is present and the latter is not, since that is a common misspelling in FITS headers.

The returned FrameSet will have an IWC (intermediate world coordinate system) frame.

Parameters
[in,out]metadataFITS header cards
[in]stripIf true: strip items from metadata used to create the WCS, such as RADESYS, EQUINOX, CTYPE12, CRPIX12, CRVAL12, etc. Always keep keywords that might be wanted for other purpposes, including NAXIS12 and date-related keywords such as "DATE-OBS" and "TIMESYS" (but not "EQUINOX").
Exceptions
pex::exceptions::TypeErrorif the metadata does not contain a FITS-WCS

Definition at line 87 of file frameSetUtils.cc.

◆ readLsstSkyWcs()

std::shared_ptr< ast::FrameDict > lsst::afw::geom::detail::readLsstSkyWcs ( daf::base::PropertySet metadata,
bool  strip = true 
)

Read an LSST celestial WCS FrameDict from a FITS header.

Calls getImageXY0FromMetadata to determine image XY0.

Saves CRVAL by setting the output SkyFrame's SkyRef to CRVAL and SkyRefIs="Ignore" (so SkyRef is not treated as an offset).

Warning
Does not compensate for the offset between a subimage and its parent image; callers must do that manually, e.g. by calling SkyWcs::copyAtShiftedPosition.
the general SkyWcs generated by LSST software cannot be exactly represented using standard WCS FITS cards, and so this function cannot read those. This function is intended for two purposes:
  • Read the standard FITS WCS found in raw data and other images from non-LSST observatories and convert it to the LSST pixel convention.
  • Read the approximate FITS WCS that LSST writes to FITS images (for use by non-LSST code).

The frames of the returned WCS will be as follows:

  • "PIXELS" (base frame): pixel frame with 0,0 the lower left corner of the image (LSST convention)
  • "IWC": FITS WCS intermediate world coordinate system
  • "SKY" (current frame): an ast::SkyFrame with domain "SKY": ICRS RA, Dec

All frames are instances of ast::Frame except the SKY frame. All have 2 axes.

Parameters
[in,out]metadataFITS header cards
[in]stripIf true: strip items from metadata used to create the WCS, such as RADESYS, EQUINOX, CTYPE12, CRPIX12, CRVAL12, etc. Always keep keywords that might be wanted for other purpposes, including NAXIS12 and date-related keywords such as "DATE-OBS" and "TIMESYS" (but not "EQUINOX").
Exceptions
lsst::pex::exceptions::TypeErrorif the metadata does not describe a celestial WCS.

Definition at line 139 of file frameSetUtils.cc.

◆ readStream()

template<class Transform >
std::shared_ptr< Transform > lsst::afw::geom::detail::readStream ( std::istream is)

Deserialize a Transform from an input stream.

Template Parameters
Transformthe Transform class; can be Transform<FromEndpoint, ToEndpoint>, SkyWcs, or any other compatible class, i.e. it must support the following (see Transform.h for details):
  • a constructor that takes an ast::FrameSet
  • static method getShortClassName
  • method getMapping
Parameters
[in]isinput stream from which to deserialize this Transform

Definition at line 79 of file transformUtils.h.

◆ writeStream()

template<class Transform >
void lsst::afw::geom::detail::writeStream ( Transform const &  transform,
std::ostream os 
)

Serialize a Transform to an output stream.

Version 1 format is as follows:

  • The version number (an integer)
  • A space
  • The short class name, as obtained from getShortClassName
  • A space
  • The contained ast::FrameSet written using FrameSet.show(os, false)
Parameters
[out]osoutput stream to which to serialize this Transform
[in]transformTransform to serialize

Definition at line 107 of file transformUtils.h.

Variable Documentation

◆ serializationVersion

constexpr int lsst::afw::geom::detail::serializationVersion = 1
constexpr

version of serialization used when writing (older versions may also be supported when reading)

Definition at line 42 of file transformUtils.h.