timeflux.nodes.dejitter


Dejittering nodes

dejitter

class timeflux.nodes.dejitter.Reindex(rate=None)[source]

Bases: timeflux.core.node.Node

A simple dejittering node that will reindex the data according to the sampling rate.

This node is useful when datetime indices are not monotonic, which can happen if the stream is acquired from a LSL inlet.

Variables:
  • i (Port) – Default input, expects DataFrame and meta.

  • o (Port) – Default output, provides DataFrame and meta.

Parameters:

rate (float|None) – Nominal sampling rate. If None, the value will be read from the meta data.

Notes

This node assumes that no samples were lost and that the device clock is relatively stable.

Instantiate the node.

update()[source]

Update the input and output ports.

class timeflux.nodes.dejitter.Snap(rate=None)[source]

Bases: timeflux.core.node.Node

Snap timestamps to the nearest occurring frequency.

Variables:
  • i (Port) – Default input, expects DataFrame and meta.

  • o (Port) – Default output, provides DataFrame and meta.

Parameters:

rate (float|None) – (optional) nominal sampling frequency of the data, to round the timestamps to (in Hz). If None, the rate will be obtained from the meta of the input port.

Instantiate the node.

update()[source]

Update the input and output ports.

class timeflux.nodes.dejitter.Interpolate(rate=None, method='cubic', n_min=3, n_max=10)[source]

Bases: timeflux.core.node.Node

Dejitter data with values interpolation.

This nodes continuously buffers a small amount of data to allow for interpolating missing samples. The output data is resampled at a fixed rate. The interpolation is performed by Pandas methods.

Variables:
  • i (Port) – Default input, expects DataFrame and meta.

  • o (Port) – Default output, provides DataFrame and meta.

Parameters:
  • rate (float|None) – (optional) nominal sampling frequency of the data. If None, the rate will be obtained from the meta of the input port.

  • method – interpolation method. See the pandas.DataFrame.interpolate documentation.

  • n_min – minimum number of samples to perform the interpolation.

  • n_max – number of samples to keep in the buffer.

Notes

Computation cost mainly depends on the window size and the estimation is performed in the main thread. Hence, the user should be careful on the computation duration.

Instantiate the node.

update()[source]

Update the input and output ports.

class timeflux.nodes.dejitter.Space[source]

Bases: timeflux.core.node.Node

Evenly space timestamps.

This is useful to correct drifting data streams.

Variables:
  • i (Port) – Default input, expects DataFrame and meta.

  • o (Port) – Default output, provides DataFrame and meta.

Example

graphs:

  - id: Spacer
    nodes:
    - id: random
      module: timeflux.nodes.random
      class: Random
      params:
        rows_min: 4
        rows_max: 5
    - id: space
      module: timeflux.nodes.dejitter
      class: Space
    - id: display
      module: timeflux.nodes.debug
      class: Display
    edges:
      - source: random
        target: space
      - source: space
        target: display
    rate: 1

Instantiate the node.

update()[source]

Update the input and output ports.