pylops.signalprocessing.Interp(M, iava, dims=None, dir=0, kind='linear', dtype='float64')[source]

Interpolation operator.

Apply different kind of interpolations given a subset of values from input vector at locations iava.

Nearest neighbour interpolation is a thin wrapper around pylops.Restriction at np.round(iava) locations.

Linear interpolation extracts values from input vector at locations np.floor(iava) and np.floor(iava)+1 and linearly combines them in forward mode, places weighted versions of the interpolated values at locations np.floor(iava) and np.floor(iava)+1 in an otherwise zero vector in adjoint mode.


the vector iava should contain unique values. If the same index is repeated twice an error will be raised. This also applies when values beyond the last element of the input array for linear interpolation as those values are forced to be just before this element.

M : int

Number of samples in model.

iava : list or numpy.ndarray

Floating indices of locations of available samples for interpolation.

dims : list

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

dir : int, optional

Direction along which restriction is applied.

kind : str, optional

Kind of interpolation (nearest and linear are currently supported)

dtype : str, optional

Type of elements in input array.

op : pylops.LinearOperator

Linear intepolation operator

iava : list or numpy.ndarray

Corrected indices of locations of available samples (samples at M-1 or beyond are forced to be at M-1-eps)


If the vector iava contains repeated values.


If kind is not nearest or linear

See also

Restriction operator


Linear interpolation of a subset of \(N\) values at locations iava from an input (or model) vector \(\mathbf{x}\) of size \(M\) can be expressed as:

\[y_i = (1-w_i) x_{l^{l}_i} + w_i x_{l^{r}_i} \quad \forall i=1,2,...,M\]

where \(\mathbf{l^l}=[\lfloor l_1 \rfloor, \lfloor l_2 \rfloor,..., \lfloor l_M \rfloor]\) and \(\mathbf{l^r}=[\lfloor l_1 \rfloor +1, \lfloor l_2 \rfloor +1,..., \lfloor l_M \rfloor +1]\) are vectors containing the indeces of the original array at which samples are taken, and \(\mathbf{w}=[l_1 - \lfloor l_1 \rfloor, l_2 - \lfloor l_2 \rfloor, ..., l_M - \lfloor l_M \rfloor]\) are the linear interpolation weights.

This operator can be implemented by simply summing two pylops.Restriction operators which are weighted using pylops.basicoperators.Diagonal operators.

Examples using pylops.signalprocessing.Interp