GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GHealpix Class Reference

HealPix projection class interface definition. More...

#include <GHealpix.hpp>

Inheritance diagram for GHealpix:
GSkyProjection GBase

Public Member Functions

 GHealpix (void)
 Void constructor. More...
 
 GHealpix (const int &nside, const std::string &ordering="NESTED", const std::string &coordsys="EQU")
 Constructor. More...
 
 GHealpix (const GFitsHDU &hdu)
 Constructor from FITS HDU table. More...
 
 GHealpix (const GHealpix &wcs)
 Copy constructor. More...
 
virtual ~GHealpix (void)
 Destructor. More...
 
GHealpixoperator= (const GHealpix &wcs)
 Assignment operator. More...
 
virtual void clear (void)
 Clear object. More...
 
virtual GHealpixclone (void) const
 Clone instance. More...
 
virtual std::string classname (void) const
 Return class name. More...
 
virtual int size (void) const
 Return dimension of projection. More...
 
virtual std::string code (void) const
 Return projection code. More...
 
virtual std::string name (void) const
 Return projection name. More...
 
virtual void read (const GFitsHDU &hdu)
 Read Healpix definition from FITS header. More...
 
virtual void write (GFitsHDU &hdu) const
 Write Healpix definition into FITS HDU. More...
 
virtual double solidangle (const GSkyPixel &pixel) const
 Returns solid angle of pixel. More...
 
virtual GSkyDir pix2dir (const GSkyPixel &pixel) const
 Returns sky direction of pixel. More...
 
virtual GSkyPixel dir2pix (const GSkyDir &dir) const
 Returns sky map pixel of sky coordinate. More...
 
virtual GBilinear interpolator (const GSkyDir &dir) const
 Return interpolator for given sky direction. More...
 
virtual std::string print (const GChatter &chatter=NORMAL) const
 Print WCS information. More...
 
const int & npix (void) const
 Returns number of pixels. More...
 
const int & nside (void) const
 Returns number of divisions of the side of each base pixel. More...
 
std::string ordering (void) const
 Returns ordering parameter. More...
 
void ordering (const std::string &ordering)
 Set pixel ordering. More...
 
std::vector< int > neighbours (const GSkyPixel &pixel) const
 Return neighbouring pixels of a pixel. More...
 
std::vector< GSkyDirboundaries (const GSkyPixel &pixel, const int &step=1) const
 Return pixel boundaries. More...
 
double max_pixrad (void) const
 Return maximum angular distance between pixel centre and corners. 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...
 

Private Member Functions

void init_members (void)
 Initialise class members. More...
 
void copy_members (const GHealpix &wcs)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
virtual bool compare (const GSkyProjection &proj) const
 Returns true if argument is identical. More...
 
int compress_bits (const int &value) const
 Compress Bits. More...
 
int spread_bits (const int &value) const
 Spread Bits. More...
 
void pix2xyf (const int &pix, int *ix, int *iy, int *face) const
 Convert pixel number in to (x,y,face) tuple. More...
 
void nest2xyf (const int &pix, int *ix, int *iy, int *face) const
 Convert pixel number in nested scheme to (x,y,face) tuple. More...
 
void ring2xyf (const int &pix, int *ix, int *iy, int *face) const
 Convert pixel number in ring scheme to (x,y,face) tuple. More...
 
int xyf2nest (const int &ix, const int &iy, const int &face) const
 Convert (x,y,face) tuple to pixel number in nested scheme. More...
 
int xyf2ring (const int &ix, const int &iy, const int &face) const
 Convert (x,y,face) tuple to pixel number in ring scheme. More...
 
void xyf2loc (const double &x, const double &y, const int &face, double *z, double *phi) const
 Convert (x,y,f) tuple into local coordinates. More...
 
int nside2order (const int &nside) const
 Convert nside to order. More...
 
int nest2ring (const int &pix) const
 Converts pixel number in nested indexing scheme to ring scheme. More...
 
int ring2nest (const int &pix) const
 Converts pixel number in ring indexing scheme to nested scheme. More...
 
void pix2xy (const int &ipix, int *x, int *y) const
 Convert pixel index to (x,y) coordinate. More...
 
int xy2pix (int x, int y) const
 Convert (x,y) coordinate to pixel. More...
 
void pix2ang_ring (int ipix, double *theta, double *phi) const
 Convert pixel index to (theta,phi) angles for ring ordering. More...
 
