Skip to content

pyflightstream.geometry.config (provisional)

Generated from the docstrings at build time: every one of the 2 names in the __all__ of pyflightstream.geometry.config has an entry below. The names a guide or an example uses come first; the others follow under Advanced.

One TOML input boundary for the parametric geometry.

Pipeline role: pure configuration stage of the geometry package. Values use metres, degrees and unitless fractions. A configuration is read from TOML, validated, completed with documented defaults and returned with a unit and a source (given or default) on every value. The resolved form can be written back and read again without change.

Generation defaults that the supplied values do not fix are explicit in default_component; they are generic examples, never inferred from any particular aircraft, and no component name is known to the library. A key a table does not know is skipped and reported in warnings; the refusals are listed in :mod:pyflightstream.geometry._schema.

Used in the guides

pyflightstream.geometry.config.resolve_config

resolve_config(data, stem=None, base=None)

Validate a geometry configuration and resolve it with the source of every value.

Parameters:

Name Type Description Default
data dict

A configuration as read from TOML: fresh input (a components table, or a single component carrying type) or a previously resolved configuration (format = "pyflightstream-geometry-resolved"), whose derived quantities are recomputed and compared.

required
stem str

File stem, the default of aircraft.name.

None
base str or PathLike

Directory that the data files named in the input (rings_file, sections_file, original) are read from; the working directory when absent.

None

Returns:

Type Description
dict

The resolved configuration: format, units (m and deg), aircraft, acceptance, reader, components with each leaf wrapped as {value, unit, source} (source given or default), derived quantities, dominance, variants, configurations (the effective member names) and registry (members with their versions, extends and variants), files (the SHA-256 of each data file), warnings and findings. A resolved input that checks out is returned as a copy of itself.

Raises:

Type Description
InputValueError

When the units are unknown, no component is given, a component lacks its type or an X.Y.Z version, a value or relationship is out of range, a dominance or extends cycle exists, a value has the wrong form, or a resolved input's derived quantity is inconsistent. Unknown keys do not raise: they are skipped and listed in warnings.

Examples:

>>> from pyflightstream.geometry import resolve_config
>>> resolved = resolve_config({"type": "body", "length_mm": 2000.0})
>>> resolved["components"]["COMPONENT"]["length"]["value"]
2.0

Advanced

pyflightstream.geometry.config.load_config

load_config(path)

Read a TOML geometry configuration file and return it validated and resolved.

Parameters:

Name Type Description Default
path str or PathLike

The TOML file to read; the data files it names are read relative to its folder.

required

Returns:

Type Description
dict

The resolved configuration, as returned by :func:resolve_config.