BinaryTimeseries
A binary timeseries storage format, where the time axis is given via an expression.
Scope
This is the specification for a really simple binary file format for storing a regularly-spaced sequence of
single-channel measurement data in an efficiently writeable and readable format. The basic assumption
is that the time axis t_i of a series of N measurements can be computed on the fly from the array indices:
for (int i=0; i<N; i++) {
t_i = t_0 + i * Delta_t;
}
where t_0 is the (reference) timestamp of the first sample and Delta_t is the sampling interval.
The data values y_i are stored as raw values y_i_raw, optionally with an offset scalingOffset
and a scaling factor scalingFactor:
for (int i=0; i<N; i++) {
if (hasScaling) {
y_i = y_i_raw;
} else {
y_i = scalingOffset + y_i_raw * scalingFactor;
}
}
The maximum number of samples that can be stored inside this file format is limited by the maximum value of the (signed) int type,
which is
Integer.MAX_VALUE == 2^31 - 1 == 2_147_483_647 \approx 2.1e9
This corresponds to a total duration of T_max = (2^31-1) * Delta_t.
In the case of raw double values as y_i_raw, the corresponding maximum file size that can occur is
(64 + Double.BYTES * 2_147_483_647) == (64+8*(2^31-1)) \approx 16 GB
where 64 bytes are reserved for the file header information.
Suppose an ADC samples at a frequency f = 1 MHz. Then, the sampling interval is Delta_t = 1/f = 1 µs
and the maximum time series length that can be stored in one file in this file format is T_max \approx 2147 s.
The recommended file name extension for this file format is *.bts for Binary Time Series.
Fast subset reading
The main goal of this file format is to allow easy and fast reading of subsets of the whole time series data. Having an equally spaced time axis allows to compute the data indices inside a given time interval and using the definitions in Sec. 3 of the documentation (see below), the offsets in the file can be computed for seeking to the computed position in the file and reading only the required data from there on.
Documentation
The specification of this file format is available as a PDF in this repository: Binary Timeseries File Format Specification.
The LaTeX source code and the compiled PDF of this specification are also embedded (as resources) in the jar of the Java implementation on Maven Central.
Implementation
A Java implementation of this file format using a ByteBuffer as the file abstraction layer is available in this repository.
The latest release is available on Maven Central:
<dependency>
<groupId>de.labathome</groupId>
<artifactId>BinaryTimeseries</artifactId>
<version>1.0.4</version>
</dependency>
A (currently read-only) Python implementation of this file format is available on PyPI:
pip install BinaryTimeseries
Useage
A starting point on how to use these classes is given in the following example files:
Release files for BinaryTimeseries 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| BinaryTimeseries-1.0.4.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| BinaryTimeseries-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.2 kB
Release files / BinaryTimeseries-1.0.4.tar.gz
| Download URL | BinaryTimeseries-1.0.4.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e59c16a02bd442db7f88b98d8608d0068fc9357b0a0aa3fe4d2d8a05bed58e1
|
|
BLAKE2b-256 checksum How to use checksums |
53a48588fbad4a4070e6955b87d2545e5e96f3dbd679c0c6fbe1832bdc9530a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.8.2
|
Release files / BinaryTimeseries-1.0.4-py3-none-any.whl
| Download URL | BinaryTimeseries-1.0.4-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
855e841c4cd3583b6874219471c1ffa45b44b33fd2d8992c67595bb3cec7f4fe
|
|
BLAKE2b-256 checksum How to use checksums |
23a35227125b732835cc1cb2c917b1c73f04c0327259097f9b91c3085d15b064
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.8.2
|