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

Fix HEALPix unit conversion at load time #795

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/toast/pixels_io_healpix.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2015-2021 by the parties listed in the AUTHORS file.
# Copyright (c) 2015-2024 by the parties listed in the AUTHORS file.
# All rights reserved. Use of this source code is governed by
# a BSD-style license that can be found in the LICENSE file.

Expand Down Expand Up @@ -77,18 +77,14 @@ def read_healpix_fits(pix, path, nest=True, comm_bytes=10000000):
funits = pix.units
if funits != pix.units:
scale = 1.0 * funits
scale.to(pix.units)
fscale = scale.value
fscale = scale.to_value(pix.units)

if nside_map != nside:
errors += "Wrong NSide: {} has {}, expected {}\n" "".format(
path, nside_map, nside
)
errors += f"Wrong NSide: {path} has {nside_map}, expected {nside}\n"
map_nnz = h[1].header["tfields"]
if map_nnz != pix.n_value:
errors += "Wrong number of columns: {} has {}, expected {}\n" "".format(
path, map_nnz, pix.n_value
)
errors += f"Wrong number of columns: {path} has {map_nnz}, "
errors += f"expected {pix.n_value}\n"
h.close()
if len(errors) != 0:
raise RuntimeError(errors)
Expand Down