void pix2ang_nest (int ipix, double *theta, double *phi) const
 Convert pixel index to (theta,phi) angles for nested ordering. More...
 
int ang2pix_z_phi_ring (double z, double phi) const
 Returns pixel which contains angular coordinates (z,phi) More...
 
int ang2pix_z_phi_nest (double z, double phi) const
 Returns pixel which contains angular coordinates (z,phi) More...
 
int ring_above (const double &z) const
 Get ring index north of cos(theta) More...
 
void get_ring_info (const int &ring, int *startpix, int *ringpix, bool *shifted) const
 Returns useful information about a given ring of the projection. More...
 
void get_ring_info (const int &ring, int *startpix, int *ringpix, double *theta, bool *shifted) const
 Returns useful information about a given ring of the projection. More...
 
GBilinear interpolator (const double &theta, const double &phi) const
 Return interpolator. More...
 
unsigned int isqrt (unsigned int arg) const
 Integer n that fulfills n*n <= arg < (n+1)*(n+1) More...
 
GVector set_z_phi (const double &z, const double &phi) const
 Return 3D vector. More...
 
GSkyDir loc2dir (const double &z, const double &phi) const
 Convert local coordinate into sky direction. More...
 

Private Attributes

int m_nside
 Number of divisions of each base pixel (1-8192) More...
 
int m_npface
 
int m_ncap
 Number of pixels in polar cap. More...
 
int m_order
 Order. More...
 
int m_ordering
 Pixel ordering (0=ring, 1=nested, -1=?) More...
 
int m_num_pixels
 Number of pixels in projection. More...
 
double m_fact1
 
double m_fact2
 
double m_solidangle
 Solid angle of pixel. More...
 

Additional Inherited Members

- 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...
 
- Protected Attributes inherited from GSkyProjection
int m_coordsys
 0=EQU, 1=GAL More...
 

Detailed Description

HealPix projection class interface definition.

The HealPix projection class has been implemented by adapting code from the HealPix library (version 2.1). For more information about HEALPix, see http://healpix.jpl.nasa.gov

Definition at line 47 of file GHealpix.hpp.

Constructor & Destructor Documentation

GHealpix::GHealpix ( void  )

Void constructor.

Definition at line 102 of file GHealpix.cpp.

References init_members().

Referenced by clone().

GHealpix::GHealpix ( const int &  nside,
const std::string &  order = "NESTED",
const std::string &  coords = "EQU" 
)

Constructor.

Parameters
[in]nsideNumber of sides.
[in]orderPixel ordering ('RING' or 'NESTED').
[in]coordsCoordinate system ('EQU' or 'GAL').
Exceptions
GException::wcs_hpx_bad_nsideInvalid nside parameter.
GException::wcs_bad_coordsInvalid coordsys parameter.
GException::wcs_hpx_bad_orderingInvalid ordering parameter.

Definition at line 126 of file GHealpix.cpp.

References GSkyProjection::coordsys(), gammalib::fourpi, G_CONSTRUCT, init_members(), m_fact1, m_fact2, m_ncap, m_npface, m_nside, m_num_pixels, m_order, m_solidangle, nside(), nside2order(), and ordering().

GHealpix::GHealpix ( const GFitsHDU hdu)
explicit

Constructor from FITS HDU table.

Parameters
[in]hduFITS HDU.

Definition at line 164 of file GHealpix.cpp.

References init_members(), and read().

GHealpix::GHealpix ( const GHealpix proj)

Copy constructor.

Parameters
[in]projHealpix projection.

Definition at line 182 of file GHealpix.cpp.

References copy_members(), and init_members().

GHealpix::~GHealpix ( void  )
virtual

Destructor.

Definition at line 198 of file GHealpix.cpp.

References free_members().

Member Function Documentation

int GHealpix::ang2pix_z_phi_nest ( double  z,
double  phi 
) const
private

Returns pixel which contains angular coordinates (z,phi)

Parameters
[in]zCosine of zenith angle - cos(theta).
[in]phiAzimuth angle in radians.

Definition at line 1565 of file GHealpix.cpp.

References gammalib::inv_pihalf, m_order, gammalib::modulo(), ns_max, order_max, sqrt(), gammalib::twopi, gammalib::twothird, and xy2pix().

Referenced by dir2pix().

int GHealpix::ang2pix_z_phi_ring ( double  z,
double  phi 
) const
private

Returns pixel which contains angular coordinates (z,phi)

