| 1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst |
| 2 | """ |
| 3 | This submodule provides a healpy-compatible interface. |
| 4 | """ |
| 5 | |
| 6 | import numpyscip-python python numpy 2.4.6 numpy/__init__: as np |
| 7 | from astropyscip-python python astropy 7.2.0 astropy/__init__: import units as u |
| 8 | from astropy.coordinates.representationscip-python python astropy 7.2.0 `astropy.coordinates.representation`/__init__: import CartesianRepresentation, UnitSphericalRepresentation |
| 9 | |
| 10 | from .corescip-python python astropy_healpix 1.1.2 core/__init__: import (nside_to_pixel_resolutionscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/nside_to_pixel_resolution()., nside_to_pixel_areascip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/nside_to_pixel_area()., |
| 11 | nside_to_npixscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/nside_to_npix()., npix_to_nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/npix_to_nside()., nested_to_ringscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/nested_to_ring()., ring_to_nestedscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/ring_to_nested()., |
| 12 | level_to_nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/level_to_nside()., lonlat_to_healpixscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/lonlat_to_healpix()., healpix_to_lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/healpix_to_lonlat()., |
| 13 | xyz_to_healpixscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/xyz_to_healpix()., healpix_to_xyzscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/healpix_to_xyz()., |
| 14 | boundaries_lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/boundaries_lonlat()., bilinear_interpolation_weightsscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/bilinear_interpolation_weights()., |
| 15 | interpolate_bilinear_lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/interpolate_bilinear_lonlat()., _NUMPY_COPY_IF_NEEDEDscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/_NUMPY_COPY_IF_NEEDED.) |
| 16 | |
| 17 | RAD2DEGscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/RAD2DEG. = 180 / np.pi |
| 18 | PI_2scip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/PI_2. = np.pi / 2 |
| 19 | |
| 20 | __all__scip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/__all__. = ['nside2resol', |
| 21 | 'nside2pixarea', |
| 22 | 'nside2npix', |
| 23 | 'npix2nside', |
| 24 | 'pix2ang', |
| 25 | 'ang2pix', |
| 26 | 'pix2vec', |
| 27 | 'vec2pix', |
| 28 | 'order2nside', |
| 29 | 'nest2ring', |
| 30 | 'ring2nest', |
| 31 | 'boundaries', |
| 32 | 'vec2ang', |
| 33 | 'ang2vec', |
| 34 | 'get_interp_weights', |
| 35 | 'get_interp_val'] |
| 36 | |
| 37 | |
| 38 | def _lonlat_to_healpyscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lonscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lon), latscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lat), lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lonlat)=False): |
| 39 | # We use in-place operations below to avoid making temporary arrays - this |
| 40 | # is safe because the lon/lat arrays returned from healpix_to_lonlat are |
| 41 | # new and not used elsewhere. |
| 42 | if lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lonlat): |
| 43 | return lonscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lon).to(u.degscip-python python astropy_healpix 1.1.2 `astropy.units.core`/arcmin#).value, latscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lat).to(u.degscip-python python astropy_healpix 1.1.2 `astropy.units.core`/arcmin#).value |
| 44 | else: |
| 45 | latscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lat), lonscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lon) = latscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lat).to(u.radscip-python python astropy_healpix 1.1.2 `astropy.units.core`/sr#).value, lonscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lon).to(u.radscip-python python astropy_healpix 1.1.2 `astropy.units.core`/sr#).value |
| 46 | if np.isscalarscip-python python numpy 2.4.6 `numpy._core.numeric`/isscalar().(lonscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lon)): |
| 47 | return PI_2scip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/PI_2. - latscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lat), lonscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lon) |
| 48 | else: |
| 49 | latscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lat) = np.subtract(PI_2scip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/PI_2., latscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lat), out=latscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lat)) |
| 50 | return latscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lat), lonscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lon) |
| 51 | |
| 52 | |
| 53 | def _healpy_to_lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(thetascip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(theta), phiscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(phi), lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(lonlat)=False): |
| 54 | # Unlike in _lonlat_to_healpy, we don't use in-place operations since we |
| 55 | # don't want to modify theta and phi since the user may be using them |
| 56 | # elsewhere. |
| 57 | if lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(lonlat): |
| 58 | lon = np.asarrayscip-python python numpy 2.4.6 `numpy._core.multiarray`/asarray().(thetascip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(theta)) / RAD2DEGscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/RAD2DEG. |
| 59 | lat = np.asarrayscip-python python numpy 2.4.6 `numpy._core.multiarray`/asarray().(phiscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(phi)) / RAD2DEGscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/RAD2DEG. |
| 60 | else: |
| 61 | lat = PI_2scip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/PI_2. - np.asarrayscip-python python numpy 2.4.6 `numpy._core.multiarray`/asarray().(thetascip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(theta)) |
| 62 | lon = np.asarrayscip-python python numpy 2.4.6 `numpy._core.multiarray`/asarray().(phiscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(phi)) |
| 63 | return u.Quantityscip-python python astropy_healpix 1.1.2 `astropy.units.quantity`/Quantity#(lon, u.radscip-python python astropy_healpix 1.1.2 `astropy.units.core`/sr#, copy=_NUMPY_COPY_IF_NEEDEDscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/_NUMPY_COPY_IF_NEEDED.), u.Quantityscip-python python astropy_healpix 1.1.2 `astropy.units.quantity`/Quantity#( |
| 64 | lat, u.radscip-python python astropy_healpix 1.1.2 `astropy.units.core`/sr#, copy=_NUMPY_COPY_IF_NEEDEDscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/_NUMPY_COPY_IF_NEEDED.) |
| 65 | |
| 66 | |
| 67 | def nside2resolscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nside2resol().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nside2resol().(nside), arcminscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nside2resol().(arcmin)=False): |
| 68 | """Drop-in replacement for healpy `~healpy.pixelfunc.nside2resol`.""" |
| 69 | resolution = nside_to_pixel_resolutionscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/nside_to_pixel_resolution().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nside2resol().(nside)) |
| 70 | if arcminscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nside2resol().(arcmin): |
| 71 | return resolution.to(u.arcminscip-python python astropy_healpix 1.1.2 `astropy.units.core`/arcmin#).value |
| 72 | else: |
| 73 | return resolution.to(u.radscip-python python astropy_healpix 1.1.2 `astropy.units.core`/sr#).value |
| 74 | |
| 75 | |
| 76 | def nside2pixareascip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nside2pixarea().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nside2pixarea().(nside), degreesscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nside2pixarea().(degrees)=False): |
| 77 | """Drop-in replacement for healpy `~healpy.pixelfunc.nside2pixarea`.""" |
| 78 | area = nside_to_pixel_areascip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/nside_to_pixel_area().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nside2pixarea().(nside)) |
| 79 | if degreesscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nside2pixarea().(degrees): |
| 80 | return area.to(u.degscip-python python astropy_healpix 1.1.2 `astropy.units.core`/arcmin# ** 2).value |
| 81 | else: |
| 82 | return area.to(u.srscip-python python astropy_healpix 1.1.2 `astropy.units.core`/sr#).value |
| 83 | |
| 84 | |
| 85 | def nside2npixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nside2npix().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nside2npix().(nside)): |
| 86 | """Drop-in replacement for healpy `~healpy.pixelfunc.nside2npix`.""" |
| 87 | return nside_to_npixscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/nside_to_npix().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nside2npix().(nside)) |
| 88 | |
| 89 | |
| 90 | def npix2nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/npix2nside().(npixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/npix2nside().(npix)): |
| 91 | """Drop-in replacement for healpy `~healpy.pixelfunc.npix2nside`.""" |
| 92 | return npix_to_nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/npix_to_nside().(npixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/npix2nside().(npix)) |
| 93 | |
| 94 | |
| 95 | def order2nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/order2nside().(orderscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/order2nside().(order)): |
| 96 | """Drop-in replacement for healpy `~healpy.pixelfunc.order2nside`.""" |
| 97 | return level_to_nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/level_to_nside().(orderscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/order2nside().(order)) |
| 98 | |
| 99 | |
| 100 | def pix2angscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2ang().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2ang().(nside), ipixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2ang().(ipix), nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2ang().(nest)=False, lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2ang().(lonlat)=False): |
| 101 | """Drop-in replacement for healpy `~healpy.pixelfunc.pix2ang`.""" |
| 102 | lon, lat = healpix_to_lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/healpix_to_lonlat().(ipixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2ang().(ipix), nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2ang().(nside), orderscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/healpix_to_lonlat().(order)='nested' if nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2ang().(nest) else 'ring') |
| 103 | return _lonlat_to_healpyscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lon, lat, lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lonlat)=lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2ang().(lonlat)) |
| 104 | |
| 105 | |
| 106 | def ang2pixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2pix().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2pix().(nside), thetascip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2pix().(theta), phiscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2pix().(phi), nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2pix().(nest)=False, lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2pix().(lonlat)=False): |
| 107 | """Drop-in replacement for healpy `~healpy.pixelfunc.ang2pix`.""" |
| 108 | lon, lat = _healpy_to_lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(thetascip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2pix().(theta), phiscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2pix().(phi), lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(lonlat)=lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2pix().(lonlat)) |
| 109 | return lonlat_to_healpixscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/lonlat_to_healpix().(lon, lat, nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2pix().(nside), orderscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/lonlat_to_healpix().(order)='nested' if nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2pix().(nest) else 'ring') |
| 110 | |
| 111 | |
| 112 | def pix2vecscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2vec().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2vec().(nside), ipixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2vec().(ipix), nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2vec().(nest)=False): |
| 113 | """Drop-in replacement for healpy `~healpy.pixelfunc.pix2vec`.""" |
| 114 | return healpix_to_xyzscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/healpix_to_xyz().(ipixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2vec().(ipix), nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2vec().(nside), orderscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/healpix_to_xyz().(order)='nested' if nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2vec().(nest) else 'ring') |
| 115 | |
| 116 | |
| 117 | def vec2pixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2pix().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2pix().(nside), xscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2pix().(x), yscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2pix().(y), zscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2pix().(z), nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2pix().(nest)=False): |
| 118 | """Drop-in replacement for healpy `~healpy.pixelfunc.vec2pix`.""" |
| 119 | return xyz_to_healpixscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/xyz_to_healpix().(xscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2pix().(x), yscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2pix().(y), zscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2pix().(z), nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2pix().(nside), orderscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/xyz_to_healpix().(order)='nested' if nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2pix().(nest) else 'ring') |
| 120 | |
| 121 | |
| 122 | def nest2ringscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nest2ring().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nest2ring().(nside), ipixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nest2ring().(ipix)): |
| 123 | """Drop-in replacement for healpy `~healpy.pixelfunc.nest2ring`.""" |
| 124 | ipixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nest2ring().(ipix) = np.atleast_1dscip-python python numpy 2.4.6 `numpy._core.shape_base`/atleast_1d().(ipixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nest2ring().(ipix)).astype(np.int64, copy=_NUMPY_COPY_IF_NEEDEDscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/_NUMPY_COPY_IF_NEEDED.) |
| 125 | return nested_to_ringscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/nested_to_ring().(ipixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nest2ring().(ipix), nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/nest2ring().(nside)) |
| 126 | |
| 127 | |
| 128 | def ring2nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ring2nest().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ring2nest().(nside), ipixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ring2nest().(ipix)): |
| 129 | """Drop-in replacement for healpy `~healpy.pixelfunc.ring2nest`.""" |
| 130 | ipixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ring2nest().(ipix) = np.atleast_1dscip-python python numpy 2.4.6 `numpy._core.shape_base`/atleast_1d().(ipixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ring2nest().(ipix)).astype(np.int64, copy=_NUMPY_COPY_IF_NEEDEDscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/_NUMPY_COPY_IF_NEEDED.) |
| 131 | return ring_to_nestedscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/ring_to_nested().(ipixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ring2nest().(ipix), nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ring2nest().(nside)) |
| 132 | |
| 133 | |
| 134 | def boundariesscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/boundaries().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/boundaries().(nside), pixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/boundaries().(pix), stepscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/boundaries().(step)=1, nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/boundaries().(nest)=False): |
| 135 | """Drop-in replacement for healpy `~healpy.boundaries`.""" |
| 136 | pixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/boundaries().(pix) = np.asarrayscip-python python numpy 2.4.6 `numpy._core.multiarray`/asarray().(pixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/boundaries().(pix)) |
| 137 | if pixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/boundaries().(pix).ndim > 1: |
| 138 | # For consistency with healpy we only support scalars or 1D arrays |
| 139 | raise ValueErrorscip-python python python-stdlib 3.11 builtins/ValueError#("Array has to be one dimensional") |
| 140 | lon, lat = boundaries_lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/boundaries_lonlat().(pixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/boundaries().(pix), stepscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/boundaries().(step), nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/boundaries().(nside), orderscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/boundaries_lonlat().(order)='nested' if nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/boundaries().(nest) else 'ring') |
| 141 | rep_sph = UnitSphericalRepresentation(lon, lat) |
| 142 | rep_car = rep_sph.to_cartesian().xyz.value.swapaxes(0, 1) |
| 143 | if rep_car.shape[0] == 1: |
| 144 | return rep_car[0] |
| 145 | else: |
| 146 | return rep_car |
| 147 | |
| 148 | |
| 149 | def vec2angscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2ang().(vectorsscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2ang().(vectors), lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2ang().(lonlat)=False): |
| 150 | """Drop-in replacement for healpy `~healpy.pixelfunc.vec2ang`.""" |
| 151 | x, y, z = vectorsscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2ang().(vectors).transpose() |
| 152 | rep_car = CartesianRepresentation(x, y, z) |
| 153 | rep_sph = rep_car.represent_as(UnitSphericalRepresentation) |
| 154 | return _lonlat_to_healpyscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(rep_sph.lon.ravel(), rep_sph.lat.ravel(), lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_lonlat_to_healpy().(lonlat)=lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/vec2ang().(lonlat)) |
| 155 | |
| 156 | |
| 157 | def ang2vecscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2vec().(thetascip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2vec().(theta), phiscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2vec().(phi), lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2vec().(lonlat)=False): |
| 158 | """Drop-in replacement for healpy `~healpy.pixelfunc.ang2vec`.""" |
| 159 | lon, lat = _healpy_to_lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(thetascip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2vec().(theta), phiscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2vec().(phi), lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(lonlat)=lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/ang2vec().(lonlat)) |
| 160 | rep_sph = UnitSphericalRepresentation(lon, lat) |
| 161 | rep_car = rep_sph.represent_as(CartesianRepresentation) |
| 162 | return rep_car.xyz.value |
| 163 | |
| 164 | |
| 165 | def get_interp_weightsscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(nside), thetascip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(theta), phiscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(phi)=None, nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(nest)=False, lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(lonlat)=False): |
| 166 | """ |
| 167 | Drop-in replacement for healpy `~healpy.pixelfunc.get_interp_weights`. |
| 168 | |
| 169 | Although note that the order of the weights and pixels may differ. |
| 170 | """ |
| 171 | # if phi is not given, theta is interpreted as pixel number |
| 172 | if phiscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(phi) is None: |
| 173 | thetascip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(theta), phiscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(phi) = pix2angscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2ang().(nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(nside), ipixscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2ang().(ipix)=thetascip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(theta), nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/pix2ang().(nest)=nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(nest)) |
| 174 | |
| 175 | lon, lat = _healpy_to_lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(thetascip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(theta), phiscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(phi), lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(lonlat)=lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(lonlat)) |
| 176 | return bilinear_interpolation_weightsscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/bilinear_interpolation_weights().(lon, lat, nsidescip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(nside), orderscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/bilinear_interpolation_weights().(order)='nested' if nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_weights().(nest) else 'ring') |
| 177 | |
| 178 | |
| 179 | def get_interp_valscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_val().(mscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_val().(m), thetascip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_val().(theta), phiscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_val().(phi), nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_val().(nest)=False, lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_val().(lonlat)=False): |
| 180 | """ |
| 181 | Drop-in replacement for healpy `~healpy.pixelfunc.get_interp_val`. |
| 182 | """ |
| 183 | lon, lat = _healpy_to_lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(thetascip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_val().(theta), phiscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_val().(phi), lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/_healpy_to_lonlat().(lonlat)=lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_val().(lonlat)) |
| 184 | return interpolate_bilinear_lonlatscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/interpolate_bilinear_lonlat().(lon, lat, mscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_val().(m), orderscip-python python astropy_healpix 1.1.2 `astropy_healpix.core`/interpolate_bilinear_lonlat().(order)='nested' if nestscip-python python astropy_healpix 1.1.2 `astropy_healpix.healpy`/get_interp_val().(nest) else 'ring') |