pyflightstream.results.loads (provisional)¶
Generated from the docstrings at build time: every one of the 8 names in the __all__ of pyflightstream.results.loads has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
The loads file, the probe-points export and the unsteady plots file, parsed.
:func:parse_loads reads one run's loads file into a :class:LoadsReport,
:func:parse_probe_points a probe-points export into a
:class:ProbePointsReport, and :func:parse_unsteady_plots the unsteady
solver's plot file into an :class:UnsteadyPlotsReport. A probe export's
columns are the export's own header, so they are read from the file rather
than pinned.
Every public name is re-exported, unchanged, by :mod:pyflightstream.results,
its path (AD-11).
Used in the guides¶
pyflightstream.results.loads.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.loads.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
Advanced¶
pyflightstream.results.loads.DRAG_PAIRS
module-attribute
¶
DRAG_PAIRS: tuple[tuple[str, str], ...] = (
("CDi", "CDo"),
("CDp", "CDv"),
)
pyflightstream.results.loads.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.loads.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.loads.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.loads.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.loads.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. |