biosiglive.streaming package
Submodules
biosiglive.streaming.client module
This file define a wrapper for the socket client to receive data from the server.
- class biosiglive.streaming.client.Client(server_ip: str, port: int, client_type: str = 'TCP', name: str = None)[source]
Bases:
object
- static client_sock(tcp_type: str)[source]
Create a client main.
- Parameters:
tcp_type (str) – Type of the main.
- Returns:
client – Client main.
- Return type:
socket.socket
- get_data(message: ~biosiglive.streaming.client.Message = <biosiglive.streaming.client.Message object>, buff: int = 32767)[source]
Get the data from server using the command.
- Parameters:
message (Message) – Message to send to the server.
buff (int) – Size of the buffer.
- Returns:
data – Data from server.
- Return type:
dict
biosiglive.streaming.server module
This file contains a wrapper for the socket server to send data to the server.
- class biosiglive.streaming.server.Connection(ip: str = '127.0.0.1', port: int = 50000)[source]
Bases:
object
This class is used to connect to the biosiglive server.
- class biosiglive.streaming.server.OscClient(ip: str = '127.0.0.1')[source]
Bases:
Connection
Class to create an OSC client.
- class biosiglive.streaming.server.Server(ip: str = '127.0.0.1', port: int = 50000, server_type: str = 'TCP')[source]
Bases:
Connection
Class to create a server.
biosiglive.streaming.stream_data module
- This file contains a class that allows to stream data from a source and start some multiprocess
to process and disseminate. It is a work in progress so basic functions are available but need to be fine-tuned.
- class biosiglive.streaming.stream_data.StreamData(stream_rate: int = 100)[source]
Bases:
object
- add_interface(interface: <biosiglive.interfaces.generic_interface.GenericInterface object at 0x7f81d58727e0>)[source]
Add an interface to the stream.
- Parameters:
interface (GenericInterface) – Interface to add. Interface should inherit from the generic interface.
- add_plot(plot: LivePlot | list, data_to_plot: str | list, raw: bool | list = None, multiprocess=False)[source]
Add a plot to the live data. Still Not working for now.
- Parameters:
plot (Union[LivePlot, list]) – Plot to add.
data_to_plot (Union[str, list]) – Name of the data to plot.
raw (Union[bool, list]) – If True, the raw data will be plotted.
multiprocess (bool) – If True, if several plot each plot will be on a separate process. If False, each plot will be on the same one.
- add_server(server_ip: str = '127.0.0.1', ports: int | list = 50000, client_type: str = 'TCP', device_buffer_size: int | list = None, marker_set_buffer_size: [<class 'int'>, <class 'list'>] = None)[source]
Add a server to the stream.
- Parameters:
server_ip (str) – The ip address of the server.
ports (int or list) – The port(s) of the server.
client_type (str) – The type of client to use. Can be TCP.
device_buffer_size (int or list) – The size of the buffer for the devices.
marker_set_buffer_size (int or list) – The size of the buffer for the marker sets.
- device_processing(device_idx: int)[source]
Process the data from the device
- Parameters:
device_idx (int) – The index of the device in the list of devices.
- plot_update(plot_idx: int = -1)[source]
Update the plots.
- Parameters:
plot_idx (int) – index of the plot to update. If -1, all plots will be updated.
- recons_kin(marker_set_idx: int)[source]
Compute inverse kinematics from markers.
- Parameters:
marker_set_idx (int) – Index of the marker set in the list of markers.
- save_streamed_data(interface_idx: int)[source]
Stream, process and save the data.
- Parameters:
interface_idx (idx) – Interface index to use from the interface list. for now only one interface is supported.
- start(save_streamed_data: bool = False, save_path: str = None, save_frequency: int = None)[source]
Start the stream.
- Parameters:
save_streamed_data (bool) – If True, the streamed data will be saved.
save_path (str) – The path to save the streamed data.
save_frequency – The frequency at which the data will be saved.