Skip to main content

A lightweight database framework for scientific computing with versioning and provenance tracking

Project description

SciDB

Database operations layer for SciStack. Provides abstractions for defining typed variables, configuring the database, and saving/loading data by metadata.

Named Filters (value-based, reusable)

Filter objects are first-class values — assign them to a variable and reuse them in any where= clause, or compose them with & / | / ~:

# Define once (this IS a ColumnFilter — no special wrapper needed)
clean_gr = GAITRiteLoadedCycle["StepLengths_GR"] != 0

# Use anywhere
for_each(mean_change_from_reference,
         inputs={"baseline": Fixed(GAITRiteLoadedCycle["StepLengths_GR"], session="BL"),
                 "value":    GAITRiteLoadedCycle["StepLengths_GR"]},
         outputs=[DeltaStepLength],
         where=clean_gr & (UAStartFoot() == "A"))

# Compose named filters
clean_and_unilateral = clean_gr & (UAStartFoot() == "U")
for_each(..., where=clean_and_unilateral)

MATLAB equivalent:

clean_gr = GAITRiteLoadedCycle("StepLengths_GR") ~= 0;
scidb.for_each(@meanChangeFromReference, ..., where=clean_gr & (UAStartFoot() == "A"));

Permanent Schema-Level Exclusions

For data that should be excluded from every analysis (e.g., a failed recording session), use the exclusion registry instead of per-call filters.

# Mark a specific trial as excluded (persisted in the database)
scidb.exclude_schema(subject=1, trial=2,
                     reason="equipment malfunction during recording")

# Exclude an entire subject (trial omitted = wildcard)
scidb.exclude_schema(subject=3, reason="participant withdrew")

# Inspect currently-excluded combinations
exclusions_df = scidb.list_exclusions()

# Re-include (logged; the original exclusion row is preserved)
scidb.include_schema(subject=1, trial=2,
                     reason="re-reviewed video, recording was valid")

MATLAB equivalent:

scidb.exclude_schema("equipment malfunction", 'subject', 1, 'trial', 2)
scidb.include_schema("re-reviewed, recording was valid", 'subject', 1, 'trial', 2)
tbl = scidb.list_exclusions()

Exclusions are applied automatically by for_each before the iteration loop. The full exclusion table is hashed and stored in version_keys (__schema_overrides_hash) so that adding or removing an exclusion invalidates cached results.

from scidb import configure_database, BaseVariable
import numpy as np

db = configure_database("experiment.duckdb", ["subject", "session"])

class RawSignal(BaseVariable):
    schema_version = 1

RawSignal.save(np.array([1, 2, 3]), subject=1, session="A")
(raw,) = RawSignal.load(subject=1, session="A")  # generator; unpack for single result
all_versions = list(RawSignal.load(subject=1, session="A", version="all"))

Logging

Every scidb operation logs through the shared scistacklog facade. configure_database() points the file sink at scidb.log next to the database file and writes a run-context header (package versions, Python version, pid), so each log file is self-describing.

Two sinks with independent levels, both defaulting to INFO:

  • console (stderr): the pipeline narrative — for_each banner, periodic progress, run summary with failure reasons, [timing] summaries.
  • file (scidb.log): the same narrative, with date + millisecond timestamps and the originating layer ([scidb], [scifor], [matlab], …) on every line; one record per line.

For debugging, raise a sink to DEBUG to capture the full execution trace (named internal steps with durations, per-iteration [run]/[skip] lines, per-phase [timing] tables, column/dtype dumps):

from scidb import Log

Log.set_level("DEBUG", sink="file")   # full detail in scidb.log only
Log.set_level("DEBUG")                # both sinks

or set the SCIDB_LOG_LEVEL environment variable, or pass -v to the scidb CLI.

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

scistack_db-0.1.11.tar.gz (228.9 kB view details)

Uploaded Source

Built Distribution

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

scistack_db-0.1.11-py3-none-any.whl (249.1 kB view details)

Uploaded Python 3

File details

Details for the file scistack_db-0.1.11.tar.gz.

File metadata

  • Download URL: scistack_db-0.1.11.tar.gz
  • Upload date:
  • Size: 228.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for scistack_db-0.1.11.tar.gz
Algorithm Hash digest
SHA256 8eb32eb875fc0c322970caa5512b06171b7bb8c8897facbed721c153761963a1
MD5 3a686f24c4b402a2a269d164f5293f1f
BLAKE2b-256 a0762948881cd33cdabd26a48b0f7911013bdd8070088a839f1d719df65f4fae

See more details on using hashes here.

Provenance

The following attestation bundles were made for scistack_db-0.1.11.tar.gz:

Publisher: publish.yml on mtillman14/scistack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scistack_db-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: scistack_db-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 249.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for scistack_db-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 e7f6303e372422308d83f04ed7cc5ebc4c3251f7a4f6209a6fa7cd8ed8ab6f28
MD5 45d33f4d4ebcbfb4c13dbfecc332a8ac
BLAKE2b-256 61934dbc606fcd80845078e106f6f31132cdd768d4b5d3f2fe98887aba7e8c9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for scistack_db-0.1.11-py3-none-any.whl:

Publisher: publish.yml on mtillman14/scistack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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