Process reference: numerical

Generated from the docstrings of vaft.process.numerical: 1 public functions. Each entry is what vaft.process.describe("numerical.<name>") prints. All process categories

Overview

One function so far. Anything that is a physics formula belongs in vaft.formula; anything that knows about a diagnostic belongs in a diagnostic module. This is for the operations that are neither.

SymbolMeaningUnit
ttimes
xthe sampled quantityany

Functions

time_derivativeTime derivative of a sampled quantity on a non-uniform time axis. Convention

time_derivative

Machine-independentConvention-sensitive source
time_derivative(time, data)

Time derivative of a sampled quantity on a non-uniform time axis.

A weighted central difference: at each interior point the forward and backward differences are averaged with weights proportional to the opposite interval, so the closer neighbour counts more. On a uniform grid this reduces to the ordinary central difference; the ends use a one-sided difference.

NameTypeUnitDescription
timenp.ndarrays

Sample times; spacing may vary.

datanp.ndarrayany

The sampled quantity, same shape as time.

Returns
—np.ndarrayany/s

d(data)/dt at each sample, same shape as data.

Convention

The weighting is the simple interval-weighted average of the two one-sided differences, not the second-order non-uniform stencil; it is what was written and is kept so that results do not move.

Raises

  • ValueError The arrays differ in shape, or hold fewer than two samples.
Processing steps · Applicability · Limitations

Processing steps

  1. First sample: forward difference. Last sample: backward difference.
  2. Interior sample i: with h_b = t[i] - t[i-1] and h_f = t[i+1] - t[i], the derivative is (h_f * backward + h_b * forward) / (h_b + h_f).
  3. A zero interval on either side falls back to the difference across the other; zero on both sides yields 0.

Applicability

Machine-independent.

Limitations

A zero time interval produces a 0 derivative silently rather than an error, so a duplicated timestamp hides as a flat spot. The scheme is first-order accurate on a non-uniform grid and amplifies sample noise as any finite difference does; smooth or filter first if the derivative is to be read quantitatively. The loop over interior points is pure Python and slow on long records.

results matching ""

    No results matching ""