Parameters
[in]zCosine of zenith angle - cos(theta).
[in]phiAzimuth angle in radians.

Definition at line 1517 of file GHealpix.cpp.

References gammalib::inv_pihalf, m_ncap, m_nside, m_num_pixels, gammalib::modulo(), sqrt(), gammalib::twopi, and gammalib::twothird.

Referenced by dir2pix().

std::vector< GSkyDir > GHealpix::boundaries ( const GSkyPixel pixel,
const int &  step = 1 
) const

Return pixel boundaries.

Parameters
[in]pixelSky pixel.
[in]stepNumber of returned points (4*step, defaults to 4).
Returns
Array of pixel boundaries.

The method returns a vector with sky directions along the boundary of a HealPix pixel. By default, the 4 corners of HealPix pixel will be returned. The first point corresponds to the northernmost corner, the subsequent points follow the pixel boundary through west, south and east corners. If step>1 more intermediate points will be added after the 4th corner of the pixel.

This method has been adapted from the boundaries() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 709 of file GHealpix.cpp.

References G_BOUNDARIES, GSkyPixel::is_1D(), loc2dir(), m_nside, pix2xyf(), GSkyPixel::print(), and xyf2loc().

Referenced by GSkyMap::flux().

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

Return class name.

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

Implements GSkyProjection.

Definition at line 141 of file GHealpix.hpp.

void GHealpix::clear ( void  )
virtual

Clear object.

This method properly resets the object to an initial state.

Implements GSkyProjection.

Definition at line 255 of file GHealpix.cpp.

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

Referenced by read().

GHealpix * GHealpix::clone ( void  ) const
virtual

Clone instance.

Implements GSkyProjection.

Definition at line 273 of file GHealpix.cpp.

References GHealpix().

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

Return projection code.

Returns
Projection code.

Returns the projection code "HPX".

Implements GSkyProjection.

Definition at line 169 of file GHealpix.hpp.

bool GHealpix::compare ( const GSkyProjection proj) const
privatevirtual

Returns true if argument is identical.

Parameters
[in]projSky projection.

This method is a helper for the sky projection friends.

Implements GSkyProjection.

Definition at line 913 of file GHealpix.cpp.

References GSkyProjection::m_coordsys, m_ncap, m_npface, m_nside, m_num_pixels, m_order, and m_ordering.

int GHealpix::compress_bits ( const int &  value) const
private

Compress Bits.

Parameters
[in]valueValue.
Returns
Compressed Bits.

This method has been adapted from the compress_bits() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 951 of file GHealpix.cpp.

References ctab.

Referenced by nest2xyf().

void GHealpix::copy_members ( const GHealpix proj)
private

Copy class members.

Parameters
[in]projHealpix projection.

Definition at line 878 of file GHealpix.cpp.

References m_fact1, m_fact2, m_ncap, m_npface, m_nside, m_num_pixels, m_order, m_ordering, and m_solidangle.

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

GSkyPixel GHealpix::dir2pix ( const GSkyDir dir) const
virtual

Returns sky map pixel of sky coordinate.

Parameters
[in]dirSky coordinate.
Returns
Sky map pixel.

Implements GSkyProjection.

Definition at line 434 of file GHealpix.cpp.

References ang2pix_z_phi_nest(), ang2pix_z_phi_ring(), GSkyDir::b(), cos(), GSkyDir::dec(), GSkyDir::l(), GSkyProjection::m_coordsys, m_ordering, gammalib::pihalf, and GSkyDir::ra().

void GHealpix::free_members ( void  )
private

Delete class members.

Definition at line 899 of file GHealpix.cpp.

Referenced by clear(), operator=(), and ~GHealpix().

void GHealpix::get_ring_info ( const int &  ring,
int *  startpix,
int *  ringpix,
bool *  shifted 
) const
private

Returns useful information about a given ring of the projection.

Parameters
[in]ringThe ring number (the number of the first ring is 1)
[out]startpixThe number of the first pixel in the ring
[out]ringpixThe number of pixels in the ring
[out]shiftedIf true, the center of the first pixel is not at phi=0

This method has been adapted from the get_ring_info_small() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 1671 of file GHealpix.cpp.

References m_ncap, m_nside, and m_num_pixels.

Referenced by interpolator(), and xyf2ring().

void GHealpix::get_ring_info ( const int &  ring,
int *  startpix,
int *  ringpix,
double *  theta,
bool *  shifted 
) const
private

