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

Print warning if no wcs is provided in write_map #274

Open
zonca opened this issue Oct 16, 2024 · 0 comments
Open

Print warning if no wcs is provided in write_map #274

zonca opened this issue Oct 16, 2024 · 0 comments

Comments

@zonca
Copy link
Member

zonca commented Oct 16, 2024

write_map attaches a default WCS if the input map has no WCS, it might be useful to add a warning (or even an error) if this happens. This can be a source of bugs if a user is not careful (e.g. galsci/pysm#192) @msyriac

Minimal example below:

import pixell.enmap
import numpy as np

shape, wcs = pixell.enmap.fullsky_geometry(
    np.radians(5),
    dims=(3,),
    variant="fejer1",
)

m = pixell.enmap.zeros(shape, wcs)
pixell.enmap.write_map("map_with_wcs.fits", m)
pixell.enmap.write_map("map_no_wcs.fits", np.array(m))

print(pixell.enmap.read_map("map_with_wcs.fits").wcs)
car:{cdelt:[-5,5],crval:[2.5,0],crpix:[36.50,18.50]}

print(pixell.enmap.read_map("map_no_wcs.fits").wcs)
:{cdelt:[1,1],crval:[0,0],crpix:[0.00,0.00]}
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