Buffer API Class¶
physiolabxr.utils.buffers¶
- class physiolabxr.utils.buffers.DataBuffer¶
A class to store data from multiple streams.
- Variables:¶
- buffer : dict
a dictionary to store data from multiple streams, contains ‘stream_names’, (‘frames’ , ‘timestamps’)
- stream_name_buffer_sizes : dict
a dictionary to store buffer size for each stream
- __init__(stream_buffer_sizes)¶
Initializes the data buffer.
- get_data(stream_name)¶
get data from a specific stream name.
- get_timestamps(self, stream_name)¶
get timestamps from a specific stream name.
- update_buffers(data_buffer)¶
Updates the buffer with data from another buffer.
- Parameters:¶
- data_buffer : DataBuffer¶
Another DataBuffer object.
- update_buffer_size(stream_name, size)¶
Updates the buffer size from stream.
- clear_buffer()¶
Clear the entire buffer.
- clear_stream_buffer(stream_name)¶
Clear buffer from a specific stream.
- clear_stream_buffer_data(stream_name)¶
- Remove the buffered data for a stream without removing the existing keys.
The data and timestamps array will instead become empty arraries
- clear_buffer_data()¶
- Remove buffered data for all streams without removing the existing keys.
The data and timestamps array will instead become empty arraries
- clear_stream_up_to(stream_name, timestamp)¶
Remove buffered data of a specific stream up to a specific timestamp. The resulting timestamp is guaranteed to be greater than the given cut-to timestamp.
- clear_stream_up_to_index(stream_name, cut_to_index)¶
Clear data of a specific stream up to a specific index.