|
lsst.afw gba399f52f3+9b61cfce8e
|
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixels. More...
#include <SkyWcs.h>
Public Member Functions | |
| SkyWcs (SkyWcs const &)=default | |
| SkyWcs (SkyWcs &&)=default | |
| SkyWcs & | operator= (SkyWcs const &)=delete |
| SkyWcs & | operator= (SkyWcs &&)=delete |
| ~SkyWcs () override=default | |
| bool | operator== (SkyWcs const &other) const |
| Equality is based on the string representations being equal. | |
| bool | operator!= (SkyWcs const &other) const |
| SkyWcs (daf::base::PropertySet &metadata, bool strip=false) | |
| Construct a SkyWcs from FITS keywords. | |
| SkyWcs (ast::FrameDict const &frameDict) | |
| Construct a SkyWcs from an ast::FrameDict. | |
| std::shared_ptr< SkyWcs > | copyAtShiftedPixelOrigin (lsst::geom::Extent2D const &shift) const |
| Return a copy of this SkyWcs with the pixel origin shifted by the specified amount. | |
| std::shared_ptr< daf::base::PropertyList > | getFitsMetadata (bool precise=false, lsst::geom::Box2I const &bbox=lsst::geom::Box2I(lsst::geom::Point2I(0, 0), lsst::geom::Extent2I(100, 100))) const |
| Return the WCS as FITS WCS metadata. | |
| lsst::geom::Angle | getPixelScale (lsst::geom::Point2D const &pixel) const |
| Get the pixel scale at the specified pixel position. | |
| lsst::geom::Angle | getPixelScale () const |
| Get the pixel scale at the pixel origin. | |
| lsst::geom::Point2D | getPixelOrigin () const |
| Get the pixel origin, in pixels, using the LSST convention. | |
| lsst::geom::SpherePoint | getSkyOrigin () const |
| Get the sky origin, the celestial fiducial point. | |
| Eigen::Matrix2d | getCdMatrix (lsst::geom::Point2D const &pixel) const |
| Get the 2x2 CD matrix at the specified pixel position. | |
| Eigen::Matrix2d | getCdMatrix () const |
| Get the 2x2 CD matrix at the pixel origin. | |
| std::shared_ptr< SkyWcs > | getTanWcs (lsst::geom::Point2D const &pixel) const |
| Get a local TAN WCS approximation to this WCS at the specified pixel position. | |
| std::shared_ptr< const ast::FrameDict > | getFrameDict () const |
| Get the contained FrameDict. | |
| std::shared_ptr< const TransformPoint2ToSpherePoint > | getTransform () const |
| Get a TransformPoint2ToSpherePoint that transforms pixels to sky in the forward direction and sky to pixels in the inverse direction. | |
| bool | isFlipped () const |
| Does the WCS follow the convention of North=Up, East=Left? | |
| bool | isPersistable () const noexcept override |
| lsst::geom::AffineTransform | linearizePixelToSky (lsst::geom::SpherePoint const &coord, lsst::geom::AngleUnit const &skyUnit) const |
| Return the local linear approximation to pixelToSky at a point given in sky coordinates. | |
| lsst::geom::AffineTransform | linearizePixelToSky (lsst::geom::Point2D const &pixel, lsst::geom::AngleUnit const &skyUnit) const |
| Return the local linear approximation to pixelToSky at a point given in pixel coordinates. | |
| lsst::geom::AffineTransform | linearizeSkyToPixel (lsst::geom::SpherePoint const &coord, lsst::geom::AngleUnit const &skyUnit) const |
| Return the local linear approximation to skyToPixel at a point given in sky coordinates. | |
| lsst::geom::AffineTransform | linearizeSkyToPixel (lsst::geom::Point2D const &pixel, lsst::geom::AngleUnit const &skyUnit) const |
| Return the local linear approximation to skyToPixel at a point given in pixel coordinates. | |
| lsst::geom::SpherePoint | pixelToSky (lsst::geom::Point2D const &pixel) const |
| Compute sky position(s) from pixel position(s). | |
| lsst::geom::SpherePoint | pixelToSky (double x, double y) const |
| std::vector< lsst::geom::SpherePoint > | pixelToSky (std::vector< lsst::geom::Point2D > const &pixels) const |
| lsst::geom::Point2D | skyToPixel (lsst::geom::SpherePoint const &sky) const |
| Compute pixel position(s) from sky position(s). | |
| std::vector< lsst::geom::Point2D > | skyToPixel (std::vector< lsst::geom::SpherePoint > const &sky) const |
| bool | hasFitsApproximation () const |
| Does this SkyWcs have an approximate SkyWcs that can be represented as standard FITS WCS? | |
| std::shared_ptr< SkyWcs > | getFitsApproximation () const |
| Return FITS SkyWcs that approximates this one. | |
| std::shared_ptr< SkyWcs > | copyWithFitsApproximation (std::shared_ptr< SkyWcs > fitsApproximation) const |
| Return a copy of this SkyWcs with the given FITS approximation. | |
| bool | isFits () const |
| Return true getFitsMetadata(true) will succeed with no arguments, false if not. | |
| void | writeStream (std::ostream &os) const |
| Serialize this SkyWcs to an output stream. | |
| std::string | writeString () const |
| Serialize this SkyWcs to a string, using the same format as writeStream. | |
| std::shared_ptr< typehandling::Storable > | cloneStorable () const override |
| Create a new SkyWcs that is a copy of this one. | |
| std::string | toString () const override |
| Create a string representation of this object. | |
| bool | equals (typehandling::Storable const &other) const noexcept override |
| Compare this object to another Storable. | |
Static Public Member Functions | |
| static std::string | getShortClassName () |
| static std::shared_ptr< SkyWcs > | readStream (std::istream &is) |
| Deserialize a SkyWcs from an input stream. | |
| static std::shared_ptr< SkyWcs > | readString (std::string &str) |
| Deserialize a SkyWcs from a string, using the same format as readStream. | |
| static std::shared_ptr< SkyWcs > | readFits (fits::Fits &fitsfile) |
| Read an object from an already open FITS object. | |
| static std::shared_ptr< SkyWcs > | dynamicCast (std::shared_ptr< Persistable > const &ptr) |
| Dynamically cast a shared_ptr. | |
Protected Member Functions | |
| std::string | getPersistenceName () const override |
| std::string | getPythonModule () const override |
| void | write (OutputArchiveHandle &handle) const override |
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixels.
SkyWcs is an immutable object that can not only represent any standard FITS WCS, but can also contain arbitrary Transforms, e.g. to model optical distortion or pixel imperfections.
In order to make a SkyWcs that models optical distortion, say, it is usually simplest to start with a standard FITS WCS (such as a TAN WCS) as an approximation, then insert a transform that models optical distortion by calling makeModifiedWcs. However, it is also possible to build a SkyWcs entirely from transforms, if you prefer, by building an ast::FrameDict and constructing the SkyWcs from that.
SkyWcs internally keeps track of the following frames of reference:
The LSST standard for pixel position is: 0,0 is the center of the lower left image pixel. The FITS standard for pixel position is: 1,1 is the center of the lower left image pixel.
LSST and FITS also use a different origin for subimages:
Internal details: the contained ast::FrameDict
SkyWcs contains an ast::FrameDict which transforms from pixels to sky (in radians) in the forward direction.
This FrameDict contains the named frames described in frames of reference, e.g. "SKY", "IWC", cameraGeom::PIXELS and possibly cameraGeom::ACTUAL_PIXELS. "SKY" is the current frame. If cameraGeom::ACTUAL_PIXELS is present then it is the base frame, otherwise cameraGeom::PIXELS is the base frame.
The "SKY" frame is of type ast::SkyFrame and has the following attributes:
The other frames are of type ast::Frame and have 2 axes.
|
default |
|
default |
|
overridedefault |
|
explicit |
Construct a SkyWcs from FITS keywords.
| [in] | metadata | FITS header metadata |
| [in] | strip | If 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"). |
| lsst::pex::exceptions::TypeError | if the metadata does not describe a celestial WCS. |
|
explicit |
Construct a SkyWcs from an ast::FrameDict.
This is the most general constructor; it can be used to define any celestial WCS. Note that in many cases the result will not be exactly representable as a FITS WCS.
| [in] | frameDict | An ast::FrameDict that describes the transformation from pixels to sky. It must meet the requirements outlined in the contained ast::FrameDict. |
| lsst::pex::exceptions::TypeError | if frameDict is missing any of the required frames of reference. |
|
override |
| std::shared_ptr< SkyWcs > lsst::afw::geom::SkyWcs::copyAtShiftedPixelOrigin | ( | lsst::geom::Extent2D const & | shift | ) | const |
| std::shared_ptr< SkyWcs > lsst::afw::geom::SkyWcs::copyWithFitsApproximation | ( | std::shared_ptr< SkyWcs > | fitsApproximation | ) | const |
|
staticinherited |
Dynamically cast a shared_ptr.
Dynamically cast a shared pointer and raise on failure.
You must provide an explicit template instantiation in the .cc file for each class that inherits from PersistableFacade. Designed to work around RTTI issues on macOS with hidden symbols;
| lsst::pex::exceptions::LogicError | if the cast fails |
param[in] ptr The pointer to be cast.
| lsst::pex::exceptions::TypeError | If the dynamic cast fails. |
Definition at line 218 of file Persistable.cc.
|
overridenoexcept |
| Eigen::Matrix2d lsst::afw::geom::SkyWcs::getCdMatrix | ( | ) | const |
| Eigen::Matrix2d lsst::afw::geom::SkyWcs::getCdMatrix | ( | lsst::geom::Point2D const & | pixel | ) | const |
|
inline |
Return FITS SkyWcs that approximates this one.
Returns an empty pointer if and only if hasFitsApproximation() returns false.
| std::shared_ptr< daf::base::PropertyList > lsst::afw::geom::SkyWcs::getFitsMetadata | ( | bool | precise = false, |
| lsst::geom::Box2I const & | bbox = lsst::geom::Box2I( lsst::geom::Point2I(0, 0), lsst::geom::Extent2I(100, 100) ) ) const |
Return the WCS as FITS WCS metadata.
| [in] | precise | If false, write an already-attached FITS approximation if it exists (if there is no FITS approximation, this parameter is ignored). If true, write the WCS itself to FITS, or raise if this is impossible. |
| [in] | bbox | The bounding box of the image the WCS will be associated with. If the WCS is being attached to a subimage, this should be the bounding box of a subimage. If not provided, this defaults to [0:100, 0:100] for backwards compatibility with previous behavior. |
FITS representations of WCS are described in "Representations of World Coordinates in FITS" by Greisen and Calabretta and several related papers.
The required precision is hard-coded as constant TIGHT_FITS_TOL in SkyWcs.cc
| lsst::pex::exceptions::RuntimeError | if precise is true or there is no FITS approxmation and AST cannot represent this WCS as a FITS WCS to sufficient precision. |
| std::shared_ptr< const ast::FrameDict > lsst::afw::geom::SkyWcs::getFrameDict | ( | ) | const |
Get the contained FrameDict.
The base frame will be cameraGeom::PIXELS or cameraGeom::ACTUAL_PIXELS and the current frame will be SKY, so the forward transform goes from pixels (using the LSST zero convention) to sky ICRS RA, Dec (in radians). For more details see the contained ast::FrameDict
|
overrideprotected |
|
inline |
|
inline |
| lsst::geom::Angle lsst::afw::geom::SkyWcs::getPixelScale | ( | lsst::geom::Point2D const & | pixel | ) | const |
Get the pixel scale at the specified pixel position.
The scale is the square root of the area of the specified pixel on the sky.
|
overrideprotected |
|
static |
| lsst::geom::SpherePoint lsst::afw::geom::SkyWcs::getSkyOrigin | ( | ) | const |
| std::shared_ptr< SkyWcs > lsst::afw::geom::SkyWcs::getTanWcs | ( | lsst::geom::Point2D const & | pixel | ) | const |
|
inline |
Get a TransformPoint2ToSpherePoint that transforms pixels to sky in the forward direction and sky to pixels in the inverse direction.
|
inline |
| bool lsst::afw::geom::SkyWcs::isFits | ( | ) | const |
| bool lsst::afw::geom::SkyWcs::isFlipped | ( | ) | const |
Does the WCS follow the convention of North=Up, East=Left?
| lsst::pex::exceptions::RuntimeError | if the parity cannot be determined because the CD matrix is singular. |
|
inlineoverridenoexcept |
| lsst::geom::AffineTransform lsst::afw::geom::SkyWcs::linearizePixelToSky | ( | lsst::geom::Point2D const & | pixel, |
| lsst::geom::AngleUnit const & | skyUnit ) const |
Return the local linear approximation to pixelToSky at a point given in pixel coordinates.
The local linear approximation is defined such the following is true (ignoring floating-point errors):
wcs.linearizePixelToSky(pixel, skyUnit)(pixel) == wcs.pixelToSky(pixel).getPosition(skyUnit)
(lsst::geom::AffineTransform::operator() applies the transform in the forward direction)
| [in] | pixel | Position in pixel coordinates where transform is desired. |
| [in] | skyUnit | Units to use for sky coordinates; units of matrix elements will be skyUnits/pixel. |
| lsst::geom::AffineTransform lsst::afw::geom::SkyWcs::linearizePixelToSky | ( | lsst::geom::SpherePoint const & | coord, |
| lsst::geom::AngleUnit const & | skyUnit ) const |
Return the local linear approximation to pixelToSky at a point given in sky coordinates.
The local linear approximation is defined such the following is true (ignoring floating-point errors):
wcs.linearizePixelToSky(sky, skyUnit)(wcs.skyToPixel(sky)) == sky.getPosition(skyUnit);
(lsst::geom::AffineTransform::operator() applies the transform in the forward direction)
| [in] | coord | Position in sky coordinates where transform is desired. |
| [in] | skyUnit | Units to use for sky coordinates; units of matrix elements will be skyUnits/pixel. |
| lsst::geom::AffineTransform lsst::afw::geom::SkyWcs::linearizeSkyToPixel | ( | lsst::geom::Point2D const & | pixel, |
| lsst::geom::AngleUnit const & | skyUnit ) const |
Return the local linear approximation to skyToPixel at a point given in pixel coordinates.
The local linear approximation is defined such the following is true (ignoring floating-point errors):
wcs.linearizeSkyToPixel(pixel, skyUnit)(wcs.pixelToSky(pixel).getPosition(skyUnit)) == pixel
(lsst::geom::AffineTransform::operator() applies the transform in the forward direction)
| [in] | pixel | Position in pixel coordinates where transform is desired. |
| [in] | skyUnit | Units to use for sky coordinates; units of matrix elements will be pixels/skyUnit. |
| lsst::geom::AffineTransform lsst::afw::geom::SkyWcs::linearizeSkyToPixel | ( | lsst::geom::SpherePoint const & | coord, |
| lsst::geom::AngleUnit const & | skyUnit ) const |
Return the local linear approximation to skyToPixel at a point given in sky coordinates.
The local linear approximation is defined such the following is true (ignoring floating-point errors):
wcs.linearizeSkyToPixel(sky, skyUnit)(sky.getPosition(skyUnit)) == wcs.skyToPixel(sky)
(lsst::geom::AffineTransform::operator() applies the transform in the forward direction)
| [in] | coord | Position in sky coordinates where transform is desired. |
| [in] | skyUnit | Units to use for sky coordinates; units of matrix elements will be pixels/skyUnit. |
|
inline |
| bool lsst::afw::geom::SkyWcs::operator== | ( | SkyWcs const & | other | ) | const |
Equality is based on the string representations being equal.
Two SkyWcs constructed the same way will be equal, and a SkyWcs that has been saved and restored will be equal to the original. However, it is possible to construct two SkyWcs that behave identically as far as transforming points go, but will compare as unequal due to subtle internal differences, such as a contained ast::Mapping that has a different ID in one SkyWcs than another.
Thus equality is primarily useful for testing persistence.
|
inline |
|
inline |
|
inline |
|
inlinestaticinherited |
Read an object from an already open FITS object.
| [in] | fitsfile | FITS object to read from, already positioned at the desired HDU. |
Definition at line 183 of file Persistable.h.
|
static |
|
static |
|
inline |
|
inline |
|
override |
|
overrideprotected |
| void lsst::afw::geom::SkyWcs::writeStream | ( | std::ostream & | os | ) | const |
Serialize this SkyWcs to an output stream.
Version 1 format is as follows:
If and when fits approximation is supported, the approximate WCS will be written as a second FrameDict immediately following the first.
| [out] | os | output stream to which to serialize this SkyWcs |
| std::string lsst::afw::geom::SkyWcs::writeString | ( | ) | const |