Download reference/calibration.py from zero-trust-physics/zero-trust-physics-rack-twin-openweight: direct link, hf CLI and curl.
- Browser
- Download file 949 Bytes
-
https://huggingface.co/datasets/zero-trust-physics/zero-trust-physics-rack-twin-openweight/resolve/main/reference/calibration.py
- Command line
-
hf download hf://datasets/zero-trust-physics/zero-trust-physics-rack-twin-openweight/reference/calibration.py
-
curl -L -o calibration.py https://huggingface.co/datasets/zero-trust-physics/zero-trust-physics-rack-twin-openweight/resolve/main/reference/calibration.py
949 Bytes
| """Site calibration of the factory maps (residual offsets measured on this lot with component solves). | |
| `site_calibration.json` (next to this file) holds additive offsets in each map's own output units, measured | |
| by solving the real components at the lot's planned operating point. Missing file or key = no offset. | |
| """ | |
| from __future__ import annotations | |
| import json | |
| import os | |
| _PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "site_calibration.json") | |
| KEYS = ("kappa_log", "vm_mpa", "lambda_log", "surge_c7_log", "nadir_hz", "cell_polar_v", "bus_drop_v") | |
| def _load() -> dict[str, float]: | |
| try: | |
| with open(_PATH, "r", encoding="utf-8") as fh: | |
| doc = json.load(fh) | |
| except (OSError, ValueError): | |
| return {} | |
| return {k: float(doc[k]) for k in KEYS if isinstance(doc.get(k), (int, float)) and not isinstance(doc.get(k), bool)} | |
| CAL = _load() | |
| def get(key: str) -> float: | |
| return CAL.get(key, 0.0) | |