Datalogger
This module provides functions to record and stream data from a streaming device.
FUNCTION | DESCRIPTION |
---|---|
get_dataframe |
Convert a list of tuples to a pandas DataFrame |
record |
Record data from a streaming device |
stream |
Stream data from a streaming device |
monitor_plot |
Monitor a data stream in real-time |
Documentation last updated: 2025-06-11
get_dataframe
get_dataframe(
data_store: Iterable[tuple[NamedTuple, datetime]],
fields: Iterable[str],
) -> DataFrame
Convert a list of tuples to a pandas DataFrame. The first element of each tuple is a NamedTuple, the second element is a datetime object.
PARAMETER | DESCRIPTION |
---|---|
data_store
|
list of tuples
TYPE:
|
fields
|
list of field names
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
DataFrame
|
pd.DataFrame: DataFrame object |
monitor_plot
monitor_plot(
data_store: Iterable[tuple[NamedTuple, datetime]]
| DataFrame,
y: str,
x: str = "timestamp",
*,
kind: str = "line",
lapsed_counts: int = 100,
stop_trigger: Event | None = None,
dataframe_maker: Callable | None = None,
) -> Event
Monitor a data stream in real-time.
PARAMETER | DESCRIPTION |
---|---|
data_store
|
list of tuples or dataframe containing the data to plot
TYPE:
|
y
|
y-axis field name
TYPE:
|
x
|
x-axis field name. Defaults to 'timestamp'.
TYPE:
|
kind
|
plot type. Defaults to 'line'.
TYPE:
|
lapsed_counts
|
number of counts to wait before stopping. Defaults to 100.
TYPE:
|
stop_trigger
|
event to stop the monitoring. Defaults to None.
TYPE:
|
dataframe_maker
|
function to convert data_store to a DataFrame. Defaults to None.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Event
|
threading.Event: event to stop the monitoring |
record
record(
on: bool,
show: bool = False,
clear_cache: bool = False,
*,
device: StreamingDevice,
data_store: deque,
split_stream: bool = True,
callback: Callable[[str], Any] | None = None,
query: Any | None = None,
event: Event | None = None,
)
Record data from a streaming device.
PARAMETER | DESCRIPTION |
---|---|
on
|
start or stop recording
TYPE:
|
show
|
display the data as it is recorded. Defaults to False.
TYPE:
|
clear_cache
|
clear the data cache before starting. Defaults to False.
TYPE:
|
device
|
streaming device object
TYPE:
|
data_store
|
data cache
TYPE:
|
split_stream
|
whether to split the stream and data processing threads. Defaults to True.
TYPE:
|
query
|
query to pass to the streaming device. Defaults to None.
TYPE:
|
event
|
event to set or clear. Defaults to None.
TYPE:
|
stream
stream(
on: bool,
show: bool = False,
*,
device: StreamingDevice,
data_store: deque,
split_stream: bool = True,
callback: Callable[[str], Any] | None = None,
query: Any | None = None,
event: Event | None = None,
)
Stream data from a streaming device.
PARAMETER | DESCRIPTION |
---|---|
on
|
start or stop streaming
TYPE:
|
show
|
display the data as it is streamed. Defaults to False.
TYPE:
|
device
|
streaming device object
TYPE:
|
data_store
|
data cache
TYPE:
|
split_stream
|
whether to split the stream and data processing threads. Defaults to True.
TYPE:
|
query
|
query to pass to the streaming device. Defaults to None.
TYPE:
|
event
|
event to set or clear. Defaults to None.
TYPE:
|