# [−][src]Crate cdshealpix

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). nested Module containing NESTED scheme methods

## 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). FOUR_OVER_PI Constant = 4/pi. HALF_PI Constant = pi/2. NSIDE_MAX Constant = nside(29), i.e. the largest possible nside available when we store HEALPix hash on a u64. PI_OVER_FOUR Constant = pi/4. 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.

## 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 and half on f64.

## Functions

 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). depth_unsafe Same as depth except that this version does not check the argument, and thus does not panics if the argument is illegal. has_best_starting_depth Returns true if the function best_starting_depth is valid for the given argument d_max_rad. So if d_max_rad < ~48 deg. d_max_rad is given in radians. 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, and false 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, and false if it is located in one of the two polar caps is_nside Returns true if the given argument is a valid nside, i.e. if it is a power of 2, is != 0 and is <= NSIDE_MAX. largest_center_to_vertex_distance All types that implement Write get methods defined in WriteBytesExt for free. 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 if lon is in [-pi, pi], then x is in [-4, 4] and if lon is in [0, 2pi], then x 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: