healpy.pixelfunc.get_interp_val

healpy.pixelfunc.get_interp_val(m, theta, phi, nest=False, lonlat=False)

Return the bi-linear interpolation value of map(s) using 4 nearest neighbours.

Parameters:
marray-like, shape (npix,) or (nmaps, npix)

a healpix map or sequence thereof, accepts masked arrays

theta, phifloat, scalar or array-like

angular coordinates of point at which to interpolate the map

nestbool

if True, the is assumed to be in NESTED ordering.

lonlatbool

If True, input angles are assumed to be longitude and latitude in degree, otherwise, they are co-latitude and longitude in radians.

Returns:
valfloat, scalar or array-like

the interpolated value(s), usual numpy broadcasting rules apply.

Examples

>>> import healpy as hp
>>> hp.get_interp_val(np.arange(12.), np.pi/2, 0)
4.0
>>> hp.get_interp_val(np.arange(12.), np.pi/2, np.pi/2)
5.0
>>> hp.get_interp_val(np.arange(12.), np.pi/2, np.pi/2 + 2*np.pi)
5.0
>>> hp.get_interp_val(np.arange(12.), np.linspace(0, np.pi, 10), 0)
array([ 1.5       ,  1.5       ,  1.5       ,  2.20618428,  3.40206143,
        5.31546486,  7.94639458,  9.5       ,  9.5       ,  9.5       ])
>>> hp.get_interp_val(np.arange(12.), 0, np.linspace(90, -90, 10), lonlat=True)
array([ 1.5       ,  1.5       ,  1.5       ,  2.20618428,  3.40206143,
        5.31546486,  7.94639458,  9.5       ,  9.5       ,  9.5       ])
>>> hp.get_interp_val(
...     [np.arange(12.), 2 * np.arange(12.)], np.linspace(0, np.pi, 10), 0
... )
array([[ 1.5       ,  1.5       ,  1.5       ,  2.20618428,  3.40206143,
         5.31546486,  7.94639458,  9.5       ,  9.5       ,  9.5       ],
       [ 3.        ,  3.        ,  3.        ,  4.41236857,  6.80412286,
        10.63092972, 15.89278916, 19.        , 19.        , 19.        ]])