Skip to content

pyflightstream.results.conditions (stable)

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

Binding between a REQUESTED operating point and the one an export printed.

Pipeline role: sits with the parsers, below the run layer, and is the single place that decides whether a parsed loads export is evidence of the point somebody asked for. Both consumers call it: the assessor, before a terminal status is decided, and the tabular layer, when it reads a recorded run back.

Why it exists as its own module rather than as a check inside either consumer. The tabular layer already had this comparison, and the assessor did not, so a result for the wrong flight condition could be recorded CONVERGED in the manifest and only contradicted later, by a helper the manifest never consults (REV010-001). A guard that lives in one consumer protects that consumer; the invariant belongs to the data.

Physical meaning. A loads export prints the conditions the solver actually ran, so those printed values are the run's identity, not decoration. If the requested angle of attack is 0 deg and the export prints 2 deg, the file is a real, valid, converged result of a DIFFERENT engineering case: nothing about it is malformed, which is exactly why nothing caught it.

Reference frames and units are those of the loads export: angles in degrees in the solver's body frame, velocity in m/s.

Used in the guides

pyflightstream.results.conditions.bind_conditions

bind_conditions(
    requested: Mapping[str, float],
    *,
    reported: object,
    bindings: tuple[
        tuple[str, str, float, str], ...
    ] = FIELD_BINDINGS,
) -> ConditionBinding

Compare a requested operating point against a parsed export.

Parameters:

Name Type Description Default
requested mapping of str to float

The point that was asked for, keyed by axis name. Keys absent from the bindings table are recorded as unbound rather than compared.

required
reported object

A parsed report carrying the attributes named in bindings, in practice a :class:~pyflightstream.results.LoadsReport.

Any object exposing the attributes in bindings can be compared, including a synthetic report for an offline check.

required
bindings tuple

The axis-to-attribute table; defaults to :data:FIELD_BINDINGS. Passed explicitly by tests so the comparison can be driven without constructing a report.

FIELD_BINDINGS

Returns:

Type Description
ConditionBinding

Every comparable field with its deviation and decision, plus the requested axes the export does not print.

Notes

A requested value of None is treated as "not requested", which is the case for an optional field such as free-stream velocity that a campaign may leave to the recipe.

Examples:

Compare a synthetic report and distinguish a mismatch from an unprinted field:

>>> from types import SimpleNamespace
>>> from pyflightstream.results import bind_conditions
>>> requested = {"alpha": 2.0}
>>> binding = bind_conditions(requested, reported=SimpleNamespace(angle_of_attack_deg=3.0))
>>> assert binding.compared and not binding.mismatch_free
>>> missing = bind_conditions(requested, reported=SimpleNamespace())
>>> assert not missing.compared and missing.unprinted == ("alpha",)

Advanced

pyflightstream.results.conditions.ConditionBinding dataclass

ConditionBinding(
    checks: tuple[ConditionCheck, ...] = (),
    unprinted: tuple[str, ...] = (),
    unbound: tuple[str, ...] = (),
)

The whole comparison for one export.

Attributes:

Name Type Description
checks tuple of ConditionCheck

One per requested axis the export also prints.

unprinted tuple of str

Requested axes the export does not print, so they could not be compared. Kept rather than dropped: "not checked" and "checked and matched" are different states and a reader must be able to tell them apart.

unbound tuple of str

Requested axes :data:FIELD_BINDINGS does not know at all, so nothing could compare them. Distinct from unprinted, which is an axis the package knows and this export happens not to print.

mismatches property

mismatches: tuple[ConditionCheck, ...]

Checks whose deviation exceeds print rounding.

compared property

compared: bool

True when at least one field was actually compared.

The distinction this whole module is about, expressed as a value: "nothing was checked" and "everything agreed" are different claims about a result, and a caller must be able to ask which one it has.

mismatch_free property

mismatch_free: bool

True when no comparable field disagrees.

This is True even when no fields were compared. Check :attr:compared alongside it, or inspect :attr:mismatches directly, to distinguish agreement from missing comparisons.

describe

describe() -> str

Return the mismatching fields as one semicolon-joined line.

as_records

as_records() -> list[dict[str, float | str | bool]]

Return every check as plain data, for the manifest.

pyflightstream.results.conditions.ConditionCheck dataclass

ConditionCheck(
    axis: str,
    requested: float,
    reported: float,
    deviation: float,
    tolerance: float,
    unit: str,
)

One requested field compared against what the export printed.

Attributes:

Name Type Description
axis str

Requested axis name, for example "alpha".

requested float

Value the campaign asked for, in unit.

reported float

Value the export printed, in unit.

deviation float

Absolute difference, in unit.

tolerance float

Largest deviation attributable to print rounding, in unit. Half a count of the last printed digit, the width being read from the committed export tests/tier1_offline/fixtures/loads_steady_26.120.txt (FlightStream 26.120, build #7012026), which prints these fields with three decimals. One measured build is not a solver guarantee: see :data:FIELD_BINDINGS for what that citation does and does not claim.

unit str

Unit of the three quantities above.

within property

within: bool

True when the deviation is no larger than print rounding.

The slack of one part in 1e9 absorbs the binary representation of the difference: a request at an exact half count, 0.0625 printed 0.063, differs by 5.000000000000004e-4 in floating point, which is the tolerance itself and not past it.

describe

describe() -> str

Return one human-readable line for an error message.

as_record

as_record() -> dict[str, float | str | bool]

Return the check as plain data, for the manifest.

pyflightstream.results.conditions.FIELD_BINDINGS module-attribute

FIELD_BINDINGS: tuple[tuple[str, str, float, str], ...] = (
    ("alpha", "angle_of_attack_deg", 0.0005, "deg"),
    ("beta", "sideslip_deg", 0.0005, "deg"),
    ("velocity", "freestream_velocity_m_s", 0.0005, "m/s"),
)