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.9.dev0.tar.gz (230.2 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.9.dev0-py3-none-any.whl (249.1 kB view details)

Uploaded Python 3

File details

Details for the file scistack_db-0.1.9.dev0.tar.gz.

File metadata

  • Download URL: scistack_db-0.1.9.dev0.tar.gz
  • Upload date:
  • Size: 230.2 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.9.dev0.tar.gz
Algorithm Hash digest
SHA256 9bdecd5f8415c190441aecef0b79267ca6edcbb986cc151ae0a5c094d656bece
MD5 e2c8d3c8e35a2b0793ea916df5be3976
BLAKE2b-256 389ff82fae6b1cf2a8bafb5a2756911e05376f463bddff66155df946b8d3db24

See more details on using hashes here.

Provenance

The following attestation bundles were made for scistack_db-0.1.9.dev0.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.9.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for scistack_db-0.1.9.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e12a27a64ad6baebd30ff3ac60a6db92ecc46334bc5169e5fbe8c0be6fa2568
MD5 582ba52482aef94f5078c0996e7e59d2
BLAKE2b-256 1a83a8fe96433432c60172cf6966f88263bfad2f0f06fafdfdf6227d3299e9c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for scistack_db-0.1.9.dev0-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