lsst.astshim  22.0.0+04719a4bac
Public Member Functions | Protected Member Functions | Friends | List of all members
ast::WcsMap Class Reference

#include <WcsMap.h>

Inheritance diagram for ast::WcsMap:
ast::Mapping ast::Object

Public Member Functions

 WcsMap (int ncoord, WcsType type, int lonax, int latax, std::string const &options="")
 
virtual ~WcsMap ()
 
 WcsMap (WcsMap const &)=default
 Copy constructor: make a deep copy. More...
 
 WcsMap (WcsMap &&)=default
 
WcsMapoperator= (WcsMap const &)=delete
 
WcsMapoperator= (WcsMap &&)=default
 
std::shared_ptr< WcsMapcopy () const
 Return a deep copy of this object. More...
 
double getNatLat () const
 get NatLat: native latitude of the reference point of a FITS-WCS projection. More...
 
double getNatLon () const
 get NatLon: native longitude of the reference point of a FITS-WCS projection. More...
 
double getPVi_m (int i, int m) const
 
int getPVMax (int axis) const
 Get PVMax(axis) for one axis: maximum number of FITS-WCS projection parameters. More...
 
std::pair< int, int > getWcsAxis () const
 
WcsType getWcsType () const
 Get WcsType: FITS-WCS projection type. More...
 
- Public Member Functions inherited from ast::Mapping
virtual ~Mapping ()
 
 Mapping (Mapping const &)=default
 Copy constructor: make a deep copy. More...
 
 Mapping (Mapping &&)=default
 
Mappingoperator= (Mapping const &)=delete
 
Mappingoperator= (Mapping &&)=default
 
std::shared_ptr< Mappingcopy () const
 Return a deep copy of this object. More...
 
int getNIn () const
 
int getNOut () const
 
bool getIsSimple () const
 
bool isInverted () const
 
bool getIsLinear () const
 
bool getReport () const
 
bool hasForward () const
 
bool hasInverse () const
 
std::shared_ptr< Mappinginverted () const
 
Array2D linearApprox (PointD const &lbnd, PointD const &ubnd, double tol) const
 
SeriesMap then (Mapping const &next) const
 
ParallelMap under (Mapping const &next) const
 
double rate (PointD const &at, int ax1, int ax2) const
 
void setReport (bool report)
 
std::shared_ptr< Mappingsimplified () const
 
void applyForward (ConstArray2D const &from, Array2D const &to) const
 
Array2D applyForward (ConstArray2D const &from) const
 
std::vector< double > applyForward (std::vector< double > const &from) const
 
void applyInverse (ConstArray2D const &from, Array2D const &to) const
 
Array2D applyInverse (ConstArray2D const &from) const
 
std::vector< double > applyInverse (std::vector< double > const &from) const
 
void tranGridForward (PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, Array2D const &to) const
 
Array2D tranGridForward (PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, int nPts) const
 
void tranGridInverse (PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, Array2D const &to) const
 
Array2D tranGridInverse (PointI const &lbnd, PointI const &ubnd, double tol, int maxpix, int nPts) const
 
- Public Member Functions inherited from ast::Object
virtual ~Object ()
 
 Object (Object const &object)
 Copy constructor: make a deep copy. More...
 
 Object (Object &&)=default
 
Objectoperator= (Object const &)=delete
 
Objectoperator= (Object &&)=default
 
bool operator== (Object const &rhs) const
 
bool operator!= (Object const &rhs) const
 
std::shared_ptr< Objectcopy () const
 Return a deep copy of this object. More...
 
void clear (std::string const &attrib)
 
bool hasAttribute (std::string const &attrib) const
 
std::string getClassName () const
 
std::string getID () const
 Get ID: object identification string that is not copied. More...
 
std::string getIdent () const
 Get Ident: object identification string that is copied. More...
 
int getNObject () const
 
int getObjSize () const
 Get ObjSize: the in-memory size of the AST object in bytes. More...
 
int getRefCount () const
 
bool getUseDefs () const
 Get UseDefs: allow use of default values for Object attributes? More...
 
void lock (bool wait)
 
bool same (Object const &other) const
 
void setID (std::string const &id)
 Set ID: object identification string that is not copied. More...
 
void setIdent (std::string const &ident)
 Set Ident: object identification string that is copied. More...
 
void setUseDefs (bool usedefs)
 Set UseDefs: allow use of default values for Object attributes? More...
 
void show (std::ostream &os, bool showComments=true) const
 
std::string show (bool showComments=true) const
 
bool test (std::string const &attrib) const
 
void unlock (bool report=false)
 
