Skip to content

Commit 5bf12b0

Browse files
authored
Merge pull request #337 from mrava87/master
Revamped __init__ files
2 parents b9dab0d + 2c8085e commit 5bf12b0

File tree

7 files changed

+369
-126
lines changed

7 files changed

+369
-126
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,12 @@ repos:
1919
hooks:
2020
- id: isort
2121
name: isort (python)
22-
args: ["--profile", "black", "--filter-files", "--line-length=88"]
22+
args:
23+
[
24+
"--profile",
25+
"black",
26+
"--skip",
27+
"__init__.py",
28+
"--filter-files",
29+
"--line-length=88",
30+
]

pylops/__init__.py

Lines changed: 61 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,70 @@
1-
# isort: skip_file
2-
from .LinearOperator import LinearOperator
3-
from .basicoperators import Regression
4-
from .basicoperators import LinearRegression
5-
from .basicoperators import MatrixMult
6-
from .basicoperators import Identity
7-
from .basicoperators import Zero
8-
from .basicoperators import Diagonal
9-
from .basicoperators import Flip
10-
from .basicoperators import Symmetrize
11-
from .basicoperators import Spread
12-
from .basicoperators import Transpose
13-
from .basicoperators import Roll
14-
from .basicoperators import Pad
15-
from .basicoperators import Sum
16-
from .basicoperators import FunctionOperator
17-
from .basicoperators import MemoizeOperator
1+
"""
2+
PyLops
3+
======
184
19-
from .basicoperators import VStack
20-
from .basicoperators import HStack
21-
from .basicoperators import Block
22-
from .basicoperators import BlockDiag
23-
from .basicoperators import Kronecker
24-
from .basicoperators import Real
25-
from .basicoperators import Imag
26-
from .basicoperators import Conj
5+
Linear operators and inverse problems are at the core of many of the most used
6+
algorithms in signal processing, image processing, and remote sensing.
7+
When dealing with small-scale problems, the Python numerical scientific
8+
libraries `numpy <http://www.numpy.org>`_
9+
and `scipy <http://www.scipy.org/scipylib/index.html>`_ allow to perform most
10+
of the underlying matrix operations (e.g., computation of matrix-vector
11+
products and manipulation of matrices) in a simple and expressive way.
2712
28-
from .basicoperators import CausalIntegration
29-
from .basicoperators import FirstDerivative
30-
from .basicoperators import SecondDerivative
31-
from .basicoperators import Laplacian
32-
from .basicoperators import Gradient
33-
from .basicoperators import FirstDirectionalDerivative
34-
from .basicoperators import SecondDirectionalDerivative
35-
from .basicoperators import Restriction
36-
from .basicoperators import Smoothing1D
37-
from .basicoperators import Smoothing2D
13+
Many useful operators, however, do not lend themselves to an explicit matrix
14+
representation when used to solve large-scale problems. PyLops operators,
15+
on the other hand, still represent a matrix and can be treated in a similar
16+
way, but do not rely on the explicit creation of a dense (or sparse) matrix
17+
itself. Conversely, the forward and adjoint operators are represented by small
18+
pieces of codes that mimic the effect of the matrix on a vector or
19+
another matrix.
3820
39-
from .avo.poststack import PoststackLinearModelling
40-
from .avo.prestack import PrestackWaveletModelling, PrestackLinearModelling
21+
Luckily, many iterative methods (e.g. cg, lsqr) do not need to know the
22+
individual entries of a matrix to solve a linear system. Such solvers only
23+
require the computation of forward and adjoint matrix-vector products as
24+
done for any of the PyLops operators.
4125
42-
from .optimization.solver import cg, cgls
43-
from .optimization.leastsquares import NormalEquationsInversion, RegularizedInversion
44-
from .optimization.leastsquares import PreconditionedInversion
45-
from .optimization.sparsity import IRLS, OMP, ISTA, FISTA, SPGL1, SplitBregman
26+
PyLops provides
27+
1. A general construct for creating Linear Operators
28+
2. An extensive set of commonly used linear operators
29+
3. A set of least-squares and sparse solvers for linear operators.
4630
47-
from .utils.seismicevents import makeaxis, linear2d, parabolic2d
48-
from .utils.tapers import hanningtaper, cosinetaper, taper2d, taper3d
49-
from .utils.wavelets import ricker, gaussian
50-
from .utils.utils import Report
51-
from .utils.deps import *
31+
Available subpackages
32+
---------------------
33+
basicoperators
34+
Basic Linear Operators
35+
signalprocessing
36+
Linear Operators for Signal Processing operations
37+
avo
38+
Linear Operators for Seismic Reservoir Characterization
39+
waveeqprocessing
40+
Linear Operators for Wave Equation oriented processing
41+
optimization
42+
Solvers
43+
utils
44+
Utility routines
45+
46+
"""
5247

