alicatlib.registry¶
Primer-verified registries of gases, units, statistics, and
loop-control variables. Generated at build time from
codes.json via
scripts/gen_codes.py; a CI idempotency
check guards against drift. See Design §5.3.
alicatlib.registry ¶
Registry layer — gas / unit / statistic enums and alias registries.
codes.json is the source of truth; typed enums are generated by
scripts/gen_codes.py into _codes_gen.py. See docs/design.md §5.3.
LOOP_CONTROL_VARIABLE_CODES
module-attribute
¶
Wire codes accepted by LV. Useful for pre-I/O gating on raw input.
AliasRegistry ¶
Bases: _BaseAliasRegistry[E]
Registry for enums whose numeric code is unique across the enum.
Used by :data:gas_registry and :data:statistic_registry. Not used by
units, whose codes collide across categories — see :class:UnitRegistry.
Source code in src/alicatlib/registry/aliases.py
by_code ¶
Resolve a numeric Alicat code to the typed enum.
Gas ¶
LoopControlVariable ¶
Bases: IntEnum
Statistics a controller's feedback loop can track.
Values are the primer's statistic codes, so LV <value> over the
wire is a direct str(member.value). The members mirror the
:class:Statistic names they correspond to — LoopControlVariable.MASS_FLOW_SETPT
matches :data:Statistic.MASS_FLOW_SETPT (code 37).
Statistic ¶
Unit ¶
UnitCategory ¶
Bases: StrEnum
Unit category, per Primer Appendix B sections.
UnitRegistry ¶
Bases: _BaseAliasRegistry[Unit]
Unit-specialised registry.
Alicat unit codes repeat across categories (code 7 = SLPM in std-flow
but bar in pressure), so by_code requires an explicit
:class:UnitCategory. Separate from :class:AliasRegistry on purpose —
making category optional would silently pick the wrong unit.
Source code in src/alicatlib/registry/aliases.py
by_code ¶
Resolve a (category, code) pair to the typed :class:Unit.
A bare by_code(code) would be ambiguous — codes repeat across
categories — so category is keyword-only and required.
Source code in src/alicatlib/registry/aliases.py
categories ¶
Return the categories (Primer Appendix B sections) this unit applies to.
coerce_loop_control_variable ¶
Resolve value to a :class:LoopControlVariable.
Accepts:
- a :class:
LoopControlVariablemember (returned unchanged); - a :class:
Statisticmember whose code is in the LV subset; - an
intwire code (one of :data:LOOP_CONTROL_VARIABLE_CODES); - a
strmatching a member name case-insensitively ("mass_flow_setpt") or a :class:Statisticmember value ("mass_flow_setpt").
Raises:
| Type | Description |
|---|---|
AlicatValidationError
|
|