aidancrilly / NeSST

NeSST - Neutron Scattered Spectra Tool, ICF primary and scattered neutron spectroscopy analysis code
MIT License
3 stars 2 forks source link

Use of deprecated interp2d in spectral_model.py #22

Closed shimwell closed 7 months ago

shimwell commented 8 months ago

I'm getting a warning with newer versions of scipy due to the use of interp2d, perhaps this is something to fix as interp2d will be removed in scipy 1.12.0 (released in January).

/home/j/miniforge/envs/openmc-dev/lib/python3.10/site-packages/NeSST/spectral_model.py:280: DeprecationWarning: `interp2d` is deprecated!
  `interp2d` is deprecated in SciPy 1.10 and will be removed in SciPy 1.12.0.

  For legacy code, nearly bug-for-bug compatible replacements are
  `RectBivariateSpline` on regular grids, and `bisplrep`/`bisplev` for
  scattered 2D data.

  In new code, for regular grids use `RegularGridInterpolator` instead.
  For scattered data, prefer `LinearNDInterpolator` or
  `CloughTocher2DInterpolator`.

  For more details see
  `https://gist.github.com/ev-br/8544371b40f414b7eaf3fe6217209bff`

link to scipy docs.

https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.interp2d.html

aidancrilly commented 8 months ago

So I have attempted an update for this in the interp2d_replacement branch.

I also tried to replace interp1d as they are warning that it is considered legacy, but it has an axis functionality which isn't in the new scipy.interpolate functions as far as I can tell.

Will do some proper testing to check it hasn't changed anything, the example notebook looks pretty much unchanged but I'll be more thorough.