pyflightstream.results.core (provisional)¶
Generated from the docstrings at build time: every one of the 34 names in the __all__ of pyflightstream.results.core has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
The errors, the anchor primitives and the code vocabularies of the results layer.
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 by alias prefix, the
reported string and build recorded verbatim (FR-18).
Beside the primitives live the two vocabularies every layer above reads and
none may own: :data:DATA_ORIGIN_CODES and :data:REDUCTION_CODES, append
only (PFS-2014.05), and :data:EXPORT_CONVERSIONS, the classification of
every phase: export command of the database (PFS-2014.02).
Every parser module of the layer imports from here and this module imports none of them, so the package root is a facade over leaves and no module of the layer imports the root.
Every public name is re-exported, unchanged, by :mod:pyflightstream.results,
its path (AD-11).
Advanced¶
pyflightstream.results.core.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.core.DATA_ORIGIN_CODES
module-attribute
¶
DATA_ORIGIN_CODES: dict[str, int] = {"raw": 0, "reduced": 1}
pyflightstream.results.core.DATA_ORIGIN_COLUMN
module-attribute
¶
DATA_ORIGIN_COLUMN = 'data_origin'
pyflightstream.results.core.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.core.EXPORT_NOT_AN_EXPORT
module-attribute
¶
EXPORT_NOT_AN_EXPORT = 'not_an_export'
pyflightstream.results.core.EXPORT_VERDICTS
module-attribute
¶
EXPORT_VERDICTS: tuple[str, ...] = (
EXPORT_PARSED,
EXPORT_EXCLUDED,
EXPORT_NOT_AN_EXPORT,
EXPORT_OWED,
)
pyflightstream.results.core.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.core.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.core.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.core.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.core.PROVENANCE_COLUMNS
module-attribute
¶
PROVENANCE_COLUMNS: tuple[str, ...] = (
DATA_ORIGIN_COLUMN,
REDUCTION_COLUMN,
REDUCTION_WINDOW_COLUMN,
)
pyflightstream.results.core.REDUCTION_CODES
module-attribute
¶
REDUCTION_CODES: dict[str, int] = {
"none": 0,
"time_average": 1,
"unknown": 2,
"last_step": 3,
}
pyflightstream.results.core.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.core.REDUCTION_WINDOW_COLUMN
module-attribute
¶
REDUCTION_WINDOW_COLUMN = 'reduction_window'
pyflightstream.results.core.SOLVER_MODES
module-attribute
¶
SOLVER_MODES: tuple[str, ...] = ('steady', 'unsteady')
pyflightstream.results.core.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.core.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.core.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.core.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.core.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.core.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.core.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.core.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.core.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.core.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.core.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.core.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.core.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.core.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.core.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.