obspy.signal.interpolation.weighted_average_slopes

weighted_average_slopes(data, old_start, old_dt, new_start, new_dt, new_npts, *args, **kwargs)[source]

Implements the weighted average slopes interpolation scheme proposed in [Wiggins1976] for evenly sampled data. The scheme guarantees that there will be no additional extrema after the interpolation in contrast to spline interpolation.

The slope \(s_i\) at each knot is given by a weighted average of the adjacent linear slopes \(m_i\) and \(m_{i+j}\):

\[s_i = (w_i m_i + w_{i+1} m_{i+1}) / (w_i + w_{i+1})\]

where

\[\begin{split}w = 1 / max \left\{ \left\| m_i \\right\|, \epsilon \\right\}\end{split}\]

The value at each data point and the slope are then plugged into a piecewise continuous cubic polynomial used to evaluate the interpolated sample points.

Parameters:
  • data (array_like) Array to interpolate.
  • old_start (float) The start of the array as a number.
  • old_dt The time delta of the current array.
  • new_start (float) The start of the interpolated array. Must be greater or equal to the current start of the array.
  • new_dt (float) The desired new time delta.
  • new_npts (int) The new number of samples.