STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
feedtwin.model.catalog.Catalog Class Reference

Public Member Functions

None __init__ (self, Iterable[Part] parts=())
int __len__ (self)
bool __contains__ (self, object part_id)
Part add (self, Part part)
Part get (self, str part_id)
list[str] parts (self, str|None type_name=None)
list[Part] load (self, Path|str path)
Catalog from_file (cls, Path|str path)
ComponentInstance instantiate (self, str instance_id, str part_id, *, Mapping[str, Param]|None overrides=None, Mapping[str, Curve]|None curves=None, str model="", Mapping[str, str]|None connections=None)
dict[str, Any] to_dict (self)

Protected Attributes

dict _parts = {p.id: p for p in parts}

Detailed Description

A collection of parts, loadable from one or more TOML files.

Layering is by design: a shipped catalog, a team catalog and a
campaign-specific one can all be loaded in order, with later definitions
replacing earlier ones by part number.

Definition at line 140 of file catalog.py.

Constructor & Destructor Documentation

◆ __init__()

None feedtwin.model.catalog.Catalog.__init__ ( self,
Iterable[Part] parts = () )

Definition at line 148 of file catalog.py.

Member Function Documentation

◆ __contains__()

bool feedtwin.model.catalog.Catalog.__contains__ ( self,
object part_id )

Definition at line 154 of file catalog.py.

References _parts.

◆ __len__()

int feedtwin.model.catalog.Catalog.__len__ ( self)

Definition at line 151 of file catalog.py.

References _parts.

◆ add()

Part feedtwin.model.catalog.Catalog.add ( self,
Part part )

◆ from_file()

Catalog feedtwin.model.catalog.Catalog.from_file ( cls,
Path | str path )

Definition at line 190 of file catalog.py.

◆ get()

Part feedtwin.model.catalog.Catalog.get ( self,
str part_id )

Definition at line 161 of file catalog.py.

References _parts.

Referenced by instantiate().

◆ instantiate()

ComponentInstance feedtwin.model.catalog.Catalog.instantiate ( self,
str instance_id,
str part_id,
* ,
Mapping[str, Param] | None overrides = None,
Mapping[str, Curve] | None curves = None,
str model = "",
Mapping[str, str] | None connections = None )
Turn a part number into a configured component.

Precedence, lowest to highest: datasheet values, then measurements, then
anything given in ``overrides``. Curves layer the same way, the part's
beneath anything passed in. An override is how a single instance
differs from its catalogue entry -- this particular valve was trimmed,
this run of tube is longer -- without inventing a new part number.

The result is validated against the component's spec, so a catalog entry
missing a required parameter fails here with the parameter named, rather
than at solve time as a missing key.

Definition at line 195 of file catalog.py.

References AdcLayout.get(), feedtwin.comps.correlations.FittingContext.get(), and get().

◆ load()

list[Part] feedtwin.model.catalog.Catalog.load ( self,
Path | str path )
Load a TOML catalog file, replacing any parts it redefines.

Definition at line 174 of file catalog.py.

References add().

Referenced by engine.layerx.measurements.MeasurementStore.get().

◆ parts()

list[str] feedtwin.model.catalog.Catalog.parts ( self,
str | None type_name = None )
Part numbers, optionally filtered by component type.

Definition at line 170 of file catalog.py.

References _parts.

◆ to_dict()

dict[str, Any] feedtwin.model.catalog.Catalog.to_dict ( self)

Member Data Documentation

◆ _parts

feedtwin.model.catalog.Catalog._parts = {p.id: p for p in parts}
protected

Definition at line 149 of file catalog.py.

Referenced by __contains__(), __len__(), add(), get(), parts(), and to_dict().


The documentation for this class was generated from the following file: