Skip to content

Commit

Permalink
Merge pull request #589 from mrava87/patch-scipyv14
Browse files Browse the repository at this point in the history
Patch: scipy v1.11
  • Loading branch information
mrava87 authored Jul 26, 2024
2 parents 8094963 + 3d0b222 commit 869ddc5
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
platform: [ ubuntu-latest, macos-13 ]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11"]

runs-on: ${{ matrix.platform }}
steps:
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
# steps:
# - task: UsePythonVersion@0
# inputs:
# versionSpec: '3.7'
# versionSpec: '3.9'
# architecture: 'x64'
#
# - script: |
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
versionSpec: '3.9'
architecture: 'x64'

- script: |
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
versionSpec: '3.9'
architecture: 'x64'

- script: |
Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The PyLops project strives to create a library that is easy to install in
any environment and has a very limited number of dependencies.
Required dependencies are limited to:

* Python 3.8 or greater
* Python 3.9 or greater
* `NumPy <http://www.numpy.org>`_
* `SciPy <http://www.scipy.org/scipylib/index.html>`_

Expand Down
2 changes: 1 addition & 1 deletion environment-dev-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
- python>=3.6.4
- pip
- numpy>=1.21.0,<2.0.0
- scipy>=1.4.0,<=1.13.0
- scipy>=1.11.0
- pytorch>=1.2.0
- cpuonly
- pyfftw
Expand Down
2 changes: 1 addition & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
- python>=3.6.4
- pip
- numpy>=1.21.0,<2.0.0
- scipy>=1.4.0,<=1.13.0
- scipy>=1.11.0
- pytorch>=1.2.0
- cpuonly
- pyfftw
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
dependencies:
- python>=3.6.4
- numpy>=1.21.0,<2.0.0
- scipy>=1.4.0,<=1.13.0
- scipy>=1.14.0
7 changes: 4 additions & 3 deletions pylops/optimization/cls_leastsquares.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def run(
and cupy `data`, respectively)
.. note::
When user does not supply ``atol``, it is set to "legacy".
When user supplies ``tol`` this is set to ``atol``.
Returns
-------
Expand All @@ -238,8 +238,9 @@ def run(
if x is not None:
self.y_normal = self.y_normal - self.Op_normal.matvec(x)
if engine == "scipy" and self.ncp == np:
if "atol" not in kwargs_solver:
kwargs_solver["atol"] = "legacy"
if "tol" in kwargs_solver:
kwargs_solver["atol"] = kwargs_solver["tol"]
kwargs_solver.pop("tol")
xinv, istop = sp_cg(self.Op_normal, self.y_normal, **kwargs_solver)
elif engine == "pylops" or self.ncp != np:
if show:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ classifiers = [
]
dependencies = [
"numpy >= 1.21.0 , < 2.0.0",
"scipy >= 1.4.0 , <= 1.13.0",
"scipy >= 1.11.0",
]
dynamic = ["version"]

Expand Down
10 changes: 5 additions & 5 deletions pytests/test_leastsquares.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ def test_NormalEquationsInversion(par):

# normal equations with regularization
xinv = normal_equations_inversion(
Gop, y, [Reg], epsI=1e-5, epsRs=[1e-8], x0=x0, **dict(maxiter=200, tol=1e-10)
Gop, y, [Reg], epsI=1e-5, epsRs=[1e-8], x0=x0, **dict(maxiter=200, atol=1e-10)
)[0]
assert_array_almost_equal(x, xinv, decimal=3)
# normal equations with weight
xinv = normal_equations_inversion(
Gop, y, None, Weight=Weigth, epsI=1e-5, x0=x0, **dict(maxiter=200, tol=1e-10)
Gop, y, None, Weight=Weigth, epsI=1e-5, x0=x0, **dict(maxiter=200, atol=1e-10)
)[0]
assert_array_almost_equal(x, xinv, decimal=3)
# normal equations with weight and small regularization
Expand All @@ -110,7 +110,7 @@ def test_NormalEquationsInversion(par):
epsI=1e-5,
epsRs=[1e-8],
x0=x0,
**dict(maxiter=200, tol=1e-10)
**dict(maxiter=200, atol=1e-10)
)[0]
assert_array_almost_equal(x, xinv, decimal=3)
# normal equations with weight and small normal regularization
Expand All @@ -123,7 +123,7 @@ def test_NormalEquationsInversion(par):
epsI=1e-5,
epsNRs=[1e-8],
x0=x0,
**dict(maxiter=200, tol=1e-10)
**dict(maxiter=200, atol=1e-10)
)[0]
assert_array_almost_equal(x, xinv, decimal=3)

Expand Down Expand Up @@ -192,7 +192,7 @@ def test_WeightedInversion(par):
y = Gop * x

xne = normal_equations_inversion(
Gop, y, None, Weight=Weigth, **dict(maxiter=5, tol=1e-10)
Gop, y, None, Weight=Weigth, **dict(maxiter=5, atol=1e-10)
)[0]
xreg = regularized_inversion(
Gop, y, None, Weight=Weigth1, **dict(damp=0, iter_lim=5, show=0)
Expand Down
2 changes: 1 addition & 1 deletion pytests/test_linearoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_sparse(par):
D = np.diag(diag)
Dop = Diagonal(diag, dtype=par["dtype"])
S = Dop.tosparse()
assert_array_equal(S.A, D)
assert_array_equal(S.toarray(), D)


@pytest.mark.parametrize("par", [(par1), (par2), (par1j)])
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
numpy>=1.21.0,<2.0.0
scipy>=1.4.0,<=1.13.0
scipy>=1.11.0
--extra-index-url https://download.pytorch.org/whl/cpu
torch>=1.2.0
numba
Expand Down

0 comments on commit 869ddc5

Please sign in to comment.