Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type handling issue in alm2map #827

Open
mreineck opened this issue Feb 7, 2023 · 0 comments
Open

Type handling issue in alm2map #827

mreineck opened this issue Feb 7, 2023 · 0 comments

Comments

@mreineck
Copy link
Member

mreineck commented Feb 7, 2023

Running the following test causes a TypeError at the last line (with healpy 1.16.2):

import healpy as hp
import numpy as np

alm_dp = np.zeros((10,), dtype=np.complex128)
alm_sp = np.zeros((10,), dtype=np.complex64)

hp.alm2map(alm_dp, nside=1, lmax=3)
hp.alm2map_spin([alm_dp,alm_dp], nside=1, lmax=3, spin=2)
hp.alm2map_spin([alm_sp,alm_sp], nside=1, lmax=3, spin=2)
hp.alm2map(alm_sp, nside=1, lmax=3)
martin@marvin:~/codes/ducc$ python3 bug.py 
Traceback (most recent call last):
  File "/home/martin/codes/ducc/bug.py", line 10, in <module>
    hp.alm2map(alm_sp, nside=1, lmax=3)
  File "/usr/lib/python3/dist-packages/astropy/utils/decorators.py", line 607, in wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/martin/.local/lib/python3.11/site-packages/healpy/sphtfunc.py", line 504, in alm2map
    output = sphtlib._alm2map(
             ^^^^^^^^^^^^^^^^^
TypeError: Type must be Complex for this function

It seems that alm2map_spin can deal with single precision and double precision inputs, but alm2map fails for single precision. I think this must be some kind of oversight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant