visiannot.visiannot.components.Signal

Summary

Module defining Signal

Classes

visiannot.visiannot.components.Signal.Signal(…)

Class defining a signal to plot in ViSiAnnoT

API

Class Signal

class visiannot.visiannot.components.Signal.Signal(data, freq, max_points=inf, plot_style=None, legend_text='')[source]

Bases: object

Class defining a signal to plot in ViSiAnnoT

The signal data can be accessed with the methods Signal.getData() and Signal.get_data_in_range().

The attributes have the prefix _, so one should call the get methods to access them.

Parameters
  • data (numpy array) – signal data, shape (n_{samples}) if regularly sampled (i.e. freq != 0), or (n_{samples}, 2) if not regularlay sampled (i.e. freq == 0), then first column contains the timestamp in milliseconds and the second column contains the data

  • freq (int or float) – signal frequency, set it to 0 if not regularly sampled

  • max_points (int) – maximum number of points to display in ViSiAnnoT (used in Signal.get_data_in_range())

  • plot_style (dict) – plot style of the signal, see https://pyqtgraph.readthedocs.io/en/latest/graphicsItems/plotdataitem.html

  • legend_text (str) – legend associated to the signal plot

Methods:

get_data_in_range(first_frame_ms, last_frame_ms)

Returns the signal data in the range defined by first_frame_ms:last_frame_ms

set_signal(*args, **kwargs)

Sets the instance with new values

Attributes:

data

(numpy array) Signal data shape (n_{samples}, 2) (even if regularly sampled), first column contains the timestamp in milliseconds and the second column contains the data

freq

(int) Signal frequency (0 if not regularly sampled)

max_points

(int) Maximum number of points to display in ViSiAnnoT

plot_style

(dict) Plot style (default None), see https://pyqtgraph.readthedocs.io/en/latest/graphicsItems/plotdataitem.html

legend_text

(str) Legend associated to the signal plot

get_data_in_range(first_frame_ms, last_frame_ms)[source]

Returns the signal data in the range defined by first_frame_ms:last_frame_ms

Parameters
  • first_frame_ms (int) – first frame of the range in milliseconds

  • last_frame_ms (int) – last frame of the range in milliseconds

Returns

signal data in the range [first_frame_ms:last_frame_ms]

Return type

numpy array

set_signal(*args, **kwargs)[source]

Sets the instance with new values

It calls the constructor.

Parameters
  • args – positional arguments of the constructor of Signal

  • kwargs (keyword arguments of the constructor of Signal) –

data

(numpy array) Signal data shape (n_{samples}, 2) (even if regularly sampled), first column contains the timestamp in milliseconds and the second column contains the data

freq

(int) Signal frequency (0 if not regularly sampled)

legend_text

(str) Legend associated to the signal plot

max_points

(int) Maximum number of points to display in ViSiAnnoT

plot_style

(dict) Plot style (default None), see https://pyqtgraph.readthedocs.io/en/latest/graphicsItems/plotdataitem.html