class pylops.CausalIntegration(N, dims=None, dir=-1, sampling=1, halfcurrent=True, dtype='float64', kind='full', removefirst=False)[source]

Causal integration.

Apply causal integration to a multi-dimensional array along dir axis.

N : int

Number of samples in model.

dims : list, optional

Number of samples for each dimension (None if only one dimension is available)

dir : int, optional

Direction along which smoothing is applied.

sampling : float, optional

Sampling step dx.

halfcurrent : bool, optional

Add half of current value (True) or the entire value (False). This will be deprecated in v2.0.0, use instead kind=half to obtain the same behaviour.

dtype : str, optional

Type of elements in input array.

kind : str, optional

Integration kind (full, half, or trapezoidal).

removefirst : bool, optional

Remove first sample (True) or not (False).


The CausalIntegration operator applies a causal integration to any chosen direction of a multi-dimensional array.

For simplicity, given a one dimensional array, the causal integration is:

\[y(t) = \int\limits_{-\infty}^t x(\tau) \,\mathrm{d}\tau\]

which can be discretised as :

\[y[i] = \sum_{j=0}^i x[j] \,\Delta t\]


\[y[i] = \left(\sum_{j=0}^{i-1} x[j] + 0.5x[i]\right) \,\Delta t\]


\[y[i] = \left(\sum_{j=1}^{i-1} x[j] + 0.5x[0] + 0.5x[i]\right) \,\Delta t\]

where \(\Delta t\) is the sampling interval, and assuming the signal is zero before sample \(j=0\). In our implementation, the choice to add \(x[i]\) or \(0.5x[i]\) is made by selecting kind=full or kind=half, respectively. The choice to add \(0.5x[i]\) and \(0.5x[0]\) instead of made by selecting the kind=trapezoidal.

Note that the causal integral of a signal will depend, up to a constant, on causal start of the signal. For example if \(x(\tau) = t^2\) the resulting indefinite integration is:

\[y(t) = \int \tau^2 \,\mathrm{d}\tau = \frac{t^3}{3} + C\]

However, if we apply a first derivative to \(y\) always obtain:

\[x(t) = \frac{\mathrm{d}y}{\mathrm{d}t} = t^2\]

no matter the choice of \(C\).

shape : tuple

Operator shape

explicit : bool

Operator contains a matrix that can be solved explicitly (True) or not (False)


__init__(N[, dims, dir, sampling, …]) Initialize this LinearOperator.
adjoint() Hermitian adjoint.
apply_columns(cols) Apply subset of columns of operator
cond([uselobpcg]) Condition number of linear operator.
conj() Complex conjugate operator
div(y[, niter, densesolver]) Solve the linear problem \(\mathbf{y}=\mathbf{A}\mathbf{x}\).
dot(x) Matrix-matrix or matrix-vector multiplication.
eigs([neigs, symmetric, niter, uselobpcg]) Most significant eigenvalues of linear operator.
matmat(X) Matrix-matrix multiplication.
matvec(x) Matrix-vector multiplication.
rmatmat(X) Matrix-matrix multiplication.
rmatvec(x) Adjoint matrix-vector multiplication.
todense([backend]) Return dense matrix.
toimag([forw, adj]) Imag operator
toreal([forw, adj]) Real operator
tosparse() Return sparse matrix.
trace([neval, method, backend]) Trace of linear operator.
transpose() Transpose this linear operator.

Examples using pylops.CausalIntegration