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

Fix deprecated argument in 'scipy.sparse.linalg.cg' #7897

Merged
merged 20 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.9'
- name: cache weekly timestamp
id: pip-cache
run: |
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ itk>=5.2
nibabel
parameterized
scikit-image>=0.19.0
scipy>=1.7.1
scipy>=1.12.0; python_version >= '3.9'
tensorboard
commonmark==0.9.1
recommonmark==0.6.0
Expand Down
10 changes: 5 additions & 5 deletions monai/data/ultrasound_confidence_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
__all__ = ["UltrasoundConfidenceMap"]

cv2, _ = optional_import("cv2")
csc_matrix, _ = optional_import("scipy.sparse", "1.7.1", min_version, "csc_matrix")
spsolve, _ = optional_import("scipy.sparse.linalg", "1.7.1", min_version, "spsolve")
cg, _ = optional_import("scipy.sparse.linalg", "1.7.1", min_version, "cg")
hilbert, _ = optional_import("scipy.signal", "1.7.1", min_version, "hilbert")
csc_matrix, _ = optional_import("scipy.sparse", "1.12.0", min_version, "csc_matrix")
spsolve, _ = optional_import("scipy.sparse.linalg", "1.12.0", min_version, "spsolve")
cg, _ = optional_import("scipy.sparse.linalg", "1.12.0", min_version, "cg")
hilbert, _ = optional_import("scipy.signal", "1.12.0", min_version, "hilbert")
ruge_stuben_solver, _ = optional_import("pyamg", "5.0.0", min_version, "ruge_stuben_solver")


Expand Down Expand Up @@ -285,7 +285,7 @@ def _solve_linear_system(self, lap, rhs):
lap_sparse = lap.tocsr()
ml = ruge_stuben_solver(lap_sparse, coarse_solver="pinv")
m = ml.aspreconditioner(cycle="V")
x, _ = cg(lap, rhs, tol=self.cg_tol, maxiter=self.cg_maxiter, M=m)
x, _ = cg(lap, rhs, rtol=self.cg_tol, maxiter=self.cg_maxiter, M=m)
else:
x = spsolve(lap, rhs)

Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-r requirements-min.txt
pytorch-ignite==0.4.11
gdown>=4.7.3
scipy>=1.7.1
scipy>=1.12.0; python_version >= '3.9'
itk>=5.2
nibabel
pillow!=8.3.0 # https://github.com/python-pillow/Pillow/issues/5571
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ all =
nibabel
ninja
scikit-image>=0.14.2
scipy>=1.7.1
scipy>=1.12.0; python_version >= '3.9'
pillow
tensorboard
gdown>=4.7.3
Expand Down Expand Up @@ -92,7 +92,7 @@ ninja =
skimage =
scikit-image>=0.14.2
scipy =
scipy>=1.7.1
scipy>=1.12.0; python_version >= '3.9'
pillow =
pillow!=8.3.0
tensorboard =
Expand Down
4 changes: 4 additions & 0 deletions tests/test_ultrasound_confidence_map_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

from monai.transforms import UltrasoundConfidenceMapTransform
from tests.utils import assert_allclose
from monai.utils import optional_import

_, has_scipy = optional_import("scipy")

TEST_INPUT = np.array(
[
Expand Down Expand Up @@ -482,6 +485,7 @@
)


@unittest.skipUnless(has_scipy, "Requires scipy")
class TestUltrasoundConfidenceMapTransform(unittest.TestCase):

def setUp(self):
Expand Down
Loading