Skip to content

Commit

Permalink
Support SciPy 1.14.
Browse files Browse the repository at this point in the history
Fixed the code that was failing in the tests for Scipy 1.14:
- Calls to simpson with more than one positional parameters are invalid
(scipy/scipy#20554).
- Representation of SciPy sparse matrix in doctests has changed
(scipy/scipy#20649).
  - As this change makes tests fail for previous SciPy versions, the
minimum version of SciPy used for tests has been set to 1.14.
  • Loading branch information
vnmabus committed Aug 17, 2024
1 parent 38ecba8 commit 22e4618
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies = [
"rdata",
"scikit-datasets[cran]>=0.2.2",
"scikit-learn>=0.20",
"scipy>=1.6.0, <1.14",
"scipy>=1.6.0",
"typing-extensions",
]

Expand All @@ -64,6 +64,7 @@ test = [
"pytest",
"pytest-env",
"pytest-subtests",
"scipy>=1.14", # Changes in sparse array representation.
]

[project.urls]
Expand Down
9 changes: 6 additions & 3 deletions skfda/_utils/_neighbors_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,12 @@ def kneighbors_graph(
>>> graph = neigh.kneighbors_graph(X[0])
>>> print(graph)
(0, 0) 1.0
(0, 8) 1.0
(0, 1) 1.0
<Compressed Sparse Row sparse matrix of dtype 'float64'
with 3 stored elements and shape (1, 30)>
Coords Values
(0, 0) 1.0
(0, 8) 1.0
(0, 1) 1.0
Notes:
This method wraps the corresponding sklearn routine in the
Expand Down
2 changes: 1 addition & 1 deletion skfda/representation/irregular.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ def integrate(
values_list = np.split(data.values, data.start_indices[1:])
points_list = np.split(data.points, data.start_indices[1:])
return np.array([
scipy.integrate.simpson(y, x, axis=0)
scipy.integrate.simpson(y, x=x, axis=0)
for y, x in zip(values_list, points_list)
])

Expand Down

0 comments on commit 22e4618

Please sign in to comment.