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(*args, **kwargs)

Common interface for performing matrix-vector products.

FunctionOperator(*args, **kwargs)

Function Operator.

MemoizeOperator(*args, **kwargs)

Memoize Operator.

TorchOperator(*args, **kwargs)

Wrap a PyLops operator into a Torch function.

Basic operators

MatrixMult(*args, **kwargs)

Matrix multiplication.

Identity(*args, **kwargs)

Identity operator.

Zero(*args, **kwargs)

Zero operator.

Diagonal(*args, **kwargs)

Diagonal operator.

Transpose(*args, **kwargs)

Transpose operator.

Flip(*args, **kwargs)

Flip along an axis.

Roll(*args, **kwargs)

Roll along an axis.

Pad(*args, **kwargs)

Pad operator.

Sum(*args, **kwargs)

Sum operator.

Symmetrize(*args, **kwargs)

Symmetrize along an axis.

Restriction(*args, **kwargs)

Restriction (or sampling) operator.

Regression(*args, **kwargs)

Polynomial regression.

LinearRegression(taxis[, dtype])

Linear regression.

CausalIntegration(*args, **kwargs)

Causal integration.

Spread(*args, **kwargs)

Spread operator.

VStack(*args, **kwargs)

Vertical stacking.

HStack(*args, **kwargs)

Horizontal stacking.

Block(ops[, nproc, dtype])

Block operator.

BlockDiag(*args, **kwargs)

Block-diagonal operator.

Kronecker(*args, **kwargs)

Kronecker operator.

Real(*args, **kwargs)

Real operator.

Imag(*args, **kwargs)

Imag operator.

Conj(*args, **kwargs)

Complex conjugate operator.

Smoothing and derivatives

Smoothing1D(nsmooth, dims[, axis, dtype])

1D Smoothing.

Smoothing2D(nsmooth, dims[, axes, dtype])

2D Smoothing.

FirstDerivative(*args, **kwargs)

First derivative.

SecondDerivative(*args, **kwargs)

Second derivative.

Laplacian(dims[, axes, weights, sampling, ...])

Laplacian.

Gradient(dims[, sampling, edge, kind, dtype])

Gradient.

FirstDirectionalDerivative(dims, v[, ...])

First Directional derivative.

SecondDirectionalDerivative(dims, v[, ...])

Second Directional derivative.

Signal processing

Convolve1D(*args, **kwargs)

1D convolution operator.

Convolve2D(dims, h[, offset, axes, method, ...])

2D convolution operator.

ConvolveND(*args, **kwargs)

ND convolution operator.

Interp(dims, iava[, axis, kind, dtype, name])

Interpolation operator.

Bilinear(*args, **kwargs)

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(*args, **kwargs)

One dimensional Wavelet operator.

DWT2D(*args, **kwargs)

Two dimensional Wavelet operator.

Seislet(*args, **kwargs)

Two dimensional Seislet operator.

Radon2D(taxis, haxis, pxaxis[, kind, ...])

Two dimensional Radon transform.

Radon3D(taxis, hyaxis, hxaxis, pyaxis, pxaxis)

Three dimensional Radon transform.

ChirpRadon2D(*args, **kwargs)

2D Chirp Radon transform

ChirpRadon3D(*args, **kwargs)

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(*args, **kwargs)

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

Kirchhoff(*args, **kwargs)

Kirchhoff Demigration operator.

AcousticWave2D(*args, **kwargs)

Devito Acoustic propagator.

Geophysical subsurface characterization

avo.AVOLinearModelling(*args, **kwargs)

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.

Callbacks

Callbacks()

This is a template class which a user must subclass when implementing callbacks for a solver.

MetricsCallback(xtrue[, Op, which])

Metrics callback

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.