scistackplotdb
Plot what's in the database
scistackplotdb loads SciDB variables into the long format
scistackplot consumes, and generates pipeline
endpoints from a finished plot spec.
pip install scistackplotdb
from scidb import configure_database
from scistackplot import PlotSpec, Role, PlotKind, render
from scistackplotdb import ScidbSource
db = configure_database("experiment.duckdb", ["subject", "session", "trial"])
source = ScidbSource(db)
table = source.get_table(["StepLength"])
spec = PlotSpec(
measures=["StepLength"],
roles={"session": Role.X, "subject": Role.FREE, "trial": Role.FREE},
kind=PlotKind.BOX,
)
figure = render(table, spec)
What this layer actually solves
The long format is nearly free — schema keys are already columns once a
variable is joined to _schema, the same shape stat_ functions receive. The
real work is the four things a flat CSV never had.
Shape classification. Scalar, 1-D, or 2-D, decided from observed values rather than declared SQL type names, and cached. It determines which plot kinds are offered at all.
Joins across schema depth. Plotting trial-level Speed against
subject-level Mass broadcasts the shallower variable down the hierarchy:
source.joinable_with("StepLength") # -> ["Mass"] (Signal is 1-D: no x axis)
table = source.get_table(["StepLength", "Mass"]) # one Mass value per trial row
Because the dataset schema is an ordered, contiguous hierarchy, one variable's
levels are always a prefix of the other's or the two cannot be joined — and
join_frames refuses the latter with a message saying why.
Variants are factors — this one is a correctness trap. A variable produced at two filter cutoffs has two records per schema combination. Treating those branch params as ordinary columns silently plots two pipelines' results as if they were replicates of one:
spec = PlotSpec(measures=["Scaled"], roles={"session": Role.X})
validate(spec, table)
# RoleError: Variant factor(s) ['scale.factor'] would be pooled: their levels
# are different pipeline variants, not replicates... Assign them
# 'color'/'facet'/'iterate', select the variants you want with
# PlotSpec.variant_sets, or — to pool them deliberately — set them to
# 'aggregate' or 'free' yourself.
A transport budget. 1-D data across hundreds of trials is megabytes.
resolve(..., max_points=N) downsamples for the interactive panel; export
never does.
From spec to pipeline endpoint
from scistackplotdb import generate_endpoint
code = generate_endpoint(spec, table, input_variable="StepLength")
print(code.source)
def plot_steplength(df, filename):
...
return g.figure
for_each(
plot_steplength,
inputs={
"df": StepLength,
"filename": PathOutput("plots/steplength_{subject}.png"),
},
outputs=[StepLengthFigure],
as_table=['df'],
finalized=True,
subject=[],
)
The one translation that has to be exactly right is Role.ITERATE → a
for_each iteration keyword. Interactively, ITERATE fans out through a pandas
groupby; in the pipeline it fans out through for_each + PathOutput. If
those disagree, the exported pipeline is not what you previewed —
tests/test_fanout_parity.py runs both paths against the same database and
compares the figure sets.
Everything about recording the figure — finalized, artifact stamping,
skip_computed, scidb report — is SciDB's existing endpoint machinery and is
untouched.
Ordering
Factor levels are ordered by SciDB's declared schema_key_types, not by
pandas' default: a key declared numeric sorts numerically, and everything
else goes through a natural sort so zero-padded IDs land as
01, 02, … 10 instead of 01, 10, 02.
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 scistackplotdb-0.1.26.tar.gz.
File metadata
- Download URL: scistackplotdb-0.1.26.tar.gz
- Upload date:
- Size: 27.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
233c4345b00e5294d3fa4d8100dccc59fdd639a824fece1d8238d7bb771c45a6
|
|
| MD5 |
ccb1eea93cc5a7050dad2f7d2dbd71f1
|
|
| BLAKE2b-256 |
c44c75b2a19d5641fbe7fe8b76b18e9907a6392f87f0c27940bbb7db13297c0e
|
Provenance
The following attestation bundles were made for scistackplotdb-0.1.26.tar.gz:
Publisher:
publish.yml on mtillman14/scistack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scistackplotdb-0.1.26.tar.gz -
Subject digest:
233c4345b00e5294d3fa4d8100dccc59fdd639a824fece1d8238d7bb771c45a6 - Sigstore transparency entry: 2818273487
- Sigstore integration time:
-
Permalink:
mtillman14/scistack@dceb1ef3ad83a0e46bca88afe94a2281e4e6dde6 -
Branch / Tag:
refs/tags/v0.1.27 - Owner: https://github.com/mtillman14
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dceb1ef3ad83a0e46bca88afe94a2281e4e6dde6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file scistackplotdb-0.1.26-py3-none-any.whl.
File metadata
- Download URL: scistackplotdb-0.1.26-py3-none-any.whl
- Upload date:
- Size: 31.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
095c3440e3f3cfb31d591efa20d15d56b87eb2b6dae4c6223772a3018ede04b5
|
|
| MD5 |
f3406938181b2ad1b8c5755aa5eaeb50
|
|
| BLAKE2b-256 |
e764402ab65dfc7ed4cb48543fc339eca69b307dd991c616eea2c0a0e59a1d3a
|
Provenance
The following attestation bundles were made for scistackplotdb-0.1.26-py3-none-any.whl:
Publisher:
publish.yml on mtillman14/scistack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scistackplotdb-0.1.26-py3-none-any.whl -
Subject digest:
095c3440e3f3cfb31d591efa20d15d56b87eb2b6dae4c6223772a3018ede04b5 - Sigstore transparency entry: 2818273807
- Sigstore integration time:
-
Permalink:
mtillman14/scistack@dceb1ef3ad83a0e46bca88afe94a2281e4e6dde6 -
Branch / Tag:
refs/tags/v0.1.27 - Owner: https://github.com/mtillman14
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dceb1ef3ad83a0e46bca88afe94a2281e4e6dde6 -
Trigger Event:
push
-
Statement type: