scistackplotdb 0.3.8__tar.gz → 0.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/PKG-INFO +6 -6
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/src/scistackplotdb/hierarchy.py +20 -16
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/src/scistackplotdb/source.py +15 -12
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/.gitignore +0 -0
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/README.md +0 -0
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/pyproject.toml +0 -0
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/src/scistackplotdb/__init__.py +0 -0
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/src/scistackplotdb/bundle_section.py +0 -0
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/src/scistackplotdb/designs.py +0 -0
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/src/scistackplotdb/endpoint.py +0 -0
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/src/scistackplotdb/load.py +0 -0
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/src/scistackplotdb/presets.py +0 -0
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/src/scistackplotdb/saved.py +0 -0
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/src/scistackplotdb/text_fields.py +0 -0
- {scistackplotdb-0.3.8 → scistackplotdb-0.4.1}/src/scistackplotdb/variants.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: scistackplotdb
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: scidb-backed plotting: load variables into long tables and plot them with scistackplot
|
|
5
5
|
Author: SciStack Contributors
|
|
6
6
|
License-Expression: MIT
|
|
@@ -17,11 +17,11 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
17
17
|
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
18
18
|
Classifier: Typing :: Typed
|
|
19
19
|
Requires-Python: >=3.10
|
|
20
|
-
Requires-Dist: sciduckdb==0.
|
|
21
|
-
Requires-Dist: scifor==0.
|
|
22
|
-
Requires-Dist: scistack-db==0.
|
|
23
|
-
Requires-Dist: scistacklog==0.
|
|
24
|
-
Requires-Dist: scistackplot==0.
|
|
20
|
+
Requires-Dist: sciduckdb==0.4.1
|
|
21
|
+
Requires-Dist: scifor==0.4.1
|
|
22
|
+
Requires-Dist: scistack-db==0.4.1
|
|
23
|
+
Requires-Dist: scistacklog==0.4.1
|
|
24
|
+
Requires-Dist: scistackplot==0.4.1
|
|
25
25
|
Provides-Extra: dev
|
|
26
26
|
Requires-Dist: matplotlib>=3.6; extra == 'dev'
|
|
27
27
|
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
Schema-depth joins.
|
|
3
3
|
|
|
4
4
|
Two variables can share a plot only if their schema levels can be joined.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
A variable lives at a SET of schema keys (the keys its records name). The tree
|
|
6
|
+
of keys is only a default (docs/claude/branched-schema-keys.md); what can join
|
|
7
|
+
what is decided by comparing those sets, so a person-level variable can attach
|
|
8
|
+
to a cross-branch Purchase even though its keys are not a prefix of the key
|
|
9
|
+
list. On a linear schema the sets are prefixes, as before:
|
|
10
|
+
|
|
11
|
+
* identical key sets → a straight merge on all of them;
|
|
12
|
+
* one a subset of the other → **broadcast**: the smaller variable's value is
|
|
13
|
+
repeated across every row of the larger that shares its keys (subject-level
|
|
14
|
+
Mass against trial-level Speed; a person-level age against a Purchase);
|
|
15
|
+
* otherwise → refuse, and say why (no record names both).
|
|
14
16
|
|
|
15
17
|
Answering this question is also what lets the GUI populate its measure list
|
|
16
18
|
honestly instead of offering combinations that cannot be built.
|
|
@@ -37,10 +39,10 @@ _RIGHT_LATEST = "__latest_right"
|
|
|
37
39
|
|
|
38
40
|
|
|
39
41
|
def join_kind(levels_a: list[str], levels_b: list[str]) -> JoinKind:
|
|
40
|
-
|
|
42
|
+
keys_a, keys_b = set(levels_a), set(levels_b)
|
|
43
|
+
if keys_a == keys_b:
|
|
41
44
|
return "identical"
|
|
42
|
-
|
|
43
|
-
if deep[: len(shallow)] == shallow:
|
|
45
|
+
if keys_a < keys_b or keys_b < keys_a:
|
|
44
46
|
return "broadcast"
|
|
45
47
|
return "incompatible"
|
|
46
48
|
|
|
@@ -65,11 +67,13 @@ def join_frames(
|
|
|
65
67
|
"""
|
|
66
68
|
kind = join_kind(left.levels, right.levels)
|
|
67
69
|
if kind == "incompatible":
|
|
70
|
+
only_left = [k for k in left.levels if k not in right.levels]
|
|
71
|
+
only_right = [k for k in right.levels if k not in left.levels]
|
|
68
72
|
raise ValueError(
|
|
69
|
-
f"{left.name} (
|
|
70
|
-
f"
|
|
71
|
-
f"
|
|
72
|
-
f"
|
|
73
|
+
f"{left.name} (keys {left.levels}) and {right.name} (keys {right.levels}) "
|
|
74
|
+
f"cannot share a plot: no record names both {only_left} and {only_right}, "
|
|
75
|
+
f"so there is no row to line their values up on. A variable saved at "
|
|
76
|
+
f"both is what would link them."
|
|
73
77
|
)
|
|
74
78
|
|
|
75
79
|
shallow_levels = left.levels if len(left.levels) <= len(right.levels) else right.levels
|
|
@@ -936,18 +936,18 @@ class ScidbSource(BaseSource):
|
|
|
936
936
|
f"{factor!r}, which this table already has. Rename the "
|
|
937
937
|
f"column in the source data, or group by something else."
|
|
938
938
|
)
|
|
939
|
-
if
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
#
|
|
943
|
-
#
|
|
944
|
-
|
|
945
|
-
# it holds.
|
|
939
|
+
if not set(variable.levels) <= set(levels):
|
|
940
|
+
# It names a key the data's rows do not carry (deeper than the
|
|
941
|
+
# data, or on a branch the rows never visit): merging would
|
|
942
|
+
# multiply rows or match nothing, and either way the figure
|
|
943
|
+
# would be quietly wrong about how many observations it holds.
|
|
944
|
+
extra = [k for k in variable.levels if k not in levels]
|
|
946
945
|
raise ValueError(
|
|
947
|
-
f"{group.label!r} sits at {variable.levels},
|
|
948
|
-
f"
|
|
949
|
-
f"attach one of its values to each row. Group by a variable "
|
|
950
|
-
f"recorded at
|
|
946
|
+
f"{group.label!r} sits at {variable.levels}, but the data's rows "
|
|
947
|
+
f"({levels}) never name {extra}, so there is no unambiguous way "
|
|
948
|
+
f"to attach one of its values to each row. Group by a variable "
|
|
949
|
+
f"recorded at keys the data's rows also name (no record of the "
|
|
950
|
+
f"measure names both; a variable saved at both would link them)."
|
|
951
951
|
)
|
|
952
952
|
on, right = self._keyed_values(variable, group)
|
|
953
953
|
frame = frame.merge(right, on=on, how="left")
|
|
@@ -971,7 +971,10 @@ class ScidbSource(BaseSource):
|
|
|
971
971
|
# Depth is the grouping variable's own schema depth: a subject-level
|
|
972
972
|
# sheet pins one value per subject, so it sits at the same level as
|
|
973
973
|
# `subject` and OUTSIDE `session` when both share the x axis.
|
|
974
|
-
|
|
974
|
+
# Its depth is its place in the flat key order: after the last key
|
|
975
|
+
# that pins it. A prefix gives len(on), as before; a branch (a
|
|
976
|
+
# person-level label on a cross-branch table) sits after `person`.
|
|
977
|
+
attached[factor] = max((levels.index(k) + 1 for k in on), default=0)
|
|
975
978
|
n_levels = frame[factor].nunique(dropna=True)
|
|
976
979
|
Log.info(
|
|
977
980
|
"attached %r as factor %r on %s (%d level(s))",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|