lsst.afw  13.0-73-gb2a4e38
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
lsst::afw::image::TanWcs Class Reference

Implementation of the WCS standard for the special case of the Gnomonic (tangent plane) projection. More...

#include <TanWcs.h>

Inheritance diagram for lsst::afw::image::TanWcs:
lsst::afw::table::io::PersistableFacade< TanWcs > lsst::afw::image::Wcs lsst::afw::table::io::PersistableFacade< Wcs > lsst::afw::table::io::Persistable lsst::afw::image::DistortedTanWcs

Public Member Functions

 TanWcs (geom::Point2D const &crval, geom::Point2D const &crpix, Eigen::Matrix2d const &cd, double equinox=2000, std::string const &raDecSys="FK5", std::string const &cunits1="deg", std::string const &cunits2="deg")
 Construct a tangent plane wcs without distortion terms. More...
 
 TanWcs (geom::Point2D const &crval, geom::Point2D const &crpix, Eigen::Matrix2d const &cd, Eigen::MatrixXd const &sipA, Eigen::MatrixXd const &sipB, Eigen::MatrixXd const &sipAp, Eigen::MatrixXd const &sipBp, double equinox=2000, std::string const &raDecSys="FK5", std::string const &cunits1="deg", std::string const &cunits2="deg")
 Construct a tangent plane wcs with distortion terms. More...
 
virtual ~TanWcs ()
 
std::shared_ptr< Wcs > clone () const override
 Polymorphic deep-copy. More...
 
geom::Angle pixelScale () const
 Returns the pixel scale, in Angle/pixel. More...
 
geom::Point2D distortPixel (geom::Point2D const &pixel) const
 Applies the SIP AP and BP distortion (used in the skyToPixel direction) More...
 
geom::Point2D undistortPixel (geom::Point2D const &pixel) const
 Applies the SIP A and B un-distortion (used in the pixelToSky direction) More...
 
bool hasDistortion () const override
 
void flipImage (int flipLR, int flipTB, lsst::afw::geom::Extent2I dimensions) const override
 Flip CD matrix around the y-axis. More...
 
void rotateImageBy90 (int nQuarter, lsst::afw::geom::Extent2I dimensions) const override
 Rotate image by nQuarter times 90 degrees. More...
 
std::shared_ptr
< daf::base::PropertyList > 
getFitsMetadata () const override
 Return a PropertyList containing FITS header keywords that can be used to save the Wcs.x. More...
 
void setDistortionMatrices (Eigen::MatrixXd const &sipA, Eigen::MatrixXd const &sipB, Eigen::MatrixXd const &sipAp, Eigen::MatrixXd const &sipBp)
 Set the distortion matrices. More...
 
Eigen::MatrixXd const & getSipA () const
 Return the SIP forward distortion matrix for the 1st intermediate world coordinate system axis. More...
 
Eigen::MatrixXd const & getSipB () const
 Return the SIP forward distortion matrix for the 2st intermediate world coordinate system axis. More...
 
Eigen::MatrixXd const & getSipAp () const
 Return the SIP reverse distortion matrix for x pixel coordinates. More...
 
Eigen::MatrixXd const & getSipBp () const
 Return the SIP reverse distortion matrix for y pixel coordinates. More...
 
bool isPersistable () const override
 Whether the object is persistable using afw::table::io archives. More...
 
- Public Member Functions inherited from lsst::afw::image::Wcs
 Wcs (lsst::afw::geom::Point2D const &crval, lsst::afw::geom::Point2D const &crpix, Eigen::Matrix2d const &CD, std::string const &ctype1="RA---TAN", std::string const &ctype2="DEC--TAN", double equinox=2000, std::string const &raDecSys="ICRS", std::string const &cunits1="deg", std::string const &cunits2="deg")
 Create a Wcs object with some known information. More...
 
virtual ~Wcs ()
 
bool operator== (Wcs const &other) const
 
bool operator!= (Wcs const &other) const
 
std::shared_ptr
< lsst::afw::coord::Coord > 
getSkyOrigin () const
 Returns CRVAL. This need not be the centre of the image. More...
 
