Skip to content

get_interp_val is not a drop-in replacement for healpy.get_interp_val #265

@jvavrek

Description

@jvavrek

The docs state

def get_interp_val(m, theta, phi, nest=False, lonlat=False):
    """
    Drop-in replacement for healpy `~healpy.pixelfunc.get_interp_val`.
    """

Here is a MWE showing differences between the two when using phi from -pi to pi:

import numpy as np
import healpy as hpy
from astropy_healpix import healpy as hpx
import matplotlib.pyplot as plt


step_deg = 1

grid_azimuth, grid_polar = np.meshgrid(
    np.deg2rad(np.arange(-180., 180 + 0.1, step_deg)),
    np.deg2rad(np.arange(0.0, 180 + 0.1, step_deg)),
)
polar, azimuth = grid_polar.ravel(), grid_azimuth.ravel()

npix = 192
m = np.arange(npix)

grid_hpx = hpx.get_interp_val(m, polar, azimuth).reshape(*grid_azimuth.shape)
grid_hpy = hpy.get_interp_val(m, polar, azimuth).reshape(*grid_azimuth.shape)

Results:

np.any(np.isnan(grid_hpx)), np.any(np.isnan(grid_hpy))  # (True, False)

Image

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions