pyflightstream.post (stable)¶
Generated from the docstrings at build time: every one of the 32 names in the __all__ of pyflightstream.post has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Results into engineering data.
Pipeline role: the top of the pipeline, where parsed solver output becomes something a report can carry. Public modules and private ones, and the list is what EXISTS rather than what is planned (a tier-1 test holds it to the modules on disk). Each says whether it is reached through this package or through its own module, which is stated rather than left to be discovered:
- :mod:
pyflightstream.post.rotor_section_framesaligns recorded section cuts; reached by the rotor section product pipeline. - :mod:
pyflightstream.post.rotor_sections_surfacecuts labelled blade surfaces; reached by the rotor section product pipeline. - :mod:
pyflightstream.post.rotor_sections_productswrites blade-local wake products; reached by the workspace far-field pipeline. - :mod:
pyflightstream.post.point_tableswrites declared solver tables; reached by the workspace pipeline. - :mod:
pyflightstream.post._structurewrites structural response and tip columns; reached by the workspace pipeline. - :mod:
pyflightstream.post.inflow_toolsregisters plan-time inflow maps; reached by the workspace pipeline. - :mod:
pyflightstream.post.correctionsregisters calibration commands; reached by the workspace pipeline. - :mod:
pyflightstream.post.polarselects explicit polar axes; reached by the workspace pipeline. - :mod:
pyflightstream.post._noise_productswrites opt-in exploratory loading noise; reached by the workspace pipeline. - :mod:
pyflightstream.post._matrix_templatesupplies the complete matrix example and its explanation to the workspace input guide. - :mod:
pyflightstream.post.diagnosticsrenders complete saved post logs as Markdown without executing stages or changing products. Its report renderer is re-exported here and registered through workspace for lower-layer callers; category presentation helpers remain in that module; - :mod:
pyflightstream.post.probe_fieldsexports sampled velocity and reusable inflow with explicit units and source provenance. Sampled volume uses the same probes/fluid-plots route and writes vertex clouds; native saved section indices remain a separate manual API concern. Re-exported here; - :mod:
pyflightstream.post.field_framesholds the coordinate and velocity transforms the sampled-field and boundary-layer products share, each with its native convention stated. Reached through its own module; - :mod:
pyflightstream.post.boundary_layerwrites the raw VTK boundary-layer scalars at recorded surface-section cut points, with the source cell of each value. It never averages, interpolates to nodes, guesses a thickness unit or builds a wall-normal velocity profile. Reached through its own module; - :mod:
pyflightstream.post.surfacesaverages the per-step surface exports of an unsteady window into one surface, the product a pproc's[time_averaging]asks for. Reached through its own module; - :mod:
pyflightstream.post.section_distributionstables the sectional loads and chordwise Cp, one table per recorded pproc distribution. Reached through its own module; - :mod:
pyflightstream.post.farfield_fieldssamples the far-field probe values of one point (the Trefftz C plane and the survey lattice), and :mod:pyflightstream.post.farfield_productswrites the Trefftz-plane and balance tables of a simulation from them. Reached through their own modules; - :mod:
pyflightstream.post.streamlineswrites the off-body streamlines of a point as a legacy VTK polydata file, from the solver's own export. Reached through its own module; - :mod:
pyflightstream.post.qsteadytables a quasi-steady rotor's steady clockings and their average, and gives its sections the 1P reduced frequency of each station. Reached through its own module; - :mod:
pyflightstream.post.harmonicsfits each blade station's 0P, 1P and 2P load around the disc from the written sections. Reached through its own module; - :mod:
pyflightstream.post.correctionswrites a quasi-steady wheel's corrected products beside the raw ones and its Theodorsen and Sears diagnostic, none of it validated. Reached through its own module; - :mod:
pyflightstream.post.acousticsreads a point's acoustic signals export into one signal per observer and writes, per observer, the pressure against time, the spectrum, the overall sound pressure level and the blade-passage harmonics, and the directivity when the observers lie on an arc. Reached through its own module; - :mod:
pyflightstream.post.disc_mapstables a rotor's sectional load by radius and azimuth over the disc, from a quasi-steady wheel's clockings or an unsteady rotor's last complete revolution. Reached through its own module; - :mod:
pyflightstream.post.inflow_toolswrites a product table in the installed frame and the blade-view harmonics of a custom inflow. Reached through its own module; - :mod:
pyflightstream.post.qsteady_noiseholds the exploratory quasi-steady rotor noise model: a blade's load reconstructed against azimuth from a quasi-steady wheel's clockings and propagated to an observer by a compact loading-noise model, reached by explicit exploratory opt-in. Its report writer, :func:pyflightstream.post.qsteady_noise.write_qsteady_noise_report, is an index of those exploratory signals in the current product manifest. Reached through its own module; - :mod:
pyflightstream.post.custom_polarand :mod:pyflightstream.post.provenancehold the custom polar format and the PROV-JSON writer that the products entry below names; their existing import spellings remain available through :mod:pyflightstream.post.products; - :mod:
pyflightstream.post.writerswrites flow-visualization exports (VTK legacy ASCII and Tecplot ASCII), each beside a settings record that lets the file be read alone. Re-exported here; - :mod:
pyflightstream.post.unsteadyreads a per-timestep field export back as an ordered series and averages it over a blade passage. Re-exported here; - :mod:
pyflightstream.post.productswrites the campaign's CSV products, the polar table per group, the sections table and the plots table per point, from the collected exports and the manifest (PFS-2029.15); the custom polar format beside the polar table when asked (PFS-2014.01.01), its writer and reader re-exported here; and a PROV-JSON provenance document per recorded run (PFS-2012.08.01). Its other writers (the polar row, the rotor table, the per-blade table, the unsteady polar) and the header of an unsteady polar's axes are reached through :mod:pyflightstream.post.productsitself and are not re-exported here. It is (AD-13) the campaign stage and the facade of the product FAMILIES, sibling modules each reached through its own module or throughproducts, which re-exports every name of their__all__at its public path: :mod:pyflightstream.post.polar(the group polar and its rows), :mod:pyflightstream.post.rotor_table(one coefficient table per rotor), :mod:pyflightstream.post.unsteady_polar(the time-averaged polar of an unsteady simulation) and :mod:pyflightstream.post.point_tables(the sections, plots, probes, reduction and per-revolution tables of a point); - :mod:
pyflightstream.post.superfilewrites the SUPERFILE of each polar and group beside the polar table (FR-89), one row per converged point whose column set is a superset of everything the workspace knows about that simulation, and the measurement of what it wrote underreports/. Reached through its own module rather than re-exported here: everything it offers is called by the products stage, and a reader wanting it wants its page; - :mod:
pyflightstream.post.seriestables the stamped per-step exports of a windowed unsteady point, one table per export kind under the matrix'sseries/(PFS-2031.18.01); itswrite_point_seriesis re-exported here. It is not :func:write_seriesbelow, which writes the plots export's own history for the reductions; - :mod:
pyflightstream.post.reductionsis the writing seam that keeps a reduction from overwriting the file it came from. Re-exported here, and it was the one this list omitted while naming the module below, which this package does NOT re-export; - :mod:
pyflightstream.post.settings_tableprojects a solver-flag snapshot into an all-numeric table, for tools that cannot read strings. Imported from its own module, because the projection is optional and lossy and a reader should meet its page first; - :mod:
pyflightstream.post.axesis the ONE home of the frame conventions: the export's frame, the body, stability and wind axes with sideslip, the eighteen axis coefficients of a polar row, and where a blade is at a step. Reached through its own module, because a reader asking which frame a published column is in wants that page and nothing else; - :mod:
pyflightstream.post.equationsevaluates a pproc's[equations]over the averaged columns of an unsteady polar. Reached through its own module: the products stage is its caller, and a user writing an equation reads the generatedWRITING-EQUATIONS.mdfirst; - :mod:
pyflightstream.post.guideswrites the generated input guides beside a workspace's pproc artifacts:VARIABLES.mdandWRITING-EQUATIONS.md, and the input glossaryINPUTS.md, every key an input artifact may state (G08); also the input templateinput_template.mdat the root ofinputs/, a complete example of every kind of input file (G47). Re-exported here. It (AD-11) writes the two pproc guides itself and re-exports the other two pages, :mod:pyflightstream.post.glossary, the input glossary with the parts the three pages share, and :mod:pyflightstream.post.input_template, the input template; - :mod:
pyflightstream.post._tablesis PRIVATE: the table primitives (the condition block, the CSV writer, the column renaming) the product modules share, so that no two of them import each other; - the PRIVATE modules of the post stage (AD-13), below the
families or between them and the campaign stage:
:mod:
pyflightstream.post._stage(the products layout, the verdict of a frozen solve, the names a file may carry, the post log records and the partial post), :mod:pyflightstream.post._condition(what a recorded point states: its condition, state, clock, windows and reference), :mod:pyflightstream.post._admit(which records of a simulation can supply a product row), :mod:pyflightstream.post._sim(one simulation's post over its frozen context, the families called in the manifest's order), :mod:pyflightstream.post._rotor_plan(where a rotor's loads come from: its plot source and its recorded speed), :mod:pyflightstream.post._reduction_stage(the reductions of a point's plots table), :mod:pyflightstream.post._rotor_products(a point's series and its quasi-steady, harmonic, noise and disc-map products), :mod:pyflightstream.post._additional(the products of the additional post), :mod:pyflightstream.post._transfer_functions(the Bessel functions and the Theodorsen and Sears transfer functions the quasi-steady corrections apply), :mod:pyflightstream.post._field_inputs(the input template's far-field, streamline and probe-lattice example and its left-out reasons), :mod:pyflightstream.post._products_campaign(the campaign products' context, admission and native surface indexing, AD-23), :mod:pyflightstream.post._settings_product(the settings table and its codebook as a campaign product, FR-419) and :mod:pyflightstream.post._installed_copies(the installed-frame copies of the probes table and the reusable inflow profile, FR-420) and :mod:pyflightstream.post._cn_slope(the normal-force slope of a rotor against incidence, FR-3502; kept unreached while[products] rotor_cn_slopeis a named skip, until PFS-2241 reads it from the rotor group RCOEF files) and :mod:pyflightstream.post._merged_polar(the unsteady polar with its rotor tables and ROTATE angles on one row, FR-3511); - the PRIVATE modules of the post tree (PFS-2231, PFS-2232):
:mod:
pyflightstream.post._run_block(the canonical run block, the columns every csv of the post opens with), :mod:pyflightstream.post._block_scope(that block at the head of every table written to the tree), :mod:pyflightstream.post._point_stage(the run block row of each point of a simulation), :mod:pyflightstream.post._family_columns(the column registry of the family, group, sections and Cp files), :mod:pyflightstream.post._family_polar(the polar files by family and by group, FAM-DIM, FAM-ACOEF and FAM-RCOEF), :mod:pyflightstream.post._polar_stage(the polar step of one simulation's post), :mod:pyflightstream.post._section_tables(the sections and Cp tables keyed by FAMILY and FAMILY_ID), :mod:pyflightstream.post._manifest_schema(the machine-readable statement of the tree inproducts.json: kinds, frames, families, groups), :mod:pyflightstream.post._tree_migration(what moved and what retired from the earlier layout, and the warning that says so) and :mod:pyflightstream.post._retired_polars(the polar files of the earlier layout found beside the new ones).
WHAT THIS LAYER DOES NOT HAVE, said plainly because this docstring
advertised it for three releases and a reader has no other way to find
out. There is no ResultArray facade: no interp_along, no
reparametrize, no trim method. The trimmed polar is a product of its
own, :func:write_trimmed_polar, carried by FR-2302 and FR-2303 and asked for by the pproc's
[products] trimmed_polar. The [[polar_at]] entries expose linear
interpolation and re-parameterization as CSV products through
:func:pyflightstream.post.polar.write_interpolated_polar (FR-3343 to FR-3349).
Sweep assembly is not here either, it is
:mod:pyflightstream.results.tables.
Advanced¶
pyflightstream.post.CustomPolarTable
dataclass
¶
CustomPolarTable(
description: str,
polar: str,
mach: float,
date: str,
group: int,
reference: ReferenceValues,
columns: tuple[str, ...],
rows: list[dict[str, float]],
)
One file of the custom polar format, read back: the header block and the rows.
Attributes:
| Name | Type | Description |
|---|---|---|
description |
str
|
The title line's description, after |
polar |
str
|
The polar identifier, line 2 without its two-digit Mach code. |
mach |
float
|
The nominal Mach number, |
date |
str
|
Line 3 as written; :func: |
group |
int
|
The group number of line 4. |
reference |
ReferenceValues
|
The reference block of line 6. |
columns |
tuple of str
|
The column names of line 9, in the file's order. |
rows |
list of dict
|
One mapping per data row, column name to value. |
pyflightstream.post.FrameAverage
dataclass
¶
FrameAverage(
window: tuple[int, int],
n_frames: int,
points: ndarray,
fields: dict[str, ndarray],
sources: tuple[Path, ...],
source_window: tuple[int, int] | None = None,
)
A reduction of a :class:TimestepSeries over one window.
Attributes:
| Name | Type | Description |
|---|---|---|
window |
tuple of int
|
Inclusive |
n_frames |
int
|
How many frames fell inside the window and were averaged. A window holding none is refused rather than averaged, so this is never zero. |
points |
ndarray
|
Sample positions, shape |
fields |
dict of str to numpy.ndarray
|
Per-sample mean of each quantity over the window, shape
|
sources |
tuple of pathlib.Path
|
The frame files behind the series, carried through so the writing seam can refuse to overwrite one of them. |
source_window |
tuple of int or None
|
First and last source steps actually averaged, which can lie inside the declared window when exports are sparse. None for manually constructed averages without that evidence. |
pyflightstream.post.INPUT_TEMPLATE_NAME
module-attribute
¶
INPUT_TEMPLATE_NAME = 'input_template.md'
pyflightstream.post.OutputProvenance
¶
Bases: BaseModel
Where one post-processing file's numbers came from.
The minimum a reader needs to say what produced a file, with the
file in hand and nothing else: which run wrote it, which campaign
that run belongs to, and the complete solver-flag snapshot of the
script that ran (:class:~pyflightstream.script.solver_setup.SolverSetup).
The FlightStream version is not a field of its own: it is
setup.fs_version, the version the per-version defaults in the
snapshot were resolved against, and a second copy could disagree
with it.
Attributes:
| Name | Type | Description |
|---|---|---|
run_id |
str
|
Identity of the run, in the campaign's own vocabulary
( |
campaign |
(str, optional)
|
Campaign name, when the file belongs to one. None for a standalone survey written outside a campaign, which is a real case and not a missing value. |
setup |
SolverSetup
|
The solver-flag snapshot of the script that produced the data. |
Examples:
>>> from pyflightstream.post import OutputProvenance
>>> from pyflightstream.script import Script, helpers
>>> script = Script(version="26.120")
>>> setup = helpers.solver_settings(script, velocity=30.0)
>>> provenance = OutputProvenance(run_id="polar/sim_1/a+00.0", setup=setup)
>>> provenance.fs_version
'26.120'
fs_version
property
¶
fs_version: str
Canonical FlightStream version the snapshot was resolved against.
pyflightstream.post.PPROC_GUIDE_NAMES
module-attribute
¶
PPROC_GUIDE_NAMES: tuple[str, ...] = (
"VARIABLES.md",
"WRITING-EQUATIONS.md",
)
pyflightstream.post.ProductError
¶
Bases: PyflightstreamError, ValueError
A product cannot be written from what the run left.
Defined in the shared error catalogue so callers can catch a product refusal without importing the post-processing layer.
post.products re-exports it, so the public name and the pair of bases are
unchanged and except ValueError catches exactly what it always did.
pyflightstream.post.ProductExistsError
¶
Bases: ProductError
A product exists and overwrite was not given.
Its own class because the campaign writer treats it differently from every other refusal (PFS-2031.16): a refusal about one simulation's content is recorded as a skip and the other simulations are written, while this one is about the caller's flag and stops the stage.
pyflightstream.post.ReferenceValues
dataclass
¶
ReferenceValues(
sref_m2: float,
cref_m: float,
bref_m: float,
xmom_m: float = 0.0,
ymom_m: float = 0.0,
zmom_m: float = 0.0,
)
The reference block of a product: SREF, CREF, BREF and the moment point.
The moment point is in the geometry's own coordinate system, the one the solver holds the mesh in and reports loads about (the MRP frame the reference scripts created sits at this point); the units ride on the field names.
from_mapping
classmethod
¶
from_mapping(
values: Mapping[str, float],
) -> ReferenceValues
Read the block from a mapping keyed by the column names.
as_lengths
¶
as_lengths() -> dict[str, float]
Return the three reference LENGTHS, keyed by their column names.
For the product families that carry no moment: a probe sample and a reduction window have no moment coefficient, so three columns of moment point would be three columns of nothing. The lengths are what a reader of those files needs to check a coefficient against.
as_moment_point
¶
as_moment_point() -> dict[str, float]
Return the moment point, keyed by its column names.
For the families that DO carry a moment without carrying the polar's own
reference block: the unsteady polar and the reductions average the plots'
MX_/MY_/MZ_ columns, and a moment states nothing without the point it
is taken about.
pyflightstream.post.TimestepSeries
dataclass
¶
TimestepSeries(
steps: ndarray,
times_s: ndarray | None,
points: ndarray,
fields: dict[str, ndarray],
sources: tuple[Path, ...],
order_evidence: str = "given",
)
One field, at every exported time step of one unsteady run.
Attributes:
| Name | Type | Description |
|---|---|---|
steps |
ndarray
|
Solver step index of each frame, shape |
times_s |
ndarray or None
|
Solution time of each frame in seconds, when the frames carried one; None when the order came from the caller instead. |
points |
ndarray
|
Sample positions, shape |
fields |
dict of str to numpy.ndarray
|
One entry per exported quantity, shape |
sources |
tuple of pathlib.Path
|
The frame files, in the order they were read. Carried so a reduction taken from this series can be refused a destination equal to one of them. |
order_evidence |
str
|
How the order was established: |
pyflightstream.post.blade_passage_average
¶
blade_passage_average(
series: TimestepSeries,
*,
window: tuple[int, int],
read_steps: set[int] | None = None,
) -> FrameAverage
Average a series over one declared window of solver steps.
The only implementation of this average in the package. A
phase-locked reduction is this function applied once per passage,
over the windows :func:passage_windows hands out, rather than a
second averaging routine: two implementations of one average is how
two published numbers come to disagree.
It is PURE. It reads no file and writes none, so nothing about it
can enforce the rule that a reduction never overwrites what it came
from; that rule lives at the writing seam,
:func:pyflightstream.post.reductions.write_reduction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
series
|
TimestepSeries
|
The read-back frames. |
required |
window
|
tuple of int, keyword-only
|
Inclusive |
required |
read_steps
|
set of int or None
|
When supplied, collect the plotted steps used by this average. |
None
|
Returns:
| Type | Description |
|---|---|
FrameAverage
|
Per-sample means over the frames inside the window. |
Raises:
| Type | Description |
|---|---|
ProductError
|
If the window holds no frame, or is given backwards. An average of nothing is still a number, which is exactly why it is refused rather than returned as a NaN. |
pyflightstream.post.passage_windows
¶
passage_windows(
series: TimestepSeries, *, period_steps: int
) -> list[tuple[int, int]]
Cut a series into successive passages of a declared period.
The composition point for a phase-locked reduction: each window goes
through :func:blade_passage_average, so the release holds one
implementation of the average and this function holds only the
arithmetic of where a passage starts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
series
|
TimestepSeries
|
The read-back frames. |
required |
period_steps
|
(int, keyword - only)
|
Solver steps in one blade passage. For a rotor this is the caller's own conversion from RPM and blade count into steps; the library does not make it, because the time step is a fact of the run and not of the export. |
required |
Returns:
| Type | Description |
|---|---|
list of tuple of int
|
Inclusive |
Raises:
| Type | Description |
|---|---|
ProductError
|
If |
MalformedOutputError
|
If the frames' steps do not advance. |
pyflightstream.post.read_csv_table
¶
read_csv_table(
path: str | Path, *, skip: int = 0
) -> tuple[tuple[str, ...], list[dict[str, str]]]
Read one CSV table back: its columns and its rows as mappings of text.
Values come back as the text written, so a caller decides what is a number; a row whose width differs from the header is refused naming the line, which is what makes the round trip a proof.
skip drops that many lines before the header. Current tables start
with the header and column POL (G16). A legacy rotor table with its
alias alone on the first line is read with skip=1.
During a post, a table that post wrote comes back without the columns its IDENTIFIERS put
there, so what a product builds from it never holds them twice (FR-3565).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
The CSV table. |
required |
skip
|
int
|
Lines dropped before the header. |
0
|
Returns:
| Type | Description |
|---|---|
tuple of (tuple of str, list of dict of str to str)
|
The columns and the rows, each a mapping of column to the text written. |
Raises:
| Type | Description |
|---|---|
ProductError
|
If the file is empty, or a row's width differs from the header's, naming the line. |
pyflightstream.post.read_custom_polar_format
¶
read_custom_polar_format(
path: str | Path,
) -> CustomPolarTable
Read a custom polar format file back, as :func:write_custom_polar_format specifies it.
The counts the file states are checked against what it holds, which is what makes the round trip (write, read, write again) a proof rather than a re-echo: a reference line, a row or a row's width that does not fit its count is refused naming the line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
A file in the custom format. |
required |
Returns:
| Type | Description |
|---|---|
CustomPolarTable
|
The header block and the rows, each row a mapping of column name to value. |
Raises:
| Type | Description |
|---|---|
ProductError
|
If the file does not have the shape the writer's docstring states. |
pyflightstream.post.read_timestep_series
¶
read_timestep_series(
frames: Sequence[str | Path],
*,
order: str | None = None,
frequency: int = 1,
) -> TimestepSeries
Read exported frames back as one ordered series.
This reader supports stationary sample coordinates only. A moving point keeps its named refusal: moving-grid series are a new capability outside 0.44.0 (RB5-30), not coordinates silently borrowed from the first frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frames
|
sequence of str or pathlib.Path
|
The exported frame files. They may be handed over in any order
when each carries its own solution time; when they do not, the
sequence is the order and |
required |
order
|
str
|
|
None
|
frequency
|
int
|
Solver time steps between exported frames, the |
1
|
Returns:
| Type | Description |
|---|---|
TimestepSeries
|
The series, with the order evidence recorded on it. |
Raises:
| Type | Description |
|---|---|
ProductError
|
If |
MalformedOutputError
|
If no order can be established; if a frame is in neither
supported shape; if a frame's variables or sample count
disagree with the first frame's, or a sample sits at another
coordinate (beyond |
Examples:
Frames written by this package's own writers, read back in the order they were handed over:
>>> import numpy as np, pathlib, tempfile
>>> from pyflightstream.post import OutputProvenance, read_timestep_series
>>> from pyflightstream.post import write_tecplot_points
>>> from pyflightstream.script import Script, helpers
>>> setup = helpers.solver_settings(Script(version="26.120"), velocity=30.0)
>>> record = OutputProvenance(run_id="rotor/sim_1/a+00.0", setup=setup)
>>> folder = pathlib.Path(tempfile.mkdtemp())
>>> points = np.array([[0.0, 0.0, 0.0], [1.0, 0.0, 0.0]])
>>> written = [
... write_tecplot_points(
... folder / f"frame_{i}.dat", points, {"cp": np.array([v, v])},
... provenance=record,
... )[0]
... for i, v in enumerate([1.0, 2.0, 3.0])
... ]
>>> series = read_timestep_series(written, order="given", frequency=10)
>>> series.steps.tolist()
[1, 11, 21]
>>> series.fields["cp"][:, 0].tolist()
[1.0, 2.0, 3.0]
pyflightstream.post.render_post_diagnostics
¶
render_post_diagnostics(log_paths: Sequence[Path]) -> str
Render all recorded diagnostics, clearly separating missing records.
The function returns Markdown and performs no writes. Older logs without categories remain readable; their classification is presentation only. Malformed logs raise a named argument error rather than report a clean run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_paths
|
sequence of Path
|
The post logs to read, one section each. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The Markdown report. |
Raises:
| Type | Description |
|---|---|
ProductArgumentError
|
If a log cannot be read, or is not an object holding a list of records. |
pyflightstream.post.settings_records
¶
settings_records(setup: SolverSetup) -> list[FlagRecord]
Return one record per snapshot flag, in FLAG_SPECS order.
Completeness is enforced here rather than trusted: a snapshot that
carries fewer flags than the library knows about is completed with
unknown records, so the written file names every flag. Silence
about a flag is the one thing this record may not do, because a
reader cannot distinguish silence from absence.
A flag the snapshot carries and FLAG_SPECS does not know about is
appended after the known set rather than dropped: it means the
snapshot was written by a newer library, and dropping it would make
this reader the thing that lost the fact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
setup
|
SolverSetup
|
The snapshot to render. |
required |
Returns:
| Type | Description |
|---|---|
list of FlagRecord
|
One record per flag, known flags first in emission order. |
pyflightstream.post.write_campaign_products
¶
write_campaign_products(
workspace: CampaignWorkspace,
*,
warning_refusals: bool | None = None,
overwrite: bool = False,
archive: bool = False,
archive_stamp: datetime | None = None,
matrix_stem: str | None = None,
check_frozen: bool = False,
sims: Collection[str] | None = None,
keep_unrebuilt: bool = False,
) -> list[Path]
Write campaign products, post.log and its JSON; refuse doubts only with check_frozen=True.
A simulation selection rewrites only its products; archiving is opt-in through archive=True (CLI: --archive), as for a whole post (FR-397).
The log is beside products.json, even on a clean or interrupted post, and
is appended: one block per post, its header and records written at its
end under the campaign lock, so two posts of one matrix in two processes
keep both, and products.json is merged there (REL-R2-017). It
records every named skip and every warning the package raises during the
post, collected in a sink of this thread's own, so two posts in two
threads each log only their own (RPT-058). post.log.json beside it
carries the same header and the same records for a program, rendered
from ONE list so the two cannot disagree (R02). After the log is written
Python callers receive warnings through their filters, outside every sink.
CLI callers suppress terminal warnings by default; --pproc-warnings
shows category totals. Both modes retain every record in the durable log.
A warning raised by code outside the package is not logged. With
archive=True a rebuild archives both files with the same stamp as
the products; by default it overwrites them in place. See
docs/post-processing-definitions.md for the sample and refusal rules.
(G12) the products of the additional post's current
extractions are written too, under additional/<pid>/, from
additional.json; the stage still launches nothing.
sims (FR-307, pyfs-matrix post --sims) limits the rebuild
to those simulations of the matrix, IN PLACE: their files are archived and
rewritten as a whole post does, every other simulation's files and
products.json entries stay as they were, and the named simulations'
super files, whose columns are the union over every simulation, are
written under the column set the others carry (PFS-2185.18); without a
readable superfile measurement every super file is left as the last whole
post wrote it and named under partial.not_rebuilt and in the log. A
simulation with no record of the matrix is refused by name before
anything is written. None, the default, is the whole post.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warning_refusals
|
bool
|
Restore demoted refusals for this call; None uses the runtime option. |
None
|
workspace
|
CampaignWorkspace
|
The campaign workspace whose recorded runs are posted. |
required |
overwrite
|
bool
|
Rebuild when the post log already exists; otherwise that is refused. |
False
|
archive
|
bool
|
(FR-397, P0350-ARCHIVE-OPT-IN) a rebuild overwrites the
files in place and writes no |
False
|
archive_stamp
|
datetime
|
The stamp of the archive; the current time when omitted. |
None
|
matrix_stem
|
str
|
The matrix whose products are written; None for the workspace's own products folder. |
None
|
check_frozen
|
bool
|
Refuse a post whose recorded doubts, named in the log, are not resolved, instead of writing with them logged. |
False
|
sims
|
collection of str
|
Limit the rebuild to these simulations of the matrix, in place; None is the whole post. |
None
|
keep_unrebuilt
|
bool
|
(PFS-2185.18) Without |
False
|
Returns:
| Type | Description |
|---|---|
list of pathlib.Path
|
Every product file the post wrote. The post log, |
Raises:
| Type | Description |
|---|---|
ProductExistsError
|
If the post log already exists and |
ProductError
|
If |
WorkspaceError
|
If |
pyflightstream.post.write_csv_table
¶
write_csv_table(
path: str | Path,
columns: Sequence[str],
rows: Sequence[Sequence[object]],
*,
overwrite: bool = True,
) -> Path
Write one CSV table, retaining six significant figures in coefficient columns.
The header names pass the cells' rule too (G16): no name holds a comma or a double quote, so nothing on any line is quoted.
THE ONE COLUMN-AWARE RULE (PFS-2105.041): a column of
:data:_SIGNIFICANT_DIGIT_COLUMNS, a physical quantity whose values five
decimals cannot carry, is written at six significant digits wherever that
states the value more closely than five decimals do. Sea-level viscosity
was written 0.00002 (12 per cent off) and a time step of 2.78e-5 s
made consecutive rows read 0.00003, 0.00006, 0.00008; a value five
decimals already hold exactly is written as it always was. Dimensional
force, moment, rotor speed and diameter columns keep this rule when a
group or rotor alias is appended to their name. Fluid velocity histories
keep it when a probe number is appended. Unknown columns retain the
reference precision. Coefficient columns use
the same six-significant-digit rule; their drift percentages retain five
decimals. Settings passed as exact text retain their stated form.
During a post, a table also takes the columns of what its matrix rows state as IDENTIFIERS
(FR-3564), right after POL (and ROTOR), as
docs/definitions/what-every-product-states.md lists them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
The table to write. |
required |
columns
|
sequence of str
|
The header names. |
required |
rows
|
sequence of sequence of object
|
The rows, one value per column; None is written as |
required |
overwrite
|
bool
|
Replace a file that already exists, as the writer always did (the default). False refuses an existing file, naming it, before it is replaced. |
True
|
Returns:
| Type | Description |
|---|---|
Path
|
The written table. |
Raises:
| Type | Description |
|---|---|
ProductError
|
If a row's width differs from the header's. |
pyflightstream.post.write_custom_polar_format
¶
write_custom_polar_format(
path: str | Path,
*,
polar: str | int,
description: str,
group: str | int,
mach: float,
reference: ReferenceValues,
rows: Sequence[Sequence[float]],
date: str | None = None,
configuration: str | None = None,
group_number: int | None = None,
columns: Sequence[str] = COEFFICIENT_COLUMNS,
overwrite: bool = True,
) -> Path
Write one polar of one group in the fixed-width text format the reference tooling opens.
THIS DOCSTRING IS THE SPECIFICATION OF THE FORMAT (PFS-2014.01.02). The
shape was read off a recorded file and is pinned by the committed fixture
tests/tier1_offline/fixtures/custom_polar_format_sample.dat, whose
every value is synthetic; the tier-1 test feeds the fixture's rows
through this writer and requires byte equality with the fixture,
except line 3. The file is ASCII, one line feed per line, a line feed
after the last line, and no line carries a trailing space beyond the
width of its fields:
- line 1: the title,
FlightStream - <description>, with- <configuration>appended where the row states one (FR-94). A character outside ASCII is TRANSLITERATED (:func:_ascii_title): an accent is dropped from its letter, and anything with no ASCII letter under it is written?. THE HEADER IS EXACTLY NINE LINES AND THE READER COUNTS THEM, so the label joins a line rather than taking one of its own; - line 2: the polar identifier followed by the two-digit Mach code,
<polar><round(mach * 100):02d>, the same code the polar table's file name carries (3207at Mach 0.20 is320720); - line 3: the write time,
%a %b %d %H:%M:%S %Yof the local clock (Tue Sep 08 23:41:07 2026, two spaces before the year), ordateverbatim when given, which is how a read file is rewritten byte for byte; - line 4: the number of reference columns as three digits, a space,
and the group number as two digits:
007 01; - line 5: the reference column names
MNOM SREF CREF BREF XMOM YMOM ZMOM, each right-aligned to width 10; - line 6: their values, the nominal Mach and the reference block, each
written as Python writes a float (
50.0and2.526) when it fits with a leading blank; otherwise significant digits are reduced until it fits. Each field is right-aligned to width 10; - line 7: the number of data rows as three digits,
013; - line 8:
len(columns)as three digits,024for the default schema; - line 9: the names in
columns, in the supplied order, each right-aligned to width 10; the default is :data:COEFFICIENT_COLUMNS; - then one line per data row, every number right-aligned to width 10
with up to five decimals. Decimal places are reduced until a leading
blank fits; a value that cannot fit is refused; an infinite value is written NA
(a NaN stays
nan, the declined column). Values follow the order of line 9, the rows in the order given (the stage gives them alpha ascending, as the polar table).
The rows carry the selected columns of the polar table, so the two
files are two serializations of one table; :func:read_custom_polar_format reads this one back.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Destination, |
required |
polar
|
str or int
|
The polar identifier, the simulation id. |
required |
description
|
str
|
The row's description, as the polar table carries it. |
required |
group
|
str or int
|
The group number. |
required |
mach
|
float
|
The nominal Mach number, written as |
required |
reference
|
ReferenceValues
|
The reference block. |
required |
rows
|
sequence of sequence of float
|
The coefficient rows, each with |
required |
date
|
str
|
Line 3 as it should be written; the local clock when None. |
None
|
configuration
|
str
|
The row's |
None
|
group_number
|
int
|
The number line 4 states for the group: the post passes the group's
|
None
|
columns
|
sequence of str
|
The data columns of lines 8 and 9, :data: |
COEFFICIENT_COLUMNS
|
overwrite
|
bool
|
Replace a file that already exists, as the writer always did (the default). False refuses an existing file, naming it, before it is replaced. |
True
|
Returns:
| Type | Description |
|---|---|
Path
|
The file written. |
Raises:
| Type | Description |
|---|---|
ProductError
|
If a row has a different length from |
pyflightstream.post.write_input_glossary
¶
write_input_glossary(
folder: str | Path,
*,
changed: list[Path] | None = None,
overwrite: bool = True,
) -> Path
Write the input glossary, INPUTS.md, into folder; return its path.
Only the marked generated block is refreshed. Existing unmarked content
and notes outside that block remain byte-for-byte intact. A legacy glossary
under pproc is left in place and linked as preserved compatibility content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder
|
str or Path
|
Where to write it: the workspace's |
required |
changed
|
list
|
Receives the page when this call actually wrote it. |
None
|
overwrite
|
bool
|
Replace a file that already exists, as the writer always did (the default). False refuses an existing file, naming it, before it is replaced. |
True
|
Returns:
| Type | Description |
|---|---|
Path
|
The page, written or not. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
If the existing page holds the generated-block markers more than once, or in reversed order, so the block cannot be refreshed safely. |
Examples:
>>> import tempfile
>>> folder = tempfile.mkdtemp()
>>> first: list = []
>>> write_input_glossary(folder, changed=first).name
'INPUTS.md'
>>> again: list = []
>>> _ = write_input_glossary(folder, changed=again)
>>> len(first), len(again)
(1, 0)
pyflightstream.post.write_input_template
¶
write_input_template(
folder: str | Path,
*,
changed: list[Path] | None = None,
overwrite: bool = True,
) -> Path
Write the input template, input_template.md, into folder; return its path.
Rewritten only when its content would change, so the call is idempotent and leaves a versioned workspace clean.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder
|
str or Path
|
Where to write it: the |
required |
changed
|
list
|
Receives the page when this call actually wrote it. |
None
|
overwrite
|
bool
|
Replace a file that already exists, as the writer always did (the default). False refuses an existing file, naming it, before it is replaced. |
True
|
Returns:
| Type | Description |
|---|---|
Path
|
The page, written or not. |
Examples:
>>> import tempfile
>>> folder = tempfile.mkdtemp()
>>> first: list = []
>>> write_input_template(folder, changed=first).name
'input_template.md'
>>> again: list = []
>>> _ = write_input_template(folder, changed=again)
>>> len(first), len(again)
(1, 0)
pyflightstream.post.write_plots_table
¶
write_plots_table(
path: str | Path,
export_text: str,
*,
pol: str | int | None = None,
overwrite: bool = True,
) -> Path | None
Write one plots table from an unsteady plots export.
The coefficient columns (CL_, CDI_, CDO_, CDP_, CDV_, CD_) are
multiplied by the square of the reference velocity over the free
stream, so a run whose reference velocity differs from the free stream
reads as free-stream coefficients. An export the reader cannot parse is
a refusal naming the file, never a silent skip; an export with no step
returns None.
pol is the polar the point belongs to. It is the table's FIRST column
(G16), NA where the caller states none, and the export's own
header follows it unchanged; :func:plots_table_series reads every column
AFTER it back as a plotted quantity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Destination CSV; also named in the refusal message. |
required |
export_text
|
str
|
Complete text of the unsteady plots export. |
required |
pol
|
str or int
|
The polar the point belongs to, written first in every row. |
None
|
overwrite
|
bool
|
Replace a file that already exists, as the writer always did (the default). False refuses an existing file, naming it, before it is replaced. |
True
|
Returns:
| Type | Description |
|---|---|
Path or None
|
The file written, or None when the export holds no step. |
Raises:
| Type | Description |
|---|---|
ProductError
|
If the export cannot be read. |
pyflightstream.post.write_point_series
¶
write_point_series(
root: Path,
*,
sim_dir: Path,
record: RunRecord,
stem: str,
out: Path,
overwrite: bool = False,
target: Callable[[Path], Path] | None = None,
condition: Mapping[str, object] | None = None,
reference: Mapping[str, object] | None = None,
rotors: Mapping[str, Mapping[str, object]]
| None = None,
skipped: dict[str, str] | None = None,
surface_exports: dict[str, dict[str, object]]
| None = None,
failed: dict[str, str] | None = None,
) -> tuple[list[Path], dict[str, dict[str, object]]]
Write the series tables of one point from its stamped exports.
condition and reference are the point's, as every other product of it
states them; without them the cells read NA. rotors is what
the sections identity needs of each rotor, as
:func:~pyflightstream.post.products.write_sections_table takes it.
surface_exports, when given, receives manifest entries for native
Tecplot, VTK and CSV files. Those files are listed, not rewritten, and
are separate from the returned tables and their entries.
A KIND WITH NO STAMPED FILE IS NOT WRITTEN. skipped, when
given, receives the reason under the table's own name.
A STEP OF THE WINDOW THAT free-space DELETED (prune_step_exports) refuses that
kind's table, naming the step and the storage call,
under the same name in skipped, or as a
:class:~pyflightstream._errors.ProductError when no skipped is given.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
The workspace root. Listed files, like product keys, are named
relative to |
required |
sim_dir
|
Path
|
The simulation folder, where the solver left the stamped files. |
required |
record
|
RunRecord
|
The point's run record; its |
required |
stem
|
str
|
The point's name, the loads spreadsheet's name without |
required |
out
|
Path
|
The matrix's products folder; the tables land under |
required |
overwrite
|
bool
|
Consulted only when |
False
|
target
|
callable
|
Called with each table's path before that table is written, and the
table is written to the path it returns, and its entry is keyed by
that path: the same seam
the retired |
None
|
condition
|
mapping of str to object
|
The point's condition, as every product of it states it. |
None
|
reference
|
mapping of str to object
|
The point's reference dimensions. |
None
|
rotors
|
mapping of str to mapping
|
What the sections identity needs of each rotor. |
None
|
skipped
|
dict of str to str
|
Receives the reason a kind is not written, under the table's name. |
None
|
surface_exports
|
dict of str to dict
|
Receives the manifest entries of the native Tecplot, VTK and CSV files. |
None
|
failed
|
dict of str to str
|
Receives, under the table's name, the refusal of a kind whose stamped files cannot be read, and the other kinds are still written. Without it that refusal is raised and no table of the point is returned. |
None
|
Returns:
| Type | Description |
|---|---|
tuple
|
The tables written, and their |
Raises:
| Type | Description |
|---|---|
ProductError
|
If a step of the window was deleted by |
ProductExistsError
|
If a table exists, no |
pyflightstream.post.write_pproc_guides
¶
write_pproc_guides(
folder: str | Path,
*,
glossary: Mapping[str, str]
| Sequence[tuple[str, str]]
| None = None,
changed: list[Path] | None = None,
overwrite: bool = True,
) -> list[Path]
Write the variable reference and the equation guide into a pproc input folder.
Generated from the models and the column constants they document. A page whose content would not change is NOT rewritten, so the call is idempotent and leaves a versioned workspace clean; no file under another name is ever touched.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder
|
str or Path
|
The pproc input folder, |
required |
glossary
|
mapping or sequence of pairs
|
The user's own symbol definitions, from the |
None
|
changed
|
list
|
Receives the pages this call actually wrote, which is none on a second call. |
None
|
overwrite
|
bool
|
Replace a file that already exists, as the writer always did (the default). False refuses an existing file, naming it, before it is replaced. |
True
|
Returns:
| Type | Description |
|---|---|
list of pathlib.Path
|
The two pages, in :data: |
Examples:
>>> import tempfile
>>> folder = tempfile.mkdtemp()
>>> first: list = []
>>> [page.name for page in write_pproc_guides(folder, changed=first)]
['VARIABLES.md', 'WRITING-EQUATIONS.md']
>>> again: list = []
>>> _ = write_pproc_guides(folder, changed=again)
>>> len(first), len(again)
(2, 0)
pyflightstream.post.write_probe_field
¶
write_probe_field(
stem: str | Path,
points_m: ndarray,
velocity_m_s: ndarray,
*,
source: str | Path,
provenance: OutputProvenance,
frame: str = "REFERENCE",
formats: Sequence[str] = ("vtk",),
reusable_inflow: bool = False,
sample_metadata: Mapping[str, object] | None = None,
overwrite: bool = False,
) -> list[Path]
Write reference-frame samples as VTK/Tecplot and optional custom inflow.
Both arrays are finite (N, 3), in meters and m/s. No cells, surface interpolation or moving-frame transform is inferred. Reusable inflow is an unstructured global YZ-plane profile; the user validates and installs it. Every file carries solver setup and a source-byte hash in its provenance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stem
|
str or Path
|
Output path without extension; |
required |
points_m
|
ndarray
|
Sample positions, finite, shape (N, 3), in metres. |
required |
velocity_m_s
|
ndarray
|
Absolute sample velocities, finite, shape (N, 3), in m/s. |
required |
source
|
str or Path
|
The file the samples were read from; its name and SHA-256 are recorded. |
required |
provenance
|
OutputProvenance
|
Run identity and solver setup written into every file's record. |
required |
frame
|
str
|
The frame of the samples; only |
"REFERENCE"
|
formats
|
sequence of str
|
Distinct field formats to write, from |
("vtk",)
|
reusable_inflow
|
bool
|
Also write the unstructured YZ-plane custom inflow profile. It needs one constant x, distinct positions and a two-dimensional survey. |
False
|
sample_metadata
|
mapping
|
Extra entries merged into the recorded |
None
|
overwrite
|
bool
|
Replace existing files; otherwise an existing file refuses the write. |
False
|
Returns:
| Type | Description |
|---|---|
list of pathlib.Path
|
Each file written, products and their provenance records. |
Raises:
| Type | Description |
|---|---|
ProductError
|
If numeric conversion, frame, shapes, finiteness, formats or inflow conditions are not met; nothing is written then. |
OutputExistsError
|
If any destination exists and |
Examples:
>>> import tempfile
>>> from pathlib import Path
>>> import numpy as np
>>> from pyflightstream.post import OutputProvenance
>>> from pyflightstream.script import Script, helpers
>>> setup = helpers.solver_settings(Script(version="26.120"), velocity=30.0)
>>> provenance = OutputProvenance(run_id="probe/sim_1/a+00.0", setup=setup)
>>> folder = Path(tempfile.mkdtemp())
>>> source = folder / "samples.csv"
>>> _ = source.write_text("PROBE,X,Y,Z", encoding="utf-8")
>>> points = np.array([[0.0, 0.0, 0.0], [0.0, 1.0, 0.0]])
>>> velocity = np.array([[30.0, 0.0, 0.0], [30.0, 0.0, 0.0]])
>>> written = write_probe_field(
... folder / "field", points, velocity, source=source, provenance=provenance
... )
>>> sorted(path.name for path in written)
['field.vtk', 'field.vtk.provenance.json']
pyflightstream.post.write_reduction
¶
write_reduction(
path: str | Path,
average: FrameAverage,
*,
series_file: str | Path,
sources: tuple[Path, ...] | list[Path] | None = None,
overwrite: bool = False,
) -> Path
Write a reduction, refusing every way it could lose its history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Destination CSV file, holding one row per field and sample:
|
required |
average
|
FrameAverage
|
The reduction, from
:func: |
required |
series_file
|
(str or Path, keyword - only)
|
The time series this reduction came from, written by
:func: |
required |
sources
|
sequence of pathlib.Path
|
Extra files this reduction was read from, on top of the frames the average already carries. Both sets are refused as destinations. |
None
|
overwrite
|
(bool, keyword - only)
|
Replace an existing destination. Default False. |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
The written file. |
Raises:
| Type | Description |
|---|---|
WorkspaceError
|
If the destination is a file the reduction was read from, or if the series file is missing or is not beside the destination. |
OutputExistsError
|
If the destination exists and |
pyflightstream.post.write_sections_table
¶
write_sections_table(
path: str | Path,
export_text: str,
*,
mach: float,
step: int | None = None,
iteration: object = _ITERATION_UNSET,
unsteady: bool = False,
azimuth_deg: float | None = None,
reference: ReferenceValues | None = None,
advance_ratio: float | None = None,
condition: Mapping[str, object] | None = None,
layout: Sequence[Mapping[str, object]] | None = None,
rotors: Mapping[str, Mapping[str, object]]
| None = None,
pol: str | int | None = None,
inventory: Sequence[str] | None = None,
rotor_ids: Mapping[str, int] | None = None,
split: str = "point",
family_files: list[Path] | None = None,
overwrite: bool = True,
) -> Path | None
Write one sections table from a sectional loads export.
pol is the polar the point belongs to, the matrix row's POL: the first
column of every row (G16), NA where the caller states none.
layout is WHICH DISTRIBUTION EACH ROW BELONGS TO: the blocks the
run's script created, in order, as the run record states them under
sections_layout. A pproc declares several distributions, the wing in XZ
and each blade in its own frame, and the export concatenates them with no
marker; with Offset the only coordinate, two distributions of similar span
were indistinguishable. FAMILY, PLANE and ROTOR say which is which.
The layout is applied ONLY when its counts add up to the rows the export
holds; otherwise, and on every record written before the run recorded one,
the three read NA. The script states surfaces by index, so nothing at post
can name them.
rotors maps a rotor's alias to its families, its
steps_per_revolution, its blade1_azimuth_deg and its signed rpm.
AZIMUTH is where BLADE ONE OF THE BLOCK'S OWN ROTOR is at the export's step,
(blade1_azimuth_deg + sign(rpm) * STEP * 360 / steps_per_revolution) mod 360
and NA on a block no rotor owns.
condition is the POINT's condition as :func:point_condition assembles it,
and the stage always passes it. The export header's Altitude (ft) line
is not set by the campaign and cannot substitute for the point's altitude.
Without it the header is read, for a caller holding an export and no point.
step is the solver step the distribution was sampled at and
azimuth_deg is where the blade was when it was; both lead the row
because they are the only two things that vary down the file. They replace
the POINT column, which carried the polar's NAME and therefore restated
the file name. A run with no rotor states no azimuth and
the cell reads NA, which is not zero: zero is a real azimuth.
Write step=; passing iteration= raises
:class:ProductArgumentError naming that replacement, even for None.
On a steady export, an omitted step is read from the header.
With unsteady=True the header counts inner iterations, so the caller
supplies the time step from the run record; an unknown step stays NA.
THE AZIMUTH IS WRAPPED -- a step count is not an angle, and 1575 steps of
3.6 degrees is 5670 degrees, which is not somewhere a blade can be. Without
a rotor that owns the block it stays NA, because the alternative is
writing a zero that a reader would believe. azimuth_deg is for a caller
holding one export of one rotor and no layout; it states every row.
Returns None without writing when the export declares no section, as a run that defined no distribution leaves; the columns are the point, its condition, and the export's own seven, in the export's units.
reference supplies the reference LENGTHS, which this table carried
none of in legacy releases: a sectional force beside no area is a number nobody
can check. It is optional because a caller that genuinely holds no
reference should write NA rather than be refused a product it can
otherwise make, and a run's reference is recorded beside its outputs
rather than inside this export.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Destination CSV. |
required |
export_text
|
str
|
Complete text of the sectional loads export. |
required |
mach
|
float
|
Mach number of the point, for the condition block when |
required |
step
|
int
|
Solver step the distribution was sampled at; read from the export's
header on a steady export when omitted, |
None
|
iteration
|
object
|
Removed; passing any value raises. |
_ITERATION_UNSET
|
unsteady
|
bool
|
Whether the export is of an unsteady run, whose header counts inner iterations rather than time steps. |
False
|
azimuth_deg
|
float
|
Azimuth in degrees stated for every row, for a caller holding one export of one rotor and no layout. |
None
|
reference
|
ReferenceValues
|
Reference lengths written beside each row; |
None
|
advance_ratio
|
float
|
Advance ratio of the point, used only when |
None
|
condition
|
mapping
|
The point's condition as :func: |
None
|
layout
|
sequence of mapping
|
The distribution blocks of the run's script, in order, as the run record states them. |
None
|
rotors
|
mapping of str to mapping
|
Each rotor's alias to its |
None
|
pol
|
str or int
|
The polar the point belongs to, written first in every row. |
None
|
inventory
|
sequence of str
|
The geometry's boundary inventory, in file order: |
None
|
rotor_ids
|
mapping of str to int
|
Each rotor alias to its declared id, for |
None
|
split
|
('point', 'family', 'both')
|
|
'point'
|
family_files
|
list of Path
|
Where the per-family paths written are appended. |
None
|
overwrite
|
bool
|
Replace a file that already exists, as the writer always did (the default). False refuses an existing file, naming it, before it is replaced. |
True
|
Returns:
| Type | Description |
|---|---|
Path or None
|
The point table written, or None when the export declares no section. |
Raises:
| Type | Description |
|---|---|
ProductArgumentError
|
If |
ProductError
|
If the export cannot be read or carries fewer than seven columns. |
pyflightstream.post.write_series
¶
write_series(
path: str | Path,
series: TimestepSeries,
*,
overwrite: bool = False,
) -> Path
Write the time series to its own dedicated file.
One row per exported frame: the solver step, the solution time in seconds where the frames carried one, and one column per sample of each field. The history is what makes an average auditable, so it gets a file rather than a section of one.
A finite value is written at full precision, the shortest decimal that
reads back to the same double, never rounded to the five decimals of the
product tables, because the series is the evidence an average is checked
against. A value that is not available (NaN or infinite, a sample or a
time) is written NA, never nan (FR-2310).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Destination CSV file. Its parent is created if absent. |
required |
series
|
TimestepSeries
|
The read-back frames. |
required |
overwrite
|
(bool, keyword - only)
|
Replace an existing destination. Default False. |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
The written file. |
Raises:
| Type | Description |
|---|---|
OutputExistsError
|
If the destination exists and |
WorkspaceError
|
If the destination is one of the frame files the series was read from. |
pyflightstream.post.write_tecplot_points
¶
write_tecplot_points(
path: str | Path,
points: ndarray,
fields: Mapping[str, ndarray] | None = None,
*,
provenance: OutputProvenance,
title: str = "pyflightstream probe data",
zone: str = "probes",
overwrite: bool = False,
) -> tuple[Path, Path]
Write probe data as a Tecplot ASCII ordered POINT zone.
Vector fields expand into three variables with _x/_y/_z
suffixes, following the Cartesian axis naming of the writers'
coordinate columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Destination |
required |
points
|
ndarray
|
Probe positions, shape |
required |
fields
|
mapping of str to numpy.ndarray
|
Per-probe data: |
None
|
provenance
|
(OutputProvenance, keyword - only)
|
Run identity and the solver-flag snapshot that produced the
numbers, written beside the output as
|
required |
title
|
str
|
TITLE record. |
'pyflightstream probe data'
|
zone
|
str
|
Zone name. |
'probes'
|
overwrite
|
(bool, keyword - only)
|
Replace an existing destination. Default False, for the same
reason as its sibling: this writer also ended in an
unconditional |
False
|
Returns:
| Type | Description |
|---|---|
tuple of pathlib.Path
|
|
Raises:
| Type | Description |
|---|---|
OutputExistsError
|
If either the destination or its record exists and
|
ValueError
|
If |
ProductError
|
If two variables would carry the same name. It is a |
pyflightstream.post.write_trimmed_polar
¶
write_trimmed_polar(
polar: str | Path,
out: str | Path | None = None,
*,
moment: str = TRIM_MOMENT_COLUMN,
angle: str = TRIM_ANGLE_COLUMN,
overwrite: bool = False,
) -> Path
Write a polar table's trimmed polar: its row at zero pitching moment (FR-2302).
The table is read back as written, :func:trimmed_polar_row finds the row,
and the file has the polar's own columns and that one row, by default
beside the polar as <polar stem>_trim.csv. The pproc artifact asks for
it beside every polar table with [products] trimmed_polar = true.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
polar
|
str or Path
|
A polar table. |
required |
out
|
str or Path
|
Where the trimmed polar is written; |
None
|
moment
|
str
|
As :func: |
TRIM_MOMENT_COLUMN
|
angle
|
str
|
As :func: |
TRIM_MOMENT_COLUMN
|
overwrite
|
bool
|
Replace a file already at |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
The file written. |
Raises:
| Type | Description |
|---|---|
ProductError
|
As :func: |
ProductExistsError
|
If |
pyflightstream.post.write_vtk_points
¶
write_vtk_points(
path: str | Path,
points: ndarray,
fields: Mapping[str, ndarray] | None = None,
*,
provenance: OutputProvenance,
title: str = "pyflightstream probe data",
overwrite: bool = False,
) -> tuple[Path, Path]
Write probe data as a VTK legacy ASCII polydata file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Destination |
required |
points
|
ndarray
|
Probe positions, shape |
required |
fields
|
mapping of str to numpy.ndarray
|
Per-probe data: |
None
|
provenance
|
(OutputProvenance, keyword - only)
|
Run identity and the solver-flag snapshot that produced the
numbers. REQUIRED, and required rather than defaulted for the
reason PFS-2012.11 gives: an optional record is absent exactly
where it matters, on the run nobody thought about while writing
the call. It is written beside the output as
|
required |
title
|
str
|
VTK header title line. |
'pyflightstream probe data'
|
overwrite
|
(bool, keyword - only)
|
Replace an existing destination. Default False, and the default
is the point: this writer ended in an unconditional
|
False
|
Returns:
| Type | Description |
|---|---|
tuple of pathlib.Path
|
|
Raises:
| Type | Description |
|---|---|
OutputExistsError
|
If either the destination or its record exists and
|
ValueError
|
If |
Examples:
>>> import numpy as np
>>> from pyflightstream.post import OutputProvenance, write_vtk_points
>>> from pyflightstream.script import Script, helpers
>>> script = Script(version="26.120")
>>> setup = helpers.solver_settings(script, velocity=30.0)
>>> points = np.array([[0.0, 0.0, 0.0], [1.0, 0.0, 0.0]])
>>> import tempfile, pathlib
>>> folder = pathlib.Path(tempfile.mkdtemp())
>>> output, record = write_vtk_points(
... folder / "probes.vtk",
... points,
... {"cp": np.array([1.0, -0.5])},
... provenance=OutputProvenance(run_id="polar/sim_1/a+00.0", setup=setup),
... )
>>> record.name
'probes.vtk.provenance.json'