pwtools.num.deriv_spl

pwtools.num.deriv_spl(y, x=None, xnew=None, n=1, fullout=False, **splrep_kwargs)[source]

n-th derivative for 1d arrays of possibly nonuniformly sampled data. Returns matching x-axis for plotting. Splines are used.

Parameters:
  • x (1d arrays of same length) – if x=None, then x=arange(len(y)) is used

  • y (1d arrays of same length) – if x=None, then x=arange(len(y)) is used

  • xnew ({None, 1d array)) – x-axis to evaluate the derivative, if None then xnew=x

  • n (int) – order of the derivative, can only be <= k

  • fullout (bool) – return xd, yd or just yd

  • splrep_kwargs (keyword args to scipy.interpolate.splrep, default: k=3, s=0)

Returns:

  • if fullout – xd, yd

  • else – yd

  • xd (1d array, (len(x) or len(xnew),))

  • yd (1d array, (len(x) or len(xnew),)) – n-th derivative of y at points xd

Notes

xd is actually == x or xnew (if x is not None). xd can be returned to match the function signature of deriv_fd.