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);
68 virtual void clear(
void) = 0;
70 virtual std::string
classname(
void)
const = 0;
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;
162 virtual void prj_set(
void)
const = 0;
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]);
bool m_linset
Linear transformation is set.
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.
void init_members(void)
Initialise class members.
GSkyPixel m_last_pix2dir_pix
Last pixel for pix2dir.
void cel_ini(void) const
Initialise celestial transformation parameters.
std::vector< double > m_imgpix
Image to pixel transformation matrix.
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.
virtual GSkyDir pix2dir(const GSkyPixel &pixel) const
Returns sky direction of sky map pixel.
void prj_off(const double &phi0, const double &theta0) const
Compute fiducial offset to force (x,y) = (0,0) at (phi0,theta0)
int m_naxis
Number of axes.
void prj_ini(void) const
Initialise projection parameters.
std::vector< double > m_crpix
CRPIXja keyvalues for each pixel axis.
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.
Sky direction class interface definition.
std::vector< std::string > m_ctype
CTYPEia keyvalues for each coord axis.
void lin_p2x(int ncoord, int nelem, const double *pixcrd, double *imgcrd) const
Pixel-to-world linear transformation.
std::vector< double > m_piximg
Pixel to image transformation matrix.
Abstract FITS extension base class.
virtual void prj_set(void) const =0
bool undefined(const double &value) const
Check if value is undefined.
bool m_celset
Celestial transformation is set.
int m_latpreq
LATPOLEa requirement.
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 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.
void spc_ini(void)
Initialise spectral transformation parameters.
double crval(const int &inx) const
Return value of reference pixel.
double m_ref[4]
Celestial coordinates of fiducial.
void unset_lock(const int &lock_id=0) const
Releases a previously set OpenMP lock.
Abstract sky projection base class definition.
virtual double solidangle(const GSkyPixel &pixel) const
Returns solid angle of pixel in units of steradians.
GSkyPixel m_last_dir2pix_pix
Last pixel for dir2pix.
std::vector< double > m_cdelt
CDELTia keyvalues for each coord axis.
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.
double m_equinox
EQUINOX keyvalue.
void free_members(void)
Delete class members.
void cel_set(void) const
Setup of celestial transformation.
virtual std::string code(void) const =0
void wcs_ini(int naxis)
Initialise World Coordinate System.
Abstract FITS extension base class definition.
std::vector< double > m_crval
CRVALia keyvalues for each coord axis.
double m_latpole
LATPOLEa keyvalue.
bool m_unity
Signals unity PC matrix.
void init_lock(const int &lock_id=0) const
Initializes an OpenMP lock with a specific name.
double crpix(const int &inx) const
Return reference pixel.
std::vector< double > m_crota
CROTAia keyvalues for each coord axis.
void wcs_set(void) const
Setup of World Coordinate System.
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
double m_lonpole
LONPOLEa keyvalue.
double m_restfrq
RESTFRQa keyvalue.
std::vector< std::string > m_ctype_c
CTYPEia comments for each coord axis.
double cdelt(const int &inx) const
Return pixel size.
virtual GWcs & operator=(const GWcs &wcs)
Assignment operator.
void wcs_set_ctype(void) const
Set CTYPEa keywords.
virtual void write(GFitsHDU &hdu) const
Write WCS definition into FITS HDU header.
virtual GSkyPixel dir2pix(const GSkyDir &dir) const
Returns sky map pixel of sky direction.
std::vector< double > m_cd
CDi_ja linear transformation matrix.
virtual void read(const GFitsHDU &hdu)
Read WCS definition from FITS header.
double m_pv[PVN]
Projection parameters.
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.
virtual bool compare(const GSkyProjection &proj) const
Compares sky projection.
double m_x0
Fiducial x offset.
GSkyDir m_last_pix2dir_dir
Last sky direction for pix2dir.
double m_restwav
RESTWAVa keyvalue.
std::string wcs_print(const GChatter &chatter=NORMAL) const
Print WCS information.
GSkyDir m_last_dir2pix_dir
Last sky direction for dir2pix.
double m_theta0
Native zenith angle of fiducial point.
void lin_ini(int naxis)
Initialise linear transformation parameters.
std::string wcs_print_value(const double &value) const
Helper function for value printing.
void wcs_set_radesys(void) const
Set radesys and equinox members.
bool m_isolat
True if |latitude| is preserved.
virtual ~GWcs(void)
Destructor.
double m_phi0
Native azimuth angle of fiducial point.
std::vector< double > m_w
Intermediate values.
bool m_has_pix2dir_cache
Has valid pix2dir cache value.
bool m_offset
Force (x,y) = (0,0) at (phi_0,theta_0)
std::string m_radesys
RADESYS keyvalue.
Abstract world coordinate system base class.
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.
Information logger class definition.
GWcs(void)
Void constructor.
double m_y0
Fiducial y offset.
void copy_members(const GWcs &wcs)
Copy class members.
void set_lock(const int &lock_id=0) const
Sets an OpenMP lock with a specific name.
void lin_matinv(const std::vector< double > &mat, std::vector< double > &inv) const
Invert linear transformation matrix.
virtual GWcs * clone(void) const =0
Clones object.
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.
std::vector< double > m_pc
PCi_ja linear transformation matrix.
bool m_prjset
Projection is set.
virtual void clear(void)=0
Clear object.
Abstract sky projection base class.
void lin_set(void) const
Initialise linear transformation parameters.
static const double UNDEFINED
bool m_wcsset
WCS information is set.
Sky map pixel class definition.
double m_euler[5]
Euler angles and functions thereof.
std::vector< std::string > m_cunit
CUNITia keyvalues for each coord axis.
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
virtual std::string name(void) const =0
virtual int size(void) const
Return dimension of projection.
double m_r0
Radius of the generating sphere.
void lin_x2p(int ncoord, int nelem, const double *imgcrd, double *pixcrd) const
World-to-pixel linear transformation.
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
bool m_bounds
Enable strict bounds checking.
bool m_has_dir2pix_cache
Has valid dir2pix cache value.
virtual std::string classname(void) const =0
Return class name.