Skip to content

← tensor_math package

FiniteDifferencesCentral

Calculate the discrete n'th derivative of the given data along a chosen axis using central finite differences.

This node will calculate the difference between next and previous (if order=1). For higher orders it will apply the procedure multiple times, which yields the discrete derivative of order n. This node can be used to compute, for instance, the velocity and acceleration from a time series of positions. It has a smoothing effect compare to the regular finite difference. More Info... Version 1.0.0

Ports/Properties

data

Data to process.

  • verbose name: Data
  • default value: None
  • port type: DataPort
  • value type: Packet (can be None)
  • data direction: INOUT

axis

Axis along which to compute the finite difference. The resulting axis will have order elements less than the original (i.e., 3 less if order is set to 3), unless keep_shape (keep output shape) property is set to True.

  • verbose name: Compute Differences Along Axis
  • default value: time
  • port type: ComboPort
  • value type: str (can be None)

order

Differencing order. If this is 3, the 3rd discrete derivative will be computed.

  • verbose name: Differencing Order
  • default value: 1
  • port type: IntPort
  • value type: int (can be None)

keep_shape

If True then the output shape will be the same as the input shape. For non-streaming packet data, this is accomplished by prepending and appending zeros along the target axis, which creates artifacts in the first order and last order samples that should typically be ignored. For streaming packet data with axes having a times array (time, instance), past data are held in buffers and the buffers will be overwritten with new data, avoiding artifacts.

  • verbose name: Keep Output Shape (Streaming)
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

scale_by_timestep

If True then differences along an axis with times attribute will be scaled by the difference in times. This is important for calculating velocity and acceleration in units of x/sec and /sec^2, or when samples are irregular.

  • verbose name: Scale By Timestep
  • default value: True
  • port type: BoolPort
  • value type: bool (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

  • verbose name: Set Breakpoint (Debug Only)
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

  • verbose name: Metadata
  • default value: {}
  • port type: DictPort
  • value type: dict (can be None)