lsst::afw::geom::Point2D getPixelOrigin () const
 Returns CRPIX (corrected to LSST convention). More...
 
Eigen::Matrix2d getCDMatrix () const
 Returns the CD matrix. More...
 
bool isFlipped () const
 Does the Wcs follow the convention of North=Up, East=Left? More...
 
double pixArea (lsst::afw::geom::Point2D pix00) const
 Sky area covered by a pixel at position pix00 in units of square degrees. More...
 
geom::Angle pixelScale () const
 Returns the pixel scale [Angle/pixel]. More...
 
std::shared_ptr< coord::Coord > pixelToSky (double pix1, double pix2) const
 Convert from pixel position to sky coordinates (e.g. More...
 
std::shared_ptr< coord::Coord > pixelToSky (lsst::afw::geom::Point2D const &pixel) const
 Convert from pixel position to sky coordinates (e.g. More...
 
void pixelToSky (double pixel1, double pixel2, geom::Angle &sky1, geom::Angle &sky2) const
 Convert from pixel position to sky coordinates (e.g. More...
 
geom::Point2D skyToPixel (geom::Angle sky1, geom::Angle sky2) const
 Convert from sky coordinates (e.g. More...
 
geom::Point2D skyToPixel (coord::Coord const &coord) const
 Convert from sky coordinates (e.g. RA/dec) to pixel positions. More...
 
geom::Point2D skyToIntermediateWorldCoord (coord::Coord const &coord) const
 Convert from sky coordinates (e.g. More...
 
afw::coord::CoordSystem getCoordSystem () const
 
double getEquinox () const
 
bool isSameSkySystem (Wcs const &wcs) const
 Return true if a WCS has the same coordinate system and equinox as this one. More...
 
geom::LinearTransform getLinearTransform () const
 Return the linear part of the Wcs, the CD matrix in FITS-speak, as an AffineTransform. More...
 
geom::AffineTransform linearizePixelToSky (coord::Coord const &coord, geom::AngleUnit skyUnit=geom::degrees) const
 Return the local linear approximation to Wcs::pixelToSky at a point given in sky coordinates. More...
 
geom::AffineTransform linearizePixelToSky (geom::Point2D const &pix, geom::AngleUnit skyUnit=geom::degrees) const
 Return the local linear approximation to Wcs::pixelToSky at a point given in pixel coordinates. More...
 
geom::AffineTransform linearizeSkyToPixel (coord::Coord const &coord, geom::AngleUnit skyUnit=geom::degrees) const
 Return the local linear approximation to Wcs::skyToPixel at a point given in sky coordinates. More...
 
geom::AffineTransform linearizeSkyToPixel (geom::Point2D const &pix, geom::AngleUnit skyUnit=geom::degrees) const
 Return the local linear approximation to Wcs::skyToPixel at a point given in pixel coordinates. More...
 
virtual void shiftReferencePixel (double dx, double dy)
 Move the pixel reference position by (dx, dy) More...
 
virtual void shiftReferencePixel (geom::Extent2D const &d)
 
- Public Member Functions inherited from lsst::afw::table::io::Persistable
void writeFits (std::string const &fileName, std::string const &mode="w") const
 Write the object to a regular FITS file. More...
 
void writeFits (fits::MemFileManager &manager, std::string const &mode="w") const
 Write the object to a FITS image in memory. More...
 
void writeFits (fits::Fits &fitsfile) const
 Write the object to an already-open FITS object. More...
 
virtual ~Persistable ()
 

Static Public Member Functions

static void decodeSipHeader (daf::base::PropertySet const &fitsMetadata, std::string const &which, Eigen::MatrixXd &m)
 Decode the SIP headers for a given matrix, if present. More...
 
- Static Public Member Functions inherited from lsst::afw::table::io::PersistableFacade< TanWcs >
static std::shared_ptr< TanWcs > readFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object. More...
 
static std::shared_ptr< TanWcs > readFits (std::string const &fileName, int hdu=INT_MIN)
 Read an object from a regular FITS file. More...
 
static std::shared_ptr< TanWcs > readFits (fits::MemFileManager &manager, int hdu=INT_MIN)
 Read an object from a FITS file in memory. More...
 
- Static Public Member Functions inherited from lsst::afw::table::io::PersistableFacade< Wcs >
static std::shared_ptr< Wcs > readFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object. More...
 
static std::shared_ptr< Wcs > readFits (std::string const &fileName, int hdu=INT_MIN)
 Read an object from a regular FITS file. More...
 
static std::shared_ptr< Wcs > readFits (fits::MemFileManager &manager, int hdu=INT_MIN)
 Read an object from a FITS file in memory. More...
 

Protected Member Functions

 TanWcs (TanWcs const &rhs)
 
void pixelToSkyImpl (double pixel1, double pixel2, geom::Angle skyTmp[2]) const override
 Worker routine for pixelToSky. More...
 
geom::Point2D skyToPixelImpl (geom::Angle sky1, geom::Angle sky2) const override
 Worker routine for skyToPixel. More...
 
- Protected Member Functions inherited from lsst::afw::image::Wcs
bool _mayBePersistable () const
 Perform basic checks on whether *this might be persistable. More...
 
virtual std::string getPythonModule () const
 Return the fully-qualified Python module that should be imported to guarantee that its factory is registered. More...
 
bool _isIcrs () const
 
 Wcs ()
 Construct an invalid Wcs given no arguments. More...
 
 Wcs (std::shared_ptr< daf::base::PropertySet const > const &fitsMetadata)
 Create a Wcs from a fits header. More...
 
 Wcs (afw::table::BaseRecord const &record)
 
 Wcs (Wcs const &rhs)
 Copy constructor. More...
 
Wcs & operator= (const Wcs &)
 
std::shared_ptr
< afw::coord::Coord > 
makeCorrectCoord (geom::Angle sky0, geom::Angle sky1) const
 Given a sky position, use the values stored in ctype and radesys to return the correct sub-class of Coord. More...
 
std::shared_ptr
< afw::coord::Coord > 
convertCoordToSky (coord::Coord const &coord) const
 Given a Coord (as a shared pointer), return the sky position in the correct coordinate system for this Wcs. More...
 
virtual geom::AffineTransform linearizePixelToSkyInternal (geom::Point2D const &pix, coord::Coord const &coord, geom::AngleUnit skyUnit) const
 Implementation for the overloaded public linearizePixelToSky methods, requiring both a pixel coordinate and the corresponding sky coordinate. More...
 
virtual geom::AffineTransform linearizeSkyToPixelInternal (geom::Point2D const &pix, coord::Coord const &coord, geom::AngleUnit skyUnit) const
 Implementation for the overloaded public linearizeSkyToPixel methods, requiring both a pixel coordinate and the corresponding sky coordinate. More...
 
void initWcsLibFromFits (std::shared_ptr< lsst::daf::base::PropertySet const > const &fitsMetadata)
 Parse a fits header, extract the relevant metadata and create a Wcs object. More...
 
void _initWcs ()
 Set some internal variables that we need to refer to. More...
 
void _setWcslibParams ()
 
- Protected Member Functions inherited from lsst::afw::table::io::Persistable
 Persistable ()
 
 Persistable (Persistable const &other)
 
void operator= (Persistable const &other)
 

Friends

class TanWcsFactory
 
std::shared_ptr< Wcs > makeWcs (std::shared_ptr< daf::base::PropertySet > const &metadata, bool)
 

Additional Inherited Members

- Protected Types inherited from lsst::afw::table::io::Persistable
typedef io::OutputArchiveHandle OutputArchiveHandle
 
- Protected Attributes inherited from lsst::afw::image::Wcs
struct wcsprm * _wcsInfo
 
int _nWcsInfo
 
int _relax
 Degree of permissiveness for wcspih (0 for strict); see wcshdr.h for details. More...
 
int _wcsfixCtrl
 Do potentially unsafe translations of non-standard unit strings? 0/1 = no/yes. More...
 
int _wcshdrCtrl
 Controls messages to stderr from wcshdr (0 for none); see wcshdr.h for details. More...
 
int _nReject
 
coord::CoordSystem _coordSystem
 
bool _skyAxesSwapped
 if true then the sky axes are swapped More...
 

Detailed Description

Implementation of the WCS standard for the special case of the Gnomonic (tangent plane) projection.

This class treats the special case of tangent plane projection. It extends the Wcs standard by optionally accounting for distortion in the image plane using the Simple Imaging Polynomial (SIP) convention. This convention is described in Shupe et al. (2005) (Astronomical Data Analysis Software and Systems XIV, Asp Conf. Series Vol XXX, Ed: Shopbell et al.), and descibed in some more detail in http://web.ipac.caltech.edu/staff/fmasci/home/wise/codeVdist.html

To convert from pixel coordintates to radec ("intermediate world coordinates"), first use the matrices _sipA and _sipB to calculate undistorted coorinates (i.e where on the chip the image would lie if the optics gave undistorted images), then pass these undistorted coorinates wcsp2s() to calculate radec.

For the reverse, radec -> pixels, convert the radec to undistorted coords, and then use the _sipAp and _sipBp matrices to add in the distortion terms.

Definition at line 68 of file TanWcs.h.

Constructor & Destructor Documentation

lsst::afw::image::TanWcs::TanWcs ( geom::Point2D const &  crval,
geom::Point2D const &  crpix,
Eigen::Matrix2d const &  cd,
double  equinox = 2000,
std::string const &  raDecSys = "FK5",
std::string const &  cunits1 = "deg",
std::string const &  cunits2 = "deg" 
)

Construct a tangent plane wcs without distortion terms.

Parameters
crvalThe sky position of the reference point
crpixThe pixel position corresponding to crval in Lsst units
cdMatrix describing transformations from pixel to sky positions
equinoxEquinox of coordinate system, eg 2000 (Julian) or 1950 (Besselian)
raDecSysSystem used to describe right ascension or declination, e.g FK4, FK5 or ICRS
cunits1Units of sky position. One of deg, arcmin or arcsec
cunits2Units of sky position. One of deg, arcmin or arcsec
lsst::afw::image::TanWcs::TanWcs ( geom::Point2D const &  crval,
geom::Point2D const &  crpix,
Eigen::Matrix2d const &  cd,
Eigen::MatrixXd const &  sipA,
Eigen::MatrixXd const &  sipB,
Eigen::MatrixXd const &  sipAp,
Eigen::MatrixXd const &  sipBp,
double  equinox = 2000,
std::string const &  raDecSys = "FK5",
std::string const &  cunits1 = "deg",
std::string const &  cunits2 = "deg" 
)

Construct a tangent plane wcs with distortion terms.

Parameters
crvalThe sky position of the reference point
crpixThe pixel position corresponding to crval in Lsst units
cdMatrix describing transformations from pixel to sky positions
sipAForward distortion matrix for axis 1
sipBForward distortion matrix for axis 2
sipApReverse distortion matrix for axis 1
sipBpReverse distortion matrix for axis 2
equinoxEquinox of coordinate system, eg 2000 (Julian) or 1950 (Besselian)
raDecSysSystem used to describe right ascension or declination, e.g FK4, FK5 or ICRS
cunits1Units of sky position. One of deg, arcmin or arcsec
cunits2Units of sky position. One of deg, arcmin or arcsec
virtual lsst::afw::image::TanWcs::~TanWcs ( )
inlinevirtual

Definition at line 109 of file TanWcs.h.

lsst::afw::image::TanWcs::TanWcs ( TanWcs const &  rhs)
protected

Member Function Documentation

std::shared_ptr<Wcs> lsst::afw::image::TanWcs::clone ( ) const
overridevirtual

Polymorphic deep-copy.

Reimplemented from lsst::afw::image::Wcs.

static void lsst::afw::image::TanWcs::decodeSipHeader ( daf::base::PropertySet const &  fitsMetadata,
std::string const &  which,
Eigen::MatrixXd &  m 
)
static

Decode the SIP headers for a given matrix, if present.

geom::Point2D lsst::afw::image::TanWcs::distortPixel ( geom::Point2D const &  pixel) const

Applies the SIP AP and BP distortion (used in the skyToPixel direction)

void lsst::afw::image::TanWcs::flipImage ( int  flipLR,
int  flipTB,
lsst::afw::geom::Extent2I  dimensions 
) const
overridevirtual

Flip CD matrix around the y-axis.

Reimplemented from lsst::afw::image::Wcs.

std::shared_ptr<daf::base::PropertyList> lsst::afw::image::TanWcs::getFitsMetadata ( ) const
overridevirtual

Return a PropertyList containing FITS header keywords that can be used to save the Wcs.x.

Reimplemented from lsst::afw::image::Wcs.

Eigen::MatrixXd const& lsst::afw::image::TanWcs::getSipA ( ) const
inline

Return the SIP forward distortion matrix for the 1st intermediate world coordinate system axis.

Definition at line 149 of file TanWcs.h.

Eigen::MatrixXd const& lsst::afw::image::TanWcs::getSipAp ( ) const
inline

Return the SIP reverse distortion matrix for x pixel coordinates.

Definition at line 155 of file TanWcs.h.

Eigen::MatrixXd const& lsst::afw::image::TanWcs::getSipB ( ) const
inline

Return the SIP forward distortion matrix for the 2st intermediate world coordinate system axis.

Definition at line 152 of file TanWcs.h.

Eigen::MatrixXd const& lsst::afw::image::TanWcs::getSipBp ( ) const
inline

Return the SIP reverse distortion matrix for y pixel coordinates.

Definition at line 158 of file TanWcs.h.

bool lsst::afw::image::TanWcs::hasDistortion ( ) const
inlineoverridevirtual

Reimplemented from lsst::afw::image::Wcs.

Definition at line 125 of file TanWcs.h.

bool lsst::afw::image::TanWcs::isPersistable ( ) const
overridevirtual

Whether the object is persistable using afw::table::io archives.

Reimplemented from lsst::afw::image::Wcs.

geom::Angle lsst::afw::image::TanWcs::pixelScale ( ) const

Returns the pixel scale, in Angle/pixel.

void lsst::afw::image::TanWcs::pixelToSkyImpl ( double  pixel1,
double  pixel2,
geom::Angle  skyTmp[2] 
) const
overrideprotectedvirtual

Worker routine for pixelToSky.

Reimplemented from lsst::afw::image::Wcs.

void lsst::afw::image::TanWcs::rotateImageBy90 ( int  nQuarter,
lsst::afw::geom::Extent2I  dimensions 
) const
overridevirtual

Rotate image by nQuarter times 90 degrees.

Reimplemented from lsst::afw::image::Wcs.

void lsst::afw::image::TanWcs::setDistortionMatrices ( Eigen::MatrixXd const &  sipA,
Eigen::MatrixXd const &  sipB,
Eigen::MatrixXd const &  sipAp,
Eigen::MatrixXd const &  sipBp 
)

Set the distortion matrices.

Parameters
sipAForward distortion matrix for 1st axis
sipBForward distortion matrix for 2nd axis
sipApReverse distortion matrix for 1st axis
sipBpReverse distortion matrix for 2nd axis

Because the base class provides the option of creating a Wcs without distortion coefficients we supply a way of setting them here. This also help make code neater by breaking an enormous constructor (above) into two small pieces.

geom::Point2D lsst::afw::image::TanWcs::skyToPixelImpl ( geom::Angle  sky1,
geom::Angle  sky2 
) const
overrideprotectedvirtual

Worker routine for skyToPixel.

Parameters
sky1RA (or, more generally, longitude)
sky2Dec (or latitude)

Reimplemented from lsst::afw::image::Wcs.

geom::Point2D lsst::afw::image::TanWcs::undistortPixel ( geom::Point2D const &  pixel) const

Applies the SIP A and B un-distortion (used in the pixelToSky direction)

Friends And Related Function Documentation

std::shared_ptr<Wcs> makeWcs ( std::shared_ptr< daf::base::PropertySet > const &  metadata,
bool  stripMetadata 
)
friend

Definition at line 37 of file makeWcs.cc.

friend class TanWcsFactory
friend

Definition at line 172 of file TanWcs.h.


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