timeflux.nodes.window


Sliding windows

window

class timeflux.nodes.window.Slide(length=0.6, step=None, rate=None)[source]

Bases: timeflux.core.node.Node

Sliding windows.

This node generates sliding windows from the default input stream. The durations are given in seconds, but these are converted in samples. Therefore, the outputs will always have the same number of datapoints, even if there is jitter in the input stream. Multiple, overlapping windows are authorized. Each concurrent window is assigned to a numbered Port. For convenience, the first window is bound to the default output, so you can avoid enumerating all output ports if you expects only one window.

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

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

  • o_* (Port) – Dynamic outputs, provide DataFrame and meta.

Parameters:
  • length (float) – The length of the window, in seconds.

  • step (float|None) – The minimal sliding step, in seconds. If None (the default), the step will be set to the length of the window.

  • rate (float) – The rate of the input stream. If None (the default), it will be taken from the meta data.

Instantiate the node.

update()[source]

Update the input and output ports.

class timeflux.nodes.window.Window(length, step=None, index='time', epochs=False)[source]

Bases: timeflux.core.node.Node

Provide sliding windows.

Attention

This node is deprecated and will be removed in future versions. Use Slide instead.

Variables:

i (Port) – Default data input, expects DataFrame.

Parameters:
  • length (float|int) – The length of the window, in seconds or samples.

  • step (float|int|None) – The minimal sliding step, in seconds or samples. If None (the default), the step will be set to the length of the window. If 0, the data will be sent as soon as it is available.

  • index (string) – If “time” (the default), the length of the window is in seconds. If “sample”, the length of the window is in samples.

  • epochs (boolean) – Whether the defaut output should be bound to an numbered output, thus simulating an epoch. This could be useful if piped to a Machine Learning node.

Instantiate the node.

update()[source]

Update the input and output ports.

class timeflux.nodes.window.TimeWindow(length, step=None)[source]

Bases: timeflux.core.node.Node

Helper class that provides a standard way to create an ABC using inheritance.

Instantiate the node.

update()[source]

Update the input and output ports.

class timeflux.nodes.window.SampleWindow(length, step=None)[source]

Bases: timeflux.core.node.Node

Helper class that provides a standard way to create an ABC using inheritance.

Instantiate the node.

update()[source]

Update the input and output ports.