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, explicit]) |
Common interface for performing matrix-vector products. |
FunctionOperator (f, *args, **kwargs) |
Function Operator. |
MemoizeOperator (Op[, max_neval]) |
Memoize Operator. |
Basic operators¶
MatrixMult (A[, dims, dtype]) |
Matrix multiplication. |
Identity (N[, M, dtype, inplace]) |
Identity operator. |
Zero (N[, M, dtype]) |
Zero operator. |
Diagonal (diag[, dims, dir, dtype]) |
Diagonal operator. |
Transpose (dims, axes[, dtype]) |
Transpose operator. |
Flip (N[, dims, dir, dtype]) |
Flip along an axis. |
Roll (N[, dims, dir, shift, dtype]) |
Roll along an axis. |
Pad (dims, pad[, dtype]) |
Pad operator. |
Sum (dims, dir[, dtype]) |
Sum operator. |
Symmetrize (N[, dims, dir, dtype]) |
Symmetrize along an axis. |
Restriction (M, iava[, dims, dir, dtype, inplace]) |
Restriction (or sampling) operator. |
Regression (taxis, order[, dtype]) |
Polynomial regression. |
LinearRegression (taxis[, dtype]) |
Linear regression. |
CausalIntegration (N[, dims, dir, sampling, …]) |
Causal integration. |
Spread (dims, dimsd[, table, dtable, fh, …]) |
Spread operator. |
VStack (ops[, dtype]) |
Vertical stacking. |
HStack (ops[, dtype]) |
Horizontal stacking. |
Block (ops[, dtype]) |
Block operator. |
BlockDiag (ops[, dtype]) |
Block-diagonal operator. |
Kronecker (Op1, Op2[, dtype]) |
Kronecker operator. |
Smoothing and derivatives¶
Smoothing1D (nsmooth, dims[, dir, dtype]) |
1D Smoothing. |
Smoothing2D (nsmooth, dims[, nodir, dtype]) |
2D Smoothing. |
FirstDerivative (N[, dims, dir, sampling, …]) |
First derivative. |
SecondDerivative (N[, dims, dir, sampling, …]) |
Second derivative. |
Laplacian (dims[, dirs, 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 (N, h[, offset, dims, dir, dtype, …]) |
1D convolution operator. |
Convolve2D (N, h, dims[, offset, nodir, …]) |
2D convolution operator. |
ConvolveND (N, h, dims[, offset, dirs, …]) |
ND convolution operator. |
Interp (M, iava[, dims, dir, kind, dtype]) |
Interpolation operator. |
Bilinear (iava, dims[, dtype]) |
Bilinear interpolation operator. |
FFT (dims[, dir, nfft, sampling, real, …]) |
One dimensional Fast-Fourier Transform. |
FFT2D (dims[, dirs, nffts, sampling, dtype]) |
Two dimensional Fast-Fourier Transform. |
FFTND (dims[, dirs, nffts, sampling, dtype]) |
N-dimensional Fast-Fourier Transform. |
DWT (dims[, dir, wavelet, level, dtype]) |
One dimensional Wavelet operator. |
DWT2D (dims[, dirs, wavelet, level, dtype]) |
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]) |
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. |
Patch2D (Op, dims, dimsd, nwin, nover, nop[, …]) |
2D 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, fast, …]) |
Multi-dimensional convolution. |
PhaseShift (vel, dz, nt, freq, kx[, ky, dtype]) |
Phase shift operator |
Demigration (z, x, t, srcs, recs, vel, wav, …) |
Kirchoff 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¶
Basic¶
solver.cg (Op, y, x0[, niter, damp, tol, …]) |
Conjugate gradient |
solver.cgls (Op, y, x0[, niter, damp, tol, …]) |
Conjugate gradient least squares |
Least-squares¶
leastsquares.NormalEquationsInversion (Op, …) |
Inversion of normal equations. |
leastsquares.RegularizedInversion (Op, Regs, data) |
Regularized inversion. |
leastsquares.PreconditionedInversion (Op, P, data) |
Preconditioned inversion. |
Sparsity¶
sparsity.IRLS (Op, data, nouter[, threshR, …]) |
Iteratively reweighted least squares. |
sparsity.OMP (Op, data[, niter_outer, …]) |
Orthogonal Matching Pursuit (OMP). |
sparsity.ISTA (Op, data, niter[, eps, alpha, …]) |
Iterative Shrinkage-Thresholding Algorithm (ISTA). |
sparsity.FISTA (Op, data, niter[, eps, …]) |
Fast Iterative Shrinkage-Thresholding Algorithm (FISTA). |
sparsity.SPGL1 (Op, data[, SOp, tau, sigma, x0]) |
Spectral Projected-Gradient for L1 norm. |
sparsity.SplitBregman (Op, RegsL1, data[, …]) |
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[, R1, dt, nt, dr, nfmax, wav, …]) |
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. |