pyflightstream.results (stable)¶
Generated from the docstrings at build time: every one of the 94 names in the __all__ of pyflightstream.results has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Anchor-based parsers for FlightStream output files.
Pipeline role: reads solver output text files into typed results.
Values are located by their printed labels (:func:labeled_value) and
tables by their header rows (:func:delimited_table), never by fixed
line numbers, so cosmetic layout changes between FlightStream versions
do not silently corrupt data (SAD Section 8, PP-4). Completeness is
structural: a missing footer or table terminator raises
:class:IncompleteOutputError, never a silently shorter table
(FR-17).
The FlightStream version printed in each output is cross-checked
against the requested version (FR-18). The printed string is coarser
than the canonical scheme: the 26.120 build reports itself as
Flightstream version 26.1, build #7012026 (observed in the
committed fixtures), so the check compares by alias prefix and records
the reported string and build verbatim; the build number is the
precise discriminator.
Number forms follow the solver's printing: .000 (no leading
zero), 4380000. (trailing point), and 1.000E-05 all parse.
On top of the parsers, a NumPy tabular layer turns the parsed
results into named-column tables: :func:to_table/:func:to_csv for each
parser, :func:parse_run_loads for one run's coefficients, and
:func:run_table/:func:sweep_table for one run or a whole sweep
read from the manifest. The manifest is an artifact of the workspace
layer above this one, so the caller passes a workspace it has already
constructed; the tables read it through structural protocols defined in
:mod:pyflightstream.results.tables and import the workspace layer
nowhere, not at run time and not for the type checker.
Two vocabularies live here beside the parsers, both because every layer above needs them and none of them may own them.
:data:DATA_ORIGIN_CODES and :data:REDUCTION_CODES are the published
answer to "did these numbers come off the run or out of a reduction"
(PFS-2014.05). The tables carry the tokens as columns and the
numeric-only writers carry the integers; the code sets are append only,
because a file written last month is read with this table and cannot be
asked what it meant.
:data:EXPORT_CONVERSIONS classifies every phase: export command of
the database as parsed, excluded, not-an-export or owed (PFS-2014.02),
and the tier 1 suite compares its keys against the live census, so a new
export command fails until somebody says which of the four it is. Ten of
the twenty-five are parsed here; five are owed, and each entry says why the
solver rather than this package is what stands in the way.
THE COLUMN LAYOUTS OF THE FIVE NEWEST FORMATS ARE PINNED
(:data:FORCE_DISTRIBUTION_COLUMNS and its four siblings) rather than
read from the file the way the probe export's are. A probe export's
columns are the export's own header, read as data; these are fixed by the solver, so a
header that has moved means a build reordered the numbers, and a table
read by position would publish one physical quantity under another
one's label.
THIS ROOT IS A FACADE (AD-11): the errors, the anchor primitives
and the code vocabularies are :mod:pyflightstream.results.core; the loads,
probe-points and unsteady-plots parsers :mod:pyflightstream.results.loads;
the solver log's :mod:pyflightstream.results.log; the export tables
:mod:pyflightstream.results.exports. Every name keeps its public path here,
and no module of the layer imports this root. The sectional loads export's
parser is :mod:pyflightstream.results.sectional_loads (AD-10):
the structural side branch re-exports it, so the branch and this layer no
longer import each other in a cycle.
Used in the guides¶
pyflightstream.results.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 |
required |
reported
|
object
|
A parsed report carrying the attributes named in Any object exposing the attributes in |
required |
bindings
|
tuple
|
The axis-to-attribute table; defaults to
:data: |
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",)
pyflightstream.results.parse_loads
¶
parse_loads(
text: str,
requested_version: str | FsVersion | None = None,
) -> LoadsReport
Parse one aerodynamic loads spreadsheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Complete file text. |
required |
requested_version
|
str, FsVersion, or None
|
When given, the version printed in the footer is cross-checked
against it by alias prefix (the printed string is coarser than
the canonical scheme; see the module docstring) and a
:class: |
None
|
Returns:
| Type | Description |
|---|---|
LoadsReport
|
Typed report; the footer and the table terminator are
structural, so an incomplete file raises
:class: |
Raises:
| Type | Description |
|---|---|
IncompleteOutputError
|
If the software footer or the closing Total row is missing, so the solver stopped before finishing the export. |
MalformedOutputError
|
If a second export follows the first, the header names no coefficient column, a column or a surface name repeats, there is more than one Total row, or a row holds a number of values other than the header names. |
Examples:
>>> text = (
... "Angle of attack (Deg) 2.000\n"
... "Side-slip angle (Deg) .000\n"
... "Freestream velocity (m/s) 30.000\n"
... "Requested solver iterations 500\n"
... "Solver convergence limit 1.000E-05\n"
... "Force solver to run all iterations F\n"
... "Solver mode: Steady\n"
... "Current solver iteration number: 312\n"
... "Surface, Cx, Cy, Cz, CL, CDi, CDo, CMx, CMy, CMz\n"
... "-----------------\n"
... "Wing,+0.01,+0.0,+0.43,+0.43,+0.009,+0.006,+0.0,-0.09,+0.0\n"
... "Total,+0.01,+0.0,+0.43,+0.43,+0.009,+0.006,+0.0,-0.09,+0.0\n"
... "-----------------\n"
... "Force Units: Coefficients\n"
... "Moment Units: Coefficients\n"
... "Software : Flightstream version 26.1, build #7012026\n"
... )
>>> report = parse_loads(text)
>>> report.angle_of_attack_deg
2.0
>>> list(report.surfaces)
['Wing']
>>> report.total['CL']
0.43
pyflightstream.results.parse_unsteady_plots
¶
parse_unsteady_plots(
text: str,
requested_version: str | FsVersion | None = None,
) -> UnsteadyPlotsReport
Parse an unsteady plot export into per-column time series.
Anchor-based like every parser here, and the anchor is the SEPARATOR: the table starts at the first line carrying a comma, so a banner or a title block above it is skipped without this parser counting lines. Everything below the header is a time step until a dashed rule closes the table. Ending before that rule is an incomplete export.
WHAT IS EVIDENCE HERE AND WHAT IS NOT. The row and column meaning
is the manual's (FSM-26.120 p.347, paraphrased in the database entry
for UNSTEADY_SOLVER_EXPORT_PLOTS: one column per plot, one row
per time step). The comma delimiter, trailing comma on each data row,
closing rule and software footer are observed in the committed
rpt134/control_plots.txt and s10_26125/plots_26.125.txt fixtures.
The footer is required and cross-checked when a requested version is given.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Complete export file text. |
required |
requested_version
|
str, FsVersion, or None
|
Cross-check the printed version and build against this requested solver. |
None
|
Returns:
| Type | Description |
|---|---|
UnsteadyPlotsReport
|
Column names in file order and the table as floats. |
Raises:
| Type | Description |
|---|---|
AnchorNotFoundError
|
If no line carries the column separator, so there is no table. |
MalformedOutputError
|
If the header names a column twice or leaves one unnamed, if a row holds MORE values than the header names, or if a cell is not a solver-printed number. Each names the step and the column it read. |
IncompleteOutputError
|
If the header is followed by no time step at all, or a row holds FEWER values than the header names: both are a write that stopped part way (FR-17). |
Examples:
>>> from pyflightstream.results import parse_unsteady_plots
>>> text = "Time (sec), CL\n.000, +2.3500000E-3,\n.004, +2.1000000E-3,\n"
>>> text += "------------\nSoftware : Flightstream version 26.1, build #7012026\n"
>>> report = parse_unsteady_plots(text)
>>> report.columns
('Time (sec)', 'CL')
>>> report.steps
2
>>> float(report.series("CL")[-1])
0.0021
pyflightstream.results.sweep_table
¶
sweep_table(
workspace: _ManifestWorkspace,
*,
loads_file: str | None = None,
require_loads: bool = True,
matrix_stem: str | None = None,
) -> Table
Assemble the tidy table of a whole campaign sweep.
One row per manifest record, in manifest order: the run identity,
sweep point, versions, and outcome of :func:run_table, joined
with the Total coefficients of each run's loads spreadsheet
resolved through :func:parse_run_loads. Runs without a loads
spreadsheet (failed points) keep their identity row with NaN
coefficients, so the sweep table always accounts for every
executed point. Table.to_csv then writes the final csv; the table states its
provenance in its own columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
CampaignWorkspace
|
The managed campaign workspace, already constructed. A bare
root path is NOT accepted, for the reason
:func: |
required |
loads_file
|
str
|
Exact loads file name per run, forwarded to
:func: |
None
|
require_loads
|
bool
|
Whether a sweep in which NO run yielded coefficients is an error. True by default, which is the historical behaviour and the right answer for a caller asking for a polar. Pass False where the table is being written as the record of what ran (PFS-2014.03): a campaign whose every point failed still has to leave a file a colleague can open, and raising here would leave nothing to write. The condition is warned about instead, and the identity rows are returned; per-record misses are already tolerated either way, as NaN coefficient rows. A record whose loads cannot be read for another reason (an output no longer on disk, an ambiguous, truncated or wrong-point spreadsheet) raises that error when True and, when False, keeps its NaN row and is warned about by run id. |
True
|
matrix_stem
|
str
|
The stem of one run matrix of the workspace; the table then holds the records that name it and no other's (PFS-2031.04). A record that names no matrix, written before the field existed or by a campaign authored in Python, is left out rather than counted in every matrix's table. None, the default, tabulates the whole manifest. |
None
|
Returns:
| Type | Description |
|---|---|
Table
|
The sweep table; sweep point axes are in their sweep units
(alpha and beta in deg, advance_ratio dimensionless) and the
coefficient columns follow each run's printed units, exposed
in the |
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
When the manifest holds no records, or when |
LoadsNotFoundError
|
When no successful run yields a coefficient table (which points
at a wrong |
Warns:
| Type | Description |
|---|---|
UserWarning
|
In the same condition when |
Examples:
>>> from pyflightstream.results import sweep_table
>>> from pyflightstream.workspace import CampaignWorkspace
>>> table = sweep_table(CampaignWorkspace("campaign"))
>>> table[["run_id", "alpha", "CL"]]
pyflightstream.results.to_table
¶
to_table(result: object) -> Table
Tabulate one parsed FlightStream result as a tidy NumPy-backed table.
Dispatches on the parsed result type:
- :class:
LoadsReport(:func:parse_loads): one row per surface plus the Total row, columnssurface, the printed coefficient names (Cx, Cy, Cz, CL, CDi, CDo, CMx, CMy, CMz), and the constantforce_units/moment_unitsmetadata columns; force and moment values follow those printed units, in the analysis frame named by the report. - list of :class:
ResidualSample(:func:parse_residual_history): columnsiteration,velocity_residual,pressure_residual(dimensionless),velocity_overflowedandpressure_overflowed(bool, True where the solver printed that residual as asterisks). - :class:
ProbePointsReport(:func:parse_probe_points): the printed columns, starting with X, Y, Z in simulation length units in the analysis reference frame. - :class:
UnsteadyPlotsReport(:func:parse_unsteady_plots): one row per time step and one column per plot, under the plot names exactly as printed. Units are per column and the export declares none, so nothing is converted here; the time column is in the unit the run's time increment is stated in. - :class:
ForceDistributionReport(:func:~pyflightstream.results.parse_force_distributions): one row per panel, columns :data:~pyflightstream.results.FORCE_DISTRIBUTION_COLUMNSwithBoundaryas an integer index, plus the constantforce_units/moment_unitsmetadata. - :class:
OffBodyStreamlinesReport(:func:~pyflightstream.results.parse_off_body_streamlines): one row per point of every streamline, keyed by a leadingstreamlinecolumn, then :data:~pyflightstream.results.OFF_BODY_STREAMLINE_COLUMNS. - :class:
SurfaceSectionsReport(:func:~pyflightstream.results.parse_surface_sections, for both surface-section commands): one row per cut point of every section, keyed by a leadingsectioncolumn, then :data:~pyflightstream.results.SURFACE_SECTION_COLUMNS. - :class:
SweepSpreadsheetReport(:func:~pyflightstream.results.parse_sweep_spreadsheet): one row per sweep point, columns :data:~pyflightstream.results.SWEEP_COLUMNSplus the printed units. - :class:
SolverAnalysisCsvReport(:func:~pyflightstream.results.parse_solver_analysis_csv):x,y,z,scalarandscalar_field, the last naming what the scalar is, because that export prints no header and the file cannot say.
Those five carry PINNED columns: the layout is the solver's rather than the run's, so a report whose columns have moved is refused here as well as at parse time, instead of being tabulated with each value under its neighbour's label.
SectionalLoadsReport(:mod:pyflightstream.results.sectional_loads, re-exported by :mod:pyflightstream.fsi.loads): unit-suffixed columnsoffset_m,chord_m,x_qc_m,z_qc_m[m],fx_n_per_m,fz_n_per_m[N/m],moment_qc_nm_per_m[N m / m, the export'sMoment, whose point the definitions page states], in the cut-plane axes the FSI parser documents.
Every one of them also carries the three provenance columns
(PFS-2014.05, PFS-2014.03): data_origin, raw for anything
read off a solver export; reduction_window, not_applicable
where nothing was averaged, last_time_step on an unsteady export,
and unknown where the mode itself never printed; and
reduction, which is none where nothing was averaged,
last_step on an unsteady export, which states the last time step
only, and unknown where the file printed no solver mode to decide
it by. time_average with not_printed is what files written
in legacy releases carry on an unsteady export.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
object
|
One parsed result of the kinds above. |
required |
Returns:
| Type | Description |
|---|---|
Table
|
Tidy table, one observation per row; write it with
:func: |
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
If a report with pinned columns carries other columns than the solver's layout. |
UnsupportedResultTypeError
|
If |
Examples:
>>> from pyflightstream.results import ResidualSample, to_table
>>> table = to_table([ResidualSample(1, 0.01, 0.02)])
>>> table["iteration"].tolist()
[1]
Advanced¶
pyflightstream.results.AmbiguousLoadsError
¶
Bases: PyflightstreamError, ValueError
Several collected outputs of one run parse as loads spreadsheets.
The resolver refuses to guess which table is the run's coefficient
evidence; pass loads_file with the exact exported file name.
pyflightstream.results.AnchorNotFoundError
¶
Bases: PyflightstreamError, ValueError
A printed label or table header was not found in the output.
Anchor-based parsing refuses to fall back to line offsets; a missing anchor means the file is not the expected kind of output or the format changed, and both must surface loudly.
pyflightstream.results.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: |
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.
as_records
¶
as_records() -> list[dict[str, float | str | bool]]
Return every check as plain data, for the manifest.
pyflightstream.results.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 |
requested |
float
|
Value the campaign asked for, in |
reported |
float
|
Value the export printed, in |
deviation |
float
|
Absolute difference, in |
tolerance |
float
|
Largest deviation attributable to print rounding, in |
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.
as_record
¶
as_record() -> dict[str, float | str | bool]
Return the check as plain data, for the manifest.
pyflightstream.results.DATA_ORIGIN_CODES
module-attribute
¶
DATA_ORIGIN_CODES: dict[str, int] = {"raw": 0, "reduced": 1}
pyflightstream.results.DRAG_PAIRS
module-attribute
¶
DRAG_PAIRS: tuple[tuple[str, str], ...] = (
("CDi", "CDo"),
("CDp", "CDv"),
)
pyflightstream.results.EXPORT_CONVERSIONS
module-attribute
¶
EXPORT_CONVERSIONS: dict[str, ExportConversion] = {
"EXPORT_SOLVER_ANALYSIS_SPREADSHEET": ExportConversion(
EXPORT_PARSED,
"pyflightstream.results.parse_loads",
None,
"the coefficient table every campaign point exports",
),
"EXPORT_PROBE_POINTS": ExportConversion(
EXPORT_PARSED,
"pyflightstream.results.parse_probe_points",
None,
"the probe survey, read under its printed column names",
),
"UNSTEADY_SOLVER_EXPORT_PLOTS": ExportConversion(
EXPORT_PARSED,
"pyflightstream.results.parse_unsteady_plots",
None,
"one row per time step; format observed in rpt134 and s10_26125 committed fixtures",
),
"EXPORT_SURFACE_SECTIONAL_LOADS": ExportConversion(
EXPORT_PARSED,
"pyflightstream.results.sectional_loads.parse_sectional_loads",
None,
"spanwise load densities, the input of the FSI coupling",
),
"EXPORT_SOLVER_ANALYSIS_TECPLOT": ExportConversion(
EXPORT_EXCLUDED,
None,
"tecplot",
"read by Tecplot itself",
),
"EXPORT_VOLUME_SECTION_TECPLOT": ExportConversion(
EXPORT_EXCLUDED,
None,
"tecplot",
"read by Tecplot itself",
),
"EXPORT_SOLVER_ANALYSIS_VTK": ExportConversion(
EXPORT_EXCLUDED,
None,
"vtk",
"read by ParaView and every VTK reader",
),
"EXPORT_VOLUME_SECTION_VTK": ExportConversion(
EXPORT_EXCLUDED,
None,
"vtk",
"read by ParaView and every VTK reader",
),
"EXPORT_SOLVER_ANALYSIS_PLOAD_BDF": ExportConversion(
EXPORT_EXCLUDED,
None,
"nastran",
"a Nastran bulk-data deck, read by the solver it feeds",
),
"FREE_SURFACE_EXPORT_TYPE": ExportConversion(
EXPORT_EXCLUDED,
None,
"vtk",
"a free-surface mesh as VTK (26.125, FSM-26.125 p.338), read by ParaView and every VTK reader; no workflow writes it",
),
"EXPORT_VOLUME_SECTION_2D_VTK": ExportConversion(
EXPORT_EXCLUDED,
None,
"vtk",
"read by ParaView and every VTK reader",
),
"EXPORT_ALL_SURFACE_STREAMLINES": ExportConversion(
EXPORT_OWED,
None,
None,
"its file has no parser here: one is written against a real export of a licensed run; none is written yet",
),
"EXPORT_6DOF_TRAJECTORY": ExportConversion(
EXPORT_OWED,
None,
None,
"the trajectory tables written after the march have no parser here: one is written against a real export; none is written yet",
),
"STABILITY_TOOLBOX_EXPORT": ExportConversion(
EXPORT_OWED,
None,
None,
"its coefficient file has no parser here, and the command has never been run on a licensed build: there is no real export to write one against",
),
"SET_VTK_EXPORT_VARIABLES": ExportConversion(
EXPORT_NOT_AN_EXPORT,
None,
None,
"chooses the variables a later VTK export writes",
),
"DELETE_BL_VELOCITY_PROFILE": ExportConversion(
EXPORT_NOT_AN_EXPORT,
None,
None,
"deletes a profile; it writes no file",
),
"SET_PLOT_TYPE": ExportConversion(
EXPORT_NOT_AN_EXPORT,
None,
None,
"chooses which plot a later SAVE_PLOT_TO_FILE writes",
),
"SAVE_PLOT_TO_FILE": ExportConversion(
EXPORT_OWED,
None,
None,
"the plotted series as text, a run header, one row per point of the plot and a units footer (RPT-067); collected and hashed as a product of the point, and never read as a coefficient source, because a plot is a display of the solve: its pitching moment is not the exported CMy",
),
"EXPORT_SOLVER_ANALYSIS_CSV": ExportConversion(
EXPORT_PARSED,
"pyflightstream.results.parse_solver_analysis_csv",
None,
"four bare columns under no header: x, y, z and the scalar the call asked for",
),
"EXPORT_SOLVER_ANALYSIS_FORCE_DISTRIBUTIONS": ExportConversion(
EXPORT_PARSED,
"pyflightstream.results.parse_force_distributions",
None,
"per-panel pressure and viscous force coefficients, by boundary",
),
"EXPORT_BL_VELOCITY_PROFILE": ExportConversion(
EXPORT_OWED,
None,
None,
"no observed output file is available for this parser. Two licensed 26.123 captures, bounded at 1800 s and 240 s, reached this command after writing the preceding exports but produced no profile. RPT-027 records the 26.122 cause: the command opens a modal window and waits for dismissal even under -hidden with redirected streams. This observation does not establish the behavior of every build; a parser requires an observed file",
),
"EXPORT_ALL_OFF_BODY_STREAMLINES": ExportConversion(
EXPORT_PARSED,
"pyflightstream.results.parse_off_body_streamlines",
None,
"one table per streamline, located by its printed marker",
),
"EXPORT_SURFACE_SECTIONS": ExportConversion(
EXPORT_PARSED,
"pyflightstream.results.parse_surface_sections",
None,
"one section's cut, in the same format the all-sections export writes",
),
"EXPORT_ALL_SURFACE_SECTIONS": ExportConversion(
EXPORT_PARSED,
"pyflightstream.results.parse_surface_sections",
None,
"every section's cut; one parser reads both commands, on two observed files",
),
"SWEEPER_EXPORT_SPREADSHEET": ExportConversion(
EXPORT_PARSED,
"pyflightstream.results.parse_sweep_spreadsheet",
None,
"the sweeper's own polar, one row per sweep point",
),
}
pyflightstream.results.EXPORT_NOT_AN_EXPORT
module-attribute
¶
EXPORT_NOT_AN_EXPORT = 'not_an_export'
pyflightstream.results.EXPORT_VERDICTS
module-attribute
¶
EXPORT_VERDICTS: tuple[str, ...] = (
EXPORT_PARSED,
EXPORT_EXCLUDED,
EXPORT_NOT_AN_EXPORT,
EXPORT_OWED,
)
pyflightstream.results.ExportConversion
dataclass
¶
ExportConversion(
verdict: str,
parser: str | None,
format: str | None,
note: str,
)
How one phase: export command's output is read, if at all.
Attributes:
| Name | Type | Description |
|---|---|---|
verdict |
str
|
One of :data: |
parser |
str or None
|
Dotted path of the callable that reads the file, for a
|
format |
str or None
|
The structured format an |
note |
str
|
Why this entry has the verdict it has, in one sentence. |
pyflightstream.results.ExportSolution
dataclass
¶
ExportSolution(
angle_of_attack_deg: float,
sideslip_deg: float,
freestream_velocity_m_s: float,
solver_mode: str,
current_iteration: int,
frame: str | None,
reported_version: str,
reported_build: str,
)
The solution block every FlightStream text export prints above its table.
One dataclass rather than the same eight fields repeated on each
report: the four text formats below print this block character for
character, so it is a fact about the solver's export writer rather
than about any one export. :class:LoadsReport and
:class:ProbePointsReport keep their own flat fields, because they
are published API that predates this and widening is cheaper than
moving a name somebody imports.
Attributes:
| Name | Type | Description |
|---|---|---|
angle_of_attack_deg |
float
|
Angle of attack of the exported solution, in deg. |
sideslip_deg |
float
|
Side-slip angle, in deg. |
freestream_velocity_m_s |
float
|
Free-stream velocity, in m/s. |
solver_mode |
str
|
|
current_iteration |
int
|
Solver iteration the export reflects. |
frame |
str or None
|
Coordinate frame the positions and vectors are expressed in, as
printed after |
reported_version |
str
|
Version string printed in the footer, verbatim. |
reported_build |
str
|
Build number printed in the footer, verbatim. The precise discriminator, because every registered 26.1x up to 26.124 prints the same version string and 26.125 spells it differently (FR-18). |
pyflightstream.results.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"),
)
pyflightstream.results.FORCE_DISTRIBUTION_COLUMNS
module-attribute
¶
FORCE_DISTRIBUTION_COLUMNS: tuple[str, ...] = (
"Boundary",
"X",
"Y",
"Z",
"Cx",
"Cy",
"Cz",
"Cxv",
"Cyv",
"Czv",
)
pyflightstream.results.FieldNotInExportError
¶
Bases: PyflightstreamError, KeyError
A named field is not among the columns an export printed.
KeyError as the second base, because that is what a mapping
lookup by name has always raised here and user code catching it
must keep working (FR-39).
pyflightstream.results.ForceDistributionReport
dataclass
¶
ForceDistributionReport(
columns: tuple[str, ...],
values: ndarray,
solution: ExportSolution,
force_units: str,
moment_units: str,
)
Parsed EXPORT_SOLVER_ANALYSIS_FORCE_DISTRIBUTIONS output.
One row per panel of every exported boundary: the panel's position and its pressure and viscous force coefficients, which are meant to integrate to the coefficients the loads spreadsheet prints as a total (that equality is assumed here, not measured in a committed report).
Attributes:
| Name | Type | Description |
|---|---|---|
columns |
tuple of str
|
Always :data: |
values |
ndarray
|
The full table, shape |
solution |
ExportSolution
|
The solution block printed above the table. |
force_units, moment_units |
str
|
Units of the force and moment columns as printed. |
pyflightstream.results.FrozenSolve
dataclass
¶
FrozenSolve(first_step: int, count: int)
A frozen unsteady solve, counted in the log's 1-based time steps.
pyflightstream.results.IncompleteOutputError
¶
Bases: PyflightstreamError, ValueError
The output file ends before its structural terminator.
A loads spreadsheet without its footer or a table without its closing dashed line means the solver stopped mid-write; the campaign records the point as FAILED_INCOMPLETE_OUTPUT instead of consuming a silently shorter table (FR-17).
pyflightstream.results.LoadsNotFoundError
¶
Bases: PyflightstreamError, ValueError
No collected output of a run yields its loads spreadsheet.
Expected for failed points: a run that stopped before
EXPORT_SOLVER_ANALYSIS_SPREADSHEET leaves no coefficient table
behind, and :func:sweep_table turns this into a row without
coefficient columns instead of dropping the run.
pyflightstream.results.LoadsReport
dataclass
¶
LoadsReport(
angle_of_attack_deg: float,
sideslip_deg: float,
freestream_velocity_m_s: float,
requested_iterations: int,
convergence_limit: float,
solver_mode: str,
current_iteration: int,
solver_model: str | None,
forced_iterations: bool | None,
reference_velocity_m_s: float | None,
reference_length: float | None,
reference_area: float | None,
reynolds: float | None,
frame: str | None,
surfaces: dict[str, dict[str, float]],
total: dict[str, float],
force_units: str,
moment_units: str,
fs_version_reported: str,
fs_build: str,
print_tolerances: dict[str, float] = dict(),
)
Typed content of one aerodynamic loads spreadsheet.
The spreadsheet is the primary quantitative output of a run
(EXPORT_SOLVER_ANALYSIS_SPREADSHEET, FSM-26.120 p.352). Coefficients
are expressed in the analysis frame named by frame; forces
follow force_units and moments moment_units.
Attributes:
| Name | Type | Description |
|---|---|---|
angle_of_attack_deg |
float
|
Angle of attack in deg. |
sideslip_deg |
float
|
Side-slip angle in deg. |
freestream_velocity_m_s |
float
|
Free-stream velocity in m/s. |
requested_iterations |
int
|
Solver iteration limit of the run. |
convergence_limit |
float
|
Residual threshold declaring convergence. |
solver_mode |
str
|
|
current_iteration |
int
|
Iteration counter at export time. |
solver_model |
str or None
|
Solver model as printed, when present. |
forced_iterations |
bool or None
|
Whether the solver was forced to run all iterations. |
reference_velocity_m_s, reference_length, reference_area |
float or None
|
Coefficient normalization references, in the printed units. |
reynolds |
float or None
|
Reynolds number of the condition. |
frame |
str or None
|
Coordinate frame of the analysis. |
surfaces |
dict of str to dict of str to float
|
Per-surface coefficients, keyed surface name then column name (Cx, Cy, Cz, CL, CDi, CDo, CMx, CMy, CMz). The three moment coefficients are normalised by the reference chord, about the moment reference point, on every build (26.124 and 26.125). |
total |
dict of str to float
|
The Total row, same columns. |
force_units, moment_units |
str
|
Units of the force and moment columns as printed. |
fs_version_reported |
str
|
Version string printed in the footer, verbatim. |
fs_build |
str
|
Build number printed in the footer, verbatim. |
print_tolerances |
dict of str to float
|
Half a count of the last digit a header value was printed with, keyed
by the attribute that holds it: the free-stream velocity's, which
:func: |
diverged_columns
¶
diverged_columns() -> list[str]
Return the Total columns holding NaN or infinite values.
pyflightstream.results.LogTimes
dataclass
¶
LogTimes(
solver_run_time_s: float | None = None,
solver_initialization_s: float | None = None,
time_steps: int | None = None,
solver_mode: str | None = None,
)
The times and the step count a solver log prints.
Every field is None where the log does not print it, so an absent line is never reported as a zero.
Attributes:
| Name | Type | Description |
|---|---|---|
solver_run_time_s |
float or None
|
The LAST |
solver_initialization_s |
float or None
|
The last |
time_steps |
int or None
|
The total of the |
solver_mode |
str or None
|
|
pyflightstream.results.MalformedOutputError
¶
Bases: PyflightstreamError, ValueError
An output file is present and whole but cannot be read as itself.
The sibling of :class:IncompleteOutputError, and deliberately a
different type: incomplete means the solver stopped mid-write, this
means the bytes are all there and do not describe what the file
claims to be. A duplicated column, a second concatenated export, a
fractional or negative count, and a token that is not a number all
land here.
Also inherits from ValueError, so callers can catch either the package error base or the
standard value-error base.
pyflightstream.results.NOT_CARRIED_BY_THE_VTK
module-attribute
¶
NOT_CARRIED_BY_THE_VTK: tuple[str, ...] = (
"Singularity_strength",
)
pyflightstream.results.OFF_BODY_STREAMLINE_COLUMNS
module-attribute
¶
OFF_BODY_STREAMLINE_COLUMNS: tuple[str, ...] = (
"X",
"Y",
"Z",
"Mach",
"Cp_ref",
"vx",
"vy",
"vz",
"vtot",
"Cp",
)
pyflightstream.results.OffBodyStreamline
dataclass
¶
OffBodyStreamline(
index: int, declared_points: int, values: ndarray
)
One streamline of an off-body streamline export.
Attributes:
| Name | Type | Description |
|---|---|---|
index |
int
|
The streamline's own 1-based number, as printed after
|
declared_points |
int
|
The bare integer printed above the marker, verbatim. READ THE
NOTE ON :func: |
values |
ndarray
|
The streamline's points, shape |
pyflightstream.results.OffBodyStreamlinesReport
dataclass
¶
OffBodyStreamlinesReport(
columns: tuple[str, ...],
streamlines: tuple[OffBodyStreamline, ...],
declared_count: int,
solution: ExportSolution,
)
Parsed EXPORT_ALL_OFF_BODY_STREAMLINES output.
Attributes:
| Name | Type | Description |
|---|---|---|
columns |
tuple of str
|
Always :data: |
streamlines |
tuple of OffBodyStreamline
|
One entry per streamline, in printed order, numbered from one. |
declared_count |
int
|
The count printed after |
solution |
ExportSolution
|
The solution block printed above the table. |
pyflightstream.results.PROVENANCE_COLUMNS
module-attribute
¶
PROVENANCE_COLUMNS: tuple[str, ...] = (
DATA_ORIGIN_COLUMN,
REDUCTION_COLUMN,
REDUCTION_WINDOW_COLUMN,
)
pyflightstream.results.ProbePointsReport
dataclass
¶
ProbePointsReport(
columns: tuple[str, ...],
values: ndarray,
angle_of_attack_deg: float,
freestream_velocity_m_s: float,
current_iteration: int,
reported_version: str,
reported_build: str,
)
Parsed EXPORT_PROBE_POINTS output (FSM-26.120 pp.362-363, p.249).
Rows follow the probe creation order: the 26.120 round-trip
evidence (reports/RPT-004) shows the solver preserves the count
and row order of imported probes, which is what lets a
:class:~pyflightstream.probes.planar.PlannedProbes plan map rows
back to grid nodes.
Attributes:
| Name | Type | Description |
|---|---|---|
columns |
tuple of str
|
Column names as printed, starting with X, Y, Z (simulation length units, reference frame). |
values |
ndarray
|
The full table, shape |
angle_of_attack_deg |
float
|
Angle of attack of the exported solution (deg). |
freestream_velocity_m_s |
float
|
Free-stream velocity (m/s). |
current_iteration |
int
|
Solver iteration the export reflects. |
reported_version |
str
|
Version string printed in the footer, verbatim. |
reported_build |
str
|
Build number printed in the footer, verbatim (the precise discriminator, FR-18). |
field
¶
field(name: str) -> np.ndarray
Return one named column as an array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Printed column name, for example |
required |
fields
¶
fields() -> dict[str, np.ndarray]
All non-coordinate columns, keyed by printed name.
Drops straight into the flow-visualization writers of
:mod:pyflightstream.post.
pyflightstream.results.REDUCTION_CODES
module-attribute
¶
REDUCTION_CODES: dict[str, int] = {
"none": 0,
"time_average": 1,
"unknown": 2,
"last_step": 3,
}
pyflightstream.results.REDUCTION_WINDOW_CODES
module-attribute
¶
REDUCTION_WINDOW_CODES: dict[str, int] = {
"not_applicable": 0,
"not_printed": 1,
"unknown": 2,
"last_time_step": 3,
"averaging_window": 4,
}
pyflightstream.results.REDUCTION_WINDOW_COLUMN
module-attribute
¶
REDUCTION_WINDOW_COLUMN = 'reduction_window'
pyflightstream.results.REFERENCE_FRAME
module-attribute
¶
REFERENCE_FRAME = SurfaceFrame(
origin=(0.0, 0.0, 0.0),
axes=(
(1.0, 0.0, 0.0),
(0.0, 1.0, 0.0),
(0.0, 0.0, 1.0),
),
index=1,
)
pyflightstream.results.ResidualSample
dataclass
¶
ResidualSample(
iteration: int,
velocity_residual: float,
pressure_residual: float,
overflowed: frozenset[str] = frozenset(),
)
One row of the solver residual history.
Attributes:
| Name | Type | Description |
|---|---|---|
iteration |
int
|
Solver iteration number. |
velocity_residual |
float
|
Surface velocity residual, dimensionless. |
pressure_residual |
float
|
Surface pressure residual, dimensionless. |
overflowed |
frozenset of str
|
The columns ( |
pyflightstream.results.SOLVER_ANALYSIS_CSV_COLUMNS
module-attribute
¶
SOLVER_ANALYSIS_CSV_COLUMNS: tuple[str, ...] = (
"x",
"y",
"z",
"scalar",
)
pyflightstream.results.SOLVER_ANALYSIS_CSV_FIELD_UNSTATED
module-attribute
¶
SOLVER_ANALYSIS_CSV_FIELD_UNSTATED = 'UNSTATED'
pyflightstream.results.SOLVER_MODES
module-attribute
¶
SOLVER_MODES: tuple[str, ...] = ('steady', 'unsteady')
pyflightstream.results.SURFACE_SECTION_COLUMNS
module-attribute
¶
SURFACE_SECTION_COLUMNS: tuple[str, ...] = (
"Section_direction_value",
"X",
"Y",
"Z",
"nx",
"ny",
"nz",
"L",
"Cp",
"Mach",
"vx",
"vy",
"vz",
"vtot",
"Cp_ref",
"Theta",
"CF",
"Delta*",
"Delta",
"H",
)
pyflightstream.results.SWEEP_COLUMNS
module-attribute
¶
SWEEP_COLUMNS: tuple[str, ...] = (
"AOA (deg)",
"Beta (deg)",
"Velocity (m/sec)",
"Cx",
"Cy",
"Cz",
"CL",
"CDi",
"CDo",
"CMx",
"CMy",
"CMz",
)
pyflightstream.results.SolverAnalysisCsvReport
dataclass
¶
SolverAnalysisCsvReport(
columns: tuple[str, ...],
values: ndarray,
scalar_field: str,
)
Parsed EXPORT_SOLVER_ANALYSIS_CSV output.
Attributes:
| Name | Type | Description |
|---|---|---|
columns |
tuple of str
|
Always :data: |
values |
ndarray
|
The full table, shape |
scalar_field |
str
|
What the fourth column is, as the caller declared it from the
FORMAT argument of the export call, upper cased; or
:data: |
pyflightstream.results.SurfaceFrame
dataclass
¶
SurfaceFrame(
origin: _Vector,
axes: tuple[_Vector, _Vector, _Vector],
index: int = 1,
)
Where the frame a VTK was written in stands in the reference frame.
Attributes:
| Name | Type | Description |
|---|---|---|
origin |
tuple of float
|
The frame's origin in the reference frame, in the simulation's length
unit, as the script's |
axes |
tuple of tuple of float
|
The frame's X, Y and Z axes as unit vectors in the reference frame,
one per row: the rows of |
index |
int
|
The frame's index in the script; 1 is the reference frame. |
Examples:
>>> import numpy as np
>>> turned = SurfaceFrame(origin=(9.152, 0.0, 0.0),
... axes=((0.0, 1.0, 0.0), (-1.0, 0.0, 0.0), (0.0, 0.0, 1.0)), index=2)
>>> turned.to_reference(np.array([[-1.0, -0.5, 0.2]])).round(3).tolist()
[[9.652, -1.0, 0.2]]
case
property
¶
case: str
Which kind of placement this frame is, for the record of what was verified.
reference (no turn, no shift), translation (no turn), z-turn or
z-turn and translation (a turn about the z axis alone), or tilted
(any turn that moves the z axis). RPT-074 measured the second to fourth and
none other.
verified
property
¶
verified: bool
Whether this frame's case is one RPT-074 measured (everything but tilted).
to_reference
¶
to_reference(points: ndarray) -> np.ndarray
Return rows written in this frame as rows of the reference frame.
p = R^T p' + o, the inverse of how the solver wrote them. The solver
writes the velocity components the same way, origin included, so they
are undone by this too (the module's docstring gives the measurement).
from_record
classmethod
¶
from_record(stated: Mapping[str, object]) -> SurfaceFrame
Rebuild a frame from :meth:record's mapping.
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
If the mapping states no origin or no axes (a frame whose placement the script did not know cannot undo anything), or a value of it is not a number. |
pyflightstream.results.SurfaceSection
dataclass
¶
SurfaceSection(index: int, edges: int, values: ndarray)
One cross-section of a surface-section export.
Attributes:
| Name | Type | Description |
|---|---|---|
index |
int
|
The section's own 1-based number, as printed after
|
edges |
int
|
The count printed as |
values |
ndarray
|
The cut points, shape |
Examples:
>>> import numpy as np
>>> section = SurfaceSection(index=1, edges=2, values=np.arange(40.0).reshape(2, 20))
>>> section.count
2
>>> section.positions.shape
(2, 3)
pyflightstream.results.SurfaceSectionsReport
dataclass
¶
SurfaceSectionsReport(
columns: tuple[str, ...],
sections: tuple[SurfaceSection, ...],
declared_count: int,
solution: ExportSolution,
)
Parsed EXPORT_SURFACE_SECTIONS or EXPORT_ALL_SURFACE_SECTIONS output.
ONE REPORT FOR TWO COMMANDS, on evidence rather than on convenience:
the committed 26.120 single-section export and the committed 26.123
all-sections export carry the same banner, the same
Number of Surface Sections: label, the same twenty-column header
and the same Edges= block structure. The single-section command
writes a file holding one section; the difference is in what the
solver selects, not in the format.
Attributes:
| Name | Type | Description |
|---|---|---|
columns |
tuple of str
|
Always :data: |
sections |
tuple of SurfaceSection
|
One entry per section, in printed order, numbered from one. |
declared_count |
int
|
The count printed after |
solution |
ExportSolution
|
The solution block printed above the table. |
pyflightstream.results.SweepSpreadsheetReport
dataclass
¶
SweepSpreadsheetReport(
columns: tuple[str, ...],
values: ndarray,
solution: ExportSolution,
force_units: str,
moment_units: str,
)
Parsed SWEEPER_EXPORT_SPREADSHEET output, one row per sweep point.
The sweeper's own spreadsheet: the solver re-solves the case at each
point of the sweep and prints one row of integrated coefficients per
point, where :func:parse_loads reads the spreadsheet of a SINGLE
point. The two are different files and the difference matters to a
caller assembling a polar: this one already is the polar.
Attributes:
| Name | Type | Description |
|---|---|---|
columns |
tuple of str
|
:data: |
values |
ndarray
|
The full table, shape |
solution |
ExportSolution
|
The solution block printed above the table. Its angle of attack and iteration counter belong to the LAST point solved, not to the sweep: the sweep's own angles are the first column. |
force_units, moment_units |
str
|
Units of the force and moment columns as printed. |
pyflightstream.results.UnjudgeableSolve
dataclass
¶
UnjudgeableSolve(
first_step: int,
count: int,
steps: tuple[int, ...] = (),
frozen_from: int | None = None,
detail: str = "",
)
Bases: FrozenSolve
A solve whose native log cannot answer the freeze question.
A run that was stopped or killed leaves its last residual page without a
closing separator, and the detector refuses to read a table that ends
mid-write. That is not evidence of a freeze and it is NOT evidence of a
healthy solve either: on a real frozen log, cutting the last page hides
FrozenSolve(60, 2) entirely. An average that cannot be shown to avoid a
frozen solve is therefore refused exactly as a frozen one is -- and so
first_step is 1, which every window of the point ends at or after.
steps names the time
steps whose residual blocks could not be read; first_step is the first
of them, so a reader that knows only FrozenSolve still refuses rather
than accepts.
pyflightstream.results.UnsteadyPlotsReport
dataclass
¶
UnsteadyPlotsReport(
columns: tuple[str, ...], values: ndarray
)
Parsed UNSTEADY_SOLVER_EXPORT_PLOTS output, one row per time step.
The only file this package reads that carries a HISTORY rather than a converged state: the loads spreadsheet and the probe export each describe one instant, and the residual log counts iterations rather than physical time.
The manual specifies one column per plot and one row per time step (FSM-26.120 p.347). Committed rpt134/control_plots.txt and s10_26125/plots_26.125.txt fixtures establish comma-terminated rows, a closing dashed rule and a software footer on their measured builds.
Attributes:
| Name | Type | Description |
|---|---|---|
columns |
tuple of str
|
Plot names exactly as printed, in file order. THE ORDER IS
DATA, not a contract: the set of columns is whatever plots the
run defined, so a reader resolves a series by its label
through :meth: |
values |
ndarray
|
The full table, shape |
series
¶
series(name: str) -> np.ndarray
Return one plot's history as an array over the time steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Printed column name, for example |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Shape |
Raises:
| Type | Description |
|---|---|
FieldNotInExportError
|
If the export carries no column of that name. |
series_by_name
¶
series_by_name() -> dict[str, np.ndarray]
Every column keyed by its printed name.
Returns:
| Type | Description |
|---|---|
dict of str to numpy.ndarray
|
One array of shape |
pyflightstream.results.UnsupportedResultTypeError
¶
Bases: PyflightstreamError, TypeError
:func:~pyflightstream.results.to_table was handed a kind it cannot tabulate.
TypeError as the second base, and it is the whole point of the
class rather than a compatibility courtesy: except TypeError is
how a caller distinguishes "I passed the wrong KIND of thing" from
"I passed a bad VALUE", which is what every ValueError-based
refusal in this package means. A handler that already catches
TypeError around the call catches exactly what it caught before
and except PyflightstreamError now catches it too (FR-39,
OPS-2009.01.08).
Raised for a result of a type no parser here produces, and for a
:class:pandas.DataFrame, which is a table already and is refused
rather than tabulated twice.
pyflightstream.results.VELOCITY_COMPONENTS
module-attribute
¶
VELOCITY_COMPONENTS: tuple[str, str, str] = (
"Vx",
"Vy",
"Vz",
)
pyflightstream.results.VersionMismatchWarning
¶
Bases: PyflightstreamWarning
The version printed in an output disagrees with the requested one.
Warned, not raised: the run evidence is still recorded, with the reported string and build stored verbatim in the manifest (FR-18).
pyflightstream.results.VtkSurface
dataclass
¶
VtkSurface(
points: ndarray,
offsets: ndarray,
connectivity: ndarray,
point_data: dict[str, ndarray] = dict(),
cell_data: dict[str, ndarray] = dict(),
title: str = "",
field_data: dict[str, float | str] = dict(),
)
One surface solution: its nodes, its polygons and their values.
Attributes:
| Name | Type | Description |
|---|---|---|
points |
ndarray
|
Node coordinates, shape |
offsets |
ndarray
|
Where each polygon starts in |
connectivity |
ndarray
|
The 0-based node indices of every polygon, one after another. |
point_data |
dict of str to numpy.ndarray
|
One value per node for each point scalar, in the file's order. |
cell_data |
dict of str to numpy.ndarray
|
One value per polygon for each cell scalar, in the file's order. |
title |
str
|
The file's title line. |
field_data |
dict of str to float or str
|
The dataset's |
Examples:
>>> import numpy as np
>>> quad = VtkSurface(
... points=np.array([[0.0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]]),
... offsets=np.array([0, 4]),
... connectivity=np.array([0, 1, 2, 3]),
... cell_data={"Cp": np.array([0.25])},
... )
>>> quad.n_points, quad.n_cells
(4, 1)
topology_differs
¶
topology_differs(other: VtkSurface) -> str | None
Say how other's nodes and polygons differ from these, or None when they agree.
One topology is one node count, one polygon count and the same node indices around every polygon; where the nodes stand is not part of it.
pyflightstream.results.classify_solver_mode
¶
classify_solver_mode(printed: str) -> str | None
Return the canonical solver mode, or None when it is unknown.
The printed string is kept on the report as evidence; this is the single place that decides whether the package recognizes it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
printed
|
str
|
The value printed after |
required |
Returns:
| Type | Description |
|---|---|
str or None
|
One of :data: |
pyflightstream.results.delimited_table
¶
delimited_table(
text: str,
header_anchor: str,
delimiter: str | None = ",",
) -> list[list[str]]
Read a table's data rows, from its header row to its terminator.
The table is located by the first line starting with
header_anchor; dashed separator lines after the header are
skipped, and rows accumulate until the closing dashed line. The
terminator is structural: reaching the end of the text without it
raises :class:IncompleteOutputError (FR-17).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Complete output file text. |
required |
header_anchor
|
str
|
Start of the header row, for example |
required |
delimiter
|
str or None
|
Cell separator of the data rows; None splits on any whitespace (the log tables are tab separated). |
','
|
Returns:
| Type | Description |
|---|---|
list of list of str
|
One list of stripped cells per data row. |
Raises:
| Type | Description |
|---|---|
AnchorNotFoundError
|
If no line starts with |
IncompleteOutputError
|
If the text ends before the closing separator line. |
pyflightstream.results.drag_pair
¶
drag_pair(row: Mapping[str, float]) -> tuple[str, str]
Return the drag split one parsed loads row carries, in the order it is printed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
mapping of str to float
|
A row of :class: |
required |
Returns:
| Type | Description |
|---|---|
tuple of str
|
|
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
If the row carries neither pair, or both. |
Examples:
>>> drag_pair({"CL": 0.4, "CDp": 0.01, "CDv": 0.002})
('CDp', 'CDv')
pyflightstream.results.export_conversion
¶
export_conversion(command: str) -> ExportConversion
Return how one export command's output is read, refusing an unknown.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
Command name as the database spells it, for example
|
required |
Returns:
| Type | Description |
|---|---|
ExportConversion
|
The classification. |
Raises:
| Type | Description |
|---|---|
FieldNotInExportError
|
When the name is not a classified export command. |
Examples:
>>> from pyflightstream.results import export_conversion
>>> export_conversion("EXPORT_PROBE_POINTS").parser
'pyflightstream.results.parse_probe_points'
pyflightstream.results.frozen_time_steps
¶
frozen_time_steps(
log_text: str, *, unjudged: list[int] | None = None
) -> FrozenSolve | None
Detect a freeze from the printed residuals of an unsteady log.
A time step is frozen when every inner iteration after its first prints
exactly zero velocity residual and its last iteration prints both residuals
exactly zero (the package's own criterion; no committed report measures it
against the solver). A solve is
frozen only when at least two consecutive time steps meet this rule; the
result names the first step of the first such stretch and counts the frozen
steps in qualifying stretches. Step numbers come from the solver's 1-based
(k/N) markers, never from its cumulative inner-iteration counter.
Steady logs, which have no unsteady step markers, return None.
unjudged OPTS IN TO TOLERANCE, and the post stage is its only caller.
A block whose residual pages cannot be read -- a header with no rows under
it, which is what a run stopped by its walltime guard leaves, or a page cut
mid-write -- is then SKIPPED and its step number appended, rather than
raising. Without it this raises as it always has, which is what the collect
path needs to record FAILED_INCOMPLETE_OUTPUT (FR-17).
A skipped block is not evidence of a healthy step and must never be read as one: it breaks the streak, so it can neither begin nor extend a freeze, and the caller is handed the step numbers to refuse the windows they fall in.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_text
|
str
|
Complete text of an unsteady solver log. |
required |
unjudged
|
list of int
|
When given, the tolerant mode described above: the number of every block whose residual pages cannot be read is appended to this list instead of raising. |
None
|
Returns:
| Type | Description |
|---|---|
FrozenSolve or None
|
The first frozen step and the count of frozen steps, or None when no stretch of two consecutive steps is frozen. |
Raises:
| Type | Description |
|---|---|
IncompleteOutputError
|
If a block has no readable residual page and |
MalformedOutputError
|
If a residual page of a block cannot be parsed and |
pyflightstream.results.imported_trailing_edges
¶
imported_trailing_edges(log_text: str) -> dict[str, int]
Read how many trailing edges the solver says it imported, per boundary.
The wake-edge import logs N trailing edges imported for boundary
<name> when it marks something and logs nothing when a file marks
nothing (RPT-061), so this count is the one statement the solver makes
about a file of points. Several import lines for one boundary are
summed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_text
|
str
|
Complete log text, an EXPORT_LOG output or the log the solver left. The NUL bytes a hidden-mode log carries between lines are removed. |
required |
Returns:
| Type | Description |
|---|---|
dict of str to int
|
Edges imported per boundary name, in the order first logged. Empty when the log carries no import line, which is what a file that matched no edge leaves. |
Examples:
>>> from pyflightstream.results import imported_trailing_edges
>>> imported_trailing_edges("16 trailing edges imported for boundary Wing")
{'Wing': 16}
pyflightstream.results.labeled_value
¶
labeled_value(text: str, label: str) -> str
Return the value printed after a label, located by the label itself.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Complete output file text. |
required |
label
|
str
|
Printed label, for example |
required |
Returns:
| Type | Description |
|---|---|
str
|
The remainder of the line after the label, stripped. |
Raises:
| Type | Description |
|---|---|
AnchorNotFoundError
|
If no line of |
pyflightstream.results.origin_code
¶
origin_code(token: str) -> int
Return the published integer of one data_origin token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str
|
One key of :data: |
required |
Returns:
| Type | Description |
|---|---|
int
|
The integer the numeric-only formats carry. |
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
When the token is not one this package publishes. Refused rather than passed through, because an unrecognised token written into a file is an identifier that identifies nothing. |
pyflightstream.results.parse_count
¶
parse_count(
token: str,
*,
label: str,
minimum: int = 0,
counts: str = "iterations",
) -> int
Parse a solver-printed COUNT, refusing anything but a whole number.
Iteration numbers and limits are counts, and every one of them used
to be read as int(parse_number(token)), which truncates: a
printed 312.9 became 312 and a run's iteration count silently
lost its fractional part instead of saying that the field it came
from is not a count at all (PYFS-009). Truncation is the wrong
failure here because the consequence is a plausible number: nothing
downstream can tell 312 from a real 312.
Integrality was the whole guard until REV010-002, which pointed out
that it is only half of what a count means: -1 is a perfectly
whole number and not a possible iteration. A negative count printed
into a loads footer was read, believed, and carried into a
CONVERGED assessment. The domain floor is therefore part of the
parse rather than a check somebody downstream remembers to make.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str
|
The printed value. |
required |
label
|
str
|
The printed label, named in the error so the reader knows which field of which export is malformed. |
required |
minimum
|
int
|
Smallest value this field can physically take. Iteration
NUMBERS count from zero, which is the default; a REQUESTED
iteration budget passes |
0
|
counts
|
str
|
What the field counts, named in the error message. REV010-007 routed the FSI sectional parser and the probe parser through this function, and the messages went on saying "this field counts iterations" about surface sections and probe points, which is a didactic-policy defect exactly where it matters most, in the terminal a user is standing at . |
'iterations'
|
Returns:
| Type | Description |
|---|---|
int
|
The value, exactly. |
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
If the token is not a number at all, is not finite, is a number
with a fractional part, or is below |
pyflightstream.results.parse_force_distributions
¶
parse_force_distributions(
text: str,
*,
requested_version: str | FsVersion | None = None,
) -> ForceDistributionReport
Parse an EXPORT_SOLVER_ANALYSIS_FORCE_DISTRIBUTIONS file.
Anchor-based like every parser here: the table is located by its
Boundary, header, the columns are pinned against
:data:FORCE_DISTRIBUTION_COLUMNS, and the footer is structural, so
a file that stops mid-write raises rather than returning a shorter
table (FR-17).
GROUNDING. Written against two observed exports, both committed:
force_distributions_26.123.txt (96 panel rows, build 8112026) and
force_distributions_26.120.txt (build 7012026). The database
entry is verified on 26.120 through 26.123 (FSM-26.120 pp.353-354).
AN EMPTY DISTRIBUTION IS RETURNED, NOT REFUSED, and the 26.120
fixture is why the question came up: it is a complete file, footer
and both rules present, whose table holds no rows because the export
ran at iteration zero. The file says so structurally, so returning
zero rows reports what the solver wrote; raising would name a defect
the file does not have. Check :attr:ForceDistributionReport.count
before integrating anything.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Complete export file text. |
required |
requested_version
|
str, FsVersion, or None
|
When given, the version and build printed in the footer are cross-checked against it and a mismatch warns (FR-18). |
None
|
Returns:
| Type | Description |
|---|---|
ForceDistributionReport
|
The pinned table plus the printed solution block. |
Raises:
| Type | Description |
|---|---|
AnchorNotFoundError
|
When the header or a labelled solution value is missing. |
MalformedOutputError
|
When the header is not the pinned layout, a row holds too many values, a cell is not a solver-printed number, or a boundary index is not a whole number of at least one. |
IncompleteOutputError
|
When the footer, the closing rule or part of a row is missing. |
pyflightstream.results.parse_log_times
¶
parse_log_times(text: str) -> LogTimes
Read the solver run time, the initialization time and the time steps off a log.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Complete log text, an EXPORT_LOG output or a scheduler's job output carrying the same lines. |
required |
Returns:
| Type | Description |
|---|---|
LogTimes
|
Each field None where the log prints no such line. |
pyflightstream.results.parse_number
¶
parse_number(token: str) -> float
Parse one solver-printed number.
Accepts the solver's forms: .000, 4380000., 1.000E-05,
signed values such as +0.0002056, and three-digit exponents with
the marker omitted, such as 0.2964-322 (0.2964E-322).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str
|
The printed number, as it stands in the file. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The value of the token. |
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
If the token is not a number (a |
pyflightstream.results.parse_off_body_streamlines
¶
parse_off_body_streamlines(
text: str,
*,
requested_version: str | FsVersion | None = None,
) -> OffBodyStreamlinesReport
Parse an EXPORT_ALL_OFF_BODY_STREAMLINES file into per-streamline tables.
The export writes one shared column header and then repeats, once per
streamline, a bare integer, a Streamline N marker and that
streamline's points. The blocks are located by their markers, never
by counting lines, and the number of blocks is checked against the
printed Number of Off-body Streamlines: (FR-17).
GROUNDING. Written against off_body_streamlines_26.123.txt, an
observed export of build 8112026: three streamlines of thirty points
each. The database entry is verified on 26.120 through 26.123
(FSM-26.120 p.369).
THE BARE INTEGER IS NOT ASSERTED TO BE THE ROW COUNT, and this is a
measurement rather than a caution. Every one of the three streamlines
in the observed export prints 31 and then writes thirty rows.
Nothing in the file or in the manual paraphrase settles what the
extra one is (a seed point that is counted and not written, a segment
count, or an off-by-one in the export), so this package records the
printed number verbatim as
:attr:OffBodyStreamline.declared_points and does NOT equate it with
:attr:OffBodyStreamline.points. Equating them would refuse every
real export of this format, which is a worse answer than saying that
one number is not yet understood. The count that IS checked is the
number of streamlines, which the observed export gets right.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Complete export file text. |
required |
requested_version
|
str, FsVersion, or None
|
When given, the version and build printed in the footer are cross-checked against it and a mismatch warns (FR-18). |
None
|
Returns:
| Type | Description |
|---|---|
OffBodyStreamlinesReport
|
One table per streamline plus the printed solution block. |
Raises:
| Type | Description |
|---|---|
AnchorNotFoundError
|
When the header or a labelled solution value is missing. |
MalformedOutputError
|
When the header is not the pinned layout, a row is malformed, a row appears before any streamline marker, a block carries no point count, or the streamlines are not numbered one upward. |
IncompleteOutputError
|
When the footer or the closing rule is missing, when a streamline holds no point at all, or when the number of streamlines written is not the number declared. |
pyflightstream.results.parse_probe_points
¶
parse_probe_points(
text: str, requested_version=None
) -> ProbePointsReport
Parse an EXPORT_PROBE_POINTS file into a typed report.
Anchor-based like every parser here: the point count is read from
its printed label, the table from its X, Y, Z, header to the
closing dashed line, and a declared-versus-parsed row mismatch
raises instead of returning less (FR-17). The boundary-layer
columns are part of the table; with the viscous coupling off they
are inert zeros, and asserting that is the caller's business
(DLV-006 Sec. 2.3).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Complete export file text. |
required |
requested_version
|
str or FsVersion
|
Version the run requested; when given, the printed version is cross-checked and a mismatch warns (FR-18). |
None
|
Returns:
| Type | Description |
|---|---|
ProbePointsReport
|
Typed table plus the solution metadata. |
Raises:
| Type | Description |
|---|---|
AnchorNotFoundError
|
If a printed label or the table header the parser anchors on is absent. |
IncompleteOutputError
|
If the software footer is missing, or the table holds FEWER rows than the file declares, so the export ended early. |
MalformedOutputError
|
If the table holds MORE rows than the file declares (it holds rows it did not declare), or a row does not match the header. |
pyflightstream.results.parse_residual_history
¶
parse_residual_history(text: str) -> list[ResidualSample]
Parse the residual table of an exported solver log.
The log's iteration table carries the velocity and pressure residuals the convergence threshold applies to (FSM-26.120 p.200); the final row is the convergence evidence of the run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Complete log text (EXPORT_LOG output or captured log file). |
required |
Returns:
| Type | Description |
|---|---|
list of ResidualSample
|
The history in iteration order; the first three columns of each row (iteration, velocity residual, pressure residual) are parsed, further columns vary with the run setup. |
Raises:
| Type | Description |
|---|---|
IncompleteOutputError
|
If the log holds no residual table (a |
MalformedOutputError
|
If a row cannot be read, or the iteration counter does not
increase down the table (a |
pyflightstream.results.parse_residual_solves
¶
parse_residual_solves(
text: str,
) -> list[list[ResidualSample]]
Parse a solver log that holds several steady solves, one residual history each.
A quasi-steady rotor wheel is solved at each of its clockings in one run: the solver is
initialised again between them and each solve
prints its own residual table, its counter starting again at 1, so the
one log the run exports holds every clocking's solve in the order the
script ran them. :func:parse_residual_history refuses such a log, as it
must for a log of one solve, where a restart is two logs concatenated.
A NEW SOLVE IS A TABLE OF ITS OWN: the counter goes back to 1 on the
first row after the Iteration header. A counter that falls or repeats
anywhere else, or starts again at any other number, is refused as
:func:parse_residual_history refuses it, because it is not a solve the
solver started. Within each solve the counter increases. How many solves
the log must hold is the caller's to check against the run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Complete log text (EXPORT_LOG output or captured log file). |
required |
Returns:
| Type | Description |
|---|---|
list of list of ResidualSample
|
One history per solve, in the order the log prints them; a log of one solve gives one. |
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
A counter that does not increase inside a solve, or a restart that is not a new table starting at iteration 1. |
IncompleteOutputError
|
No residual row at all. |
Examples:
>>> page = "Iteration Res.Vel. Res.Pres.\n{}\n----------\n"
>>> log = page.format("1 1.0 1.0\n2 1e-6 1e-6") + page.format("1 1.0 1.0\n2 2e-6 1e-6")
>>> [[sample.iteration for sample in solve] for solve in parse_residual_solves(log)]
[[1, 2], [1, 2]]
pyflightstream.results.parse_run_loads
¶
parse_run_loads(
workspace: _ManifestWorkspace,
record: _ManifestRecord | str,
*,
loads_file: str | None = None,
) -> LoadsReport
Resolve and parse the loads spreadsheet of one recorded run.
The record's collected outputs (paths relative to its managed
simulation folder) are the only search space: run evidence lives
where the manifest says it does, never where a folder name
suggests. Without loads_file every collected output is tried
and exactly one must parse as a loads spreadsheet. The parsed
conditions are cross-checked against the record's sweep point
(alpha and beta in deg), so a same-named export overwritten by a
later point of the same simulation is refused instead of silently
standing in for this run's coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
CampaignWorkspace
|
The managed campaign workspace, already constructed. A bare
root path is NOT accepted: taking one made this layer import
the layer above it to build the workspace, which is the
upward dependency AD-01 forbids. Pass
|
required |
record
|
RunRecord or str
|
The manifest record, or its |
required |
loads_file
|
str
|
File name of the loads spreadsheet among the collected outputs, or the recorded path of one of them when several share the name; required when several outputs parse as loads tables. |
None
|
Returns:
| Type | Description |
|---|---|
LoadsReport
|
The parsed spreadsheet; the version printed in its footer is cross-checked against the version the run requested (FR-18). |
Raises:
| Type | Description |
|---|---|
LoadsNotFoundError
|
When no collected output yields a loads spreadsheet (the normal outcome of a failed point). |
AmbiguousLoadsError
|
When several collected outputs parse as loads spreadsheets and
|
MalformedOutputError or IncompleteOutputError
|
When an output that opens as a loads spreadsheet (its |
FileNotFoundError
|
When a recorded output is no longer on disk, for example after the simulation folder was archived. |
MalformedOutputError
|
When |
pyflightstream.results.parse_solver_analysis_csv
¶
parse_solver_analysis_csv(
text: str, *, field: str | None = None
) -> SolverAnalysisCsvReport
Parse an EXPORT_SOLVER_ANALYSIS_CSV file, whose columns nothing names.
THIS EXPORT WRITES NO HEADER. Four comma-separated columns of
solver-printed floats and nothing else: no banner, no labelled
solution block, no software footer. Every other parser here anchors
on a printed label, and there is none to anchor on, so what the
columns mean cannot be read out of the file and had to be settled
from evidence. What follows is that evidence, because a column
labelled on a guess is worse than a column labelled column_3.
WHAT IS SETTLED, and how. The observed export is
solver_analysis_26.123.csv, from a generated NACA 0012 wing
of chord 1 m and span 8 m,
called as EXPORT_SOLVER_ANALYSIS_CSV <path> CP-FREESTREAM PASCALS
1 -1 (the arguments the database names filename, format, units,
frame and surfaces; FSM-26.120 p.353).
- Column 1 is X. Its 86 rows take exactly seven values, and they are the seven cosine-spaced chordwise node stations of that mesh (0, 0.066987, 0.25, 0.5, 0.75, 0.933013, 1), spanning 0 to the 1 m chord.
- Column 2 is Y. It takes exactly seven values, the spanwise node stations at multiples of 8/6 m from -4 to +4, which is the wing's full span.
- Column 3 is Z. At each X it takes the two values plus and minus the NACA 0012 half-thickness there (0.0312 at x = 0.75, 0.0093 at x = 0.933, 0 at the trailing edge), and its extreme, 0.0594, is the section's own maximum half-thickness.
- Column 4 is the scalar the FORMAT argument asked for. Its values
match, station for station and surface for surface, the
Cpcolumn of the surface-section export captured in the same run (-0.2274 against -0.2293 on the upper surface near x = 0.93, -0.0570 against -0.0512 on the lower), so it is a pressure coefficient and not a pressure in the PASCALS the third argument names: that argument applies to the PRESSURE format.
WHAT IS NOT SETTLED, and is therefore not labelled. Which pressure
coefficient is a property of the CALL and not of the file: FORMAT
selects among CP-FREESTREAM, CP-REFERENCE and PRESSURE, and the
observed run cannot even distinguish the first two, because it set
the reference velocity equal to the free-stream velocity, which makes
the section export's Cp and Cp_ref columns identical to seven
digits. The column is therefore named scalar and the caller may
say what it asked for through field, which is carried onto the
report and into the table rather than inferred.
NO VERSION IS CROSS-CHECKED (FR-18) and this function takes no
requested_version: the file prints no software footer, so there
is nothing to check against and a parameter that silently did nothing
would be worse than its absence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Complete export file text. |
required |
field
|
str or None
|
The FORMAT argument the export was called with, for example
|
None
|
Returns:
| Type | Description |
|---|---|
SolverAnalysisCsvReport
|
The four columns plus what the caller said the fourth one is. |
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
When a line does not hold exactly four solver-printed numbers,
when the file carries the labelled block of a different export,
or when |
IncompleteOutputError
|
When the file holds no row at all. |
Examples:
>>> from pyflightstream.results import parse_solver_analysis_csv
>>> text = (
... " 0.100E+01, -0.400E+01, 0.000E+00, -0.141E+00\n"
... " 0.933E+00, -0.400E+01, -0.933E-02, -0.570E-01\n"
... )
>>> report = parse_solver_analysis_csv(text, field="CP-FREESTREAM")
>>> report.columns
('x', 'y', 'z', 'scalar')
>>> report.count
2
>>> report.scalar_field
'CP-FREESTREAM'
>>> float(report.scalar[0])
-0.141
pyflightstream.results.parse_surface_sections
¶
parse_surface_sections(
text: str,
*,
requested_version: str | FsVersion | None = None,
) -> SurfaceSectionsReport
Parse a surface-section export into one table per cross-section.
The export writes one shared column header and then repeats, once per
section, an Edges=N line, a Surface cross-section N marker
and that section's cut points. Two counts are declared and both are
checked: the number of sections against
Number of Surface Sections:, and each section's row count against
its own Edges=. A mismatch raises rather than returning a shorter
table (FR-17).
GROUNDING. Written against two observed exports, both committed:
all_surface_sections_26.123.txt (build 8112026,
EXPORT_ALL_SURFACE_SECTIONS, one section of twelve edges) and
surface_sections_26.120.txt (build 7012026,
EXPORT_SURFACE_SECTIONS, one section of zero edges). The database
entries are verified on 26.120 through 26.123 for the all-sections
command and documented for the single-section one (FSM-26.120 p.365).
A SECTION OF ZERO EDGES IS A REAL FILE and is returned as a section
with no rows. The 26.120 fixture is one: its cutting plane was laid
on a spanwise panel boundary, so it crossed no edge and the solver
wrote Edges=0 and no rows. The file declares that, so it is
reported rather than refused; a caller integrating along a section
checks :attr:SurfaceSection.count first. The equality between
Edges and the row count still holds, and is what would catch a
section that lost rows it declared.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Complete export file text. |
required |
requested_version
|
str, FsVersion, or None
|
When given, the version and build printed in the footer are cross-checked against it and a mismatch warns (FR-18). |
None
|
Returns:
| Type | Description |
|---|---|
SurfaceSectionsReport
|
One table per section plus the printed solution block. |
Raises:
| Type | Description |
|---|---|
AnchorNotFoundError
|
When the header or a labelled solution value is missing. |
MalformedOutputError
|
When the header is not the pinned layout, a row is malformed, a
row appears before any section marker, a section carries no
|
IncompleteOutputError
|
When the footer or the closing rule is missing, when a section holds fewer rows than the edges it declares, or when the number of sections written is not the number declared. |
pyflightstream.results.parse_sweep_spreadsheet
¶
parse_sweep_spreadsheet(
text: str,
*,
requested_version: str | FsVersion | None = None,
) -> SweepSpreadsheetReport
Parse a SWEEPER_EXPORT_SPREADSHEET file into the polar it holds.
Anchor-based like every parser here: the table is located by its
AOA (deg), header, the columns are pinned against
:data:SWEEP_COLUMNS or the observed 26.125 layout with CDp, CDv,
and the footer is structural (FR-17).
GROUNDING. Written against sweeper_spreadsheet_26.123.txt, an
observed export of build 8112026 holding a three-point angle sweep.
The database entry is verified on 26.101 through 26.123
(FSM-26.120 p.359).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Complete export file text. |
required |
requested_version
|
str, FsVersion, or None
|
When given, the version and build printed in the footer are cross-checked against it and a mismatch warns (FR-18). |
None
|
Returns:
| Type | Description |
|---|---|
SweepSpreadsheetReport
|
The pinned table plus the printed solution block. |
Raises:
| Type | Description |
|---|---|
AnchorNotFoundError
|
When the header or a labelled solution value is missing. |
MalformedOutputError
|
When the header is not the pinned layout or a row is malformed. |
IncompleteOutputError
|
When the footer or the closing rule is missing, or when the sweep holds no point at all. |
pyflightstream.results.read_vtk_surface
¶
read_vtk_surface(source: str | Path) -> VtkSurface
Read a surface solution the solver exported as VTK legacy ASCII polydata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str or Path
|
The |
required |
Returns:
| Type | Description |
|---|---|
VtkSurface
|
Its nodes, polygons and scalars, in the frame the file was written in. |
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
If the file is not ASCII polydata of polygons carrying one-component scalars, which is what the solver's surface export writes (RPT-074), or if a count, an index or a value contradicts the file. |
IncompleteOutputError
|
If the file ends inside a block it declared. |
Examples:
>>> import pathlib, tempfile
>>> text = (
... "# vtk DataFile Version 3.0\nFlightStream vtk output\nASCII\nDATASET POLYDATA\n"
... "POINTS 3 float\n0 0 0\n1 0 0\n0 1 0\nPOLYGONS 1 4\n3 0 1 2\n"
... "CELL_DATA 1\nSCALARS Cp_reference FLOAT\nLOOKUP_TABLE default\n-0.5\n"
... )
>>> path = pathlib.Path(tempfile.mkdtemp()) / "solution.vtk"
>>> _ = path.write_text(text)
>>> surface = read_vtk_surface(path)
>>> surface.n_points, surface.n_cells, surface.cell_data["Cp_reference"].tolist()
(3, 1, [-0.5])
pyflightstream.results.reduction_code
¶
reduction_code(token: str) -> int
Return the published integer of one reduction token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str
|
One key of :data: |
required |
Returns:
| Type | Description |
|---|---|
int
|
The integer the numeric-only formats carry. |
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
When the token is not one this package publishes. |
pyflightstream.results.reduction_for_solver_mode
¶
reduction_for_solver_mode(printed: str | None) -> str
Name the reduction behind a row, from the solver mode it printed.
The single place the mapping is decided, so the sweep table, the per-parser tables and the numeric-only writers cannot disagree about what an unsteady export's coefficients are.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
printed
|
str or None
|
The value printed after |
required |
Returns:
| Type | Description |
|---|---|
str
|
One key of :data: |
Notes
An unsteady export states the last time step only, one instant of a
cycle (docs/definitions/the-unsteady-polar.md); it was labelled
time_average in legacy releases, a solver average no package run asks
for.
pyflightstream.results.reject_duplicate_columns
¶
reject_duplicate_columns(
columns: Sequence[str], *, what: str
) -> None
Refuse a table header that names the same column twice.
A duplicated name is not a cosmetic problem: the row is read into a
mapping, so one physical quantity silently takes another's label and
a column disappears. The loads parser has refused this since
PYFS-009; the probe parser did not, and the review's reproduction is
exact (a header rewritten from Mach, Cp_ref to
Cp_ref, Cp_ref returned the Mach value under the Cp label).
Both call this now, so the two cannot drift apart again
(REV010-003).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
columns
|
sequence of str
|
The header names, already stripped. |
required |
what
|
str
|
Name of the export, for the error message. |
required |
Returns:
| Type | Description |
|---|---|
None
|
The header is acceptable when the call returns. |
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
If any normalized name appears more than once (a |
pyflightstream.results.reject_trailing_export
¶
reject_trailing_export(text: str, *, what: str) -> None
Refuse a file that holds a second complete export after the first.
The footer is located with a first-match search and the table helper stops at the first closing separator, so a second normally terminated export was simply invisible: the duplicate-total guard never saw it and the caller received the first report with no indication that another one existed (REV010-006). Appended or stale solver output must not be silently ignored, because the consumer cannot then know which complete export was intended.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Complete file text. |
required |
what
|
str
|
Name of the export, for the error message. |
required |
Returns:
| Type | Description |
|---|---|
None
|
The file is acceptable when the call returns. |
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
If the file holds more than one software footer (a |
Notes
The function owns the footer rule and counts footers itself; callers supply no parser offset.
pyflightstream.results.require_export_parser
¶
require_export_parser(command: str) -> str
Return the parser of one export command, or refuse naming the format.
The refusal is the point of this function: a conversion that is not available must SAY so, naming the format and the reason, rather than being skipped and leaving a caller with a shorter set of tables than it asked for.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
Command name as the database spells it. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Dotted path of the parser callable. |
Raises:
| Type | Description |
|---|---|
FieldNotInExportError
|
When the name is not a classified export command. |
MalformedOutputError
|
When the command has no converter: an excluded structured format, a command that exports nothing, or one whose parser is still owed. The message names which of the three it is. |
pyflightstream.results.run_table
¶
run_table(
record: _ManifestRecord,
*,
loads: LoadsReport | None = None,
) -> Table
Join one manifest record with its parsed loads into one wide row.
The row carries the run identity and conditions from the manifest
(POL first, the polar the run belongs to under the
name the run matrix gives its polar column, then run_id,
sim_id, the data_origin and reduction pair
of PFS-2014.05, the sweep point axes in their sweep units:
alpha and beta in deg, advance_ratio dimensionless), the recorded
versions and outcome (fs_version_requested,
fs_version_reported, fs_build, package_version,
status, iterations, residual, wall_time_s in s),
and, when loads is given, the analysis frame, the
force_units / moment_units metadata, and the Total row
coefficients under their printed names in those printed units.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
RunRecord
|
One manifest record, read through
:meth: |
required |
loads
|
LoadsReport
|
The run's parsed loads spreadsheet, for example from
:func: |
None
|
Returns:
| Type | Description |
|---|---|
Table
|
One row; missing numeric outcomes are NaN. |
pyflightstream.results.stamped_translation
¶
stamped_translation(
vtk: str, dat: str, step: int
) -> tuple[str, str]
Return the names one step's VTK and its Tecplot carry (RPT-041 finding 3).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vtk
|
str
|
The VTK file name. |
required |
dat
|
str
|
The Tecplot file name. |
required |
step
|
int
|
The solver step the files belong to. |
required |
Returns:
| Type | Description |
|---|---|
tuple of (str, str)
|
The VTK and Tecplot names with |
Examples:
>>> stamped_translation("P1-AL+000.vtk", "P1-AL+000.dat", 37)
('P1-AL+000_iteration=37.vtk', 'P1-AL+000_iteration=37.dat')
pyflightstream.results.superseded_by_a_continuation
¶
superseded_by_a_continuation(
records: Iterable[_ManifestRecord],
) -> dict[str, str]
Return the runs a later run CONTINUED, each mapped to the run that continued it.
A continuation archives the contents of the point's folder and writes into
that same folder, and a record is never rewritten, so the stopped run's
outputs go on naming files its continuation wrote. Read through that
record, the point appears twice with the continuation's numbers. The
continuation states which run it continues (continues)
and that statement is the ONLY thing read here: two runs that merely
resemble each other are both kept. A record written in legacy releases states
nothing and is never dropped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
records
|
iterable of manifest records
|
The run records of a workspace, each with a |
required |
Returns:
| Type | Description |
|---|---|
dict of str to str
|
Each continued run's id mapped to the id of the run that continued it. |
pyflightstream.results.surface_in_reference
¶
surface_in_reference(
surface: VtkSurface, frame: SurfaceFrame
) -> VtkSurface
Return the surface with its nodes and velocity components in the reference frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface
|
VtkSurface
|
A surface as the solver wrote it, in the analysis loads frame. |
required |
frame
|
SurfaceFrame
|
That frame, as the script placed it. |
required |
Returns:
| Type | Description |
|---|---|
VtkSurface
|
The same polygons, the nodes turned and moved back, the point scalars
|
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
If the frame is not the reference frame and the surface carries some of the velocity components and not all three: each component was written from all three, so one alone cannot be undone. |
pyflightstream.results.to_csv
¶
to_csv(
result: object,
path: str | Path,
*,
overwrite: bool = False,
) -> Path
Write one parsed FlightStream result as a csv file.
The tidy table of :func:to_table is written without the
positional index, so the csv holds exactly the documented columns
in their documented units, plus the data_origin and
reduction columns every file this package writes carries
(PFS-2014.05). It is the one write path of a parsed result, so a table
that cannot say what produced its numbers is refused here too.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
object
|
One parsed result of the kinds :func: |
required |
path
|
str or Path
|
Target csv file; its parent folder must exist. |
required |
overwrite
|
bool
|
Whether an existing file may be replaced; False by default, so a product is never replaced by accident. |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
The written file. |
Examples:
>>> import tempfile
>>> from pathlib import Path
>>> from pyflightstream.results import parse_unsteady_plots
>>> text = "Time (sec), CL\n.000, +2.3500000E-3,\n.004, +2.1000000E-3,\n"
>>> text += "------------\nSoftware : Flightstream version 26.1, build #7012026\n"
>>> report = parse_unsteady_plots(text)
>>> with tempfile.TemporaryDirectory() as folder:
... written = to_csv(report, Path(folder) / "plots.csv")
... header = written.read_text(encoding="utf-8").splitlines()[0]
>>> header.split(',')[:2]
['Time (sec)', 'CL']
pyflightstream.results.translate_surface_exports
¶
translate_surface_exports(
folder: str | Path,
translations: Sequence[Mapping[str, object]],
*,
frame: Mapping[str, object] | None = None,
) -> list[dict[str, object]]
Translate one point's surface batch and record elapsed time and problems.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder
|
str or Path
|
Where the solver wrote the VTK files, the point's working directory. |
required |
translations
|
sequence of mapping
|
What the script recorded: |
required |
frame
|
mapping
|
The frame to use where a translation states no placement. |
None
|
Returns:
| Type | Description |
|---|---|
list of dict
|
Each translation as recorded, with |
pyflightstream.results.translate_vtk_surface
¶
translate_vtk_surface(
vtk: str | Path,
dat: str | Path,
*,
frame: SurfaceFrame,
overwrite: bool = False,
native_tecplot: str | Path | None = None,
periodic_copies: int | None = None,
) -> dict[str, object]
Write exact VTK cell values plus optional matched native nodal strength.
Native strength is read from the same point/step's auxiliary Tecplot export,
never interpolated from Cp or substituted from the final step. A run without
that auxiliary source, a legacy one or one whose pproc leaves
singularity_strength false (the default), keeps an explicit
not-carried declaration.
periodic_copies is the copy count of a row under SYMMETRY PERIODIC. Its native
export holds one zone per copy, and the VTK holds the
modelled surface first and then its images (RPT-080), so zone k is joined
to the k-th copy of the VTK (native_surface.attach_native_strength_by_copy);
a native file holding another number of
zones is refused naming both counts. None, or 1, is the one-zone export of
every other row.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vtk
|
str or Path
|
The VTK surface export to translate. |
required |
dat
|
str or Path
|
The Tecplot file to write, in the reference frame. |
required |
frame
|
SurfaceFrame
|
Where the frame the VTK was written in stands in the reference frame. |
required |
overwrite
|
bool
|
Whether an existing |
False
|
native_tecplot
|
str or Path
|
The same point's native Tecplot export, whose nodal strength is matched to the VTK. None carries no native strength. |
None
|
periodic_copies
|
int
|
Copy count of a |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
What was done: the source and its digest, the frame, the location of
the values, the variables, what is not carried, the native record when
one was matched, and |
Raises:
| Type | Description |
|---|---|
ProductError
|
If the native source and the destination are the same file. |
IncompleteOutputError
|
If the native source named is not a file. |
MalformedOutputError
|
If the VTK or the native source changed during translation, or the
native zones cannot be matched to the VTK. A frame with left-handed
axes is refused when it is built ( |
Examples:
>>> import tempfile
>>> from pathlib import Path
>>> import numpy as np
>>> quad = VtkSurface(
... points=np.array([[0.0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]]),
... offsets=np.array([0, 4]),
... connectivity=np.array([0, 1, 2, 3]),
... cell_data={"Cp": np.array([0.25])},
... )
>>> frame = SurfaceFrame(origin=(0.0, 0.0, 0.0),
... axes=((1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0)))
>>> with tempfile.TemporaryDirectory() as folder:
... vtk = write_vtk_surface(Path(folder) / "a.vtk", quad, title="demo")
... record = translate_vtk_surface(vtk, Path(folder) / "a.dat", frame=frame)
... written = (Path(folder) / "a.dat").is_file()
>>> written, record["variables"], record["not_carried"]
(True, ['Cp'], ['Singularity_strength'])
pyflightstream.results.window_for_reduction
¶
window_for_reduction(reduction: str) -> str
Return the window token that goes with a reduction this package stamps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reduction
|
str
|
One key of :data: |
required |
Returns:
| Type | Description |
|---|---|
str
|
One key of :data: |
Raises:
| Type | Description |
|---|---|
MalformedOutputError
|
When |
Notes
time_average maps to not_printed rather than to a window,
because such an average would be the solver's and the spreadsheet
does not describe it; it is kept for files written in legacy releases.
last_step maps to last_time_step, the instant an unsteady
export states. unknown maps to unknown: a row whose solver
mode never printed cannot be said to have been averaged at all.
A DICT RATHER THAN A CHAIN OF IFS, so an unhandled token is a refusal
rather than a default. The chain it replaced ended in a fallback
returning not_printed, which made the time_average branch
above it behaviourally dead and stamped a solver average on rows that
may have had none.
pyflightstream.results.write_tecplot_surface
¶
write_tecplot_surface(
path: str | Path,
surface: VtkSurface,
*,
title: str,
auxdata: Mapping[str, str] | None = None,
zone: str = "Surface",
overwrite: bool = False,
) -> Path
Write a surface as one Tecplot FEPolygon zone, its cell values cell-centred.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
The |
required |
surface
|
VtkSurface
|
The surface, in the frame the file should state (the reference frame). |
required |
title
|
str
|
The file's |
required |
auxdata
|
mapping of str to str
|
|
None
|
zone
|
str
|
The zone's title. |
'Surface'
|
overwrite
|
bool
|
Whether an existing file may be replaced. False by default. |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
The file written. |
Raises:
| Type | Description |
|---|---|
ProductExistsError
|
If the file exists and |
ProductError
|
If an auxiliary record's name is not a Tecplot name, or a variable name repeats. |
pyflightstream.results.write_vtk_surface
¶
write_vtk_surface(
path: str | Path,
surface: VtkSurface,
*,
title: str,
overwrite: bool = False,
) -> Path
Write a surface as VTK legacy ASCII polydata, in the layout the solver writes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
The |
required |
surface
|
VtkSurface
|
The surface. |
required |
title
|
str
|
The title line; one line, at most 256 characters as the format allows. |
required |
overwrite
|
bool
|
Whether an existing file may be replaced. False by default. |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
The file written. |
Raises:
| Type | Description |
|---|---|
ProductExistsError
|
If the file exists and |
ProductError
|
If a point or cell field name is empty or holds whitespace, which the
VTK |