Skip to content

pyflightstream.results.exports (provisional)

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

The solver's export tables: force distributions, streamlines, sections, sweeps, CSV.

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.

Every public name is re-exported, unchanged, by :mod:pyflightstream.results, its path (AD-11).

Advanced

pyflightstream.results.exports.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

Steady or Unsteady as printed. The reduction token every table of this export carries is decided from it by :func:reduction_for_solver_mode.

current_iteration int

Solver iteration the export reflects.

frame str or None

Coordinate frame the positions and vectors are expressed in, as printed after Coordinate frame for analysis:; None when the export omits the label.

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.exports.FORCE_DISTRIBUTION_COLUMNS module-attribute

FORCE_DISTRIBUTION_COLUMNS: tuple[str, ...] = (
    "Boundary",
    "X",
    "Y",
    "Z",
    "Cx",
    "Cy",
    "Cz",
    "Cxv",
    "Cyv",
    "Czv",
)

pyflightstream.results.exports.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:FORCE_DISTRIBUTION_COLUMNS; carried on the report so a caller can index a row without importing the constant.

values ndarray

The full table, shape (count, 10), in printed order. Units and reference frame are the constant's.

solution ExportSolution

The solution block printed above the table.

force_units, moment_units str

Units of the force and moment columns as printed.

count property

count: int

Number of panel rows.

boundary_indices property

boundary_indices: ndarray

The Boundary column as 1-based integer indices.

positions property

positions: ndarray

Panel positions, shape (count, 3): the X, Y, Z columns.

field

field(name: str) -> np.ndarray

Return one printed column as an array.

Parameters:

Name Type Description Default
name str

One of :data:FORCE_DISTRIBUTION_COLUMNS, for example "Cxv".

required

pyflightstream.results.exports.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.exports.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 Streamline.

declared_points int

The bare integer printed above the marker, verbatim. READ THE NOTE ON :func:parse_off_body_streamlines before treating it as the row count: on the only observed export it exceeds the row count by exactly one, on all three streamlines.

values ndarray

The streamline's points, shape (points, 10), in integration order. Columns, units and frame are :data:OFF_BODY_STREAMLINE_COLUMNS.

points property

points: int

Number of points actually written for this streamline.

positions property

positions: ndarray

The X, Y, Z columns, shape (points, 3).

field

field(name: str) -> np.ndarray

Return one printed column of this streamline as an array.

pyflightstream.results.exports.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:OFF_BODY_STREAMLINE_COLUMNS.

streamlines tuple of OffBodyStreamline

One entry per streamline, in printed order, numbered from one.

declared_count int

The count printed after Number of Off-body Streamlines:. It is checked against the number of blocks read, which is what makes a truncated export raise rather than return fewer streamlines.

solution ExportSolution

The solution block printed above the table.

count property

count: int

Number of streamlines.

points property

points: int

Total number of points over every streamline.

pyflightstream.results.exports.SOLVER_ANALYSIS_CSV_COLUMNS module-attribute

SOLVER_ANALYSIS_CSV_COLUMNS: tuple[str, ...] = (
    "x",
    "y",
    "z",
    "scalar",
)

pyflightstream.results.exports.SOLVER_ANALYSIS_CSV_FIELD_UNSTATED module-attribute

SOLVER_ANALYSIS_CSV_FIELD_UNSTATED = 'UNSTATED'

pyflightstream.results.exports.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.exports.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.exports.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:SOLVER_ANALYSIS_CSV_COLUMNS. THESE NAMES ARE THIS PACKAGE'S, not the solver's: the export prints no header.

values ndarray

The full table, shape (count, 4), in printed order.

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:SOLVER_ANALYSIS_CSV_FIELD_UNSTATED when the caller said nothing. The file itself cannot say.

count property

count: int

Number of rows, which is the number of mesh nodes exported.

positions property

positions: ndarray

Node positions, shape (count, 3): the x, y, z columns.

scalar property

scalar: ndarray

The fourth column, shape (count,); see :attr:scalar_field.

pyflightstream.results.exports.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 Surface cross-section.

edges int

The count printed as Edges=N above the marker. Equal to the number of rows in every observed export, and asserted so by :func:parse_surface_sections.

values ndarray

The cut points, shape (edges, 20), in printed order. Columns, units and frame are :data:SURFACE_SECTION_COLUMNS.

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)

count property

count: int

Number of rows written for this section, which is edges.

positions property

positions: ndarray

The X, Y, Z columns, shape (edges, 3).

field

field(name: str) -> np.ndarray

Return one printed column of this section as an array.

pyflightstream.results.exports.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:SURFACE_SECTION_COLUMNS.

sections tuple of SurfaceSection

One entry per section, in printed order, numbered from one.

declared_count int

The count printed after Number of Surface Sections:, checked against the number of blocks read.

solution ExportSolution

The solution block printed above the table.

count property

count: int

Number of sections.

points property

points: int

Total number of cut points over every section.

pyflightstream.results.exports.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:SWEEP_COLUMNS, with CDp, CDv replacing CDi, CDo where the export prints the 26.125 split.

values ndarray

The full table, shape (points, 12), in printed order. Units and frame are the constant's.

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.

points property

points: int

Number of sweep points, which is the number of rows.

field

field(name: str) -> np.ndarray

Return one printed column as an array over the sweep points.

Parameters:

Name Type Description Default
name str

One of this report's printed columns, for example "CL".

required

pyflightstream.results.exports.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.exports.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.exports.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 Cp column 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 "CP-FREESTREAM". Recorded upper cased and never validated against the database here: the emitter already refused an unknown format when the script was written, and a second copy of that enumeration in this layer is a copy that can drift.

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 field is given as blank.

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.exports.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 Edges= line, or the sections are not numbered one upward.

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.exports.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.