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: fix FRB integration with CylindricalResolutionBuffer #4790

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

neutrinoceros
Copy link
Member

@neutrinoceros neutrinoceros commented Jan 26, 2024

PR Summary

Fix #4789
This is a proof-of-concept level patch, I want to see how it performs against CI.
I'll need to write the missing bits in _set_radius and add an actual test.

This is currently based atop #4784

PR Checklist

  • New features are documented, with docstrings and narrative docs
  • Adds a test for any bugs fixed. Adds tests for new features.

@neutrinoceros
Copy link
Member Author

I think I need to be reminded what "unitary" units mean

@neutrinoceros neutrinoceros force-pushed the viz/bug/cyl/frb_integration branch 3 times, most recently from 7ee6a51 to d772c64 Compare January 27, 2024 11:24
@neutrinoceros
Copy link
Member Author

@yt-fido test this please

@neutrinoceros neutrinoceros force-pushed the viz/bug/cyl/frb_integration branch 2 times, most recently from 98299b7 to 292f278 Compare January 27, 2024 14:26
@forrestglines
Copy link
Contributor

forrestglines commented Jan 31, 2024

Thanks @neutrinoceros , very much appreciate the work on this.

The FRB's don't quite match what I'd expect. If I run the following code:

import yt
import numpy as np

import matplotlib as mpl
import matplotlib.pyplot as plt

ds = yt.load_sample("bw_polar_2d")

slc = yt.SlicePlot(ds, "z", ("gas", "density"))
frb = slc.data_source.to_frb(width=(4,"cm"),resolution=(512,512),center=(0,0))

minmax = lambda A : (np.nanmin(A).v[()],np.nanmax(A).v[()])

R = frb["r"].in_units("cm")
Theta = frb["theta"].in_units("")
X = R*np.cos(Theta)
Y = R*np.sin(Theta)
rho = frb["density"]

print("R:", minmax(R) )
print("Theta:", minmax(Theta) )
print("X:", minmax(X) )
print("Y:", minmax(Y) )
print("rho:", minmax(rho) )

slc.show()

plt.figure()
plt.imshow(rho)
plt.show()

plt.figure()
plt.hist( np.unique(Theta) )
plt.xlabel("Theta")
plt.ylabel("Counts")
plt.show()

I get this output:

R: (0.51171875, 1.98828125)
Theta: (0.012271846644580364, 6.270913635380566)
X: (-1.9881315382033238, 1.988131540336353)
Y: (-1.9881315392698402, 1.9881315371368034)
rho: (0.21301667392253876, 4.513450622558594)

output0001 dat_Slice_z_density
imshow
hist

Whereas I'd expect imshow to be similar to the slice plot and the histogram to be distributed over [0,2 pi]

@neutrinoceros neutrinoceros marked this pull request as draft January 31, 2024 07:00
@neutrinoceros
Copy link
Member Author

thanks for pointing this out. I'll try to come back to see in a few days. In the meantime any additional feedback is most welcome.

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

Successfully merging this pull request may close these issues.

BUG: defect in polar coordinate handler breaks fixed-resolution buffer
2 participants