pswamp.utils.time_window

Attributes

tw

Classes

TimeWindow

Stores the most recent n_samples of multichannel data, and corresponding time stamps. Updating with a new

GrowingTimeWindow

Stores the most recent n_samples of multichannel data, and corresponding time stamps. Updating with a new

Module Contents

class pswamp.utils.time_window.TimeWindow(n_samples=100, n_cols=0, dtype=float)

Stores the most recent n_samples of multichannel data, and corresponding time stamps. Updating with a new set of measurements is efficient, since only one row in the data array (self._data) is overwritten.

n_samples = 100
n_cols = 0
n_channels = 0
lock
_data
_time
_k = 0
get_safe(col_idx=slice(None))
get(col_idx=slice(None))

Get time vector and data array. If col_idx is specified, only the corresponding columns are returned. If not specified, all columns are returned.

Parameters:

col_idx – Indices of data columns to be returned.

Returns:

Time vector and data array.

get_time()

Get time vector. :returns: Time vector.

get_col(col_idx=slice(None))

Get data columns. If col_idx is specified, only the corresponding columns are returned. If not specified, all columns are returned. :param col_idx: Indices of data columns to be returned.

Returns:

Data array.

append(new_time, new_data)

Append a new set of measurement data, and corresopnding time stap. :param new_time: Time stamp. Single number. :param new_data: Row of measurement data.

append_data(new_data)

Append a new set of measurement data, without time stamp. :param new_data: Row of measurement data.

class pswamp.utils.time_window.GrowingTimeWindow(n_samples=None, n_cols=0, dtype=float)

Bases: TimeWindow

Stores the most recent n_samples of multichannel data, and corresponding time stamps. Updating with a new set of measurements is efficient, since only one row in the data array (self._data) is overwritten.

n_samples = None
n_cols = 0
n_channels = 0
lock
_time
_data
get_time()

Get time vector. :returns: Time vector.

get_col(col_idx=slice(None))

Get data columns. If col_idx is specified, only the corresponding columns are returned. If not specified, all columns are returned. :param col_idx: Indices of data columns to be returned.

Returns:

Data array.

append(new_time, new_data)

Append a new set of measurement data, and corresponding time stap. :param new_time: Time stamp. Single number. :param new_data: Row of measurement data.

Returns:

pswamp.utils.time_window.tw