time-series-buffer - a buffer for time-series with associated measurement uncertainties¶
time-series-buffer is a Python software package developed by software developers and researchers from Physikalisch-Technische Bundesanstalt (Germany) as part of the joint European Research Project EMPIR 17IND12 Met4FoF and the German research project FAMOUS.
For the time-series-buffer homepage go to GitHub.
time-series-buffer is written in Python 3 and strives to run with all Python versions with upstream support. Currently it is tested to work with Python 3.5 to 3.8.
Python package
Documentation Status
time-series-buffer - a metrological time-series buffer¶
This package provides support for time-series buffering based on the build-in Python collections.deque
.
The package is developed and maintained at the “Physikalisch-Technische Bundesanstalt” by Björn Ludwig and Maximilian Gruber.
TimeSeriesBuffer - the reference¶
-
class
time_series_buffer.buffer.
TimeSeriesBuffer
(maxlen=10, return_type='array')[source]¶ Custom buffer class, that allows to save streams of time-series with uncertainty in timestamps and values. Acts like a FIFO buffer.
-
add
(data=None, time=nan, time_unc=0.0, val=nan, val_unc=0.0)[source]¶ Append one or more new datapoints to the buffer. A datapoint consists of the tuple (time, time_uncertainty, value, value_uncertainty).
Parameters: - data (iterable of iterables with shape (N, M) (default: None)) –
If given, all other kwargs are ignored.
- M==2 (pairs): assumed to be like (time, value)
- M==3 (triple): assumed to be like (time, value, value_unc)
- M==4 (4-tuple): assumed to be like (time, time_unc, value, value_unc)
- time (float, or iterable of float/ufloat (default: np.nan)) – Timestamp(s) to be added.
- time_unc (float, or iterable of float (default: 0.0)) – Uncertainty(ies) of the timestamp(s) to be added.
- val ((iterable of) float/ufloat (default: np.nan)) – Value(s) to be added.
- val_unc ((iterable of) float (default: 0.0)) – Uncertainty(ies) of the value(s) to be added.
- time_unc, val, val_unc need to be of same shape, but uncertainties can be omitted. (time,) –
- data (iterable of iterables with shape (N, M) (default: None)) –
-
pop
(n_samples=1)[source]¶ Return the next n_samples from the left side of the buffer.
View the latest n additions to the buffer. Returns the format that was specified during init of the buffer.
Parameters: n (int (default: 1)) – How many datapoints to return. Returns: Return type: Depends on return_type, see __init__()
for details
-
show
(n_samples=1)[source]¶ View the latest n_samples additions to the buffer. Returns the format that was specified during init of the buffer.
Parameters: n_samples (int (default: 1)) – How many samples to return. Return all samples in buffer, if set to -1. Returns: Return type: Depends on return_type, see __init__()
for details
-