Returns useful information about a given ring of the projection.

Parameters
[in]ringThe ring number (the number of the first ring is 1)
[out]startpixThe number of the first pixel in the ring
[out]ringpixThe number of pixels in the ring
[out]theta(radians)
[out]shiftedIf true, the center of the first pixel is not at phi=0

This method has been adapted from the get_ring_info2() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 1716 of file GHealpix.cpp.

References gammalib::acos(), gammalib::atan2(), m_fact1, m_fact2, m_ncap, m_nside, m_num_pixels, gammalib::pi, and sqrt().

void GHealpix::init_members ( void  )
private

Initialise class members.

Definition at line 845 of file GHealpix.cpp.

References ctab, m_fact1, m_fact2, m_ncap, m_npface, m_nside, m_num_pixels, m_order, m_ordering, m_solidangle, and utab.

Referenced by clear(), GHealpix(), and operator=().

GBilinear GHealpix::interpolator ( const GSkyDir dir) const
virtual

Return interpolator for given sky direction.

Parameters
[in]dirSky direction

Definition at line 475 of file GHealpix.cpp.

References GSkyDir::b(), GSkyDir::dec(), GSkyDir::l(), GSkyProjection::m_coordsys, gammalib::modulo(), gammalib::pi, gammalib::pihalf, GSkyDir::ra(), and gammalib::twopi.

Referenced by interpolator().

GBilinear GHealpix::interpolator ( const double &  theta,
const double &  phi 
) const
private

Return interpolator.

Parameters
[in]thetaColatitude of direction (radian, the North pole is at theta=0)
[in]phiLongitude of direction (radians)
Exceptions
GException::invalid_argumentInvalid theta argument

Returns a bilinear pixel interpolator for a given sky direction.

This method has been adapted from the get_interpol() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 1767 of file GHealpix.cpp.

References cos(), G_INTERPOLATOR, get_ring_info(), GBilinear::index1(), GBilinear::index2(), GBilinear::index3(), GBilinear::index4(), interpolator(), m_nside, m_num_pixels, m_ordering, gammalib::pi, ring2nest(), ring_above(), gammalib::str(), gammalib::twopi, GBilinear::weight1(), GBilinear::weight2(), GBilinear::weight3(), and GBilinear::weight4().

unsigned int GHealpix::isqrt ( unsigned int  arg) const
private

Integer n that fulfills n*n <= arg < (n+1)*(n+1)

Parameters
[in]argArgument.

Returns the integer n, which fulfills n*n <= arg < (n+1)*(n+1).

Definition at line 1890 of file GHealpix.cpp.

References sqrt().

Referenced by pix2ang_ring(), and ring2xyf().

GSkyDir GHealpix::loc2dir ( const double &  z,
const double &  phi 
) const
private

Convert local coordinate into sky direction.

Parameters
[in]zZ value.
[in]phiPhi value.
Returns
Sky direction.

This method has been adapted from the locToVec3() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 1236 of file GHealpix.cpp.

References asin(), gammalib::atan2(), cos(), GSkyDir::lb(), GSkyProjection::m_coordsys, GSkyDir::radec(), sin(), and sqrt().

Referenced by boundaries().

double GHealpix::max_pixrad ( void  ) const

Return maximum angular distance between pixel centre and corners.

Returns
Maximum angular distance between pixel centre and corners (radians).

Returns the maximum angular distance (in radians) between any pixel centre and its corners.

This method has been adapted from the max_pixrad() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 777 of file GHealpix.cpp.

References gammalib::atan2(), cross(), m_nside, norm(), gammalib::pi, and set_z_phi().

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

Return projection name.

Returns
Projection name.

Returns the projection name.

Implements GSkyProjection.

Definition at line 183 of file GHealpix.hpp.

std::vector< int > GHealpix::neighbours ( const GSkyPixel pixel) const

Return neighbouring pixels of a pixel.

Parameters
[in]pixelPixel index.
Returns
Array of neighbouring pixels.

Returns the 8 neighbours of a given pixel. The method returns a vector with contains the pixel indices of the SW, W, NW, N, NE, E, SE and S neighbours of pix (in the given order). If a neighbour does not exist (this can only be the case for the W, N, E and S neighbors), its entry is set to -1.

This method has been adapted from the neighbors() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 577 of file GHealpix.cpp.

