backend.data.RawData¶
- class backend.data.RawData(num_channels=16, buffer_size=2000, buffer=None)¶
This class holds the full numpy buffer of emg data, the current timestep buffer that is filled by the emg thread, and the full timestep buffer of emg data that the current_timestep is appended to
- excluded_params = ['current_buffer', 'raw_timesteps']¶
- __init__(num_channels=16, buffer_size=2000, buffer=None)¶
Initialize self. See help(type(self)) for accurate signature.
- property n_chan¶
- property buffer_size¶
- get_params()¶
Returns dict of this object’s attributes, excluding any attributes in the excluded_params list
- get_settings_params()¶
Returns only the settings-related params; not the data
- update_from_params(params: dict)¶
Update this object’s attributes using the params dict. Any attributes in the excluded_params list will not be updated
- update_current_buffer(idx, idx_step)¶
Updates the full buffer from the given idx of the timestep buffer
- concat_all_timesteps()¶
useful debugging utility for getting all raw data timesteps into one array
- static concatenate(*raw_data_objects)¶
Used to concatentate multiple RawData objects
- clear_data(keep_buffer=False)¶
Clear the data while leaving settings unchanged
- slice(start=None, end=None, bools=None)¶
Returns a new data object created from slicing the current data from start to end, or using the bools list of indices
- process_new_timestep(new_data: numpy.ndarray, save_raw=True, filter_timing_history=None)¶
Process the newest timestep of raw data, returning the current filtered buffer.
More specifically, this appends the new_data to the current_buffer and to the raw_timesteps list if save_raw is True, and then filters the current buffer and returns it.
IMPORTANT new_data should have the newest samples first