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

plot_projection() is unable to plot VDFs where energy bins are equivalent to less than the spacecraft potential #16

Open
harryclewis opened this issue Mar 14, 2024 · 0 comments

Comments

@harryclewis
Copy link

harryclewis commented Mar 14, 2024

The problem seems to come from the vdf_projection function, which is taking the square root of shifted energy bins. When the bins are smaller than the spacecraft potential, they are shifted to negative numbers and the np.sqrt() function is returning nan. The pcolormesh function can't accept nans as bin coordinates, which causes an error in plot_projection.py.

To fix this, I suggest np.sqrt(..., dtype=np.csingle) or np.emath.sqrt(...) on line 348 of vdf_projection.py.

Doing this gives 0 for the "negative" velocity bins, which I believe to be your intention based on the np.real() function on line 349. However, it might not be the perfect solution as it stretches the innermost bin to the center of the polar plot.

If you need an example timestep, use 1475257837.6974614 a.k.a ['2016-09-30T17:50:37.697'].

Running on pyrfu version 2.4.12 but with dependencies installed for 2.4.11 (see my other issue).

Hope this helps.

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

No branches or pull requests

1 participant