Healpix#
- class cygrid.Healpix(uint64_t nside=1, uint32_t scheme=RING)#
Bases:
objectHelper class for HEALPix operations.
Implements conversion between HEALPix world and pixel coordinates (‘RING’ representation only). Also provides a
query_discmethod that returns a disc footprint for \(\varphi = 180^\circ\) for a given ring.- Parameters:
Notes
A lot of the code in this class was adapted from the HEALPix C++ library. (Copyright (C) 2003-2012 Max-Planck-Society; author Martin Reinecke; see http://healpix.sourceforge.net)
Attributes Summary
property ncap : unsigned 64-bit int
property nface : unsigned 64-bit int
property npix : unsigned 64-bit int
property nrings : unsigned 64-bit int
property nside : unsigned 64-bit int
property omega : double
property order : unsigned 64-bit int
property resolution : double
property scheme : enum
Methods Summary
ang2pix(self, double theta, double phi)Return the pixel index containing the angular coordinates \((\varphi, \vartheta)\).
ang2pix_many(self, double[, double[)Return the pixel indices containing the angular coordinates of \((\varphi, \vartheta)\) arrays.
get_ring_info_small(self, uint64_t ring)Return start index and number of pixels per healpix ring.
pix2ang(self, uint64_t pix)Convert HEALPix index to angular coordinates \((\varphi, \vartheta)\).
pix2ang_many(self, long[)Convert HEALPix indices to angular coordinates of \((\varphi, \vartheta)\) arrays.
pix2ring(self, uint64_t pix)Return 'ring' number that contains the HEALPix pixel, 'pix'.
pix2ring_many(self, long[)Return 'ring' numbers containing HEALPix pixels given in array, 'pix'.
query_disc(self, double theta, double phi, ...)Return hpx indices of a disc around \((\vartheta, \varphi)\).
query_disc_phi180(self, ...)Return HEALPix indices of a disc around \(\varphi=180^\circ\) for 'disc_ring'.
Attributes Documentation
- ncap#
- property ncapunsigned 64-bit int
Return the HEALPix ‘ncap’ parameter.
- npface#
- property nfaceunsigned 64-bit int
Return the HEALPix ‘nface’ parameter.
- npix#
- property npixunsigned 64-bit int
Return the HEALPix ‘npix’ parameter.
- nrings#
- property nringsunsigned 64-bit int
Return the HEALPix ‘nrings’ parameter.
- nside#
- property nsideunsigned 64-bit int
The HEALPix ‘nside’ parameter. (Re-)setting ‘nside’ updates other properties.
- order#
- property orderunsigned 64-bit int
Return the HEALPix ‘order’ parameter.
- resolution#
- property resolutiondouble
Return the angular size of the HEALPix pixels for current
nside.
- scheme#
- property schemeenum
The HEALPix ‘scheme’. Currently only ‘RING’ is supported.
Methods Documentation
- ang2pix(self, double theta, double phi)#
Return the pixel index containing the angular coordinates \((\varphi, \vartheta)\).
Wrapper around the Cython-only (private) method _ang2pix.
- Parameters:
- theta
double \(\vartheta\) coordinate (\(\vartheta = \pi/2 - \mathrm{latitude}\)).
- phi
double \(\varphi\) coordinate (longitude).
- theta
- Returns:
- pix
unsigned64-bitint The HEALPix pixel index.
- pix
- Raises:
ValueErrorInvalid theta value.
- ang2pix_many(self, double[::1] theta, double[::1] phi)#
Return the pixel indices containing the angular coordinates of \((\varphi, \vartheta)\) arrays.
Wrapper around the Cython-only (private) method _ang2pix.
- get_ring_info_small(self, uint64_t ring)#
Return start index and number of pixels per healpix ring.
Wrapper around the Cython-only (private) method
_get_ring_info_small.- Parameters:
- ring
unsigned64-bitint The HEALPix ring parameter to get information on.
- ring
- Returns:
- Raises:
ValueErrorRing index not in valid range.
- pix2ang(self, uint64_t pix)#
Convert HEALPix index to angular coordinates \((\varphi, \vartheta)\).
Wrapper around the Cython-only (private) method
_pix2ang.- Parameters:
- pix
unsigned64-bitint The HEALPix pixel index.
- pix
- Returns:
- theta
double \(\vartheta\) coordinate (\(\vartheta = \pi/2 - \mathrm{latitude}\)).
- phi
double \(\varphi\) coordinate (longitude).
- theta
- Raises:
ValueErrorpixnot in valid range.
- pix2ang_many(self, long[::1] pix)#
Convert HEALPix indices to angular coordinates of \((\varphi, \vartheta)\) arrays.
Wrapper around the Cython-only (private) method
_pix2ang.
- pix2ring(self, uint64_t pix)#
Return ‘ring’ number that contains the HEALPix pixel, ‘pix’.
Wrapper around the Cython-only (private) method _pix2ring.
- Parameters:
- pix
unsigned64-bitint The HEALPix index.
- pix
- Returns:
- ring
unsigned64-bitint The HEALPix ring.
- ring
- Raises:
ValueErrorPixel index not in valid range.
- pix2ring_many(self, long[::1] pix)#
Return ‘ring’ numbers containing HEALPix pixels given in array, ‘pix’.
Wrapper around the Cython-only (private) method _pix2ring.
- query_disc(self, double theta, double phi, double disc_size_rad)#
Return hpx indices of a disc around \((\vartheta, \varphi)\).
This uses
query_disc_phi180and shifts the pixels along ring.Wrapper around the cython-only (private) method _query_disc.
- query_disc_phi180(self, double disc_size_rad, uint64_t disc_ring)#
Return HEALPix indices of a disc around \(\varphi=180^\circ\) for ‘disc_ring’.
This is a modified version of the HEALPix library
query_discroutine that returns the HEALPix indices of a disc around arbitrary coordinates. Here, it was modified to only work for coordinates having \(\varphi=180^\circ\) and a \(\vartheta\) that coincides with the latitude of a HEALPix ring. These discs can be shifted along \(\varphi\) - which is faster than callingquery_discif one cashes the \(\varphi=180^\circ\) discs.Wrapper around the Cython-only (private) method
_query_disc_phi180.