Skip to main content

A library which stores, loads and filters time-series-events and catalogues.

Project description

tscat — Time Series Catalogues

Test Status Coverage Status

tscat is a Python library for managing catalogues of time intervals (events). It is the catalogue backend for SciQLop and is designed for space physics workflows — storing event lists such as magnetopause crossings, ICMEs, or any user-defined intervals with arbitrary metadata.

Events are persisted in a local SQLite database. No server required.

Installation

pip install tscat

Quick start

from datetime import datetime
from tscat import create_event, create_catalogue, add_events_to_catalogue, save

catalogue = create_catalogue("Bow shock crossings", author="Alice",
                             tags=["MMS", "bow_shock"])

events = [
    create_event(datetime(2023, 1, 1, 10, 0), datetime(2023, 1, 1, 10, 30),
                 author="Alice", tags=["inbound"], Bz_max=12.5),
    create_event(datetime(2023, 1, 3, 14, 0), datetime(2023, 1, 3, 14, 45),
                 author="Alice", tags=["outbound"], Bz_max=8.3),
]

add_events_to_catalogue(catalogue, events)
save()

Any keyword argument beyond the fixed fields (start, stop, author, tags, products, rating) becomes a custom attribute stored alongside the event.

Filtering

Retrieve events matching conditions using a natural Python DSL:

from tscat import get_events
from tscat.filtering import event, In, Field

# Events after a date
get_events(event.start >= datetime(2023, 1, 2))

# Combine predicates with &, |, ~
get_events((event.author == "Alice") & In("inbound", Field("tags")))

# Filter on custom attributes
get_events(event.Bz_max > 10.0)

Dynamic catalogues

A catalogue with a predicate automatically includes all matching events:

from tscat import create_catalogue
from tscat.filtering import event

dynamic = create_catalogue(
    "High Bz events", author="Alice",
    predicate=event.Bz_max > 10.0,
)

Import / export

Share catalogues as JSON or VOTable (AMDA-compatible):

from tscat import export_json, import_json, export_votable_str

json_str = export_json(catalogue)
import_json(json_str)  # into another database

Documentation

Full usage guide: docs/usage.rst

Development

This project uses uv:

uv sync --extra test
uv run pytest
uv run flake8 tscat tests

License

GNU General Public License v3

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

tscat-0.5.0.tar.gz (57.6 kB view details)

Uploaded Source

Built Distribution

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

tscat-0.5.0-py3-none-any.whl (30.8 kB view details)

Uploaded Python 3

File details

Details for the file tscat-0.5.0.tar.gz.

File metadata

  • Download URL: tscat-0.5.0.tar.gz
  • Upload date:
  • Size: 57.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tscat-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ae17040334ab5586602c767a315b7e7c34a1742db1120b9ca67b0822a0b25c4a
MD5 5088b50a9150dc799a28750c9b5ece84
BLAKE2b-256 742e4ffca4afe45962aa5f7f83d225eedf1890ab8d2ef921e168f44c5139833e

See more details on using hashes here.

File details

Details for the file tscat-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: tscat-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 30.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tscat-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 64e084444073f95db13eb804f5cf315b75649b8bee977ff01569fcc102a4c17d
MD5 653541d5282edb0a014a949025661005
BLAKE2b-256 2693dc08a0be2c6641f515f75b26dca4c061594bed806b7ebf1267294f5f0626

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