Expand description
Implementation of the HEALPix framework.
See papers:
- Gorsky2005: “HEALPix: A Framework for High-Resolution Discretization and Fast Analysis of Data Distributed on the Sphere”, Górski, K. M. et al., 2005; 2005ApJ…622..759G.
- Calabretta2004: “Mapping on the HEALPix grid”, Calabretta, M. R., 2004; 2004astro.ph.12607C
- Calabretta2007: “Mapping on the HEALPix grid”, Calabretta, M. R. et Roukema, B. F., 2007; 2007MNRAS.381..865C
- Reinecke2015: “Efficient data structures for masks on 2D grids”, Reinecke, M. et Hivon, E., 2015; 2015A&A…580A.132R
Modules§
- compass_
point - Module defining the commodity enums Cardinal (points) and MainWind (points).
- external_
edge - Module simply defining a the structure storing the external edges of an HEALPix cell and provided accesses according to the main wind directions. This strcut is common to nested and ring scheme.
- nested
- Module containing NESTED scheme methods
- ring
- Module containing RING scheme methods
- special_
points_ finder - sph_
geom - Module containing spherical geometry structures and methods like 3D vectors, polygon or cone on the unit sphere…
Constants§
- DEPTH_
MAX - Constant = 29, i.e. the largest possible depth we can store on a signed positive long (4 bits for base cells + 2 bits per depth + 2 remaining bits (1 use in the unique notation).
- F64_
BUT_ SIGN_ BIT_ MASK - Equals !F64_SIGN_BIT_MASK (the inverse of the f64 sign mask)
- F64_
SIGN_ BIT_ MASK - Mask to keep only the f64 sign
- FOUR_
OVER_ PI - Constant = 4 / pi.
- NSIDE_
MAX - Constant = nside(29), i.e. the largest possible nside available when we store HEALPix hash on a u64.
- ONE_
OVER_ TRANSITION_ Z - Inverse of the limit on |z|=|sin(lat)| between the equatorial region and the polar caps. Equals 1/(2/3) = 1.5, see Eq. (1) in Gorsky2005.
- PI_
OVER_ FOUR - Constant = pi / 4.
- SQRT6
- Constant = sqrt(6).
- TRANSITION_
LATITUDE - Limit on the latitude (in radians) between the equatorial region and the polar caps. Equals asin(2/3) = 0.7297276562269663 radians ~= 41,81 degrees. Written $\theta_X$ in Calabretta2007.
- TRANSITION_
Z - Limit on |z|=|sin(lat)| between the equatorial region and the polar caps. Equals 2/3, see Eq. (1) in Gorsky2005.
- TWICE_
PI - Constant = 2 * pi.
Statics§
- LAT_
OF_ SQUARE_ CELL - Latitude, in the equatorial region, for which the distance from the cell center to its four vertices is almost equal on the sky (i.e. the shape of the cell on the sky is close to a square). The larger the depth, the better the approximation (based on differential calculus).
Traits§
- Customf64
- Simple trait used to implements
pow2
,twice
andhalf
on f64.
Functions§
- base_
cell_ from_ proj_ coo - Returns the hash of the base cell given the coordinates of a points in the Euclidean projection plane. The purpose so far is just to test and compare both speed and precision with the 45deg rotation solution.
- best_
starting_ depth - Returns the the smallest depth (in
[0, 29]
) at which a shape having the given largest distance from its center to a border overlaps a maximum of 9 cells (the cell containing the center of the shape plus the 8 neighbouring cells).
Info: internally, unrolled binary search loop on 30 pre-computed values (one by depth). @return -1 if the given distance is very large (> ~48deg), else returns the smallest depth (in [0, 29]) at which a shape having the given largest distance from its center to a border overlaps a maximum of 9 cells (the cell containing the center of the shape plus the 8 neighbouring cells). - depth
- Returns, for the given
nside
, the number of subdivision of a base-resolution cell (i.e. the depth). For the NESTED scheme only. - depth_
from_ n_ hash_ unsafe - Returns, for the given
n_hash
i.e. number of cells, the number of subdivision of a base-resolution cell (i.e. the depth). For the NESTED scheme only. - depth_
unsafe - Same as depth except that this version does not check the argument, and thus does not panics if the argument is illegal.
- direction_
from_ neighbour - Returns the direction of the given base cell from its neighbour base cell located in the given direction.
- edge_
cell_ direction_ from_ neighbour - Returns the direction of a cell on the inner edge of the given base cell from its neighbour located at the given direction in a different base cell.
- has_
best_ starting_ depth - Returns
true
if the function best_starting_depth is valid for the given argumentd_max_rad
. So ifd_max_rad < ~48 deg
.d_max_rad
is given in radians. - haversine_
dist - is_
depth - Returns
true
if the given argument is a valid depth, i.e. if it is <= DEPTH_MAX. - is_
in_ equatorial_ region - Returns
true
if the point of given (absolute value of) latitude is in the equatorial region, andfalse
if it is located in one of the two polar caps - is_
in_ projected_ equatorial_ region - Returns
true
if the point of given (absolute value of) y coordinate in the projected plane is in the equatorial region, andfalse
if it is located in one of the two polar caps - is_
nside - Returns
true
if the given argument is a validnside
for the NESTED scheme, i.e. if it is a power of 2, is != 0 and is <= NSIDE_MAX. - largest_
center_ to_ vertex_ distance - Returns an upper limit on the distance between a cell center around the given position and its furthest vertex.
- largest_
center_ to_ vertex_ distance_ with_ radius - Returns an upper limit on the distance between a cell center and it furthest vertex, for
all the cells in the region covered by a cone of given center and radius.
It is an extension of largest_center_to_vertex_distance - largest_
center_ to_ vertex_ distances_ with_ radius - Same as largest_center_to_vertex_distance_with_radius but making the computation for several depths at the same time.
- n_hash
- Returns the number of distinct hash value (the number of cells or pixel the unit sphere is
devided in) at the given
depth
. - n_
hash_ unsafe - Same as n_hash except that this version does not panic if the given
depth
is out of range. - neighbour
- Compute the base cell value which is the neighbour of the given base cell, in the given direction.
There is no neighbour: - nside
- Returns, for the given depth, the number of cells along both axis of a base-resolution cell.
- nside_
square - Returns, for the given difference of depth, the number of cells small cells the large cell contains. If the small cell level is 0, the result is the sqaured nside.
- nside_
square_ unsafe - Same as nside_square except that this version does not check the argument, and thus does not panics if the argument is illegal.
- nside_
unsafe - Same as nside except that this version does not check the argument, and thus does not panics if the argument is illegal.
- proj
- Performs the HEALPix projection:
(x, y) = proj(lon, lat)
.
The chosen scale is such that: base cell vertices and center coordinates are integers; the distance from a cell center to its vertices equals one.
This projection is multi-purpose in the sense that iflon
is in[-pi, pi]
, thenx
is in[-4, 4]
and iflon
is in[0, 2pi]
, thenx
is in[0, 8]
.
It means that a same position on the sphere can lead to different positions in the projected Euclidean plane. - unproj
- Unproject the given HEALPix projected points.
This unprojection is multi-purpose in the sense that: