Unable to use Healpix function `ang2pix` in Python with 32-bit floating-point type
The function ducc0.healpix.Healpix_Base.ang2pix
seems to accepts only 64-bit floating point numbers:
import numpy as np
import ducc0.healpix
resol = ducc0.healpix.Healpix_Base(256, "RING")
# Generate random pointings
pointings = np.random.rand(100, 3)
# This works
pixidx = resol.ang2pix(pointings[:, 0:2])
# Convert the pointings to 32-bit numbers
pointings = np.array(pointings, dtype="float32")
# This does *not* work
pixidx = resol.ang2pix(pointings[:, 0:2])
The error is the following:
RuntimeError Traceback (most recent call last)
Input In [13], in <module>
----> 1 resol.ang2pix(pointings[:, 0:2])
RuntimeError:
./src/ducc0/bindings/pybind_utils.h: 51 (pybind11::array_t<T> ducc0::detail_pybind::toPyarr(const pybind11::object&) [with T = double]):
Assertion failure
error during array conversion
Is there the possibility to pass 32-bit arrays to ang2pix
?