References G_NEIGHBOURS, GSkyPixel::is_1D(), m_nside, m_order, m_ordering, nb_facearray, nb_swaparray, nb_xoffset, nb_yoffset, pix2xyf(), GSkyPixel::print(), spread_bits(), xyf2nest(), and xyf2ring().

int GHealpix::nest2ring ( const int &  pix) const
private

Converts pixel number in nested indexing scheme to ring scheme.

Parameters
[in]pixPixel number in nested indexing scheme.
Returns
Pixel number in ring indexing scheme.
Exceptions
GException::invalid_valueHealpix projection does not represent a hiearachical map.

This method has been adapted from the nest2ring() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 1300 of file GHealpix.cpp.

References G_NEST2RING, m_order, nest2xyf(), and xyf2ring().

void GHealpix::nest2xyf ( const int &  pix,
int *  ix,
int *  iy,
int *  face 
) const
private

Convert pixel number in nested scheme to (x,y,face) tuple.

Parameters
[in]pixPixel number in nested scheme.
[out]ixX index.
[out]iyY index.
[out]faceFace number.

This method has been adapted from the nest2xyf() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 1020 of file GHealpix.cpp.

References compress_bits(), m_npface, and m_order.

Referenced by nest2ring(), and pix2xyf().

const int & GHealpix::npix ( void  ) const
inline

Returns number of pixels.

Definition at line 193 of file GHealpix.hpp.

References m_num_pixels.

Referenced by GSkyMap::GSkyMap(), GSkyMap::is_same(), and write().

const int & GHealpix::nside ( void  ) const
inline

Returns number of divisions of the side of each base pixel.

Definition at line 204 of file GHealpix.hpp.

References m_nside.

Referenced by GHealpix(), GSkyMap::is_same(), and write().

int GHealpix::nside2order ( const int &  nside) const
private

Convert nside to order.

Parameters
[in]nsideNumber of sides.
Returns
Order of HealPix projection.

Definition at line 1267 of file GHealpix.cpp.

References order_max.

Referenced by GHealpix(), and read().

GHealpix & GHealpix::operator= ( const GHealpix proj)

Assignment operator.

Parameters
[in]projHealpix projection.
Returns
Healpix projection.

Definition at line 220 of file GHealpix.cpp.

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

std::string GHealpix::ordering ( void  ) const

Returns ordering parameter.

Definition at line 512 of file GHealpix.cpp.

References m_ordering.

Referenced by GHealpix(), GSkyMap::is_same(), print(), read(), and write().

void GHealpix::ordering ( const std::string &  ordering)

Set pixel ordering.

Parameters
[in]orderingPixel ordering (RING or NEST/NESTED).
Exceptions
GException::wcs_hpx_bad_orderingInvalid ordering parameter.

Definition at line 541 of file GHealpix.cpp.

References G_ORDERING_SET, m_ordering, and gammalib::toupper().

void GHealpix::pix2ang_nest ( int  ipix,
double *  theta,
double *  phi 
) const
private

Convert pixel index to (theta,phi) angles for nested ordering.

Parameters
[in]ipixPixel index for which (theta,phi) are to be computed.
[out]thetaPointer to result zenith angle in radians.
[out]phiPointer to result azimuth angle in radians.
Exceptions
GException::out_of_rangePixel index is out of range.

Definition at line 1451 of file GHealpix.cpp.

References gammalib::acos(), G_PIX2ANG_NEST, jpll, jrll, m_fact1, m_fact2, m_npface, m_nside, m_num_pixels, m_order, gammalib::pihalf, and pix2xy().

Referenced by pix2dir().

void GHealpix::pix2ang_ring ( int  ipix,
double *  theta,
double *  phi 
) const
private

Convert pixel index to (theta,phi) angles for ring ordering.

Parameters
[in]ipixPixel index for which (theta,phi) are to be computed.
[out]thetaPointer to result zenith angle in radians.
[out]phiPointer to result azimuth angle in radians.
Exceptions
GException::out_of_rangePixel index is out of range.

Definition at line 1401 of file GHealpix.cpp.

References gammalib::acos(), G_PIX2ANG_RING, isqrt(), m_fact1, m_fact2, m_ncap, m_nside, m_num_pixels, and gammalib::pi.

Referenced by pix2dir().

GSkyDir GHealpix::pix2dir ( const GSkyPixel pixel) const
virtual

Returns sky direction of pixel.

Parameters
[in]pixelSky map pixel.

Implements GSkyProjection.

Definition at line 385 of file GHealpix.cpp.

