-
Notifications
You must be signed in to change notification settings - Fork 279
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
ENH: add support for VelocityCallback and MagFieldCallBack in spherical coordinates #3817
ENH: add support for VelocityCallback and MagFieldCallBack in spherical coordinates #3817
Conversation
54ec49b
to
b068bfd
Compare
b068bfd
to
f553d0a
Compare
While I'm at it, I'll add support for "conic" projections too (theta-normal), illustrated here with a purely azimuthal magnetic field import numpy as np
import yt
from yt.units import G
shape = (32, 128, 128)
a = np.sin(np.linspace(-np.pi / 2, np.pi / 2, 128))
b = np.ones((32, 128, 128))
c = np.zeros((32, 128, 128))
data = {
("gas", "magnetic_field_r"): np.reshape(a * c, shape) * G,
("gas", "magnetic_field_theta"): np.reshape(a * c, shape) * G,
("gas", "magnetic_field_phi"): np.reshape(a * b, shape) * G,
}
ds = yt.load_uniform_grid(
data,
shape,
bbox=np.array([[1, 5], [np.pi / 2 - 0.5, np.pi / 2 + 0.5], [0, +np.pi]]),
geometry="spherical",
)
p = yt.SlicePlot(ds, "theta", "magnetic_field_phi")
p.annotate_magnetic_field()
p.save("/tmp/") image actualized on 2022-08-01 |
9536841
to
68273d6
Compare
Tests exploding everywhere, switching to draft for now. |
68273d6
to
b46569c
Compare
2a709a0
to
c634192
Compare
I think your diagnosis -- the buffer being low-resolution -- is the root cause, but perhaps it can be fixed by more carefully adjusting the arguments to the pixelization routine to query at the specific pixel centers. |
I did not realize it depended on |
How about the proposed fix in #3818 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I need to revisit this. Switching to draft in the mean time. For now I'll just resolve a conflict and add a comment as requested by Matt. |
c634192
to
5ba0e53
Compare
5ba0e53
to
581eb28
Compare
refreshing CI |
581eb28
to
6035e9a
Compare
rebased to resolve conflicts and refresh CI |
c7920e5
to
9b6c9f2
Compare
this is now rebased on top of #4021. I also cleaned up a couple redundant definitions as previously discussed, and fixed a couple outstanding bugs. |
@yt-fido test this please |
9b6c9f2
to
924f4f6
Compare
924f4f6
to
000425a
Compare
@matthewturk can we merge this ? |
PR Summary
minimal demo
image actualized on 2022-08-01
older version
note that the quiver plot is drawn well outside of the actual data domain. I think this effect is due to the current implementation of the pixelizer routine (
pixelize_cylinder
), combined with the "low resolution" buffer associated with the quiver plot for readability. I consider this a bug, but it's out of scope here.Edit: this is solved in #3818