|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Functions | |
| Path | snapshot_path (str run_id) |
| dict | load (str run_id) |
| int | _slot (int board_id) |
| dict[int, str] | _board_display_names (dict boards) |
| dict[str, str] | entity_labels (dict cfg) |
| str | label_for (str entity, dict[str, str] labels) |
| dict[int, str] | state_names (dict cfg) |
| dict | annotate (dict index, str run_id) |
Variables | |
| dict | BUILTIN_STATES |
| STATE_FIELDS = frozenset({"current_state", "from_state", "to_state"}) | |
| dict | _ENTITY_PREFIX |
| dict | _BOARD_TYPE_LABEL |
| int | T7_CJC_AIN = 14 |
| _SELF_TEST_RE = re.compile(r"^(SELF_TEST\.BOARD_\d+)\.s(\d+)$") | |
Human names for a run's numeric Elodin identities, from the run's config snapshot. Elodin records only numeric identities — `PT1.CH5`, `ACT2.CH1`, `ACT_CMD.B2.CH1`, `BOARD.HB_21` — and every state as a raw u8. The names live in config.toml, which the backend copies beside the run dir as `<run_id>.toml` when the session starts (service-controller.ts `snapshotRunConfig`). This module reads that snapshot back and rebuilds the mapping, so a past run reads as "Ox Upstream" and "Fire" instead of "PT1.CH5" and "16". Everything here mirrors conventions that already exist elsewhere and must not drift: * entity spelling — DatabaseConfig.cpp (`PT<n>.CH<c>`, `PT<n>_Cal.CH<c>`, `ACT_CMD.B<n>.CH<c>`, `BOARD.HB_<board_id>`, `SELF_TEST.BOARD_<board_id>`, and for a LabJack T7 `T7<n>.AIN<a>`, `T7<n>_Cal.AIN<a>`, `T7<n>.CJC` — register_t7_*_tables) * Elodin slot `<n>` = `board_id % 10`, 0 → 10 — LoadActiveBoards.hpp / sensor-config.ts * board display names — the config editor's `boardDisplayName` (app/config/page.tsx) A run predating the snapshot has no `.toml` and keeps its numeric entity names. State ids are the exception: they are stable by contract (see the `[[states]]` comment in config_base.toml), so the built-in table below names them even with no snapshot, and `[[states]]` overrides it the same way it overrides the C++ enum.
|
protected |
board_id → "PT Board #2", numbered by position among boards of the same type (matching the config editor). A lone board of its type drops the ordinal.
Definition at line 112 of file run_config.py.
Referenced by entity_labels().
|
protected |
Elodin slot for a board_id: the last digit, with 0 meaning 10.
Definition at line 107 of file run_config.py.
Referenced by entity_labels().
| dict backend.run_config.annotate | ( | dict | index, |
| str | run_id ) |
Attach the run's names to a component index, in place. Done at serve time rather than baked into the cached index: the snapshot is a separate file from the parquet cache, so one dropped in later (or a config fix) takes effect on the next open instead of needing the export thrown away.
Definition at line 243 of file run_config.py.
References entity_labels(), label_for(), load(), and state_names().
| dict[str, str] backend.run_config.entity_labels | ( | dict | cfg | ) |
Entity name → the role it plays, for every entity config can name.
Definition at line 131 of file run_config.py.
References _board_display_names(), and _slot().
Referenced by annotate().
| str backend.run_config.label_for | ( | str | entity, |
| dict[str, str] | labels ) |
The human name for one entity, or "" when config does not name it.
Definition at line 220 of file run_config.py.
Referenced by annotate().
| dict backend.run_config.load | ( | str | run_id | ) |
Parse the run's config snapshot. Missing or malformed → {} (names degrade to
numbers; a viewer must never fail to open a run over its metadata).
Definition at line 96 of file run_config.py.
References snapshot_path().
Referenced by annotate().
| Path backend.run_config.snapshot_path | ( | str | run_id | ) |
The config copied beside the run dir at session start.
Definition at line 91 of file run_config.py.
Referenced by load().
| dict[int, str] backend.run_config.state_names | ( | dict | cfg | ) |
State id → name. `[[states]]` overrides the built-in table entry by entry, so a partial list cannot erase the machine's knowledge of its own states.
Definition at line 231 of file run_config.py.
Referenced by annotate().
|
protected |
Definition at line 76 of file run_config.py.
|
protected |
Definition at line 66 of file run_config.py.
|
protected |
Definition at line 217 of file run_config.py.
| dict backend.run_config.BUILTIN_STATES |
Definition at line 35 of file run_config.py.
| backend.run_config.STATE_FIELDS = frozenset({"current_state", "from_state", "to_state"}) |
Definition at line 63 of file run_config.py.
| int backend.run_config.T7_CJC_AIN = 14 |
Definition at line 88 of file run_config.py.