eelbrain.NDVar.diff

NDVar.diff(dim=None, n=1, pad=True, name=None)

Discrete difference

Parameters:
  • dim (str) – Dimension along which to operate.

  • n (int) – Number of times to difference (default 1).

  • pad (bool) – Pad the dim dimension of the result to conserve NDVar shape (default). For exmaple, diff([0, 1, 1, 0]) -> [0, 1, 0, -1].

  • name (str) – Name of the output NDVar (default is the current name).

Returns:

diff – NDVar with the n th differences. If the input is masked, the previous mask is extended by n to mask all values in diff that incorporate previsouly masked values.

Return type:

NDVar