jarvisplot 1.0.1__py3-none-any.whl
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.
- jarvisplot/Figure/adapters.py +773 -0
- jarvisplot/Figure/cards/std_axes_adapter_config.json +23 -0
- jarvisplot/Figure/data_pipelines.py +87 -0
- jarvisplot/Figure/figure.py +1573 -0
- jarvisplot/Figure/helper.py +217 -0
- jarvisplot/Figure/load_data.py +252 -0
- jarvisplot/__init__.py +0 -0
- jarvisplot/cards/a4paper/1x1/ternary.json +6 -0
- jarvisplot/cards/a4paper/2x1/rect.json +106 -0
- jarvisplot/cards/a4paper/2x1/rect5x1.json +344 -0
- jarvisplot/cards/a4paper/2x1/rect_cmap.json +181 -0
- jarvisplot/cards/a4paper/2x1/ternary.json +139 -0
- jarvisplot/cards/a4paper/2x1/ternary_cmap.json +189 -0
- jarvisplot/cards/a4paper/4x1/rect.json +106 -0
- jarvisplot/cards/a4paper/4x1/rect_cmap.json +174 -0
- jarvisplot/cards/a4paper/4x1/ternary.json +139 -0
- jarvisplot/cards/a4paper/4x1/ternary_cmap.json +189 -0
- jarvisplot/cards/args.json +50 -0
- jarvisplot/cards/colors/colormaps.json +140 -0
- jarvisplot/cards/default/output.json +11 -0
- jarvisplot/cards/gambit/1x1/ternary.json +6 -0
- jarvisplot/cards/gambit/2x1/rect_cmap.json +200 -0
- jarvisplot/cards/gambit/2x1/ternary.json +139 -0
- jarvisplot/cards/gambit/2x1/ternary_cmap.json +205 -0
- jarvisplot/cards/icons/JarvisHEP.png +0 -0
- jarvisplot/cards/icons/gambit.png +0 -0
- jarvisplot/cards/icons/gambit_small.png +0 -0
- jarvisplot/cards/style_preference.json +23 -0
- jarvisplot/cli.py +64 -0
- jarvisplot/client.py +6 -0
- jarvisplot/config.py +69 -0
- jarvisplot/core.py +237 -0
- jarvisplot/data_loader.py +441 -0
- jarvisplot/inner_func.py +162 -0
- jarvisplot/utils/__init__.py +0 -0
- jarvisplot/utils/cmaps.py +258 -0
- jarvisplot/utils/interpolator.py +377 -0
- jarvisplot-1.0.1.dist-info/METADATA +80 -0
- jarvisplot-1.0.1.dist-info/RECORD +42 -0
- jarvisplot-1.0.1.dist-info/WHEEL +5 -0
- jarvisplot-1.0.1.dist-info/entry_points.txt +2 -0
- jarvisplot-1.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"hist": {
|
|
4
|
+
"color": [
|
|
5
|
+
"#FFC9C9",
|
|
6
|
+
"#FFD6A7",
|
|
7
|
+
"#FEE685",
|
|
8
|
+
"#FFF085",
|
|
9
|
+
"#D8F999",
|
|
10
|
+
"#B9F8CF",
|
|
11
|
+
"#A4F4CF",
|
|
12
|
+
"#46ECD5",
|
|
13
|
+
"#A2F4FD",
|
|
14
|
+
"#B8E6FE",
|
|
15
|
+
"#BEDBFF",
|
|
16
|
+
"#C6D2FF",
|
|
17
|
+
"#DDD6FF",
|
|
18
|
+
"#F6CFFF",
|
|
19
|
+
"#FCCEE8",
|
|
20
|
+
"#FF8A99"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
#!/usr/bin/env python3
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
from typing import Any, Callable, Dict, Optional
|
|
6
|
+
import threading
|
|
7
|
+
|
|
8
|
+
class SharedContent:
|
|
9
|
+
"""
|
|
10
|
+
Session-level variable shared storage for all Figures (supports lazy evaluation and updates).
|
|
11
|
+
- register(name, compute_fn): Register a lazy evaluation function.
|
|
12
|
+
- get(name): Return cached value if available; otherwise, compute using compute_fn and cache the result.
|
|
13
|
+
- update(name, value): Explicitly write or overwrite a value.
|
|
14
|
+
- invalidate(name=None): Invalidate a specific entry or all entries.
|
|
15
|
+
- stats(): Diagnostic information.
|
|
16
|
+
"""
|
|
17
|
+
def __init__(self, seed: Optional[int] = None, logger: Any = None):
|
|
18
|
+
self._logger = logger
|
|
19
|
+
self._seed = seed
|
|
20
|
+
self._store: Dict[str, Any] = {}
|
|
21
|
+
self._registry: Dict[str, Callable[[SharedContent], Any]] = {}
|
|
22
|
+
self._lock = threading.RLock()
|
|
23
|
+
|
|
24
|
+
# ---- 懒计算接口 ----
|
|
25
|
+
def register(self, name: str, compute_fn: Callable[[SharedContent], Any]) -> None:
|
|
26
|
+
with self._lock:
|
|
27
|
+
self._registry[name] = compute_fn
|
|
28
|
+
if self._logger:
|
|
29
|
+
self._logger.debug(f"SharedContent: register -> {name}")
|
|
30
|
+
|
|
31
|
+
def get(self, name: str) -> Any:
|
|
32
|
+
with self._lock:
|
|
33
|
+
if name in self._store:
|
|
34
|
+
return self._store[name]
|
|
35
|
+
if name in self._registry:
|
|
36
|
+
if self._logger:
|
|
37
|
+
self._logger.debug(f"SharedContent: MISS -> {name}; computing...")
|
|
38
|
+
val = self._registry[name](self)
|
|
39
|
+
self._store[name] = val
|
|
40
|
+
return val
|
|
41
|
+
if self._logger:
|
|
42
|
+
self._logger.debug(f"SharedContent: MISS (no registry) -> {name}; returning None")
|
|
43
|
+
return None
|
|
44
|
+
|
|
45
|
+
def update(self, name: str, value: Any) -> None:
|
|
46
|
+
with self._lock:
|
|
47
|
+
self._store[name] = value
|
|
48
|
+
if self._logger:
|
|
49
|
+
self._logger.debug(f"SharedContent: update -> {name}")
|
|
50
|
+
|
|
51
|
+
def invalidate(self, name: Optional[str] = None) -> None:
|
|
52
|
+
with self._lock:
|
|
53
|
+
if name is None:
|
|
54
|
+
self._store.clear()
|
|
55
|
+
if self._logger:
|
|
56
|
+
self._logger.debug("SharedContent: invalidate ALL")
|
|
57
|
+
else:
|
|
58
|
+
self._store.pop(name, None)
|
|
59
|
+
if self._logger:
|
|
60
|
+
self._logger.debug(f"SharedContent: invalidate -> {name}")
|
|
61
|
+
|
|
62
|
+
def stats(self) -> Dict[str, int]:
|
|
63
|
+
with self._lock:
|
|
64
|
+
return {"cached": len(self._store), "registered": len(self._registry)}
|
|
65
|
+
|
|
66
|
+
class DataContext:
|
|
67
|
+
"""
|
|
68
|
+
Inject it into the facade of each Figure to isolate the Figure from the core implementation.
|
|
69
|
+
Figures use it to get, update, register, and invalidate shared content.
|
|
70
|
+
"""
|
|
71
|
+
def __init__(self, shared: SharedContent):
|
|
72
|
+
self._shared = shared
|
|
73
|
+
|
|
74
|
+
def get(self, name: str) -> Any:
|
|
75
|
+
return self._shared.get(name)
|
|
76
|
+
|
|
77
|
+
def update(self, name: str, value: Any) -> None:
|
|
78
|
+
self._shared.update(name, value)
|
|
79
|
+
|
|
80
|
+
def register(self, name: str, compute_fn: Callable[[SharedContent], Any]) -> None:
|
|
81
|
+
self._shared.register(name, compute_fn)
|
|
82
|
+
|
|
83
|
+
def invalidate(self, name: Optional[str] = None) -> None:
|
|
84
|
+
self._shared.invalidate(name)
|
|
85
|
+
|
|
86
|
+
def stats(self) -> Dict[str, int]:
|
|
87
|
+
return self._shared.stats()
|