This Python 3.3 module implements the HEALPix map projection as described in [CaRo2007].
[CaRo2007] | Mark R. Calabretta and Boudewijn F. Roukema, Mapping on the healpix grid, Monthly Notices of the Royal Astronomical Society 381 (2007), no. 2, 865–872. |
CHANGELOG:
NOTE:
All lengths are measured in meters and all angles are measured in radians unless indicated otherwise. By ‘ellipsoid’ below, i mean an oblate ellipsoid of revolution.
Return a function object that wraps the HEALPix projection and its inverse of an ellipsoid with major radius a and eccentricity e.
EXAMPLES:
>>> f = healpix(a=2, e=0)
>>> print(my_round(f(0, pi/3, radians=True), 15))
(0.57495135977821499, 2.1457476865731109)
>>> p = (0, 60)
>>> q = f(*p, radians=False); print(my_round(q, 15))
(0.57495135977821499, 2.1457476865731109)
>>> print(my_round(f(*q, radians=False, inverse=True), 15))
(5.9999999999999997e-15, 59.999999999999986)
>>> print(my_round(p, 15))
(0, 60)
OUTPUT:
Return a Sage Graphics object diagramming the HEALPix projection boundary and polar triangles for the ellipsoid with major radius a and eccentricity e. Inessential graphics method. Requires Sage graphics methods.
Compute the signature functions of the HEALPix projection of an oblate ellipsoid with eccentricity e whose authalic sphere is the unit sphere. Works when e = 0 (spherical case) too.
INPUT:
EXAMPLES:
>>> print(my_round(healpix_ellipsoid(0, pi/7), 15))
(0, 0.51115723774642197)
>>> print(my_round(healpix_ellipsoid(0, pi/7, e=0.8), 15))
(0, 0.26848445085783701)
Compute the inverse of healpix_ellipsoid().
EXAMPLES:
>>> p = (0, pi/7)
>>> q = healpix_ellipsoid(*p)
>>> print(my_round(healpix_ellipsoid_inverse(*q), 15))
(0, 0.44879895051282798)
>>> print(my_round(p, 15))
(0, 0.448798950512828)
Compute the signature function of the HEALPix projection of the unit sphere.
INPUT:
EXAMPLES:
>>> print(healpix_sphere(0, arcsin(2.0/3)) == (0, pi/4))
True
Compute the inverse of the healpix_sphere().
INPUT:
EXAMPLES:
>>> print(healpix_sphere_inverse(0, pi/4) == (0, arcsin(2.0/3)))
True
Return a list of the planar vertices of the HEALPix projection of the unit sphere.
Return True if and only if (x, y) lies in the image of the HEALPix projection of the unit sphere.
EXAMPLES:
>>> eps = 0 # Test boundary points.
>>> hp = [
... (-pi - eps, pi/4),
... (-3*pi/4, pi/2 + eps),
... (-pi/2, pi/4 + eps),
... (-pi/4, pi/2 + eps),
... (0, pi/4 + eps),
... (pi/4, pi/2 + eps),
... (pi/2, pi/4 + eps),
... (3*pi/4, pi/2 + eps),
... (pi + eps, pi/4),
... (pi + eps,-pi/4),
... (3*pi/4,-pi/2 - eps),
... (pi/2,-pi/4 - eps),
... (pi/4,-pi/2 - eps),
... (0,-pi/4 - eps),
... (-pi/4,-pi/2 - eps),
... (-pi/2,-pi/4 - eps),
... (-3*pi/4,-pi/2 - eps),
... (-pi - eps,-pi/4)
... ]
>>> for p in hp:
... if not in_healpix_image(*p):
... print('Fail')
...
>>> in_healpix_image(0, 0)
True
>>> in_healpix_image(0, pi/4 + 0.1)
False