References G_XY2DIR, GSkyPixel::is_1D(), GSkyDir::lb(), GSkyProjection::m_coordsys, m_ordering, gammalib::pihalf, pix2ang_nest(), pix2ang_ring(), GSkyPixel::print(), and GSkyDir::radec().

Referenced by GSkyMap::flux().

void GHealpix::pix2xy ( const int &  ipix,
int *  x,
int *  y 
) const
private

Convert pixel index to (x,y) coordinate.

Parameters
[in]ipixPixel index for which (x,y) are to be computed.
[out]xPointer to x coordinate.
[out]yPointer to y coordinate.

Definition at line 1363 of file GHealpix.cpp.

References ctab.

Referenced by pix2ang_nest().

void GHealpix::pix2xyf ( const int &  pix,
int *  ix,
int *  iy,
int *  face 
) const
private

Convert pixel number in to (x,y,face) tuple.

Parameters
[in]pixPixel number.
[out]ixX index.
[out]iyY index.
[out]faceFace number.

This method has been adapted from the pix2xyf() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 992 of file GHealpix.cpp.

References m_ordering, nest2xyf(), and ring2xyf().

Referenced by boundaries(), and neighbours().

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

Print WCS information.

Parameters
[in]chatterChattiness (defaults to NORMAL).
Returns
String containing WCS information.

Implements GSkyProjection.

Definition at line 801 of file GHealpix.cpp.

References GSkyProjection::coordsys(), m_ncap, m_npface, m_nside, m_num_pixels, m_order, m_solidangle, ordering(), gammalib::parformat(), SILENT, and gammalib::str().

void GHealpix::read ( const GFitsHDU hdu)
virtual

Read Healpix definition from FITS header.

Parameters
[in]hduFITS HDU.
Exceptions
GException::wcsUnable to load Healpix definition from HDU.
GException::wcs_bad_coordsInvalid coordsys parameter.
GException::wcs_hpx_bad_orderingInvalid ordering parameter.

Implements GSkyProjection.

Definition at line 291 of file GHealpix.cpp.

References clear(), GSkyProjection::coordsys(), gammalib::fourpi, G_READ, GFitsHDU::has_card(), GFitsHDU::integer(), m_fact1, m_fact2, m_ncap, m_npface, m_nside, m_num_pixels, m_order, m_solidangle, nside2order(), ordering(), and GFitsHDU::string().

Referenced by GHealpix().

int GHealpix::ring2nest ( const int &  pix) const
private

Converts pixel number in ring indexing scheme to nested scheme.

Parameters
[in]pixPixel number in ring indexing scheme.
Returns
Pixel number in nested indexing scheme.
Exceptions
GException::invalid_valueHealpix projection does not represent a hiearachical map.

This method has been adapted from the ring2nest() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 1334 of file GHealpix.cpp.

References G_RING2NEST, m_order, ring2xyf(), and xyf2nest().

Referenced by interpolator().

void GHealpix::ring2xyf ( const int &  pix,
int *  ix,
int *  iy,
int *  face 
) const
private

Convert pixel number in ring scheme to (x,y,face) tuple.

Parameters
[in]pixPixel number in ring scheme
[out]ixX index.
[out]iyY index.
[out]faceFace number.

This method has been adapted from the ring2xyf() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 1048 of file GHealpix.cpp.

References isqrt(), jpll, jrll, m_ncap, m_nside, m_num_pixels, and m_order.

Referenced by pix2xyf(), and ring2nest().

int GHealpix::ring_above ( const double &  costheta) const
private

Get ring index north of cos(theta)

Parameters
[in]costhetaCosine of colatitude theta

Returns the number of the next ring to the north of cos(theta). It may return 0; in this case costheta lies north of all rings.

This method has been adapted from the ring_above() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 1633 of file GHealpix.cpp.

References abs(), m_nside, sqrt(), and gammalib::twothird.

Referenced by interpolator().

GVector GHealpix::set_z_phi ( const double &  z,
const double &  phi 
) const
private

Return 3D vector.

Parameters
[in]zZ value.
[in]phiPhi value.
Returns
3D vector

This method has been adapted from the set_z_phi() function located in the file vec3.h in Healpix version 3.20.

Definition at line 1907 of file GHealpix.cpp.

References cos(), sin(), and sqrt().

Referenced by max_pixrad().

int GHealpix::size ( void  ) const
inlinevirtual

Return dimension of projection.

Returns
Dimension of projection.

Returns the dimension of the projection.

Implements GSkyProjection.

Definition at line 155 of file GHealpix.hpp.

double GHealpix::solidangle ( const GSkyPixel pixel) const
inlinevirtual

Returns solid angle of pixel.

Parameters
[in]pixelSky pixel.
Returns
Solid angle of pixel.

Returns the solid angle of the specified pixel. Note that HEALPix pixels have all the same solid angle, hence the pixel argument is in fact not used by the method.

Implements GSkyProjection.

Definition at line 221 of file GHealpix.hpp.

References m_solidangle.

int GHealpix::spread_bits ( const int &  value) const
private

Spread Bits.

Parameters
[in]valueCompressed value.
Returns
Spread Bits.

This method has been adapted from the spread_bits() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 971 of file GHealpix.cpp.

References utab.

Referenced by neighbours(), and xyf2nest().

void GHealpix::write ( GFitsHDU hdu) const
virtual

Write Healpix definition into FITS HDU.

Parameters
[in]hduFITS HDU.

Writes the following keywords in the FITS HDU: EXTNAME = HEALPIX PIXTYPE = HEALPIX NSIDE = nside() = m_nside FIRSTPIX = 0 LASTPIX = npix()-1 = m_num_pixels-1 ORDERING = ordering() COORDSYS = coordsys()

Implements GSkyProjection.

Definition at line 357 of file GHealpix.cpp.

References GFitsHDU::card(), GSkyProjection::coordsys(), GFitsHDU::extname(), npix(), nside(), and ordering().

int GHealpix::xy2pix ( int  x,
int  y 
) const
private

Convert (x,y) coordinate to pixel.

Parameters
[in]xx coordinate.
[in]yy coordinate.

Definition at line 1384 of file GHealpix.cpp.

References utab.

Referenced by ang2pix_z_phi_nest().

void GHealpix::xyf2loc ( const double &  x,
const double &  y,
const int &  face,
double *  z,
double *  phi 
) const
private

Convert (x,y,f) tuple into local coordinates.

Parameters
[in]xX value.
[in]yY value.
[in]faceFace number.
[out]zZ value.
[out]phiPhi value.

This method has been adapted from the xyf2loc() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 1188 of file GHealpix.cpp.

References jpll, jrll, and gammalib::pihalf.

Referenced by boundaries().

int GHealpix::xyf2nest ( const int &  ix,
const int &  iy,
const int &  face 
) const
private

Convert (x,y,face) tuple to pixel number in nested scheme.

Parameters
[in]ixX index
[in]iyY index
[in]faceFace number
Returns
Pixel number if nested scheme

This method has been adapted from the xyf2nest() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 1125 of file GHealpix.cpp.

References m_order, and spread_bits().

Referenced by neighbours(), and ring2nest().

int GHealpix::xyf2ring ( const int &  ix,
const int &  iy,
const int &  face 
) const
private

Convert (x,y,face) tuple to pixel number in ring scheme.

Parameters
[in]ixX index
[in]iyY index
[in]faceFace number
Returns
Pixel number if ring scheme

This method has been adapted from the xyf2ring() function located in the file healpix_base.cc in Healpix version 3.20.

Definition at line 1147 of file GHealpix.cpp.

References get_ring_info(), jpll, jrll, and m_nside.

Referenced by neighbours(), and nest2ring().

Member Data Documentation

double GHealpix::m_fact1
private
double GHealpix::m_fact2
private
int GHealpix::m_ncap
private

Number of pixels in polar cap.

Definition at line 125 of file GHealpix.hpp.

Referenced by ang2pix_z_phi_ring(), compare(), copy_members(), get_ring_info(), GHealpix(), init_members(), pix2ang_ring(), print(), read(), and ring2xyf().

int GHealpix::m_npface
private
int GHealpix::m_nside
private
int GHealpix::m_num_pixels
private
int GHealpix::m_ordering
private

Pixel ordering (0=ring, 1=nested, -1=?)

Definition at line 127 of file GHealpix.hpp.

Referenced by compare(), copy_members(), dir2pix(), init_members(), interpolator(), neighbours(), ordering(), pix2dir(), and pix2xyf().

double GHealpix::m_solidangle
private

Solid angle of pixel.

Definition at line 131 of file GHealpix.hpp.

Referenced by copy_members(), GHealpix(), init_members(), print(), read(), and solidangle().


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