pygeoinf 1.2.8__tar.gz → 1.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/PKG-INFO +40 -13
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/README.md +35 -9
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/__init__.py +67 -0
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/backus_gilbert.py +0 -2
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/checks/nonlinear_operators.py +1 -1
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/direct_sum.py +0 -2
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/gaussian_measure.py +7 -1
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/linear_forms.py +1 -1
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/linear_operators.py +1 -2
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/nonlinear_forms.py +0 -1
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/nonlinear_operators.py +2 -2
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/symmetric_space/sphere.py +13 -5
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/symmetric_space/symmetric_space.py +1 -1
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pyproject.toml +18 -3
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/LICENSE +0 -0
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/checks/hilbert_space.py +0 -0
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/checks/linear_operators.py +0 -0
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/forward_problem.py +0 -0
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/hilbert_space.py +0 -0
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/inversion.py +0 -0
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/linear_bayesian.py +0 -0
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/linear_optimisation.py +0 -0
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/linear_solvers.py +0 -0
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/nonlinear_optimisation.py +0 -0
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/parallel.py +0 -0
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/random_matrix.py +0 -0
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/symmetric_space/__init__.py +0 -0
- {pygeoinf-1.2.8 → pygeoinf-1.3.0}/pygeoinf/symmetric_space/circle.py +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pygeoinf
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: A package for solving geophysical inference and inverse problems
|
|
5
5
|
License: BSD-3-Clause
|
|
6
|
+
License-File: LICENSE
|
|
6
7
|
Author: David Al-Attar and Dan Heathcote
|
|
7
8
|
Requires-Python: >=3.11
|
|
8
9
|
Classifier: License :: OSI Approved :: BSD License
|
|
@@ -10,12 +11,12 @@ Classifier: Programming Language :: Python :: 3
|
|
|
10
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
12
13
|
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
-
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Provides-Extra: sphere
|
|
14
16
|
Requires-Dist: joblib (>=1.5.2,<2.0.0)
|
|
15
17
|
Requires-Dist: matplotlib (>=3.0.0)
|
|
16
18
|
Requires-Dist: numpy (>=1.26.0)
|
|
17
19
|
Requires-Dist: pyqt6 (>=6.0.0)
|
|
18
|
-
Requires-Dist: pyshtools (>=4.0.0)
|
|
19
20
|
Requires-Dist: scipy (>=1.16.1)
|
|
20
21
|
Description-Content-Type: text/markdown
|
|
21
22
|
|
|
@@ -47,16 +48,31 @@ The library is built on a few key concepts:
|
|
|
47
48
|
* **Optimisation Methods**: Includes Tikhonov-regularized least-squares and minimum-norm solutions.
|
|
48
49
|
* **Probabilistic Modelling**: Define priors and noise models using `GaussianMeasure` objects on abstract spaces.
|
|
49
50
|
* **Randomized Algorithms**: Utilizes randomized SVD and Cholesky decompositions for efficient low-rank approximations of large operators.
|
|
51
|
+
* **Specialized Operator Variants**: Efficient implementations for `DiagonalSparseMatrixLinearOperator` and `NormalSumOperator`.
|
|
50
52
|
* **Application-Specific Spaces**: Provides concrete `HilbertSpace` implementations for functions on a **line**, **circle**, and the **two-sphere**.
|
|
51
53
|
* **High-Quality Visualisation**: Built-in plotting methods for functions on symmetric spaces, including map projections via `cartopy`.
|
|
52
54
|
|
|
55
|
+
## Advanced Features
|
|
56
|
+
|
|
57
|
+
* **Block Operators**: Construct complex operators from smaller components using `BlockLinearOperator`, `ColumnLinearOperator`, and `RowLinearOperator`. This is ideal for coupled inverse problems.
|
|
58
|
+
* **Parallelisation**: Many expensive operations are parallelized with `joblib`, including dense matrix construction and randomized algorithms.
|
|
59
|
+
|
|
53
60
|
## Installation
|
|
54
61
|
|
|
55
|
-
The package can be installed directly using pip
|
|
62
|
+
The package can be installed directly using pip. By default, this will perform a minimal installation.
|
|
56
63
|
|
|
57
64
|
```bash
|
|
65
|
+
# Minimal installation
|
|
58
66
|
pip install pygeoinf
|
|
59
67
|
```
|
|
68
|
+
|
|
69
|
+
To include the functionality for functions on the sphere, you can install the `sphere` extra. This provides support for `pyshtools` and `Cartopy`.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Installation with sphere-related features
|
|
73
|
+
pip install pygeoinf[sphere]
|
|
74
|
+
```
|
|
75
|
+
|
|
60
76
|
For development, you can clone the repository and install using Poetry:
|
|
61
77
|
|
|
62
78
|
```bash
|
|
@@ -64,6 +80,7 @@ git clone https://github.com/da380/pygeoinf.git
|
|
|
64
80
|
cd pygeoinf
|
|
65
81
|
poetry install
|
|
66
82
|
```
|
|
83
|
+
|
|
67
84
|
You can install all optional dependencies for development—including tools for running the test suite,
|
|
68
85
|
building the documentation, and running the Jupyter tutorials—by using the ```--with``` flag and specifying the ```dev``` group.
|
|
69
86
|
|
|
@@ -233,20 +250,30 @@ The output of the above script will look similar to the following figure:
|
|
|
233
250
|
* NumPy
|
|
234
251
|
* SciPy
|
|
235
252
|
* Matplotlib
|
|
236
|
-
*
|
|
237
|
-
* Cartopy (for plotting in `sphere.py`)
|
|
253
|
+
* joblib
|
|
238
254
|
|
|
239
|
-
|
|
255
|
+
### Optional (`sphere`)
|
|
256
|
+
|
|
257
|
+
* pyshtools
|
|
258
|
+
* Cartopy
|
|
259
|
+
|
|
260
|
+
## Recent Updates
|
|
261
|
+
|
|
262
|
+
`pygeoinf` is under active development, and recent updates have expanded its capabilities to address a broader range of geophysical problems. Key improvements include:
|
|
240
263
|
|
|
241
|
-
|
|
264
|
+
* **Non-Linear Inverse Problems**: The library now supports non-linear inverse problems through the `NonLinearOperator` and `NonLinearForm` classes. This allows you to define and solve problems where the relationship between model parameters and data is non-linear. The framework includes support for Fréchet derivatives, enabling the use of gradient-based optimisation methods.
|
|
242
265
|
|
|
243
|
-
* **
|
|
266
|
+
* **Advanced Optimisation Algorithms**: To complement the non-linear framework, `pygeoinf` now includes a suite of optimisation algorithms. You can use the custom `GradientDescent` solver or leverage the power of SciPy's optimization library with methods like 'BFGS', 'L-BFGS-B', and 'Newton-CG'. Derivative-free methods such as 'Powell' and 'Nelder-Mead' are also supported for problems where gradients are unavailable.
|
|
267
|
+
|
|
268
|
+
* **Backus-Gilbert Methods**: The foundations for the Backus-Gilbert method have been implemented. While this feature is still evolving, the core components are in place for you to begin exploring this powerful inference technique.
|
|
269
|
+
|
|
270
|
+
## Future Plans
|
|
244
271
|
|
|
245
|
-
|
|
272
|
+
Future development will focus on the following areas:
|
|
246
273
|
|
|
247
|
-
* **Non-linear Bayesian Inference**:
|
|
274
|
+
* **Non-linear Bayesian Inference**: We plan to develop methods for non-linear Bayesian problems, including techniques for linearizing the problem around the maximum a posteriori (MAP) solution to estimate posterior uncertainty. This will also involve constructing efficient proposal distributions for Markov chain Monte Carlo (MCMC) sampling methods.
|
|
248
275
|
|
|
249
|
-
* **New Geophysical Hilbert Spaces**:
|
|
276
|
+
* **New Geophysical Hilbert Spaces**: We will be adding more `HilbertSpace` implementations for specific geophysical applications. A key focus will be on creating spaces for functions defined within a **spherical annulus** (spherical shell), which is crucial for problems in global seismology and mantle tomography.
|
|
250
277
|
|
|
251
278
|
|
|
252
279
|
## Contributing
|
|
@@ -26,16 +26,31 @@ The library is built on a few key concepts:
|
|
|
26
26
|
* **Optimisation Methods**: Includes Tikhonov-regularized least-squares and minimum-norm solutions.
|
|
27
27
|
* **Probabilistic Modelling**: Define priors and noise models using `GaussianMeasure` objects on abstract spaces.
|
|
28
28
|
* **Randomized Algorithms**: Utilizes randomized SVD and Cholesky decompositions for efficient low-rank approximations of large operators.
|
|
29
|
+
* **Specialized Operator Variants**: Efficient implementations for `DiagonalSparseMatrixLinearOperator` and `NormalSumOperator`.
|
|
29
30
|
* **Application-Specific Spaces**: Provides concrete `HilbertSpace` implementations for functions on a **line**, **circle**, and the **two-sphere**.
|
|
30
31
|
* **High-Quality Visualisation**: Built-in plotting methods for functions on symmetric spaces, including map projections via `cartopy`.
|
|
31
32
|
|
|
33
|
+
## Advanced Features
|
|
34
|
+
|
|
35
|
+
* **Block Operators**: Construct complex operators from smaller components using `BlockLinearOperator`, `ColumnLinearOperator`, and `RowLinearOperator`. This is ideal for coupled inverse problems.
|
|
36
|
+
* **Parallelisation**: Many expensive operations are parallelized with `joblib`, including dense matrix construction and randomized algorithms.
|
|
37
|
+
|
|
32
38
|
## Installation
|
|
33
39
|
|
|
34
|
-
The package can be installed directly using pip
|
|
40
|
+
The package can be installed directly using pip. By default, this will perform a minimal installation.
|
|
35
41
|
|
|
36
42
|
```bash
|
|
43
|
+
# Minimal installation
|
|
37
44
|
pip install pygeoinf
|
|
38
45
|
```
|
|
46
|
+
|
|
47
|
+
To include the functionality for functions on the sphere, you can install the `sphere` extra. This provides support for `pyshtools` and `Cartopy`.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Installation with sphere-related features
|
|
51
|
+
pip install pygeoinf[sphere]
|
|
52
|
+
```
|
|
53
|
+
|
|
39
54
|
For development, you can clone the repository and install using Poetry:
|
|
40
55
|
|
|
41
56
|
```bash
|
|
@@ -43,6 +58,7 @@ git clone https://github.com/da380/pygeoinf.git
|
|
|
43
58
|
cd pygeoinf
|
|
44
59
|
poetry install
|
|
45
60
|
```
|
|
61
|
+
|
|
46
62
|
You can install all optional dependencies for development—including tools for running the test suite,
|
|
47
63
|
building the documentation, and running the Jupyter tutorials—by using the ```--with``` flag and specifying the ```dev``` group.
|
|
48
64
|
|
|
@@ -212,20 +228,30 @@ The output of the above script will look similar to the following figure:
|
|
|
212
228
|
* NumPy
|
|
213
229
|
* SciPy
|
|
214
230
|
* Matplotlib
|
|
215
|
-
*
|
|
216
|
-
* Cartopy (for plotting in `sphere.py`)
|
|
231
|
+
* joblib
|
|
217
232
|
|
|
218
|
-
|
|
233
|
+
### Optional (`sphere`)
|
|
234
|
+
|
|
235
|
+
* pyshtools
|
|
236
|
+
* Cartopy
|
|
237
|
+
|
|
238
|
+
## Recent Updates
|
|
239
|
+
|
|
240
|
+
`pygeoinf` is under active development, and recent updates have expanded its capabilities to address a broader range of geophysical problems. Key improvements include:
|
|
219
241
|
|
|
220
|
-
|
|
242
|
+
* **Non-Linear Inverse Problems**: The library now supports non-linear inverse problems through the `NonLinearOperator` and `NonLinearForm` classes. This allows you to define and solve problems where the relationship between model parameters and data is non-linear. The framework includes support for Fréchet derivatives, enabling the use of gradient-based optimisation methods.
|
|
221
243
|
|
|
222
|
-
* **
|
|
244
|
+
* **Advanced Optimisation Algorithms**: To complement the non-linear framework, `pygeoinf` now includes a suite of optimisation algorithms. You can use the custom `GradientDescent` solver or leverage the power of SciPy's optimization library with methods like 'BFGS', 'L-BFGS-B', and 'Newton-CG'. Derivative-free methods such as 'Powell' and 'Nelder-Mead' are also supported for problems where gradients are unavailable.
|
|
245
|
+
|
|
246
|
+
* **Backus-Gilbert Methods**: The foundations for the Backus-Gilbert method have been implemented. While this feature is still evolving, the core components are in place for you to begin exploring this powerful inference technique.
|
|
247
|
+
|
|
248
|
+
## Future Plans
|
|
223
249
|
|
|
224
|
-
|
|
250
|
+
Future development will focus on the following areas:
|
|
225
251
|
|
|
226
|
-
* **Non-linear Bayesian Inference**:
|
|
252
|
+
* **Non-linear Bayesian Inference**: We plan to develop methods for non-linear Bayesian problems, including techniques for linearizing the problem around the maximum a posteriori (MAP) solution to estimate posterior uncertainty. This will also involve constructing efficient proposal distributions for Markov chain Monte Carlo (MCMC) sampling methods.
|
|
227
253
|
|
|
228
|
-
* **New Geophysical Hilbert Spaces**:
|
|
254
|
+
* **New Geophysical Hilbert Spaces**: We will be adding more `HilbertSpace` implementations for specific geophysical applications. A key focus will be on creating spaces for functions defined within a **spherical annulus** (spherical shell), which is crucial for problems in global seismology and mantle tomography.
|
|
229
255
|
|
|
230
256
|
|
|
231
257
|
## Contributing
|
|
@@ -85,3 +85,70 @@ from .backus_gilbert import HyperEllipsoid
|
|
|
85
85
|
from .nonlinear_optimisation import (
|
|
86
86
|
ScipyUnconstrainedOptimiser,
|
|
87
87
|
)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
__all__ = [
|
|
91
|
+
# random_matrix
|
|
92
|
+
"fixed_rank_random_range",
|
|
93
|
+
"variable_rank_random_range",
|
|
94
|
+
"random_range",
|
|
95
|
+
"random_svd",
|
|
96
|
+
"random_eig",
|
|
97
|
+
"random_cholesky",
|
|
98
|
+
"random_diagonal",
|
|
99
|
+
# hilbert_space
|
|
100
|
+
"HilbertSpace",
|
|
101
|
+
"DualHilbertSpace",
|
|
102
|
+
"EuclideanSpace",
|
|
103
|
+
"HilbertModule",
|
|
104
|
+
"MassWeightedHilbertSpace",
|
|
105
|
+
"MassWeightedHilbertModule",
|
|
106
|
+
# nonlinear_forms
|
|
107
|
+
"NonLinearForm",
|
|
108
|
+
# linear_forms
|
|
109
|
+
"LinearForm",
|
|
110
|
+
# nonlinear_operators
|
|
111
|
+
"NonLinearOperator",
|
|
112
|
+
# linear_operators
|
|
113
|
+
"LinearOperator",
|
|
114
|
+
"MatrixLinearOperator",
|
|
115
|
+
"DenseMatrixLinearOperator",
|
|
116
|
+
"SparseMatrixLinearOperator",
|
|
117
|
+
"DiagonalSparseMatrixLinearOperator",
|
|
118
|
+
"NormalSumOperator",
|
|
119
|
+
# gaussian_measure
|
|
120
|
+
"GaussianMeasure",
|
|
121
|
+
# direct_sum
|
|
122
|
+
"HilbertSpaceDirectSum",
|
|
123
|
+
"BlockStructure",
|
|
124
|
+
"BlockLinearOperator",
|
|
125
|
+
"ColumnLinearOperator",
|
|
126
|
+
"RowLinearOperator",
|
|
127
|
+
"BlockDiagonalLinearOperator",
|
|
128
|
+
# linear_solvers
|
|
129
|
+
"LinearSolver",
|
|
130
|
+
"DirectLinearSolver",
|
|
131
|
+
"LUSolver",
|
|
132
|
+
"CholeskySolver",
|
|
133
|
+
"EigenSolver",
|
|
134
|
+
"IterativeLinearSolver",
|
|
135
|
+
"ScipyIterativeSolver",
|
|
136
|
+
"CGMatrixSolver",
|
|
137
|
+
"BICGMatrixSolver",
|
|
138
|
+
"BICGStabMatrixSolver",
|
|
139
|
+
"GMRESMatrixSolver",
|
|
140
|
+
"CGSolver",
|
|
141
|
+
# forward_problem
|
|
142
|
+
"ForwardProblem",
|
|
143
|
+
"LinearForwardProblem",
|
|
144
|
+
# linear_optimisation
|
|
145
|
+
"LinearLeastSquaresInversion",
|
|
146
|
+
"LinearMinimumNormInversion",
|
|
147
|
+
# linear_bayesian
|
|
148
|
+
"LinearBayesianInversion",
|
|
149
|
+
"LinearBayesianInference",
|
|
150
|
+
# backus_gilbert
|
|
151
|
+
"HyperEllipsoid",
|
|
152
|
+
# nonlinear_optimisation
|
|
153
|
+
"ScipyUnconstrainedOptimiser",
|
|
154
|
+
]
|
|
@@ -8,8 +8,6 @@ from .hilbert_space import HilbertSpace, Vector
|
|
|
8
8
|
from .linear_operators import LinearOperator
|
|
9
9
|
from .nonlinear_forms import NonLinearForm
|
|
10
10
|
|
|
11
|
-
from .forward_problem import LinearForwardProblem
|
|
12
|
-
from .inversion import LinearInference
|
|
13
11
|
|
|
14
12
|
|
|
15
13
|
class HyperEllipsoid:
|
|
@@ -26,12 +26,10 @@ from abc import ABC, abstractmethod
|
|
|
26
26
|
from typing import List, Any
|
|
27
27
|
import numpy as np
|
|
28
28
|
from scipy.linalg import block_diag
|
|
29
|
-
from joblib import Parallel, delayed
|
|
30
29
|
|
|
31
30
|
from .hilbert_space import HilbertSpace
|
|
32
31
|
from .linear_operators import LinearOperator
|
|
33
32
|
from .linear_forms import LinearForm
|
|
34
|
-
from .parallel import parallel_compute_dense_matrix_from_scipy_op
|
|
35
33
|
|
|
36
34
|
|
|
37
35
|
class HilbertSpaceDirectSum(HilbertSpace):
|
|
@@ -20,7 +20,7 @@ Key Features
|
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
22
|
from __future__ import annotations
|
|
23
|
-
from typing import Callable, Optional, Any, List,
|
|
23
|
+
from typing import Callable, Optional, Any, List, TYPE_CHECKING
|
|
24
24
|
|
|
25
25
|
import numpy as np
|
|
26
26
|
from scipy.linalg import eigh
|
|
@@ -40,6 +40,12 @@ from .direct_sum import (
|
|
|
40
40
|
)
|
|
41
41
|
|
|
42
42
|
|
|
43
|
+
# This block is only processed by type checkers, not at runtime.
|
|
44
|
+
if TYPE_CHECKING:
|
|
45
|
+
from .hilbert_space import HilbertSpace
|
|
46
|
+
from .typing import Vector
|
|
47
|
+
|
|
48
|
+
|
|
43
49
|
class GaussianMeasure:
|
|
44
50
|
"""
|
|
45
51
|
Represents a Gaussian measure on a Hilbert space.
|
|
@@ -18,7 +18,7 @@ from .nonlinear_forms import NonLinearForm
|
|
|
18
18
|
|
|
19
19
|
# This block only runs for type checkers, not at runtime
|
|
20
20
|
if TYPE_CHECKING:
|
|
21
|
-
from .hilbert_space import HilbertSpace,
|
|
21
|
+
from .hilbert_space import HilbertSpace, Vector
|
|
22
22
|
from .linear_operators import LinearOperator
|
|
23
23
|
|
|
24
24
|
|
|
@@ -25,7 +25,6 @@ from collections import defaultdict
|
|
|
25
25
|
import numpy as np
|
|
26
26
|
import scipy.sparse as sp
|
|
27
27
|
from scipy.sparse.linalg import LinearOperator as ScipyLinOp
|
|
28
|
-
from scipy.sparse import diags
|
|
29
28
|
|
|
30
29
|
|
|
31
30
|
from joblib import Parallel, delayed
|
|
@@ -46,7 +45,7 @@ from .checks.linear_operators import LinearOperatorAxiomChecks
|
|
|
46
45
|
|
|
47
46
|
# This block only runs for type checkers, not at runtime
|
|
48
47
|
if TYPE_CHECKING:
|
|
49
|
-
from .hilbert_space import HilbertSpace
|
|
48
|
+
from .hilbert_space import HilbertSpace
|
|
50
49
|
from .linear_forms import LinearForm
|
|
51
50
|
|
|
52
51
|
|
|
@@ -8,7 +8,7 @@ algebraic operations and an interface for the Frécher derivative.
|
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
from __future__ import annotations
|
|
11
|
-
from typing import Callable,
|
|
11
|
+
from typing import Callable, Any, TYPE_CHECKING
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
from .checks.nonlinear_operators import NonLinearOperatorAxiomChecks
|
|
@@ -16,7 +16,7 @@ from .checks.nonlinear_operators import NonLinearOperatorAxiomChecks
|
|
|
16
16
|
|
|
17
17
|
# This block only runs for type checkers, not at runtime
|
|
18
18
|
if TYPE_CHECKING:
|
|
19
|
-
from .hilbert_space import HilbertSpace,
|
|
19
|
+
from .hilbert_space import HilbertSpace, Vector
|
|
20
20
|
from .linear_operators import LinearOperator
|
|
21
21
|
|
|
22
22
|
|
|
@@ -29,10 +29,16 @@ import matplotlib.ticker as mticker
|
|
|
29
29
|
import numpy as np
|
|
30
30
|
from scipy.sparse import diags, coo_array
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
import
|
|
34
|
-
import cartopy.
|
|
35
|
-
|
|
32
|
+
try:
|
|
33
|
+
import pyshtools as sh
|
|
34
|
+
import cartopy.crs as ccrs
|
|
35
|
+
import cartopy.feature as cfeature
|
|
36
|
+
from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter
|
|
37
|
+
except ImportError:
|
|
38
|
+
raise ImportError(
|
|
39
|
+
"pyshtools and cartopy are required for the sphere module. "
|
|
40
|
+
"Please install them with 'pip install pygeoinf[sphere]'"
|
|
41
|
+
)
|
|
36
42
|
|
|
37
43
|
from pygeoinf.hilbert_space import (
|
|
38
44
|
HilbertModule,
|
|
@@ -599,7 +605,9 @@ class Sobolev(SphereHelper, MassWeightedHilbertModule, AbstractInvariantSobolevS
|
|
|
599
605
|
summation = 1.0
|
|
600
606
|
l = 0
|
|
601
607
|
err = 1.0
|
|
602
|
-
|
|
608
|
+
|
|
609
|
+
def sobolev_func(deg):
|
|
610
|
+
return (1.0 + scale**2 * deg * (deg + 1)) ** order
|
|
603
611
|
|
|
604
612
|
while err > rtol:
|
|
605
613
|
l += 1
|
|
@@ -35,7 +35,7 @@ from typing import Callable, Any, List
|
|
|
35
35
|
import numpy as np
|
|
36
36
|
from scipy.sparse import diags
|
|
37
37
|
|
|
38
|
-
from pygeoinf.hilbert_space import EuclideanSpace
|
|
38
|
+
from pygeoinf.hilbert_space import EuclideanSpace
|
|
39
39
|
from pygeoinf.linear_operators import LinearOperator
|
|
40
40
|
from pygeoinf.linear_forms import LinearForm
|
|
41
41
|
from pygeoinf.gaussian_measure import GaussianMeasure
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pygeoinf"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.3.0"
|
|
4
4
|
description = "A package for solving geophysical inference and inverse problems"
|
|
5
5
|
authors = ["David Al-Attar and Dan Heathcote"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -10,12 +10,12 @@ license = "BSD-3-Clause"
|
|
|
10
10
|
python = ">=3.11"
|
|
11
11
|
numpy = ">=1.26.0"
|
|
12
12
|
scipy = ">=1.16.1"
|
|
13
|
-
pyshtools = ">=4.0.0"
|
|
14
13
|
matplotlib = ">=3.0.0"
|
|
15
14
|
pyqt6 = ">=6.0.0"
|
|
16
|
-
Cartopy = "^0.23.0"
|
|
17
15
|
joblib = "^1.5.2"
|
|
18
16
|
|
|
17
|
+
[tool.poetry.extras]
|
|
18
|
+
sphere = ["pyshtools", "Cartopy"]
|
|
19
19
|
|
|
20
20
|
[tool.poetry.group.dev]
|
|
21
21
|
optional = true
|
|
@@ -28,7 +28,22 @@ jupyter = "^1.1.1"
|
|
|
28
28
|
furo = "^2025.7.19"
|
|
29
29
|
sphinx = "<8.2"
|
|
30
30
|
nbsphinx = "^0.9.7"
|
|
31
|
+
pyshtools = ">=4.0.0"
|
|
32
|
+
Cartopy = "^0.23.0"
|
|
33
|
+
ruff = "^0.5.5"
|
|
31
34
|
|
|
32
35
|
[build-system]
|
|
33
36
|
requires = ["poetry-core"]
|
|
34
37
|
build-backend = "poetry.core.masonry.api"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# --- Added Ruff Configuration ---
|
|
41
|
+
[tool.ruff]
|
|
42
|
+
|
|
43
|
+
[tool.ruff.lint.per-file-ignores]
|
|
44
|
+
# For any file in the "tests/" directory, ignore the lambda assignment warning (E731).
|
|
45
|
+
"tests/*" = ["E731", "E741"]
|
|
46
|
+
|
|
47
|
+
# For the sphere.py file, where 'l' is a common variable name for spherical
|
|
48
|
+
# harmonic degree, ignore the ambiguous variable name warning (E741).
|
|
49
|
+
"pygeoinf/symmetric_space/sphere.py" = ["E741"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|