AstObject const * getRawPtr () const
 
AstObject * getRawPtr ()
 

Protected Member Functions

virtual std::shared_ptr< ObjectcopyPolymorphic () const override
 
 WcsMap (AstWcsMap *rawptr)
 Construct a WcsMap from a raw AST pointer. More...
 
- Protected Member Functions inherited from ast::Mapping
 Mapping (AstMapping *rawMap)
 
template<typename Class >
std::shared_ptr< Class > decompose (int i, bool copy) const
 
- Protected Member Functions inherited from ast::Object
 Object (AstObject *object)
 
template<typename T , typename AstT >
std::shared_ptr< T > copyImpl () const
 
bool getB (std::string const &attrib) const
 
std::string const getC (std::string const &attrib) const
 
double getD (std::string const &attrib) const
 
float getF (std::string const &attrib) const
 
int getI (std::string const &attrib) const
 
long int getL (std::string const &attrib) const
 
void set (std::string const &setting)
 
void setB (std::string const &attrib, bool value)
 
void setC (std::string const &attrib, std::string const &value)
 
void setD (std::string const &attrib, double value)
 
void setF (std::string const &attrib, float value)
 
void setI (std::string const &attrib, int value)
 
void setL (std::string const &attrib, long int value)
 

Friends

class Object
 

Additional Inherited Members

- Public Types inherited from ast::Object
using ObjectPtr = std::unique_ptr< AstObject, Deleter >
 unique pointer holding an AST raw pointer More...
 
- Static Public Member Functions inherited from ast::Object
static std::shared_ptr< ObjectfromString (std::string const &str)
 
template<typename Class >
static std::shared_ptr< Class > fromAstObject (AstObject *rawObj, bool copy)
 
- Static Protected Member Functions inherited from ast::Object
template<typename ShimT , typename AstT >
static std::shared_ptr< ShimT > makeShim (AstObject *p)
 

Detailed Description

Map from a spherical system to a cartesian system using standard FITS sky coordinate projections.

WcsMap is used to represent sky coordinate projections as described in the FITS world coordinate system (FITS-WCS) paper II "Representations of Celestial Coordinates in FITS" by M. Calabretta and E.W. Griesen. This paper defines a set of functions, or sky projections, which transform longitude-latitude pairs representing spherical celestial coordinates into corresponding pairs of Cartesian coordinates (and vice versa).

