STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
engine.layerx.catalog Namespace Reference

Functions

List[Dict[str, Any]] drill_rows (float lo_mm=0.5, float hi_mm=13.0)
Dict[str, Any] _check_row (str kind, Mapping[str, Any] row, str where)
List[Dict[str, Any]] _read (Path path, str kind)
Optional[Path] user_catalog_dir (Optional[Path] user_dir)
Dict[str, Any] load_catalogs (Optional[Path] user_dir=None, Optional[Path] shipped_dir=None)
List[Dict[str, Any]] rows_for (Mapping[str, Any] catalogs, str kind, str applies)
Optional[float] param_si (Mapping[str, Any] row, str name)
List[Dict[str, Any]] neighbours (List[Dict[str, Any]] rows, str key, float current, int n)

Variables

str SCHEMA = "layerx.catalog/1"
tuple KINDS = ("drills", "valves", "tubes", "bottles")
tuple FILE_KINDS = ("valves", "tubes", "bottles")
tuple SOURCES = ("measured", "manufacturer", "estimated")
str SHIPPED_DIR = Path(__file__).resolve().parent / "data" / "catalog"
str DRILL_STANDARD = "ASME B94.11M, Twist Drills (number sizes #40-#70)"

Detailed Description

The catalogues Hardware mode draws from: discrete parts, every row with where it came from.

Hardware mode never sizes a part continuously. It offers what can be bought or drilled, and only
what a row here says exists. Four kinds:

* **drills** -- number drills #40-#70 from ``engine.layerx.reconcile.NUMBER_DRILLS_IN`` (ASME
  B94.11M, *Twist Drills*), the table the injector reconcile already drills from, plus metric drills
  in 0.05 mm steps (``reconcile.METRIC_STEP_MM``, assumed: jobber sets in that range). Built here
  from that table, not re-typed, so the two cannot disagree.
* **valves** (``data/catalog/valves.json``) -- Cv options for solenoids, valves and regulators.
* **tubes** (``data/catalog/tubes.json``) -- bore and wall pairs for lines.
* **bottles** (``data/catalog/bottles.json``) -- pressurant bottles.

The JSON catalogues are seeded only with the parts the team named (the Aqua 1092-50 at Cv 0.8, the
1.7 Cv press solenoid) and what the shipped drawings carry, each row naming the drawing elements
and their own provenance. Nothing is taken from a vendor data sheet this repo does not hold
(docs/layerx/AUDIT.md 9.10 4b: "Hardware mode must wait for cited catalogue data, or it will
invent Cv values, bottle masses and tube ratings"). A person adds rows in
``<userdata>/layerx/catalog/<kind>.json`` (same shape); a user row replaces a shipped row with the
same id.

A row::

    {"id": "press-solenoid-cv1.7", "label": "...", "applies_to": ["SOL"],
     "params": {"Cv": {"value": 1.7, "unit": "Cv"}, "bore": {"value": 6.35, "unit": "mm", "source": "manufacturer"}},
     "source": "measured" | "manufacturer" | "estimated",
     "provenance": "who says so, and where (data sheet, drawing element)"}

A parameter's own ``source`` (optional) wins over the row's, for a row whose numbers do not share
one provenance (the drawn bottle: volume measured, mass and MAWP estimated).

``applies_to`` names drawing component types (``SOL``, ``PR``, ``KBOTTLE``) or ``line`` for an edge.

Function Documentation

◆ _check_row()

Dict[str, Any] engine.layerx.catalog._check_row ( str kind,
Mapping[str, Any] row,
str where )
protected

Definition at line 70 of file catalog.py.

Referenced by _read().

◆ _read()

List[Dict[str, Any]] engine.layerx.catalog._read ( Path path,
str kind )
protected

Definition at line 97 of file catalog.py.

References _check_row().

Referenced by load_catalogs().

◆ drill_rows()

List[Dict[str, Any]] engine.layerx.catalog.drill_rows ( float lo_mm = 0.5,
float hi_mm = 13.0 )
Number drills from the reconcile's table and metric drills every 0.05 mm in [lo, hi].

Definition at line 51 of file catalog.py.

Referenced by load_catalogs().

◆ load_catalogs()

Dict[str, Any] engine.layerx.catalog.load_catalogs ( Optional[Path] user_dir = None,
Optional[Path] shipped_dir = None )
Every catalogue, shipped rows first and a user's rows over them (by id). A user file that
does not read is reported in ``problems``, never silently dropped, and the shipped rows stand.

Definition at line 108 of file catalog.py.

References _read(), drill_rows(), and user_catalog_dir().

◆ neighbours()

List[Dict[str, Any]] engine.layerx.catalog.neighbours ( List[Dict[str, Any]] rows,
str key,
float current,
int n )
Up to ``n`` rows each side of ``current`` in ``key`` (nearest first, by ratio), never the
current size itself.

Definition at line 143 of file catalog.py.

References param_si().

◆ param_si()

Optional[float] engine.layerx.catalog.param_si ( Mapping[str, Any] row,
str name )
A row parameter in the drawing's own SI-ish units: mm for lengths, L for volume, psi, Cv.

Definition at line 134 of file catalog.py.

Referenced by neighbours().

◆ rows_for()

List[Dict[str, Any]] engine.layerx.catalog.rows_for ( Mapping[str, Any] catalogs,
str kind,
str applies )

Definition at line 130 of file catalog.py.

◆ user_catalog_dir()

Optional[Path] engine.layerx.catalog.user_catalog_dir ( Optional[Path] user_dir)

Definition at line 104 of file catalog.py.

Referenced by load_catalogs().

Variable Documentation

◆ DRILL_STANDARD

str engine.layerx.catalog.DRILL_STANDARD = "ASME B94.11M, Twist Drills (number sizes #40-#70)"

Definition at line 48 of file catalog.py.

◆ FILE_KINDS

tuple engine.layerx.catalog.FILE_KINDS = ("valves", "tubes", "bottles")

Definition at line 44 of file catalog.py.

◆ KINDS

tuple engine.layerx.catalog.KINDS = ("drills", "valves", "tubes", "bottles")

Definition at line 43 of file catalog.py.

◆ SCHEMA

str engine.layerx.catalog.SCHEMA = "layerx.catalog/1"

Definition at line 42 of file catalog.py.

◆ SHIPPED_DIR

str engine.layerx.catalog.SHIPPED_DIR = Path(__file__).resolve().parent / "data" / "catalog"

Definition at line 46 of file catalog.py.

◆ SOURCES

tuple engine.layerx.catalog.SOURCES = ("measured", "manufacturer", "estimated")

Definition at line 45 of file catalog.py.