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

BUG: radio fits notebook is broken #4238

Closed
neutrinoceros opened this issue Dec 5, 2022 · 2 comments · Fixed by #4239
Closed

BUG: radio fits notebook is broken #4238

neutrinoceros opened this issue Dec 5, 2022 · 2 comments · Fixed by #4239

Comments

@neutrinoceros
Copy link
Member

At least one of the notebooks that uses it in the docs is currently broken for a different reason:
https://yt-project.org/docs/dev/cookbook/fits_radio_cubes.html?highlight=fits%20radio

...
ValueError: Invalid vmin or vmax

Originally posted by @neutrinoceros in #4235 (comment)

@neutrinoceros
Copy link
Member Author

neutrinoceros commented Dec 5, 2022

here's a minimal reproducer for the broken part of the notebook:

import yt

ds = yt.load("grs-50-cube.fits.gz")
prj = yt.ProjectionPlot(
    ds, "z", ("fits", "temperature"), origin="native", weight_field=("index", "ones")
)  # "ones" weights each cell by 1
prj.set_log(("fits", "temperature"), True)

prj.save("/tmp/")

The reason why this crashes is that we're forcing a log norm but the data contains strictly negative values, as can be seen by leaving the default scaling:
grs-50-cube fits gz_Projection_z_temperature_ones

@neutrinoceros
Copy link
Member Author

neutrinoceros commented Dec 5, 2022

A possible fix is to manually set zmin to a strictly positive value first, e.g;

prj.set_zlim(("fits", "temperature"), zmin=(1e-3, "K"))

which yields
grs-50-cube fits gz_Projection_z_temperature_ones

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

Successfully merging a pull request may close this issue.

1 participant