GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GWcsSFL Class Reference

Sanson-Flamsteed (SFL) projection class definition. More...

#include <GWcsSFL.hpp>

Inheritance diagram for GWcsSFL:
GWcs GSkyProjection GBase GWcsGLS

Public Member Functions

 GWcsSFL (void)
 Void constructor. More...
 
 GWcsSFL (const std::string &coords, const double &crval1, const double &crval2, const double &crpix1, const double &crpix2, const double &cdelt1, const double &cdelt2)
 Projection constructor. More...
 
 GWcsSFL (const GWcsSFL &wcs)
 Copy constructor. More...
 
virtual ~GWcsSFL (void)
 Destructor. More...
 
GWcsSFLoperator= (const GWcsSFL &wcs)
 Assignment operator. More...
 
virtual void clear (void)
 Clear Sanson-Flamsteed projection. More...
 
virtual GWcsSFLclone (void) const
 Clone Sanson-Flamsteed projection. More...
 
virtual std::string classname (void) const
 Return class name. More...
 
virtual std::string code (void) const
 Return projection code. More...
 
virtual std::string name (void) const
 Return projection name. More...
 
virtual std::string print (const GChatter &chatter=NORMAL) const
 Print Sanson-Flamsteed projection information. More...
 
- Public Member Functions inherited from GWcs
 GWcs (void)
 Void constructor. More...
 
 GWcs (const std::string &coords, const double &crval1, const double &crval2, const double &crpix1, const double &crpix2, const double &cdelt1, const double &cdelt2)
 Standard WCS sky map constructor. More...
 
 GWcs (const GFitsHDU &hdu)
 Construct from FITS HDU table. More...
 
 GWcs (const GWcs &wcs)
 Copy constructor. More...
 
virtual ~GWcs (void)
 Destructor. More...
 
virtual GWcsoperator= (const GWcs &wcs)
 Assignment operator. More...
 
virtual int size (void) const
 Return dimension of projection. More...
 
virtual void read (const GFitsHDU &hdu)
 Read WCS definition from FITS header. More...
 
virtual void write (GFitsHDU &hdu) const
 Write WCS definition into FITS HDU header. More...
 
virtual double solidangle (const GSkyPixel &pixel) const
 Returns solid angle of pixel in units of steradians. More...
 
virtual GSkyDir pix2dir (const GSkyPixel &pixel) const
 Returns sky direction of sky map pixel. More...
 
virtual GSkyPixel dir2pix (const GSkyDir &dir) const
 Returns sky map pixel of sky direction. More...
 
void set (const std::string &coords, const double &crval1, const double &crval2, const double &crpix1, const double &crpix2, const double &cdelt1, const double &cdelt2)
 Set World Coordinate System parameters. More...
 
double crval (const int &inx) const
 Return value of reference pixel. More...
 
double crpix (const int &inx) const
 Return reference pixel. More...
 
double cdelt (const int &inx) const
 Return pixel size. More...
 
- Public Member Functions inherited from GSkyProjection
 GSkyProjection (void)
 Void constructor. More...
 
 GSkyProjection (const GSkyProjection &proj)
 Copy constructor. More...
 
virtual ~GSkyProjection (void)
 Destructor. More...
 
virtual GSkyProjectionoperator= (const GSkyProjection &proj)
 Assignment operator. More...
 
virtual std::string coordsys (void) const
 Returns coordinate system. More...
 
virtual void coordsys (const std::string &coordsys)
 Set coordinate system. More...
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor. More...
 

Protected Member Functions

void init_members (void)
 Initialise class members. More...
 
void copy_members (const GWcsSFL &wcs)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void prj_set (void) const
 Setup of projection. More...
 
void prj_x2s (int nx, int ny, int sxy, int spt, const double *x, const double *y, double *phi, double *theta, int *stat) const
 Pixel-to-spherical deprojection. More...
 
void prj_s2x (int nphi, int ntheta, int spt, int sxy, const double *phi, const double *theta, double *x, double *y, int *stat) const
 Generic spherical-to-pixel projection. More...
 
- Protected Member Functions inherited from GWcs
void init_members (void)
 Initialise class members. More...
 
void copy_members (const GWcs &wcs)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void set_members (const std::string &coords, const double &crval1, const double &crval2, const double &crpix1, const double &crpix2, const double &cdelt1, const double &cdelt2)
 Set World Coordinate System parameters. More...
 
virtual bool compare (const GSkyProjection &proj) const
 Compares sky projection. More...
 
bool undefined (const double &value) const
 Check if value is undefined. More...
 
void wcs_ini (int naxis)
 Initialise World Coordinate System. More...
 
void wcs_set (void) const
 Setup of World Coordinate System. More...
 
void wcs_set_radesys (void) const
 Set radesys and equinox members. More...
 
void wcs_set_ctype (void) const
 Set CTYPEa keywords. More...
 
void wcs_p2s (int ncoord, int nelem, const double *pixcrd, double *imgcrd, double *phi, double *theta, double *world, int *stat) const
 Pixel-to-world transformation. More...
 
void wcs_s2p (int ncoord, int nelem, const double *world, double *phi, double *theta, double *imgcrd, double *pixcrd, int *stat) const
 World-to-pixel transformation. More...
 
std::string wcs_print (const GChatter &chatter=NORMAL) const
 Print WCS information. More...
 
std::string wcs_print_value (const double &value) const
 Helper function for value printing. More...
 
void cel_ini (void) const
 Initialise celestial transformation parameters. More...
 
void cel_set (void) const
 Setup of celestial transformation. More...
 
void cel_x2s (int nx, int ny, int sxy, int sll, const double *x, const double *y, double *phi, double *theta, double *lng, double *lat, int *stat) const
 Pixel-to-world celestial transformation. More...
 
void cel_s2x (int nlng, int nlat, int sll, int sxy, const double *lng, const double *lat, double *phi, double *theta, double *x, double *y, int *stat) const
 World-to-pixel celestial transformation. More...
 
void sph_x2s (int nphi, int ntheta, int spt, int sll, const double *phi, const double *theta, double *lng, double *lat) const
 Rotation in the pixel-to-world direction. More...
 
void sph_s2x (int nlng, int nlat, int sll, int spt, const double *lng, const double *lat, double *phi, double *theta) const
 Rotation in the pixel-to-world direction. More...
 
void spc_ini (void)
 Initialise spectral transformation parameters. More...
 
void lin_ini (int naxis)
 Initialise linear transformation parameters. More...
 
void lin_set (void) const
 Initialise linear transformation parameters. More...
 
void lin_p2x (int ncoord, int nelem, const double *pixcrd, double *imgcrd) const
 Pixel-to-world linear transformation. More...
 
void lin_x2p (int ncoord, int nelem, const double *imgcrd, double *pixcrd) const
 World-to-pixel linear transformation. More...
 
void lin_matinv (const std::vector< double > &mat, std::vector< double > &inv) const
 Invert linear transformation matrix. More...
 
void prj_ini (void) const
 Initialise projection parameters. More...
 
void prj_off (const double &phi0, const double &theta0) const
 Compute fiducial offset to force (x,y) = (0,0) at (phi0,theta0) More...
 
int prj_bchk (const double &tol, const int &nphi, const int &ntheta, const int &spt, double *phi, double *theta, int *stat) const
 Performs bounds checking on native spherical coordinates. More...
 
void init_lock (const int &lock_id=0) const
 Initializes an OpenMP lock with a specific name. More...
 
void set_lock (const int &lock_id=0) const
 Sets an OpenMP lock with a specific name. More...
 
void unset_lock (const int &lock_id=0) const
 Releases a previously set OpenMP lock. More...
 
- Protected Member Functions inherited from GSkyProjection
void init_members (void)
 Initialise class members. More...
 
void copy_members (const GSkyProjection &proj)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Additional Inherited Members

- Protected Attributes inherited from GWcs
bool m_wcsset
 WCS information is set. More...
 
int m_naxis
 Number of axes. More...
 
std::vector< double > m_crval
 CRVALia keyvalues for each coord axis. More...
 
std::vector< std::string > m_cunit
 CUNITia keyvalues for each coord axis. More...
 
std::vector< std::string > m_ctype
 CTYPEia keyvalues for each coord axis. More...
 
std::vector< std::string > m_ctype_c
 CTYPEia comments for each coord axis. More...
 
double m_lonpole
 LONPOLEa keyvalue. More...
 
double m_latpole
 LATPOLEa keyvalue. More...
 
double m_restfrq
 RESTFRQa keyvalue. More...
 
double m_restwav
 RESTWAVa keyvalue. More...
 
std::string m_radesys
 RADESYS keyvalue. More...
 
double m_equinox
 EQUINOX keyvalue. More...
 
std::vector< double > m_cd
 CDi_ja linear transformation matrix. More...
 
std::vector< double > m_crota
 CROTAia keyvalues for each coord axis. More...
 
int m_lng
 Longitude axis. More...
 
int m_lat
 Latitude axis. More...
 
int m_spec
 Spectral axis. More...
 
bool m_linset
 Linear transformation is set. More...
 
bool m_unity
 Signals unity PC matrix. More...
 
std::vector< double > m_crpix
 CRPIXja keyvalues for each pixel axis. More...
 
std::vector< double > m_pc
 PCi_ja linear transformation matrix. More...
 
std::vector< double > m_cdelt
 CDELTia keyvalues for each coord axis. More...
 
std::vector< double > m_piximg
 Pixel to image transformation matrix. More...
 
