Skip to main content

Exact time axes and time-indexed streams for Python

Project description

ChronoSeq

CI PyPI version Python versions Types

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 a TimeAxis and Reader into 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chronoseq-0.3.0.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chronoseq-0.3.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

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

Hashes for chronoseq-0.3.0.tar.gz
Algorithm Hash digest
SHA256 fae455192ee3fe90313f5be8ce490cac348270fb75bd79c4d51be3affce1b286
MD5 1b77f091382ff61c9f9010218450a088
BLAKE2b-256 7e31ab221372d290de4ea0eb205f36146bf31d2efde3b824ac43da1fce639510

See more details on using hashes here.

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

Hashes for chronoseq-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d929fa0fd1573a1fbb758189acea2bff94efe00c2b9c7f91057d562e7b1b09a4
MD5 ca25b1cd8bb0c9fa25a56a2e3d716b7d
BLAKE2b-256 65da827d09037e08c6707884ce4080235b9d8ef08c7be916732cb07469a3bc50

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page