56 GWcs(
const std::string& coords,
57 const double& crval1,
const double& crval2,
58 const double& crpix1,
const double& crpix2,
59 const double& cdelt1,
const double& cdelt2);
71 virtual std::string
code(
void)
const = 0;
72 virtual std::string
name(
void)
const = 0;
76 virtual int size(
void)
const;
84 void set(
const std::string& coords,
85 const double& crval1,
const double& crval2,
86 const double& crpix1,
const double& crpix2,
87 const double& cdelt1,
const double& cdelt2);
88 double crval(
const int& inx)
const;
89 double crpix(
const int& inx)
const;
90 double cdelt(
const int& inx)
const;
94 static const int PVN = 32;
103 const double& crval1,
const double& crval2,
104 const double& crpix1,
const double& crpix2,
105 const double& cdelt1,
const double& cdelt2);
107 bool undefined(
const double& value)
const;
114 void wcs_p2s(
int ncoord,
int nelem,
const double* pixcrd,
double* imgcrd,
115 double* phi,
double* theta,
double* world,
int* stat)
const;
116 void wcs_s2p(
int ncoord,
int nelem,
const double* world,
117 double* phi,
double* theta,
double* imgcrd,
118 double* pixcrd,
int* stat)
const;
125 void cel_x2s(
int nx,
int ny,
int sxy,
int sll,
126 const double* x,
const double* y,
127 double* phi,
double* theta,
128 double* lng,
double* lat,
int* stat)
const;
129 void cel_s2x(
int nlng,
int nlat,
int sll,
int sxy,
130 const double* lng,
const double* lat,
131 double* phi,
double* theta,
132 double* x,
double* y,
int* stat)
const;
135 void sph_x2s(
int nphi,
int ntheta,
int spt,
int sll,
136 const double* phi,
const double* theta,
137 double* lng,
double* lat)
const;
138 void sph_s2x(
int nlng,
int nlat,
int sll,
int spt,
139 const double* lng,
const double* lat,
140 double* phi,
double* theta)
const;
148 void lin_p2x(
int ncoord,
int nelem,
const double* pixcrd,
double* imgcrd)
const;
149 void lin_x2p(
int ncoord,
int nelem,
const double* imgcrd,
double* pixcrd)
const;
150 void lin_matinv(
const std::vector<double>& mat, std::vector<double>& inv)
const;
154 void prj_off(
const double& phi0,
const double& theta0)
const;
163 virtual void prj_x2s(
int nx,
int ny,
int sxy,
int spt,
164 const double* x,
const double* y,
165 double* phi,
double* theta,
int* stat)
const = 0;
166 virtual void prj_s2x(
int nphi,
int ntheta,
int spt,
int sxy,
167 const double* phi,
const double* theta,
168 double* x,
double* y,
int* stat)
const = 0;
217 mutable std::vector<double>
m_w;
231 void init_lock(
const int& lock_id=0)
const;
232 void set_lock(
const int& lock_id=0)
const;
236 mutable std::map<int, omp_lock_t> m_locks;
277 if (m_locks.count(lock_id) == 0) {
278 m_locks[lock_id] = omp_lock_t();
279 omp_init_lock(&m_locks[lock_id]);
294 omp_set_lock(&m_locks[lock_id]);
308 omp_unset_lock(&m_locks[lock_id]);
Abstract FITS extension base class definition.
Information logger class definition.
Sky direction class interface definition.
Sky map pixel class definition.
Abstract sky projection base class definition.
Abstract FITS extension base class.
Abstract sky projection base class.
Abstract world coordinate system base class.
void cel_set(void) const
Setup of celestial transformation.
double cdelt(const int &inx) const
Return pixel size.
void free_members(void)
Delete class members.
void wcs_ini(int naxis)
Initialise World Coordinate System.
void copy_members(const GWcs &wcs)
Copy class members.
virtual void read(const GFitsHDU &hdu)
Read WCS definition from FITS header.
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.
void lin_p2x(int ncoord, int nelem, const double *pixcrd, double *imgcrd) const
Pixel-to-world linear transformation.
std::string m_radesys
RADESYS keyvalue.
virtual GSkyDir pix2dir(const GSkyPixel &pixel) const
Returns sky direction of sky map pixel.
virtual ~GWcs(void)
Destructor.
double crpix(const int &inx) const
Return reference pixel.
virtual void prj_set(void) const =0
double m_restfrq
RESTFRQa keyvalue.
virtual void prj_s2x(int nphi, int ntheta, int spt, int sxy, const double *phi, const double *theta, double *x, double *y, int *stat) const =0
std::vector< double > m_crval
CRVALia keyvalues for each coord axis.
double m_euler[5]
Euler angles and functions thereof.
void spc_ini(void)
Initialise spectral transformation parameters.
GSkyDir m_last_dir2pix_dir
Last sky direction for dir2pix.
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.
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.
virtual void prj_x2s(int nx, int ny, int sxy, int spt, const double *x, const double *y, double *phi, double *theta, int *stat) const =0
bool m_unity
Signals unity PC matrix.
virtual std::string classname(void) const =0
Return class name.
void lin_ini(int naxis)
Initialise linear transformation parameters.
void lin_x2p(int ncoord, int nelem, const double *imgcrd, double *pixcrd) const
World-to-pixel linear transformation.
bool m_has_pix2dir_cache
Has valid pix2dir cache value.
virtual void write(GFitsHDU &hdu) const
Write WCS definition into FITS HDU header.
std::vector< double > m_piximg
Pixel to image transformation matrix.
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.
virtual std::string code(void) const =0
bool m_has_dir2pix_cache
Has valid dir2pix cache value.
void prj_off(const double &phi0, const double &theta0) const
Compute fiducial offset to force (x,y) = (0,0) at (phi0,theta0)
bool m_wcsset
WCS information is set.
std::string wcs_print_value(const double &value) const
Helper function for value printing.
static const double UNDEFINED
virtual bool compare(const GSkyProjection &proj) const
Compares sky projection.
bool m_linset
Linear transformation is set.
virtual GWcs * clone(void) const =0
Clones object.
std::vector< double > m_imgpix
Image to pixel transformation matrix.
void wcs_set_ctype(void) const
Set CTYPEa keywords.
void prj_ini(void) const
Initialise projection parameters.
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.
virtual double solidangle(const GSkyPixel &pixel) const
Returns solid angle of pixel in units of steradians.
int m_naxis
Number of axes.
virtual GWcs & operator=(const GWcs &wcs)
Assignment operator.
double m_latpole
LATPOLEa keyvalue.
double m_lonpole
LONPOLEa keyvalue.
std::string wcs_print(const GChatter &chatter=NORMAL) const
Print WCS information.
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.
void init_members(void)
Initialise class members.
void lin_set(void) const
Initialise linear transformation parameters.
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
std::vector< double > m_crpix
CRPIXja keyvalues for each pixel axis.
double m_pv[PVN]
Projection parameters.
GWcs(void)
Void constructor.
std::vector< std::string > m_ctype_c
CTYPEia comments for each coord axis.
double m_phi0
Native azimuth angle of fiducial point.
std::vector< std::string > m_cunit
CUNITia keyvalues for each coord axis.
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.
void unset_lock(const int &lock_id=0) const
Releases a previously set OpenMP lock.
std::vector< double > m_cdelt
CDELTia keyvalues for each coord axis.
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.
void wcs_set(void) const
Setup of World Coordinate System.
std::vector< double > m_crota
CROTAia keyvalues for each coord axis.
void cel_ini(void) const
Initialise celestial transformation parameters.
void lin_matinv(const std::vector< double > &mat, std::vector< double > &inv) const
Invert linear transformation matrix.
double crval(const int &inx) const
Return value of reference pixel.
int m_latpreq
LATPOLEa requirement.
bool m_bounds
Enable strict bounds checking.
double m_ref[4]
Celestial coordinates of fiducial.
bool m_isolat
True if |latitude| is preserved.
virtual void clear(void)=0
Clear object.
bool m_celset
Celestial transformation is set.
std::vector< std::string > m_ctype
CTYPEia keyvalues for each coord axis.
GSkyDir m_last_pix2dir_dir
Last sky direction for pix2dir.
virtual int size(void) const
Return dimension of projection.
double m_theta0
Native zenith angle of fiducial point.
double m_restwav
RESTWAVa keyvalue.
double m_equinox
EQUINOX keyvalue.
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.
virtual std::string name(void) const =0
void init_lock(const int &lock_id=0) const
Initializes an OpenMP lock with a specific name.
std::vector< double > m_pc
PCi_ja linear transformation matrix.
GSkyPixel m_last_dir2pix_pix
Last pixel for dir2pix.
bool m_prjset
Projection is set.
std::vector< double > m_w
Intermediate values.
bool m_offset
Force (x,y) = (0,0) at (phi_0,theta_0)
virtual GSkyPixel dir2pix(const GSkyDir &dir) const
Returns sky map pixel of sky direction.
void set_lock(const int &lock_id=0) const
Sets an OpenMP lock with a specific name.
void wcs_set_radesys(void) const
Set radesys and equinox members.
double m_y0
Fiducial y offset.
GSkyPixel m_last_pix2dir_pix
Last pixel for pix2dir.
double m_x0
Fiducial x offset.
double m_r0
Radius of the generating sphere.
std::vector< double > m_cd
CDi_ja linear transformation matrix.
bool undefined(const double &value) const
Check if value is undefined.