pyflightstream.qa.matrix (stable)¶
Generated from the docstrings at build time: every one of the 10 names in the __all__ of pyflightstream.qa.matrix has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
pyfs-qa physics and pyfs-qa drift read the workspace (PFS-2031.17).
Pipeline role: the driver that turns the physics rows of a campaign
workspace into the PHY-* and DRF-* evidence reports. It runs the
workspace's physics matrix through the run layer exactly as
pyfs-matrix run does (:func:run_physics_matrix), reads the records
back and reduces each case's points with the functions of
:mod:pyflightstream.qa.physics (:func:reduce_physics), judges them
against the committed references and hands the result to that module's
report writer. drift is the same matrix run twice, once per solver
build under a registry overlay naming that build's executable, and the
two reductions diffed by :mod:pyflightstream.qa.drift
(:func:drift_from_workspace).
WHERE THIS MODULE LIVES, which is the decision the design study (66) said
the design settles first. The study feared that a driver reading the
workspace would put the qa layer above the workspace layer and invert the
pipeline's direction, "qa sits below workspace". Measured against the
package's own layer table, pyflightstream.overview._CORE_LAYERS, the
premise is false: post | qa is the TOP row and run | workspace the
row under it, tests/tier1_offline/test_conventions.py asserts that qa
and post share a row, and the qa package already imported the run layer
(qa.physics, qa.probes, qa.compat) and the workspace layer
(qa.cost, qa.cli) at module level before this module existed. A
driver composing run, workspace and qa therefore belongs in qa, where its
every import points DOWN, and the two homes the study priced were both
worse: a module under run/ importing qa would be the one upward import
in the tree, and a new top-level package above qa would add a row to the
published architecture table for one module. tests/tier1_offline/test_qa_matrix.py
measures the direction: this module imports the run and workspace layers
at module level, and no module of a lower row imports the qa package back.
HOW A ROW NAMES ITS CASE. The row's DESCRIPTION begins with the case id,
PHY-01_lift_slope_of_the_AR8_NACA0012_wing_polar, and the package
makes the link from that token to the reduction: a user never writes an
index of rows to cases. PHY-02 is two rows, told apart by the row's
SYMMETRY (the MIRROR row is the half); PHY-06 is its own unsteady row
plus the steady polar of the PHY-01 row at the same angles, which is how
the tier-3 test read it before this module did.
WHAT RUNS AND WHAT IS READ. The run is the run layer's, unchanged: the
assessor is :class:pyflightstream.run.LoadsAssessor, the recipe
registry is the workflow table, the HIDDEN column decides the window, and
a recorded point is refused unless resume is given, in which case the
recorded points are skipped and only new ones run. On a workspace whose
physics matrix already ran under pyfs-matrix run, resume is what
makes pyfs-qa physics a reader: nothing executes and the report is the
reduction of what the manifest holds.
Advanced¶
pyflightstream.qa.matrix.case_of_row
¶
case_of_row(row: MatrixRow) -> str | None
Return the case id a row names at the head of its DESCRIPTION, or None.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
MatrixRow
|
A row of the physics matrix. |
required |
Returns:
| Type | Description |
|---|---|
str or None
|
The case id at the head of the row's DESCRIPTION, for example |
pyflightstream.qa.matrix.drift_from_workspace
¶
drift_from_workspace(
root: str | Path,
version_a: str,
version_b: str,
*,
fs_exes: Mapping[str, str | Path],
workroot: str | Path,
matrix: str = DEFAULT_MATRIX,
name: str | None = None,
references_dir: str | Path | None = None,
) -> DriftRun
Run the physics matrix on two builds and diff the two reductions.
Each side is a workspace of its own under workroot, a_<build>
and b_<build>: a copy of the workspace's inputs/ library and
the matrix, plus an inputs/executables.local.toml overlay sending
every build id the rows name to that side's executable and version.
So the rows are the same bytes on both sides, the two manifests and
the two sweep tables are kept apart, and the run layer records each
side against the executable it actually ran. The reductions are then
diffed with the case bands centered on side A
(:func:pyflightstream.qa.drift.diff_runs).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str or Path
|
The workspace whose library and matrix both sides copy. |
required |
version_a
|
str
|
Baseline and compared versions; the same version twice is the degenerate self-comparison that proves the machinery. |
required |
version_b
|
str
|
Baseline and compared versions; the same version twice is the degenerate self-comparison that proves the machinery. |
required |
fs_exes
|
mapping of str to path
|
The executable per canonical version, never guessed. |
required |
workroot
|
str or Path
|
Where the two side workspaces are made; each must not exist yet, because a drift is two fresh runs and a side that exists holds a manifest the run would refuse point by point. |
required |
matrix
|
str
|
The matrix file name at the root. |
DEFAULT_MATRIX
|
name
|
str
|
The campaign name of both sides. When omitted, each side uses its own
directory name, |
None
|
references_dir
|
str or Path
|
Alternative reference directory, used by tests; the diff itself needs no reference. |
None
|
Returns:
| Type | Description |
|---|---|
DriftRun
|
The diff of the two reductions, as :func: |
Raises:
| Type | Description |
|---|---|
PhysicsEnvironmentError
|
A missing matrix, a version with no executable, or a side root that already exists. |
pyflightstream.qa.matrix.physics_build
¶
physics_build(matrix: str | Path) -> str
Return the one canonical version the build every active row names declares.
A PHY report is evidence of ONE build, and its stem carries that
build, so the pre-flight that protects a licensed seat has to know it
before anything runs. Two builds in one matrix is a comparison, which
is what drift is for.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
str or Path
|
The physics matrix file. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The canonical version the registry entry of that build id declares, which is the version the records carry and the report stem is written under. The build id itself is a name the user chose and is never read as a version (PFS-2102.006). |
Raises:
| Type | Description |
|---|---|
PhysicsEnvironmentError
|
When an active row leaves FS_BUILD empty, the rows name more
than one build, or the build's registry entry cannot be read,
declares no version, or declares one this package does not
resolve (the message names |
pyflightstream.qa.matrix.physics_from_workspace
¶
physics_from_workspace(
root: str | Path,
*,
matrix: str = DEFAULT_MATRIX,
name: str | None = None,
resume: bool = False,
references_dir: str | Path | None = None,
) -> PhysicsRun
Run the workspace's physics matrix and reduce it: what pyfs-qa physics does.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str or Path
|
The workspace root, holding |
required |
matrix
|
str
|
The matrix file name at the root, |
DEFAULT_MATRIX
|
name
|
str
|
The campaign name; the directory's name when left out. |
None
|
resume
|
bool
|
Skip the points the manifest already records. On a workspace whose matrix already ran, this is what makes the command a reader that spends no seat. |
False
|
references_dir
|
str or Path
|
Alternative reference directory, used by tests. |
None
|
Returns:
| Type | Description |
|---|---|
PhysicsRun
|
The judged run. A point that failed leaves its case reported
with an error rather than aborting the report: the run layer
raises :class: |
Raises:
| Type | Description |
|---|---|
PhysicsEnvironmentError
|
The refusals of :func: |
(MatrixError, InputArtifactError)
|
The run layer's own refusals, before anything executes: a blocked
pre-flight, a recorded point without |
Examples:
The tier-3 workspace after its physics matrix ran on the licensed machine, reduced without a second seat:
>>> from pyflightstream.qa.matrix import physics_from_workspace
>>> run = physics_from_workspace("tests/tier3_licensed", resume=True)
>>> run.verdict_counts()["fail"]
0
pyflightstream.qa.matrix.physics_matrix
¶
physics_matrix(
root: str | Path, matrix: str = DEFAULT_MATRIX
) -> Path
Return the physics matrix of a workspace, refusing a name it does not hold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str or Path
|
The workspace root. |
required |
matrix
|
str
|
The matrix FILE NAME, |
DEFAULT_MATRIX
|
Returns:
| Type | Description |
|---|---|
Path
|
The matrix file the workspace holds under that name. |
Raises:
| Type | Description |
|---|---|
PhysicsEnvironmentError
|
When |
pyflightstream.qa.matrix.physics_rows
¶
physics_rows(
matrix: str | Path,
) -> dict[str, list[MatrixRow]]
Return the active rows of the matrix grouped by the case each names.
The shape of the matrix is known before anything runs, so it is refused before anything runs: a row naming a case the registry does not know, and a case named by two rows where the reduction reads one (every case but PHY-02, whose two rows are the full span and the mirrored half). Both checks precede licensed solver work.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
str or Path
|
The physics matrix file. |
required |
Returns:
| Type | Description |
|---|---|
dict of str to list of MatrixRow
|
Case id to the active rows that name it, in file order. |
Raises:
| Type | Description |
|---|---|
PhysicsEnvironmentError
|
When a row names an unregistered case, or a one-row case is named by more than one row. Rows naming no case are not grouped and not refused: a workspace matrix may carry rows of its own. |
pyflightstream.qa.matrix.point_result
¶
point_result(
workspace: CampaignWorkspace, record: RunRecord
) -> PointResult
One recorded point as the reduction functions read it.
The loads table is resolved through the manifest and cross-checked
against the point (:func:pyflightstream.results.tables.parse_run_loads),
the label is the row and the point (sim_5001/a+04.0), and the
convergence word is the record's own status, which the run layer
judged with the log when one was exported. This is the _point of
the tier-3 physics test, moved into the package so the driver and
the test read a record the same way.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
CampaignWorkspace
|
The workspace whose manifest holds the record. |
required |
record
|
RunRecord
|
One recorded point. |
required |
Returns:
| Type | Description |
|---|---|
PointResult
|
The point's angle of attack, its Total loads row, its iteration count, its label and its convergence word. |
Raises:
| Type | Description |
|---|---|
QaEvidenceError
|
If the record's point has no |
pyflightstream.qa.matrix.reduce_physics
¶
reduce_physics(
workspace: CampaignWorkspace,
matrix: str | Path,
*,
references_dir: str | Path | None = None,
source: str | None = None,
name: str | None = None,
) -> PhysicsRun
Reduce the recorded rows of the physics matrix into a judged physics run.
Reads the manifest, takes the records of this matrix, groups them by
row, maps each row to the case its DESCRIPTION names, reduces the
case's points with the qa functions and judges the metrics against
the committed references. A case whose rows did not all finish, or
whose rows do not fit its reduction, is reported with its error
rather than raised, so one broken case cannot hide the others'
evidence, which is what the hand-built run did too.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
CampaignWorkspace
|
The workspace whose manifest holds the records. |
required |
matrix
|
str or Path
|
The matrix file; its stem selects the records and its rows name the cases. |
required |
references_dir
|
str or Path
|
Alternative reference directory, used by tests. |
None
|
source
|
str
|
The sentence the report prints as its source; derived from the matrix and the workspace directory when left out. |
None
|
name
|
str
|
The campaign name the run used, by the rule of
:func: |
None
|
Returns:
| Type | Description |
|---|---|
PhysicsRun
|
One :class: |
Raises:
| Type | Description |
|---|---|
PhysicsEnvironmentError
|
When a row names a case the registry does not know, when the manifest holds no record of this matrix under the campaign name, or when the records name more than one solver version, build or executable digest (a physics report is evidence of one build; two is a drift). |
pyflightstream.qa.matrix.run_physics_matrix
¶
run_physics_matrix(
workspace: CampaignWorkspace,
matrix: str | Path,
*,
name: str | None = None,
resume: bool = False,
) -> list[RunRecord]
Run the physics matrix through the run layer, as pyfs-matrix run would.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
CampaignWorkspace
|
The workspace holding the library the rows resolve against and the manifest the records land in. |
required |
matrix
|
str or Path
|
The matrix file, at the workspace root. |
required |
name
|
str
|
The campaign name; the workspace directory's name when left out. |
None
|
resume
|
bool
|
Skip the points the manifest already records and run the rest;
without it a recorded point is refused before anything executes,
exactly as in :func: |
False
|
Returns:
| Type | Description |
|---|---|
list of RunRecord
|
The records this call executed, in execution order; empty for a resumed run over a complete manifest. |
Raises:
| Type | Description |
|---|---|
CampaignErrors
|
After the loop, when at least one executed point failed. Every
point is in the manifest by then, so a caller reducing the
records reports the failed case beside the others rather than
losing them (:func: |
PhysicsEnvironmentError
|
A required command is unavailable or recorded broken on the selected build. The affected physics case is reported as inapplicable before any point is executed. |