PyLops API¶
The Application Programming Interface (API) of PyLops can be loosely seen as composed of a stack of three main layers:
- Linear operators: building blocks for the setting up of inverse problems
- Solvers: interfaces to a variety of solvers, providing an easy way to augment an inverse problem with additional regularization and/or preconditioning term
- Applications: high-level interfaces allowing users to easily setup and solve specific problems (while hiding the non-needed details - i.e., creation and setup of linear operators and solvers).
Linear operators¶
Templates¶
LinearOperator ([Op, dtype, shape, dims, …]) |
Common interface for performing matrix-vector products. |
FunctionOperator (f, *args, **kwargs) |
Function Operator. |
MemoizeOperator (Op[, max_neval]) |
Memoize Operator. |
Basic operators¶
MatrixMult (A[, otherdims, dtype, name]) |
Matrix multiplication. |
Identity (N[, M, dtype, inplace, name]) |
Identity operator. |
Zero (N[, M, dtype, name]) |
Zero operator. |
Diagonal (diag[, dims, axis, dtype, name]) |
Diagonal operator. |
Transpose (dims, axes[, dtype, name]) |
Transpose operator. |
Flip (dims[, axis, dtype, name]) |
Flip along an axis. |
Roll (dims[, axis, shift, dtype, name]) |
Roll along an axis. |
Pad (dims, pad[, dtype, name]) |
Pad operator. |
Sum (dims[, axis, dtype, name]) |
Sum operator. |
Symmetrize (dims[, axis, dtype, name]) |
Symmetrize along an axis. |
Restriction (dims, iava[, axis, dtype, …]) |
Restriction (or sampling) operator. |
Regression (taxis, order[, dtype, name]) |
Polynomial regression. |
LinearRegression (taxis[, dtype]) |
Linear regression. |
CausalIntegration (dims[, axis, sampling, …]) |
Causal integration. |
Spread (dims, dimsd[, table, dtable, fh, …]) |
Spread operator. |
VStack (ops[, nproc, dtype]) |
Vertical stacking. |
HStack (ops[, nproc, dtype]) |
Horizontal stacking. |
Block (ops[, nproc, dtype]) |
Block operator. |
BlockDiag (ops[, nproc, dtype]) |
Block-diagonal operator. |
Kronecker (Op1, Op2[, dtype, name]) |
Kronecker operator. |
Real (dims[, dtype, name]) |
Real operator. |
Imag (dims[, dtype, name]) |
Imag operator. |
Conj (dims[, dtype, name]) |
Complex conjugate operator. |
Smoothing and derivatives¶
Smoothing1D (nsmooth, dims[, axis, dtype]) |
1D Smoothing. |
Smoothing2D (nsmooth, dims[, axes, dtype]) |
2D Smoothing. |
FirstDerivative (dims[, axis, sampling, …]) |
First derivative. |
SecondDerivative (dims[, axis, sampling, …]) |
Second derivative. |
Laplacian (dims[, axes, weights, sampling, …]) |
Laplacian. |
Gradient (dims[, sampling, edge, dtype, kind]) |
Gradient. |
FirstDirectionalDerivative (dims, v[, …]) |
First Directional derivative. |
SecondDirectionalDerivative (dims, v[, …]) |
Second Directional derivative. |
Signal processing¶
Convolve1D (dims, h[, offset, axis, dtype, …]) |
1D convolution operator. |
Convolve2D (dims, h[, offset, axes, dtype, …]) |
2D convolution operator. |
ConvolveND (dims, h[, offset, axes, method, …]) |
ND convolution operator. |
Interp (dims, iava[, axis, kind, dtype, name]) |
Interpolation operator. |
Bilinear (iava, dims[, dtype, name]) |
Bilinear interpolation operator. |
FFT (dims[, axis, nfft, sampling, norm, …]) |
One dimensional Fast-Fourier Transform. |
FFT2D (dims[, axes, nffts, sampling, norm, …]) |
Two dimensional Fast-Fourier Transform. |
FFTND (dims[, axes, nffts, sampling, norm, …]) |
N-dimensional Fast-Fourier Transform. |
Shift (dims, shift[, axis, nfft, sampling, …]) |
Shift operator |
DWT (dims[, axis, wavelet, level, dtype, name]) |
One dimensional Wavelet operator. |
DWT2D (dims[, axes, wavelet, level, dtype, name]) |
Two dimensional Wavelet operator. |
Seislet (slopes[, sampling, level, kind, …]) |
Two dimensional Seislet operator. |
Radon2D (taxis, haxis, pxaxis[, kind, …]) |
Two dimensional Radon transform. |
Radon3D (taxis, hyaxis, hxaxis, pyaxis, pxaxis) |
Three dimensional Radon transform. |
ChirpRadon2D (taxis, haxis, pmax[, dtype, name]) |
2D Chirp Radon transform |
ChirpRadon3D (taxis, hyaxis, hxaxis, pmax[, …]) |
3D Chirp Radon transform |
Sliding1D (Op, dim, dimd, nwin, nover[, …]) |
1D Sliding transform operator. |
Sliding2D (Op, dims, dimsd, nwin, nover[, …]) |
2D Sliding transform operator. |
Sliding3D (Op, dims, dimsd, nwin, nover, nop) |
3D Sliding transform operator.w |
Patch2D (Op, dims, dimsd, nwin, nover, nop[, …]) |
2D Patch transform operator. |
Patch3D (Op, dims, dimsd, nwin, nover, nop[, …]) |
3D Patch transform operator. |
Fredholm1 (G[, nz, saveGt, usematmul, dtype, …]) |
Fredholm integral of first kind. |
Wave-Equation processing¶
PressureToVelocity (nt, nr, dt, dr, rho, vel) |
Pressure to Vertical velocity conversion. |
UpDownComposition2D (nt, nr, dt, dr, rho, vel) |
2D Up-down wavefield composition. |
UpDownComposition3D (nt, nr, dt, dr, rho, vel) |
3D Up-down wavefield composition. |
MDC (G, nt, nv[, dt, dr, twosided, …]) |
Multi-dimensional convolution. |
PhaseShift (vel, dz, nt, freq, kx[, ky, …]) |
Phase shift operator |
Demigration (z, x, t, srcs, recs, vel, wav, …) |
Kirchhoff Demigration operator. |
Geophysical subsurface characterization¶
avo.AVOLinearModelling (theta[, vsvp, nt0, …]) |
AVO Linearized modelling. |
poststack.PoststackLinearModelling (wav, nt0) |
Post-stack linearized seismic modelling operator. |
prestack.PrestackLinearModelling (wav, theta) |
Pre-stack linearized seismic modelling operator. |
prestack.PrestackWaveletModelling (m, theta, nwav) |
Pre-stack linearized seismic modelling operator for wavelet. |
Solvers¶
Template¶
Solver (Op[, callbacks]) |
This is a template class which a user must subclass when implementing a new solver. |
Basic¶
CG (Op[, callbacks]) |
Conjugate gradient |
CGLS (Op[, callbacks]) |
Conjugate gradient least squares |
LSQR (Op) |
Solve an overdetermined system of equations given an operator Op and data y using LSQR iterations. |
cg (Op, y[, x0, niter, tol, show, itershow, …]) |
Conjugate gradient |
cgls (Op, y[, x0, niter, damp, tol, show, …]) |
Conjugate gradient least squares |
lsqr (Op, y[, x0, damp, atol, btol, conlim, …]) |
LSQR |
Least-squares¶
NormalEquationsInversion (Op[, callbacks]) |
Inversion of normal equations. |
RegularizedInversion (Op[, callbacks]) |
Regularized inversion. |
PreconditionedInversion (Op[, callbacks]) |
Preconditioned inversion. |
normal_equations_inversion (Op, y, Regs[, …]) |
Inversion of normal equations. |
regularized_inversion (Op, y, Regs[, x0, …]) |
Regularized inversion. |
preconditioned_inversion (Op, y, P[, x0, …]) |
Preconditioned inversion. |
Sparsity¶
IRLS (Op[, callbacks]) |
Iteratively reweighted least squares. |
OMP (Op[, callbacks]) |
Orthogonal Matching Pursuit (OMP). |
ISTA (Op[, callbacks]) |
Iterative Shrinkage-Thresholding Algorithm (ISTA). |
FISTA (Op[, callbacks]) |
Fast Iterative Shrinkage-Thresholding Algorithm (FISTA). |
SPGL1 (Op[, callbacks]) |
Spectral Projected-Gradient for L1 norm. |
SplitBregman (Op[, callbacks]) |
Split Bregman for mixed L2-L1 norms. |
irls (Op, y[, x0, nouter, threshR, epsR, …]) |
Iteratively reweighted least squares. |
omp (Op, y[, niter_outer, niter_inner, …]) |
Orthogonal Matching Pursuit (OMP). |
ista (Op, y[, x0, niter, SOp, eps, alpha, …]) |
Iterative Shrinkage-Thresholding Algorithm (ISTA). |
fista (Op, y[, x0, niter, SOp, eps, alpha, …]) |
Fast Iterative Shrinkage-Thresholding Algorithm (FISTA). |
spgl1 (Op, y[, x0, SOp, tau, sigma, show]) |
Spectral Projected-Gradient for L1 norm. |
splitbregman (Op, y, RegsL1[, x0, …]) |
Split Bregman for mixed L2-L1 norms. |
Applications¶
Wave-Equation processing¶
SeismicInterpolation (data, nrec, iava[, …]) |
Seismic interpolation (or regularization). |
Deghosting (p, nt, nr, dt, dr, vel, zrec[, …]) |
Wavefield deghosting. |
WavefieldDecomposition (p, vz, nt, nr, dt, …) |
Up-down wavefield decomposition. |
MDD (G, d[, dt, dr, nfmax, wav, twosided, …]) |
Multi-dimensional deconvolution. |
Marchenko (R[, dt, nt, dr, nfmax, wav, toff, …]) |
Marchenko redatuming |
LSM (z, x, t, srcs, recs, vel, wav, wavcenter) |
Least-squares Migration (LSM). |
Geophysical subsurface characterization¶
poststack.PoststackInversion (data, wav[, …]) |
Post-stack linearized seismic inversion. |
prestack.PrestackInversion (data, theta, wav) |
Pre-stack linearized seismic inversion. |