A WcsMap is a specialised form of Mapping which implements these sky projections and applies them to a specified pair of coordinates. All the projections in the FITS-WCS paper are supported, plus the now deprecated "TAN with polynomial correction terms" projection which is refered to here by the code "TPN". Using the FITS-WCS terminology, the transformation is between "native spherical" and "projection plane" coordinates (also called "intermediate world coordinates". These coordinates may, optionally, be embedded in a space with more than two dimensions, the remaining coordinates being copied unchanged. Note, however, that for consistency with other AST facilities, a WcsMap handles coordinates that represent angles in radians (rather than the degrees used by FITS-WCS).

The type of FITS-WCS projection to be used and the coordinates (axes) to which it applies are specified when a WcsMap is first created. The projection type may subsequently be determined using the WcsType attribute and the coordinates on which it acts may be determined using the WcsAxis(lonlat) attribute.

Each WcsMap also allows up to 100 "projection parameters" to be associated with each axis. These specify the precise form of the projection, and are accessed using PVi_m attribute, where "i" is the integer axis index (starting at 1), and "m" is an integer "parameter index" in the range 0 to 99. The number of projection parameters required by each projection, and their meanings, are dependent upon the projection type (most projections either do not use any projection parameters, or use parameters 1 and 2 associated with the latitude axis). Before creating a WcsMap you should consult the FITS-WCS paper for details of which projection parameters are required, and which have defaults. When creating the WcsMap, you must explicitly set values for all those required projection parameters which do not have defaults defined in this paper.

Attributes

Notes

Constructor & Destructor Documentation

◆ WcsMap() [1/4]

ast::WcsMap::WcsMap ( int  ncoord,
WcsType  type,
int  lonax,
int  latax,
std::string const &  options = "" 
)
inlineexplicit

Create a WcsMap

Parameters
[in]ncoordThe number of coordinate values for each point to be transformed (i.e. the number of dimensions of the space in which the points will reside). This must be at least 2. The same number is applicable to both input and output points.
[in]typeThe type of FITS-WCS projection to apply, as a WcsType enum such as WcsType::TAN (for a tangent plane projection). The enum constant name give the projection type code (in upper case) as used in the FITS-WCS "CTYPEi" keyword. You should consult the FITS-WCS paper for a list of the available projections. The additional code of WcsType::TPN can be supplied which represents a TAN projection with polynomial correction terms as defined in an early draft of the FITS-WCS paper.
[in]lonaxIndex of the longitude axis. This should lie in the range 1 to ncoord.
[in]lataxIndex of the latitude axis. This should lie in the range 1 to ncoord.
[in]optionsPointer to a null-terminated string containing an optional comma-separated list of attribute assignments to be used for initialising the new WcsMap. The syntax used is identical to that for the astSet function and may include "printf" format specifiers identified by "%" symbols in the normal way. If the sky projection to be implemented requires projection parameter values to be set, then this should normally be done here via the PVi_m attribute (see the "Examples" section). Setting values for these parameters is mandatory if they do not have default values (as defined in the FITS-WCS paper).
Warning
The validity of any projection parameters given via the PVi_m PVi_m parameter in the "options" string is not checked at construction. However, their validity is checked when the resulting WcsMap is used to transform coordinates, and an error will result if the projection parameters do not satisfy all the required constraints (as defined in the FITS-WCS paper).

Examples

  • auto wcsmap = ast::WcsMap(2, WcsType::MER, 1, 2, "")

    Create a WcsMap that implements a FITS-WCS Mercator projection on pairs of coordinates, with coordinates 1 and 2 representing the longitude and latitude respectively. Note that the FITS-WCS Mercator projection does not require any projection parameters.

  • auto wcsmap = ast::WcsMap(3, WcsType::COE, 2, 3, "PV3_1=40.0")

    Create a WcsMap that implements a FITS-WCS conical equal area projection. The WcsMap acts on points in a 3-dimensional space; coordinates 2 and 3 represent longitude and latitude respectively, while the values of coordinate 1 are copied unchanged. Projection parameter 1 associatyed with the latitude axis (corresponding to FITS keyword "PV3_1") is required and has no default, so is set explicitly to 40.0 degrees. Projection parameter 2 (corresponding to FITS keyword "PV3_2") is required but has a default of zero, so need not be specified.

◆ ~WcsMap()

virtual ast::WcsMap::~WcsMap ( )
inlinevirtual

◆ WcsMap() [2/4]

ast::WcsMap::WcsMap ( WcsMap const &  )
default

Copy constructor: make a deep copy.

◆ WcsMap() [3/4]

ast::WcsMap::WcsMap ( WcsMap &&  )
default

◆ WcsMap() [4/4]

ast::WcsMap::WcsMap ( AstWcsMap *  rawptr)
inlineexplicitprotected

Construct a WcsMap from a raw AST pointer.

Member Function Documentation

◆ copy()

std::shared_ptr<WcsMap> ast::WcsMap::copy ( ) const
inline

Return a deep copy of this object.

◆ copyPolymorphic()

virtual std::shared_ptr<Object> ast::WcsMap::copyPolymorphic ( ) const
inlineoverrideprotectedvirtual

Return a deep copy of this object. This is called by copy.

Each subclass must override this method. The standard implementation is:

return copyImpl<astshim_class, ast_class>();

for example Frame implements this as:

return copyImpl<Frame, AstFrame>();

Reimplemented from ast::Mapping.

◆ getNatLat()

double ast::WcsMap::getNatLat ( ) const
inline

get NatLat: native latitude of the reference point of a FITS-WCS projection.

◆ getNatLon()

double ast::WcsMap::getNatLon ( ) const
inline

get NatLon: native longitude of the reference point of a FITS-WCS projection.

◆ getPVi_m()

double ast::WcsMap::getPVi_m ( int  i,
int  m 
) const
inline

Get PVi_m for one value of i and m: a FITS-WCS projection parameter.

Parameters
[in]iAxis index, starting at 1
[in]mParameter number, in range 1 to PVMax

◆ getPVMax()

int ast::WcsMap::getPVMax ( int  axis) const
inline

Get PVMax(axis) for one axis: maximum number of FITS-WCS projection parameters.

◆ getWcsAxis()

std::pair<int, int> ast::WcsMap::getWcsAxis ( ) const
inline

Get WcsAxis(lonlat) FITS-WCS projection axis for longitude, latitude.

◆ getWcsType()

WcsType ast::WcsMap::getWcsType ( ) const
inline

Get WcsType: FITS-WCS projection type.

◆ operator=() [1/2]

WcsMap& ast::WcsMap::operator= ( WcsMap &&  )
default

◆ operator=() [2/2]

WcsMap& ast::WcsMap::operator= ( WcsMap const &  )
delete

Friends And Related Function Documentation

◆ Object

friend class Object
friend

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