53-
from . import avo
54-
from . import basicoperators
55-
from . import optimization
56-
from . import signalprocessing
57-
from . import utils
58-
from . import waveeqprocessing
48+
from .LinearOperator import LinearOperator
49+
from .basicoperators import *
50+
51+
from . import (
52+
avo,
53+
basicoperators,
54+
optimization,
55+
signalprocessing,
56+
utils,
57+
waveeqprocessing,
58+
)
59+
from .avo.poststack import *
60+
from .avo.prestack import *
61+
from .optimization.solver import *
62+
from .optimization.leastsquares import *
63+
from .optimization.sparsity import *
64+
from .utils.seismicevents import *
65+
from .utils.tapers import *
66+
from .utils.utils import Report
67+
from .utils.wavelets import *
5968

6069
try:
6170
from .version import version as __version__

pylops/avo/__init__.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,34 @@
1-
# isort: skip_file
1+
"""
2+
AVO Operators
3+
=============
4+
5+
The subpackage avo provides linear operators and applications aimed at
6+
solving various inverse problems in the area of Seismic Reservoir
7+
Characterization.
8+
9+
A list of available operators present in pylops.avo:
10+
11+
AVOLinearModelling AVO modelling.
12+
PoststackLinearModelling Post-stack seismic modelling.
13+
PrestackLinearModelling Pre-stack seismic modelling.
14+
PrestackWaveletModelling Pre-stack modelling operator for wavelet.
15+
16+
and a list of applications:
17+
18+
PoststackInversion Post-stack seismic inversion.
19+
PrestackInversion Pre-stack seismic inversion.
20+
21+
"""
22+
23+
from .poststack import *
24+
from .prestack import *
25+
26+
27+
__all__ = [
28+
"AVOLinearModelling",
29+
"PoststackLinearModelling",
30+
"PrestackWaveletModelling",
31+
"PrestackLinearModelling",
32+
"PoststackInversion",
33+
"PrestackInversion",
34+
]

pylops/basicoperators/__init__.py

