Debian Codegraph @

docs/healpy_compat.rst

raw
1 Healpy-compatible interface
2 ===========================
3
4 In addition to the above high- and low-level interfaces, we have provided
5 a `healpy <http://healpy.readthedocs.io>`_-compatible interface in
6 :mod:`astropy_healpix.healpy`. Note that this only includes a subset of the healpy functions.
7 This is not the recommended interface, and is only provided as a convenience
8 for packages that want to support both healpy and this package.
9
10 Example
11 -------
12
13 As an example, the :func:`~astropy_healpix.healpy.pix2ang` function can be used to get
14 the longitude/latitude of a given HEALPix pixel (by default using the 'ring'
15 convention)::
16
17 >>> from astropy_healpix.healpy import pix2ang
18 >>> pix2ang(16, [100, 120])
19 (array([ 0.35914432, 0.41113786]), array([ 3.70259134, 1.6689711 ]))
20
21 which agrees exactly with the healpy function::
22
23 .. doctest-requires:: healpy
24
25 >>> from healpy import pix2ang
26 >>> pix2ang(16, [100, 120])
27 (array([ 0.35914432, 0.41113786]), array([ 3.70259134, 1.6689711 ]))
28
29 Migrate
30 -------
31
32 To migrate a script or package from using ``healpy`` to this ``healpix`` package,
33 to check if the required functionality is available by changing all::
34
35 import healpy as hp
36
37 to::
38
39 from astropy_healpix import healpy as hp
40
41 and see what's missing or breaks. Please file issues or feature requests!
42
43 As mentioned above, we then recommend that when you actually make the change,
44 you use the main API of this package instead of the ``healpy``-compatible interface.