std::vector< double > m_imgpix
 Image to pixel transformation matrix. More...
 
bool m_celset
 Celestial transformation is set. More...
 
bool m_offset
 Force (x,y) = (0,0) at (phi_0,theta_0) More...
 
double m_phi0
 Native azimuth angle of fiducial point. More...
 
double m_theta0
 Native zenith angle of fiducial point. More...
 
double m_ref [4]
 Celestial coordinates of fiducial. More...
 
double m_euler [5]
 Euler angles and functions thereof. More...
 
int m_latpreq
 LATPOLEa requirement. More...
 
bool m_isolat
 True if |latitude| is preserved. More...
 
bool m_prjset
 Projection is set. More...
 
double m_r0
 Radius of the generating sphere. More...
 
double m_pv [PVN]
 Projection parameters. More...
 
bool m_bounds
 Enable strict bounds checking. More...
 
double m_x0
 Fiducial x offset. More...
 
double m_y0
 Fiducial y offset. More...
 
std::vector< double > m_w
 Intermediate values. More...
 
bool m_has_pix2dir_cache
 Has valid pix2dir cache value. More...
 
bool m_has_dir2pix_cache
 Has valid dir2pix cache value. More...
 
GSkyDir m_last_pix2dir_dir
 Last sky direction for pix2dir. More...
 
GSkyDir m_last_dir2pix_dir
 Last sky direction for dir2pix. More...
 
GSkyPixel m_last_pix2dir_pix
 Last pixel for pix2dir. More...
 
GSkyPixel m_last_dir2pix_pix
 Last pixel for dir2pix. More...
 
- Protected Attributes inherited from GSkyProjection
int m_coordsys
 0=CEL, 1=GAL More...
 

Detailed Description

Sanson-Flamsteed (SFL) projection class definition.

This class implements the Sanson-Flamsteed projection for the World Coordinate System.

Definition at line 43 of file GWcsSFL.hpp.

Constructor & Destructor Documentation

GWcsSFL::GWcsSFL ( void  )

Void constructor.

Definition at line 64 of file GWcsSFL.cpp.

References init_members().

Referenced by clone().

GWcsSFL::GWcsSFL ( const std::string &  coords,
const double &  crval1,
const double &  crval2,
const double &  crpix1,
const double &  crpix2,
const double &  cdelt1,
const double &  cdelt2 
)

Projection constructor.

Parameters
[in]coordsCoordinate system.
[in]crval1X value of reference pixel.
[in]crval2Y value of reference pixel.
[in]crpix1X index of reference pixel (starting from 1).
[in]crpix2Y index of reference pixel (starting from 1).
[in]cdelt1Increment in x direction at reference pixel [deg].
[in]cdelt2Increment in y direction at reference pixel [deg].

Definition at line 85 of file GWcsSFL.cpp.

References init_members(), and GWcs::wcs_set().

GWcsSFL::GWcsSFL ( const GWcsSFL wcs)

Copy constructor.

Parameters
[in]wcsWorld Coordinate System.

Definition at line 107 of file GWcsSFL.cpp.

References copy_members(), and init_members().

GWcsSFL::~GWcsSFL ( void  )
virtual

Destructor.

Definition at line 123 of file GWcsSFL.cpp.

References free_members().

Member Function Documentation

std::string GWcsSFL::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GWcsSFL").

Implements GWcs.

Reimplemented in GWcsGLS.

Definition at line 87 of file GWcsSFL.hpp.

void GWcsSFL::clear ( void  )
virtual

Clear Sanson-Flamsteed projection.

Resets the Sanson-Flamsteed projection to an clean initial state.

Implements GWcs.

Reimplemented in GWcsGLS.

Definition at line 180 of file GWcsSFL.cpp.

References free_members(), GSkyProjection::free_members(), GWcs::free_members(), init_members(), GSkyProjection::init_members(), and GWcs::init_members().

GWcsSFL * GWcsSFL::clone ( void  ) const
virtual

Clone Sanson-Flamsteed projection.

Returns
Pointer to deep copy of Sanson-Flamsteed projection.

Implements GWcs.

Reimplemented in GWcsGLS.

Definition at line 202 of file GWcsSFL.cpp.

References GWcsSFL().

std::string GWcsSFL::code ( void  ) const
inlinevirtual

Return projection code.

Returns
Projection code.

Returns the projection code "SFL".

Implements GWcs.

Reimplemented in GWcsGLS.

Definition at line 101 of file GWcsSFL.hpp.

void GWcsSFL::copy_members ( const GWcsSFL wcs)
protected

Copy class members.

Parameters
[in]wcsWorld Coordinate System.

Definition at line 256 of file GWcsSFL.cpp.

Referenced by GWcsSFL(), and operator=().

void GWcsSFL::free_members ( void  )
protected

Delete class members.

Definition at line 266 of file GWcsSFL.cpp.

Referenced by clear(), GWcsGLS::clear(), operator=(), and ~GWcsSFL().

void GWcsSFL::init_members ( void  )
protected

Initialise class members.

Definition at line 244 of file GWcsSFL.cpp.

Referenced by clear(), GWcsGLS::clear(), GWcsSFL(), and operator=().

std::string GWcsSFL::name ( void  ) const
inlinevirtual

Return projection name.

Returns
Projection name.

Returns the projection name.

Implements GWcs.

Reimplemented in GWcsGLS.

Definition at line 115 of file GWcsSFL.hpp.

GWcsSFL & GWcsSFL::operator= ( const GWcsSFL wcs)

Assignment operator.

Parameters
[in]wcsWorld Coordinate System.
Returns
World Coordinate System.

Definition at line 145 of file GWcsSFL.cpp.

References copy_members(), free_members(), init_members(), and GWcs::operator=().

Referenced by GWcsGLS::operator=().

std::string GWcsSFL::print ( const GChatter chatter = NORMAL) const
virtual

Print Sanson-Flamsteed projection information.

Parameters
[in]chatterChattiness.
Returns
String containing Sanson-Flamsteed projection information.

Implements GWcs.

Reimplemented in GWcsGLS.

Definition at line 214 of file GWcsSFL.cpp.

References SILENT, and GWcs::wcs_print().

void GWcsSFL::prj_s2x ( int  nphi,
int  ntheta,
int  spt,
int  sxy,
const double *  phi,
const double *  theta,
double *  x,
double *  y,
int *  stat 
) const
protectedvirtual

Generic spherical-to-pixel projection.

Parameters
[in]nphiLongitude vector length.
[in]nthetaLatitude vector length (0=no replication).
[in]sptInput vector step.
[in]sxyOutput vector step.
[in]phiLongitude vector of the projected point in native spherical coordinates [deg].
[in]thetaLatitude vector of the projected point in native spherical coordinates [deg].
[out]xVector of projected x coordinates.
[out]yVector of projected y coordinates.
[out]statStatus return value for each vector element (always 0)

Project native spherical coordinates (phi,theta) to pixel (x,y) coordinates in the plane of projection.

This method has been adapted from the wcslib function prj.c::sfls2x(). The interface follows very closely that of wcslib. In contrast to the wcslib routine, however, the method assumes that the projection has been setup previously (as this will be done by the constructor).

Implements GWcs.

Definition at line 463 of file GWcsSFL.cpp.

References gammalib::cosd(), GWcs::m_prjset, GWcs::m_w, GWcs::m_x0, GWcs::m_y0, and prj_set().

void GWcsSFL::prj_set ( void  ) const
protectedvirtual

Setup of projection.

This method sets up the projection information. The method has been adapted from the wcslib function prj.c::sflset.

Given and/or returned: m_r0 Reset to 180/pi if 0. m_phi0 Reset to 0.0 if undefined. m_theta0 Reset to 0.0 if undefined.

Returned: m_x0 Fiducial offset in x. m_y0 Fiducial offset in y. m_w[0] r0*(pi/180) m_w1/r0

Implements GWcs.

Definition at line 290 of file GWcsSFL.cpp.

References gammalib::deg2rad, GWcs::m_prjset, GWcs::m_r0, GWcs::m_w, GWcs::prj_off(), and gammalib::rad2deg.

Referenced by prj_s2x(), and prj_x2s().

void GWcsSFL::prj_x2s ( int  nx,
int  ny,
int  sxy,
int  spt,
const double *  x,
const double *  y,
double *  phi,
double *  theta,
int *  stat 
) const
protectedvirtual

Pixel-to-spherical deprojection.

Parameters
[in]nxX vector length.
[in]nyY vector length (0=no replication).
[in]sxyInput vector step.
[in]sptOutput vector step.
[in]xVector of projected x coordinates.
[in]yVector of projected y coordinates.
[out]phiLongitude of the projected point in native spherical coordinates [deg].
[out]thetaLatitude of the projected point in native spherical coordinates [deg].
[out]statStatus return value for each vector element (always 0)

Deproject pixel (x,y) coordinates in the plane of projection to native spherical coordinates (phi,theta).

This method has been adapted from the wcslib function prj.c::sflx2s(). The interface follows very closely that of wcslib. In contrast to the wcslib routine, however, the method assumes that the projection has been setup previously (as this will be done by the constructor).

Implements GWcs.

Definition at line 341 of file GWcsSFL.cpp.

References gammalib::check_prj_x2s_status(), cos(), G_PRJ_X2S, GWcs::m_prjset, GWcs::m_r0, GWcs::m_w, GWcs::m_x0, GWcs::m_y0, GWcs::prj_bchk(), and prj_set().


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