onnela-lab / forest

Forest is a library for analyzing smartphone-based high-throughput digital phenotyping data
https://forest.beiwe.org
BSD 3-Clause "New" or "Revised" License
28 stars 16 forks source link

Oak NotImplementedError: `interp2d` has been removed in SciPy 1.14.0 #210

Closed hackdna closed 1 week ago

hackdna commented 1 year ago

To reproduce

pytest forest/oak/tests

Observed output

Current:

E       NotImplementedError: `interp2d` has been removed in SciPy 1.14.0.
E       
E       For legacy code, nearly bug-for-bug compatible replacements are
E       `RectBivariateSpline` on regular grids, and `bisplrep`/`bisplev` for
E       scattered 2D data.
E       
E       In new code, for regular grids use `RegularGridInterpolator` instead.
E       For scattered data, prefer `LinearNDInterpolator` or
E       `CloughTocher2DInterpolator`.
E       
E       For more details see
E       https://scipy.github.io/devdocs/tutorial/interpolate/interp_transition_guide.html

Original:

forest/oak/tests/test_identify_peaks_in_cwt.py::test_identify_peaks_in_cwt
  /Users/ils475/code/onnelalab/forest/forest/oak/base.py:177: 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`

    ip = interpolate.interp2d(range(coefs.shape[1]), freqs, coefs)

Expected output

no errors or warnings

Reference

https://scipy.github.io/devdocs/tutorial/interpolate/interp_transition_guide.html

hackdna commented 1 week ago

@MStraczkiewicz and @GeorgeEfstathiadis This is causing the test suite to fail now. Could you have a look and provide a fix? https://github.com/onnela-lab/forest/actions/runs/11486693855/job/31969543176