Exact time axes and time-indexed streams for Python
Project description
ChronoSeq
ChronoSeq is a Python library for time-indexed streams of sampled data. It provides exact integer-nanosecond timestamps, rational sampling rates, regular and irregular time axes, nearest-sample lookup, and half-open time-window slicing. Data may be stored in memory, a file, a database, a video container, an external API, or any custom backend.
ChronoSeq has no time-zone, calendar, or wall-clock semantics. Timestamps are exact integer nanosecond offsets on a user-defined timeline.
Installation
pip install chronoseq
Core model
ChronoSeq has three main concepts:
TimeAxis: converts between timestamps and integer sample indices.Reader: reads values by integer sample index.Stream: combines aTimeAxisandReaderinto a time-queryable stream.
The common constructors are concise:
from chronoseq import Hz, Stream, seconds
frames = Stream.regular(
start=seconds(0),
rate=Hz(30),
values=[f"frame_{i:03d}" for i in range(300)],
)
frame = frames.nearest(seconds("0.101"))
print(frame.index)
print(frame.time)
print(frame.value)
For irregular sampled data:
from chronoseq import Stream, seconds
speed = Stream.irregular(
timestamps=[
seconds("0.000"),
seconds("0.047"),
seconds("0.101"),
seconds("0.153"),
],
values=[10.0, 10.3, 10.8, 11.1],
)
sample = speed.nearest(seconds("0.100"))
More documentation
docs/semantics.md: formal timestamp, lookup, window, and reader rules.docs/custom_readers.md: custom backend and stream extension patterns.docs/performance.md: complexity notes, batching guidance, and benchmark snapshots.samples/: dependency-free usage patterns.benchmarks/: local benchmark scripts for large regular and irregular axes.
Licence
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chronoseq-0.3.0.tar.gz.
File metadata
- Download URL: chronoseq-0.3.0.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fae455192ee3fe90313f5be8ce490cac348270fb75bd79c4d51be3affce1b286
|
|
| MD5 |
1b77f091382ff61c9f9010218450a088
|
|
| BLAKE2b-256 |
7e31ab221372d290de4ea0eb205f36146bf31d2efde3b824ac43da1fce639510
|
File details
Details for the file chronoseq-0.3.0-py3-none-any.whl.
File metadata
- Download URL: chronoseq-0.3.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d929fa0fd1573a1fbb758189acea2bff94efe00c2b9c7f91057d562e7b1b09a4
|
|
| MD5 |
ca25b1cd8bb0c9fa25a56a2e3d716b7d
|
|
| BLAKE2b-256 |
65da827d09037e08c6707884ce4080235b9d8ef08c7be916732cb07469a3bc50
|