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

Functions

tuple[tuple[str, str|None],...] _stack_versions ()
dict[str, str|None] stack_versions ()
dict[str, str|None] _collect ()
str|None _version_of (str import_name, str dist_name)

Variables

dict _PHYSICS_STACK

Detailed Description

Which versions of the physics stack produced a result.

Correlations and equations of state are not frozen. CoolProp revises a fluid's
EOS between releases; ``fluids`` corrects a fitting coefficient. When a number
that was right last month is wrong today and nothing in this repo changed, the
stack version is the first thing you want and the last thing anyone records.

So every run stamps this. It costs one dict and it is the difference between
"the model drifted" and "CoolProp 7.3 revised the nitrogen EOS".

A missing package reports ``None`` rather than raising: this is diagnostic
plumbing, and it must never be the reason an import fails.

Function Documentation

◆ _collect()

dict[str, str | None] feedtwin._environment._collect ( )
protected

Definition at line 56 of file _environment.py.

References _version_of().

Referenced by _stack_versions().

◆ _stack_versions()

tuple[tuple[str, str | None], ...] feedtwin._environment._stack_versions ( )
protected
The uncached scan, memoised. See :func:`stack_versions`.

Definition at line 34 of file _environment.py.

References _collect().

Referenced by stack_versions().

◆ _version_of()

str | None feedtwin._environment._version_of ( str import_name,
str dist_name )
protected
Version of one dependency, or ``None`` if it is not installed.

Prefers the installed distribution's metadata over the module's own
``__version__``: the metadata is what pip resolved, and a module attribute
can lag it. Falls back to the attribute for packages that ship no metadata,
and imports only as a last resort so this stays cheap on a warm interpreter.

Definition at line 71 of file _environment.py.

Referenced by _collect().

◆ stack_versions()

dict[str, str | None] feedtwin._environment.stack_versions ( )
Versions of feedtwin and every dependency that can move a number.

Cached for the life of the process. Reading distribution metadata means
parsing an email-format file per package, which took about 4 ms -- half the
cost of a small steady solve, on every solve, for an answer that cannot
change while the interpreter is running. A fresh dict is returned each call
so a caller cannot mutate the cache.

Returns a mapping of package name to version string, with ``None`` for
anything not installed. ``python`` and ``platform`` are included because a
LAPACK or libm difference across platforms is a real, if rare, source of
divergence in a Newton solve.

Definition at line 39 of file _environment.py.

References _stack_versions().

Variable Documentation

◆ _PHYSICS_STACK

dict feedtwin._environment._PHYSICS_STACK
protected
Initial value:
1= {
2 "numpy": "numpy",
3 "scipy": "scipy",
4 "CoolProp": "CoolProp",
5 "fluids": "fluids",
6 "ht": "ht",
7}

Definition at line 24 of file _environment.py.