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: to_pw ignores geometry specific rules ? #3862

Closed
neutrinoceros opened this issue Mar 28, 2022 · 2 comments · Fixed by #3863
Closed

BUG: to_pw ignores geometry specific rules ? #3862

neutrinoceros opened this issue Mar 28, 2022 · 2 comments · Fixed by #3863

Comments

@neutrinoceros
Copy link
Member

neutrinoceros commented Mar 28, 2022

Bug report

Bug summary
In spherical geometry (and probably other non-cartesian geometries too), creating a plot via ds.slice(...).to_pw produces inconsistent results as compared by the supposedly equivalent plot done with yt.SlicePlot

Code for reproduction

import numpy as np
import yt
from yt.testing import fake_amr_ds

ds = fake_amr_ds(geometry="spherical")
field = ("stream", "Density")

yt.SlicePlot(ds, "phi", field).save("/tmp/method1.png")

slc = ds.slice("phi", np.pi)
plot = slc.to_pw(field)
plot.save("/tmp/method2.png")

Actual outcome

method1
method2

Note how the horizontal axis labels are incorrect in the second case
This was originally discovered and reported by @vdbma

@neutrinoceros neutrinoceros changed the title BUG: to_pw ignore geometry specific rules ? BUG: to_pw ignores geometry specific rules ? Mar 28, 2022
@matthewturk
Copy link
Member

Is this because it calls _setup_plots?

@neutrinoceros
Copy link
Member Author

neutrinoceros commented Mar 28, 2022

No, I think it's because some of the input sanitizing is only done in plot classes. More specifically, I'm thinking of this

if ds.geometry in (
"spherical",
"cylindrical",
"geographic",
"internal_geographic",
"polar",
):
mylog.info("Setting origin='native' for %s geometry.", ds.geometry)
origin = "native"

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