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
Fix nearest neighbor index errors/Remove SciPy upper limit #2475
Conversation
Thank you for submitting a pull request (PR) to PlasmaPy! ✨ The future of the project depends on contributors like you, so we deeply appreciate it! 🌱 Our contributor guide has information on:
The bottom of this page shows several checks that are run for every PR. Don't worry if something broke! We break stuff all the time. 😺 Click on "Details" to learn why a check didn't pass. Please also feel free to ask for help. We do that all the time as well. 🌸 You can find us in our chat room or weekly community meeting & office hours. Here are some tips:
If this PR is marked as ready for review, someone should stop by to provide a code review and offer suggestions soon. ✅ If you don't get a review within a few days, please feel free to send us a reminder. Please also use SI units within PlasmaPy, except when there is strong justification otherwise or in some examples. We thank you once again! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2475 +/- ##
==========================================
- Coverage 96.93% 96.93% -0.01%
==========================================
Files 104 104
Lines 9165 9163 -2
==========================================
- Hits 8884 8882 -2
Misses 281 281 ☔ View full report in Codecov by Sentry. |
@pheuer wanted me to make sure that we aren't doing multiple interpolations due to the nature of providing a multidimensional array for the data values in the construction of the Here is the relevant code: The underlying type/shape of the provided data values is actually irrelevant until it comes to populating the |
Sounds good, thanks for checking this - once you add a changelog entry I think we can merge this PR |
oops forgot thanks for reminding me |
Thanks @StanczakDominik ! |
Thank you for fixing and reviewing this so quickly! |
An update to SciPy 1.12.0 conducted in #2472 revealed breaking changes made to SciPy's
NearestNDInterpolator
.The problematic lines can be seen here:
PlasmaPy/plasmapy/plasma/grids.py
Lines 1388 to 1398 in d23a9a1
The issue is that SciPy implicitly converts the grid indices (
indgrid
) to floats in the interpolation step. This is problematic because the return from this interpolation is used to index the quantity array:PlasmaPy/plasmapy/plasma/grids.py
Lines 1421 to 1423 in d23a9a1
I propose we move the quantities array directly to the instantiation of the
NearestNDInterpolator
object, as seen in this PR:PlasmaPy/plasmapy/plasma/grids.py
Lines 1388 to 1398 in 8ae3966
Resolves #2474