Lines changed: 113 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,113 @@
1-
# isort: skip_file
2-
from .FunctionOperator import FunctionOperator
3-
from .MemoizeOperator import MemoizeOperator
4-
from .Regression import Regression
5-
from .LinearRegression import LinearRegression
6-
from .MatrixMult import MatrixMult
7-
from .Diagonal import Diagonal
8-
from .Zero import Zero
9-
from .Identity import Identity
10-
from .Restriction import Restriction
11-
from .Flip import Flip
12-
from .Symmetrize import Symmetrize
13-
from .Spread import Spread
14-
from .Transpose import Transpose
15-
from .Roll import Roll
16-
from .Pad import Pad
17-
from .Sum import Sum
18-
from .Real import Real
19-
from .Imag import Imag
20-
from .Conj import Conj
21-
22-
from .VStack import VStack
23-
from .HStack import HStack
24-
from .Block import Block
25-
from .BlockDiag import BlockDiag
26-
from .Kronecker import Kronecker
27-
28-
from .Smoothing1D import Smoothing1D
29-
from .Smoothing2D import Smoothing2D
30-
31-
from .CausalIntegration import CausalIntegration
32-
from .FirstDerivative import FirstDerivative
33-
from .SecondDerivative import SecondDerivative
34-
from .Laplacian import Laplacian
35-
from .Gradient import Gradient
36-
from .DirectionalDerivative import FirstDirectionalDerivative
37-
from .DirectionalDerivative import SecondDirectionalDerivative
1+
"""
2+
Basic Linear Operators
3+
======================
4+
5+
The subpackage basicoperators extends some of the basic linear algebra
6+
operations provided by numpy providing forward and adjoint functionalities.
7+
8+
A list of operators present in pylops.basicoperators :
9+
10+
MatrixMult Matrix multiplication.
11+
Identity Identity operator.
12+
Zero Zero operator.
13+
Diagonal Diagonal operator.
14+
Transpose Transpose operator.
15+
Flip Flip along an axis.
16+
Roll Roll along an axis.
17+
Pad Pad operator.
18+
Sum Sum operator.
19+
Symmetrize Symmetrize along an axis.
20+
Restriction Restriction (or sampling) operator.
21+
Regression Polynomial regression.
22+
LinearRegression Linear regression.
23+
CausalIntegration Causal integration.
24+
Spread Spread operator.
25+
VStack Vertical stacking.
26+
HStack Horizontal stacking.
27+
Block Block operator.
28+
BlockDiag Block-diagonal operator.
29+
Kronecker Kronecker operator.
30+
Real Real operator.
31+
Imag Imag operator.
32+
Conj Conj operator.
33+
Smoothing1D 1D Smoothing.
34+
Smoothing2D 2D Smoothing.
35+
FirstDerivative First derivative.
36+
SecondDerivative Second derivative.
37+
Laplacian Laplacian.
38+
Gradient Gradient.
39+
FirstDirectionalDerivative First Directional derivative.
40+
SecondDirectionalDerivative Second Directional derivative.
41+
"""
42+
43+
from .FunctionOperator import *
44+
from .MemoizeOperator import *
45+
from .Regression import *
46+
from .LinearRegression import *
47+
from .MatrixMult import *
48+
from .Diagonal import *
49+
from .Zero import *
50+
from .Identity import *
51+
from .Restriction import *
52+
from .Flip import *
53+
from .Symmetrize import *
54+
from .Spread import *
55+
from .Transpose import *
56+
from .Roll import *
57+
from .Pad import *
58+
from .Sum import *
59+
60+
from .VStack import *
61+
from .HStack import *
62+
from .Block import *
63+
from .BlockDiag import *
64+
from .Kronecker import *
65+
from .Real import *
66+
from .Imag import *
67+
from .Conj import *
68+
69+
from .Smoothing1D import *
70+
from .Smoothing2D import *
71+
72+
from .CausalIntegration import *
73+
from .FirstDerivative import *
74+
from .SecondDerivative import *
75+
from .Laplacian import *
76+
from .Gradient import *
77+
from .DirectionalDerivative import *
78+
79+
__all__ = [
80+
"FunctionOperator",
81+
"MemoizeOperator",
82+
"Regression",
83+
"LinearRegression",
84+
"MatrixMult",
85+
"Diagonal",
86+
"Zero",
87+
"Identity",
88+
"Restriction",
89+
"Flip",
90+
"Symmetrize",
91+
"Spread",
92+
"Transpose",
93+
"Roll",
94+
"Pad",
95+
"Sum",
96+
"VStack",
97+
"HStack",
98+
"Block",
99+
"BlockDiag",
100+
"Kronecker",
101+
"Real",
102+
"Imag",
103+
"Conj",
104+
"Smoothing1D",
105+
"Smoothing2D",
106+
"CausalIntegration",
107+
"FirstDerivative",
108+
"SecondDerivative",
109+
"Laplacian",
110+
"Gradient",
111+
"FirstDirectionalDerivative",
112+
"SecondDirectionalDerivative",
113+
]

pylops/optimization/__init__.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,29 @@
1-
# isort: skip_file
1+
"""
2+
Optimization
3+
============
4+
5+
The subpackage optimization provides an extensive set of solvers to be
6+
used with PyLops linear operators.
7+
8+
A list of least-squares solvers in pylops.optimization.solver:
9+
10+
cg Conjugate gradient.
11+
cgls Conjugate gradient least-squares.
12+
lsqr LSQR.
13+
14+
and wrappers for regularized or preconditioned inversion in pylops.optimization.leastsquares:
15+
16+
NormalEquationsInversion Inversion of normal equations.
17+
RegularizedInversion Regularized inversion.
18+
PreconditionedInversion Preconditioned inversion.
19+
20+
and sparsity-promoting solvers in pylops.optimization.sparsity:
21+
22+
IRLS Iteratively reweighted least squares.
23+
OMP Orthogonal Matching Pursuit (OMP).
24+
ISTA Iterative Soft Thresholding Algorithm.
25+
FISTA Fast Iterative Soft Thresholding Algorithm.
26+
SPGL1 Spectral Projected-Gradient for L1 norm.
27+
SplitBregman Split Bregman for mixed L2-L1 norms.
28+
29+
"""

0 commit comments

Comments
 (0)