Skip to content

pyflightstream.post.products (stable)

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

The campaign's post-processed products: polar, section and plot tables as CSV.

PFS-2029.15. A campaign's raw exports are the solver's own text files, one set per point; the products are the tables a study reads and plots, and this module writes them as plain CSV, one header line and one row per record, so any spreadsheet or dataframe reads them with nothing else:

  • the POLAR FILES of every polar under polars/ (FR-88, PFS-2231): FAM-DIM, FAM-ACOEF and FAM-RCOEF-P<POL>.csv, one row per point and family, and P<POL>-<GROUP>-<KIND>.csv for TOTAL, AIRFRAME, every rotor and every [groups] key, one row per point, each opening with the run block (:mod:pyflightstream.post._polar_stage). The super file is not written; a file of that layout found in polars/ is left untouched and said (:mod:pyflightstream.post._retired_polars);
  • a SECTIONS table per point, sections/<point>_sections.csv: the sectional loads export re-tabled, when the run defined sections at all;
  • the FLOW-FIELD SAMPLES of a point under probes/ (FR-87), whatever the run type was: probes/<point>_plots.csv, the unsteady plots export re-tabled with its coefficient columns brought from the solver's reference velocity to the free stream, and probes/<point>_probes.csv, the probe-points export of a steady row or the fluid-plots history of an unsteady row, re-tabled in its own units;
  • the REDUCTIONS of that table, one file per applicable reduction beside it (PFS-2015.04): probes/<point>_time_average.csv, probes/<point>_phase_locked.csv and probes/<point>_per_blade.csv. The time average is a row per window with the window in solver steps and then the plots table's own columns averaged over it; the phase-locked table is a row per AZIMUTHAL POSITION, each value the mean across the last revolutions at that fixed azimuth (docs/definitions/phase_locked.md); the per-blade table follows below. a row that NAMES ITS ROTORS reduces per rotor (FR-68), so the two passage files carry the rotor's alias, probes/<point>_per_blade_<ALIAS>.csv, and their manifest entries carry a rotor field; the time average is one file whatever turns in the run. Raw is the plots table itself and is written once. the per-blade table is one row PER BLADE over one shared window. The windows follow the MATRIX ROW as it stands (:mod:pyflightstream.cases.windows), and a record's own windows, resolved by the run stage (:func:pyflightstream.cases.workflows.reduction_windows), where the row no longer states a key; a reduction the row could not window is recorded under skipped in products.json with its reason, as a refused polar is;
  • THE CUSTOM POLAR FORMAT beside each group ACOEF file when the pproc artifact asks ([products] custom_polar_format = true, PFS-2014.01.01): P<POL>-<GROUP>-ACOEF.dat, the file's own stem with the suffix changed, the same rows in the fixed-width text file the existing tooling opens, specified line by line in :func:write_custom_polar_format and read back by :func:read_custom_polar_format;
  • a PROVENANCE document per recorded run, under provenance/ and named by the point's own convention (FR-86) (PFS-2012.08.01): W3C PROV in its PROV-JSON serialization, the staged inputs, the script and the outputs as entities with their sha256, the solver run as the activity with its start, end and argv, the package and the solver build as agents.

THE AXIS COLUMNS COME FROM ONE VECTOR. The loads export states a force (Cx, Cy, Cz) in its own frame, x aft, y right, z up (scored against recorded exports in RPT-063, "emitted coefficients are scored against recorded solver output", 2026-09-23; its moments are read in the same frame, not scored), and :mod:pyflightstream.post.axes turns that one pair into body, stability and wind axes, under sideslip too. So CDB is the Cx of the export and CLB its Cz; the rolling and yawing moments are normalised by the span and the pitching moment by the chord, after the moment has turned as one vector. CD0 and CDI stay the solver's own profile and induced drag. Values are written with at least six significant figures when five decimals lose precision.

Polar rows rotate forces and moments into their declared axes using the shared axis transformations. Solver coefficients are not substituted for a differently defined frame.

(AD-13) THIS MODULE IS THE CAMPAIGN STAGE AND THE FACADE. The families it wrote are sibling modules: :mod:pyflightstream.post.polar, :mod:pyflightstream.post.rotor_table, :mod:pyflightstream.post.unsteady_polar and :mod:pyflightstream.post.point_tables, each with an exact __all__ that this module re-exports, so every name of its __all__ and every public import path is kept. One simulation's products are written by the private simulation stage (:mod:pyflightstream.post._sim) over one frozen SimContext; what is left here is :func:write_campaign_products, which walks the campaign, writes the series, the superfiles and the additional post, and keeps the manifest and the post log.

Advanced

pyflightstream.post.products.ADVANCE_RATIO_COLUMN module-attribute

ADVANCE_RATIO_COLUMN = 'J'

pyflightstream.post.products.COEFFICIENT_COLUMNS module-attribute

COEFFICIENT_COLUMNS: tuple[str, ...] = (
    "ALPHA",
    "BETA",
    "MACH",
    "RE",
    "CDB",
    "CYB",
    "CLB",
    "CRB25",
    "CMB25",
    "CNB25",
    "CDS",
    "CYS",
    "CLS",
    "CRS25",
    "CMS25",
    "CNS25",
    "CDW",
    "CYW",
    "CLW",
    "CRW25",
    "CMW25",
    "CNW25",
    "CD0",
    "CDI",
)

pyflightstream.post.products.CONDITION_KEY_ALIASES module-attribute

CONDITION_KEY_ALIASES: dict[str, str] = {
    "advance_ratio": ADVANCE_RATIO_COLUMN,
    "tasmps": "VINF",
    "altft": "ALT",
    "angle_of_attack_deg": "ALPHA",
    "sideslip_deg": "BETA",
    "freestream_velocity_m_s": "VINF",
    "altitude_ft": "ALT",
    "reference_velocity_m_s": "VREF",
    "density_kg_m3": "RHO",
    "temperature_k": "TEMP",
    "viscosity_pa_s": "MU",
    "rhokgm3": "RHO",
    "tk": "TEMP",
    "mupas": "MU",
}

pyflightstream.post.products.CONTEXT_COLUMNS module-attribute

CONTEXT_COLUMNS: tuple[str, ...] = (
    *FLIGHT_CONDITION_COLUMNS,
    *REFERENCE_LENGTH_COLUMNS,
)

pyflightstream.post.products.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 FlightStream -.

polar str

The polar identifier, line 2 without its two-digit Mach code.

mach float

The nominal Mach number, MNOM of the reference line.

date str

Line 3 as written; :func:write_custom_polar_format takes it back so a read file is rewritten byte for byte.

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.products.DEFAULT_DRIFT_LIMIT_PCT module-attribute

DEFAULT_DRIFT_LIMIT_PCT = 1.0

pyflightstream.post.products.DRIFT_SUFFIX module-attribute

DRIFT_SUFFIX = '_DRIFT_PCT'

pyflightstream.post.products.FLIGHT_CONDITION_COLUMNS module-attribute

FLIGHT_CONDITION_COLUMNS: tuple[str, ...] = (
    "ALPHA",
    "BETA",
    "MACH",
    "RE",
    "VINF",
    "VREF",
    "ALT",
    "RHO",
    "TEMP",
    "MU",
    ADVANCE_RATIO_COLUMN,
    "J_CLOCK",
    "RPM_CLOCK",
)

pyflightstream.post.products.GEOMETRY_ANALYSIS_FRAMES module-attribute

GEOMETRY_ANALYSIS_FRAMES = frozenset(
    {"reference", "global", "geometry", "mrp"}
)

pyflightstream.post.products.NOT_APPLICABLE module-attribute

NOT_APPLICABLE = 'NA'

pyflightstream.post.products.PER_BLADE_COLUMNS module-attribute

PER_BLADE_COLUMNS: tuple[str, ...] = (
    POLAR_ID_COLUMN,
    "REDUCTION",
    "ROTOR",
    "BLADE",
    "FAMILY",
    "FIRST_STEP",
    "LAST_STEP",
    "STEPS",
    "AZIMUTH_START",
    "AZIMUTH_END",
    *CONTEXT_COLUMNS,
    "XMOM",
    "YMOM",
    "ZMOM",
)

pyflightstream.post.products.PER_REVOLUTION_COLUMNS module-attribute

PER_REVOLUTION_COLUMNS: tuple[str, ...] = (
    POLAR_ID_COLUMN,
    "REDUCTION",
    ROTOR_ID_COLUMN,
    "REVOLUTION",
    "FIRST_STEP",
    "LAST_STEP",
    "STEPS",
    *CONTEXT_COLUMNS,
    *_MOMENT_POINT_COLUMNS,
)

pyflightstream.post.products.POLARS_DIR module-attribute

POLARS_DIR = 'polars'

pyflightstream.post.products.PROBES_DIR module-attribute

PROBES_DIR = 'probes'

pyflightstream.post.products.PRODUCTS_MANIFEST module-attribute

PRODUCTS_MANIFEST = 'products.json'

pyflightstream.post.products.PROVENANCE_DIR module-attribute

PROVENANCE_DIR = 'provenance'

pyflightstream.post.products.PROVENANCE_SUFFIX module-attribute

PROVENANCE_SUFFIX = '.prov.json'

pyflightstream.post.products.PolarPoint dataclass

PolarPoint(
    name: str,
    loads: LoadsReport,
    loads_path: Path,
    point: Mapping[str, float] | None = None,
    state: PointState | None = None,
    vorticity_selection: object = None,
)

One point of a polar: its loads report and where it came from.

point is the sweep point the RECORD states, which is what the point was ASKED for; the angles below are what the solver REPORTED and are read off the table. The two are separate on purpose: the file name and the swept column are about the request (FR-85), and the coefficients are about the answer.

alpha_deg property

alpha_deg: float

The point's angle of attack, from its loads table.

beta_deg property

beta_deg: float

The point's sideslip, from its loads table.

pyflightstream.post.products.ProductArgumentError

Bases: PyflightstreamError, TypeError

A product writer was called with arguments that contradict each other.

An argument misuse and not a datum, so the standard-library base is TypeError and not ValueError: except TypeError catches it exactly as it caught the bare raise this replaced. Beside ProductError below because the same two layers name both (the step= / iteration= deprecation of write_sections_table).

pyflightstream.post.products.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.products.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.products.REDUCTION_COLUMNS module-attribute

REDUCTION_COLUMNS: tuple[str, ...] = (
    POLAR_ID_COLUMN,
    "REDUCTION",
    ROTOR_ID_COLUMN,
    "WINDOW",
    "FIRST_STEP",
    "LAST_STEP",
    "STEPS",
    *CONTEXT_COLUMNS,
    "XMOM",
    "YMOM",
    "ZMOM",
)

pyflightstream.post.products.REFERENCE_LENGTH_COLUMNS module-attribute

REFERENCE_LENGTH_COLUMNS: tuple[str, ...] = (
    "SREF",
    "CREF",
    "BREF",
)

pyflightstream.post.products.ROTOR_TABLE_LEAD_LINES module-attribute

ROTOR_TABLE_LEAD_LINES = 0

pyflightstream.post.products.ROTOR_TABLE_SUFFIX module-attribute

ROTOR_TABLE_SUFFIX = '_rotor.csv'

pyflightstream.post.products.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_row

as_row() -> tuple[float, ...]

Return the six values in :data:_REFERENCE_COLUMNS order.

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.products.SECTIONS_DIR module-attribute

SECTIONS_DIR = 'sections'

pyflightstream.post.products.SECTION_COLUMNS module-attribute

SECTION_COLUMNS: tuple[str, ...] = (
    POLAR_ID_COLUMN,
    *_SECTION_IDENTITY_COLUMNS,
    *CONTEXT_COLUMNS,
    "Offset",
    "Chord",
    "X_QC",
    "Z_QC",
    "Fx",
    "Fz",
    "Moment",
)

pyflightstream.post.products.SWEEP_AXES module-attribute

SWEEP_AXES: tuple[str, ...] = (
    "alpha",
    "beta",
    "advance_ratio",
)

pyflightstream.post.products.UNSTEADY_AXIS_COLUMNS module-attribute

UNSTEADY_AXIS_COLUMNS: tuple[str, ...] = (
    *_STEADY_AXIS_COLUMNS[12:18],
    *_STEADY_AXIS_COLUMNS[6:12],
    *_STEADY_AXIS_COLUMNS[0:6],
)

pyflightstream.post.products.context_row

context_row(
    condition: Mapping[str, object] | None = None,
    reference: Mapping[str, object] | None = None,
    *,
    columns: Sequence[str] = CONTEXT_COLUMNS,
) -> tuple[object, ...]

Return the values of columns, read from what the run recorded.

ONE ASSEMBLY FOR EVERY PRODUCT FAMILY, keeping their condition columns consistent instead of constructing a separate subset at each call site.

A key the run did not record is NOT invented and is not left blank: it arrives at the funnel as None and is written as NA, which says the column does not apply to that row. That is the third of the three reasons a cell can be empty and the only one NA stands for -- so a condition the solver was never told is visibly absent rather than quietly zero, and a zero angle of attack stays a zero.

The lookup is CASE-INSENSITIVE on purpose: a record writes alpha and a column is ALPHA, and requiring the two to agree makes every caller remember a convention that this function can simply apply.

Parameters:

Name Type Description Default
condition mapping of str to object

The point's recorded condition.

None
reference mapping of str to object

The point's recorded reference dimensions.

None
columns sequence of str

The columns to read, :data:CONTEXT_COLUMNS by default.

CONTEXT_COLUMNS

Returns:

Type Description
tuple of object

One value per column, looked up without regard to case in the condition and the reference; None where the run recorded none.

pyflightstream.post.products.is_force_or_moment_column

is_force_or_moment_column(name: str) -> bool

Whether a plotted column is a force or a moment, or a force coefficient of one.

The plots table names a column <parameter>_<group> (FX_MRP_TOTAL), and the parameter is one of the solver's force plot parameters: the six components and the four force coefficients. The parameter is what is asked, so a group that happens to begin with F is not mistaken for a force.

Parameters:

Name Type Description Default
name str

A column name of the plots table.

required

Returns:

Type Description
bool

True when the part of the name before the first underscore is one of the solver's force plot parameters.

Examples:

>>> is_force_or_moment_column("FX_MRP_TOTAL"), is_force_or_moment_column("CDI_WING")
(True, True)
>>> is_force_or_moment_column("VX_probe1"), is_force_or_moment_column("FXX_TOTAL")
(False, False)

pyflightstream.post.products.per_revolution_table

per_revolution_table(
    series: TimestepSeries,
    columns: Sequence[str],
    *,
    revolution_steps: int,
    read_steps: set[int] | None = None,
) -> tuple[
    list[tuple[int, int]], list[dict[str, float]], int
]

Cut a plots history into COMPLETE revolutions and take each column's mean.

Revolution k is rows (k-1) * revolution_steps to k * revolution_steps - 1 of the table, counted from its first row, so a history that begins at step one cuts at steps 1 to N, N+1 to 2N and so on. The mean is :func:pyflightstream.post.unsteady.blade_passage_average, the package's one implementation of that average, so this table cannot disagree with the time average about what a mean is. A trailing partial revolution is NOT averaged: its length differs, so its mean would be the mean of another thing under the same name.

Parameters:

Name Type Description Default
series TimestepSeries

The plots table as :func:plots_table_series reads it.

required
columns sequence of str

The columns to average.

required
revolution_steps int

Solver steps in one revolution; at least one.

required
read_steps set of int

Receives the steps the averages read.

None

Returns:

Type Description
tuple

The (first, last) step of each complete revolution, each revolution's mean by column, and the number of rows left over in the partial one.

Raises:

Type Description
ProductError

If revolution_steps is below one.

pyflightstream.post.products.plots_table_series

plots_table_series(
    path: str | Path,
) -> tuple[tuple[str, ...], TimestepSeries]

Read a written plots table back as the series its reductions are taken over.

THE TABLE'S OWN CLOCK WHEN IT STATES ONE (PFS-2038.04, GEO-039-F05). The export writes one row per time step (the manual's paraphrase in the database entry for UNSTEADY_SOLVER_EXPORT_PLOTS) and states the step it wrote in a Time-step column; the step axis is that column, so a window's FIRST_STEP and LAST_STEP mean what the file means, including an offset or sparse clock.

Use row ordinals only where the table states no step clock.

THE ORDINAL REMAINS THE FALLBACK, for a table that states no such column and for one whose column is not a strictly increasing whole number: a product is better than a refusal there, and the review's coverage validation, which would refuse windows that work today, is deliberately not taken. The column is still carried as a FIELD as well, so no existing product loses a value.

Every column is one field of one sample, since the plots table samples no position; the sample position is the origin, which stands for the configuration the plot was defined over.

Read from the WRITTEN table rather than from the export in memory, so a reduction is of the file a user holds and can be recomputed from it.

POL IS NOT A PLOTTED QUANTITY (G16). The table opens with the polar its point belongs to, which says which polar the file is OF and is no field of any sample: it is left out of the columns and of the series, so no reduction averages it and no reduction states it twice. A table with no such column needs no exclusion.

Parameters:

Name Type Description Default
path str or Path

A plots table the post wrote.

required

Returns:

Type Description
tuple

The table's plotted columns, in its order, and the series.

Raises:

Type Description
ProductError

If the table holds a header and no rows.

pyflightstream.post.products.point_name_of

point_name_of(record: RunRecord) -> str | None

Return the point name a record's script carries, or None (FR-86).

THE SCRIPT IS THE SOURCE and not the naming template. The template a workspace is configured with today is not the one a record from last month was written under; the record names the file the run actually wrote, and that file's stem IS the convention every other generated file of the point carries. A record whose script is not named the way this package writes one answers None, and the caller keeps the run id, which is what every document was named in legacy releases.

Parameters:

Name Type Description Default
record RunRecord

The run's record.

required

Returns:

Type Description
str or None

The point name, or None where the script is not named the way this package writes one.

pyflightstream.post.products.provenance_file_name

provenance_file_name(
    run_id: str, *, point_name: str | None = None
) -> str

Return the name of one run's provenance document (FR-86).

<point name>.prov.json when the point's own name is known, which is the convention the script and every export of the same point carry and what lets a reader sort scripts/ and provenance/ side by side. <run id with '/' replaced by '_'>.prov.json otherwise, which is what every document was named in legacy releases.

NOTHING RENAMES A RUN. The run id is unchanged: it keys the products manifest and it is a field inside the document, under pyfs:run_id, and it is the identifier of the activity. What moves is a file name, which this package never parses for meaning.

Parameters:

Name Type Description Default
run_id str

The run's id.

required
point_name str

The point's name, where it is known.

None

Returns:

Type Description
str

The document's file name.

pyflightstream.post.products.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.products.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.products.renamed_columns

renamed_columns(
    columns: Sequence[str],
    names: Mapping[str, str] | None,
    *,
    printed: Sequence[str],
    where: str,
) -> tuple[str, ...]

Return columns with the pproc's [names] dictionary applied.

printed is what the plots export prints, which is what a dictionary's left side may name. THE WHOLE DICTIONARY APPLIES OR NONE OF IT DOES: half a dictionary applied is a file nobody can predict.

Parameters:

Name Type Description Default
columns sequence of str

The table's columns.

required
names mapping of str to str, or None

The pproc's [names] dictionary, printed name to new name; None or empty leaves the columns as they are.

required
printed sequence of str

The columns the plots export prints.

required
where str

What the refusal names as the place of the dictionary.

required

Returns:

Type Description
tuple of str

The columns, each renamed where the dictionary names it.

Raises:

Type Description
ProductError

If an entry names a column no plot prints, which must never become a column of NA nor pass in silence; or gives a column a name the table already carries.

pyflightstream.post.products.revolution_drift_pct

revolution_drift_pct(
    current: float, previous: float
) -> float | None

Return the drift of one mean from the previous one, in per cent, or None (NA).

(current - previous) / |previous| * 100: the sign says whether the mean rose or fell whatever the sign of the quantity. None where the previous mean is zero, which has no relative change, and where either mean is not a number.

Parameters:

Name Type Description Default
current float

The mean of the revolution.

required
previous float

The mean of the revolution before it.

required

Returns:

Type Description
float or None

The drift in per cent, or None where it is undefined.

Examples:

>>> revolution_drift_pct(101.0, 100.0)
1.0
>>> revolution_drift_pct(-99.0, -100.0)
1.0
>>> revolution_drift_pct(1.0, 0.0) is None
True

pyflightstream.post.products.rotor_advance_ratio

rotor_advance_ratio(
    speed_m_s: object, rpm: object, diameter_m: object
) -> float | None

Return J = V / (n D) of a rotor at its own speed and diameter, or None.

THE ONE HOME of the ratio a rotor RAN at (P0320-QS-J): J_CLOCK of every table and the J of a quasi-steady point's tables read it here. n is in rev/s and its MAGNITUDE, because the hand of the rotation is the rotor's and RPM_CLOCK carries it. None, and not a guess, where an input is missing or not a finite number, or where the rotor speed is zero or the diameter is not positive. A speed of zero gives J = 0.

Parameters:

Name Type Description Default
speed_m_s object

The free-stream speed in m/s; zero gives J = 0.

required
rpm object

The rotor's speed in rev/min; its sign is left out.

required
diameter_m object

The rotor's diameter in metres.

required

Returns:

Type Description
float or None

J, or None where an input is missing or not finite, the rotor speed is zero or the diameter is not positive.

pyflightstream.post.products.section_identity

section_identity(
    n_rows: int,
    layout: Sequence[Mapping[str, object]] | None,
    rotors: Mapping[str, Mapping[str, object]] | None,
    step: int | None,
    azimuth_deg: float | None,
) -> list[tuple[object, object, object, object]]

Return (FAMILY, PLANE, ROTOR, AZIMUTH) for each row of one sections export.

A layout whose counts do not add up to the export is NOT applied: a row given its neighbour's family is worse than a row given none.

Parameters:

Name Type Description Default
n_rows int

The export's number of rows.

required
layout sequence of mapping, or None

The recorded sections layout, one block per distribution with its count, families and plane.

required
rotors mapping of str to mapping, or None

Rotor alias to its recorded metadata, which says which rotor owns a block and where its blade is.

required
step int or None

The export's time step, for the azimuth at it.

required
azimuth_deg float or None

The azimuth every row carries where the layout is not applied, in degrees.

required

Returns:

Type Description
list of tuple

One (FAMILY, PLANE, ROTOR, AZIMUTH) per row; None for the first three of every row where the layout is missing or its counts do not add up.

pyflightstream.post.products.swept_axes

swept_axes(
    points: Sequence[Mapping[str, float]],
) -> tuple[str, ...]

Return the axes that VARY across points, in the convention's order (FR-85).

Measured over the points rather than declared, so a one-point case sweeps nothing and a row whose matrix declared a sweep that resolved to a single value is named for the value it actually has. Compared at the precision the name itself writes, because two advance ratios that round to one field are one field.

Parameters:

Name Type Description Default
points sequence of mapping of str to float

The sweep points, each holding some of alpha, beta and advance_ratio.

required

Returns:

Type Description
tuple of str

The axes whose values differ across the points, in the order of :data:SWEEP_AXES.

pyflightstream.post.products.trimmed_polar_row

trimmed_polar_row(
    columns: Sequence[str],
    rows: Sequence[Mapping[str, object]],
    *,
    moment: str = TRIM_MOMENT_COLUMN,
    angle: str = TRIM_ANGLE_COLUMN,
) -> dict[str, object]

Return a polar's row at zero pitching moment, interpolated inside its sampled range.

The rows are ordered by angle; the pair of neighbouring rows whose moment changes sign brackets the trim, and every numeric column is interpolated linearly between them at the fraction m0 / (m0 - m1) of the way, so moment reads exactly zero (FR-2302). A row that states the zero itself is the trim. A text column keeps its value where both rows agree and reads NA where they do not; so does a numeric cell either row lacks. Nothing is extrapolated: a polar whose sampled moments do not change sign is refused (FR-2303), and so is one that changes sign more than once, because it has more than one trim and the table would have to choose.

Parameters:

Name Type Description Default
columns sequence of str

The polar table's columns.

required
rows sequence of mapping

The polar table's rows, by column (the text :func:read_csv_table reads).

required
moment str

The pitching-moment column, :data:TRIM_MOMENT_COLUMN by default.

TRIM_MOMENT_COLUMN
angle str

The angle the trim moves, :data:TRIM_ANGLE_COLUMN by default.

TRIM_ANGLE_COLUMN

Returns:

Type Description
dict of str to object

The trimmed row by column; None where a cell is not available.

Raises:

Type Description
ProductError

If moment or angle is not a column, fewer than two rows state both, the sampled moments do not bracket zero, or they cross it more than once.

Examples:

>>> rows = [{"ALPHA": "0.0", "CMB25": "0.1", "CLB": "0.2"},
...         {"ALPHA": "4.0", "CMB25": "-0.1", "CLB": "0.6"}]
>>> trimmed_polar_row(["ALPHA", "CMB25", "CLB"], rows)
{'ALPHA': 2.0, 'CMB25': 0.0, 'CLB': 0.4}

pyflightstream.post.products.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 archive/ folder. True moves the files a rebuild replaces into the products archive, under one stamp, as the package always did (pyfs-matrix post --archive).

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 archive, a previous product this post did not rebuild is KEPT, file and products.json entry, and warned, rather than removed: a post with no data for a product (exports not on this machine) never deletes it. A polar table the rebuild wrote under another name, and with check_frozen every product the frozen check refuses, is moved under archive/ instead of kept current. The command line and the run's own post pass True unless --force-overwrite was confirmed.

False

Returns:

Type Description
list of pathlib.Path

Every product file the post wrote. The post log, products.json and the provenance documents are written beside them and are not in the list.

Raises:

Type Description
ProductExistsError

If the post log already exists and overwrite is false.

ProductError

If check_frozen is true and a point's evidence is in doubt, or the manifest holds no record of matrix_stem.

WorkspaceError

If sims is empty or names a simulation the matrix has no record of.

pyflightstream.post.products.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 NA.

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.products.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 (3207 at Mach 0.20 is 320720);
  • line 3: the write time, %a %b %d %H:%M:%S %Y of the local clock (Tue Sep 08 23:41:07 2026, two spaces before the year), or date verbatim 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.0 and 2.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, 024 for 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, <polar>_M<code>_g<group>.dat beside the polar table.

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 MNOM and as the code of line 2.

required
reference ReferenceValues

The reference block.

required
rows sequence of sequence of float

The coefficient rows, each with len(columns) values in that order.

required
date str

Line 3 as it should be written; the local clock when None.

None
configuration str

The row's CONFIGURATION label (FR-94), appended to the title of line 1 after -. Absent from the title when the row states none (blank, a dash or NA), so a file written by a row without one is unchanged.

None
group_number int

The number line 4 states for the group: the post passes the group's GROUP_ID (0 TOTAL, 1 AIRFRAME, 10 + id a rotor, 100 + k a declared group), so no two groups of a polar share one. Without it a numbered group states its number and a named one is refused (:func:group_number).

None
columns sequence of str

The data columns of lines 8 and 9, :data:COEFFICIENT_COLUMNS by default. A polar of 26.125 names its drag split CDV, CDP in the last two, and a polar holding rows of both builds carries both pairs (FR-423, :func:pyflightstream.post.polar._drag_columned_rows).

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 columns, a value does not fit a field with a blank before it even with no decimals, a header name has ten or more characters, or a header line other than the title holds a character outside ASCII. A value that is not a number is written nan (the format writes every number %10.5f) and :func:read_custom_polar_format reads nan, NA and the historical - back as missing; a line break in the description or the configuration is folded to a blank.

pyflightstream.post.products.write_fixed_width_table

write_fixed_width_table(
    path: Path,
    columns: Sequence[str],
    rows: Sequence[Sequence[object]],
) -> Path

Write a table in the legacy polar format: fixed-width fields, no commas.

The SAME columns and the same values as the csv form; only the rendering differs, which is what SUPERFILE_FORMATS promises. Each column is padded to one width, which is what makes the format readable by a tool that splits on position rather than on a delimiter.

THE WIDTH IS 16 OR ONE MORE THAN THE COLUMN'S LONGEST NAME OR CELL, and a space inside a cell is written _, so at least one space separates every two fields and a reader splitting on whitespace reads one field per column. At a fixed 16 a name of 16 characters or more ran into its neighbour (POLSET_SOLVER_VISCOUS_COUPLING), and a superfile always carries such names; a description wing at cruise split into three.

Parameters:

Name Type Description Default
path Path

The file to write; its folder is created.

required
columns sequence of str

The column names, the header line.

required
rows sequence of sequence of object

One sequence of cells per row, in the order of columns.

required

Returns:

Type Description
Path

path, written with LF line ends.

pyflightstream.post.products.write_phase_locked_table

write_phase_locked_table(
    path: str | Path,
    series: TimestepSeries,
    columns: Sequence[str],
    *,
    window: Sequence[int],
    revolutions: float,
    steps_per_revolution: float,
    rotor: str | None,
    blades: int,
    facts: Mapping[str, object],
    condition: Mapping[str, object] | None = None,
    reference: ReferenceValues | None = None,
    pol: str | int | None = None,
    overwrite: bool = True,
) -> Path

Write the phase-locked reduction a [phase_locked] table asks for: ONE ROW PER AZIMUTH.

pol is the polar the point belongs to, the first column of every row (G16); NA where the caller states none.

Each row is an azimuthal position of the rotor's last revolution, and each value the mean of the samples AT that position across the last revolutions revolutions; the rows run from 0 towards 360 degrees. It is :func:pyflightstream.post.unsteady.phase_locked_rows, which says how a blade's own columns are tabulated by that blade's azimuth.

facts is what the retired write_per_blade_table takes of the rotor: its blade families, its blade1_azimuth_deg and its signed rpm. The columns keep the names the plots export prints, all in one file: a blade's end in its family, a rotor's in the group the pproc named for it.

Parameters:

Name Type Description Default
path str or Path

Destination CSV.

required
series TimestepSeries

The plots table as :func:plots_table_series reads it.

required
columns sequence of str

The plots table's columns, in its order.

required
window sequence of int

First and last solver step of the window.

required
revolutions float

How many of the last revolutions enter each mean.

required
steps_per_revolution float

Solver steps in one revolution.

required
rotor str or None

The rotor's alias, written in each row.

required
blades int

The rotor's blade count.

required
facts mapping

What the run states of the rotor: families, blade1_azimuth_deg and rpm.

required
condition mapping

The point's condition block, written in every row.

None
reference ReferenceValues

Reference lengths and moment point written beside each row.

None
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

The file written, one row per azimuth.

Raises:

Type Description
ProductError

If nothing states where blade one is or which way the rotor turns, so no azimuth can be written, or the history does not hold the revolutions.

pyflightstream.post.products.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.products.write_probes_table

write_probes_table(
    path: str | Path,
    export_text: str,
    *,
    positions: Mapping[int, tuple[float, float, float, str]]
    | None = None,
    condition: Mapping[str, object] | None = None,
    reference: ReferenceValues | None = None,
    pol: str | int | None = None,
    step: int | None = None,
    overwrite: bool = True,
) -> Path | None

Write one probe-points table from an EXPORT_PROBE_POINTS export (FR-87, FR-91).

pol is the polar the point belongs to, the first column of every row (G16); NA where the caller states none.

The flow-field samples of a point that is not an unsteady history: one row per probe point, the export's own columns in its own order and units, which carry the fluid quantities (Mach, Cp, vx, vy, vz, vtot) beside the boundary-layer columns. Nothing is scaled: the plots table brings its COEFFICIENT columns from the solver's reference velocity to the free stream because those columns are coefficients, and a sampled velocity is not. The sampled Mach header is MACH_LOCAL; the condition keeps MACH.

It lands beside the unsteady plots table, under :data:PROBES_DIR, which is the whole point of FR-87: a steady row and an unsteady row citing the same artifact put their flow-field samples in one place. An export the reader cannot parse is a refusal naming the file, never a silent skip; an export with no probe point returns None, as an unsteady export with no step does, since a table of nothing is a promise of content that is not there.

FR-91 PUTS THE SPINE IN FRONT OF THOSE COLUMNS. A steady export already states X, Y and Z and it never states WHICH FRAME they are measured in, so a reader could place the numbers only by knowing the artifact. The export's own coordinates are kept, because they are the solver's answer about the point it sampled. The export is labeled REFERENCE; recorded positions cannot relabel it. A licensed per-export placement probe remains pending.

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 probe points export.

required
positions mapping

Vertex number to (x, y, z, frame), from :func:read_probe_positions. Absent for every run recorded in legacy releases. Exported coordinates still carry REFERENCE; only a position unavailable from both sources reads NA. Missing cells were EMPTY in legacy releases; the producer still returns a blank there and the funnel in :mod:pyflightstream.post._tables renders it, so this says what the user opens rather than what the tuple carries.

None
condition mapping

The point's condition block, written in every row.

None
reference ReferenceValues

Reference lengths written beside each row.

None
pol str or int

The polar the point belongs to, written first in every row.

None
step int

The time step the export holds, written in every row's STEP: the last time step of an unsteady run whose probes are normal (FR-417 FR-887). NA where the caller states none, as on a steady point.

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 probe point.

Raises:

Type Description
ProductError

If the export cannot be read.

pyflightstream.post.products.write_reduction_table

write_reduction_table(
    path: str | Path,
    series: TimestepSeries,
    columns: Sequence[str],
    *,
    reduction: str,
    windows: Sequence[Sequence[int]],
    names: Mapping[str, str] | None = None,
    condition: Mapping[str, object] | None = None,
    reference: ReferenceValues | None = None,
    rotor: str | None = None,
    pol: str | int | None = None,
    overwrite: bool = True,
) -> Path

Write one reduction of a plots table: one row per window, the table's columns averaged.

pol is the polar the point belongs to, the first column of every row (G16) and the first of :data:REDUCTION_COLUMNS; NA where the caller states none.

THE CLOCK IS NOT AVERAGED. FIRST_STEP and LAST_STEP identify the span; Time-step is a counter rather than a plotted physical quantity. rotor is the alias this reduction is cut for, NA for the time average.

condition and reference are what the row is a reduction OF, and this table carried neither in legacy releases: a window of averaged coefficients with no angle of attack and no reference area beside it is a set of numbers about nothing. Both are optional, and what neither supplies reads NA rather than being invented.

The average is :func:pyflightstream.post.unsteady.blade_passage_average, the only implementation of that average in the package, applied once per window; the time average is one window, the phase-locked reduction one per passage, the per-blade reduction one per blade. Coefficients and recognized physical quantities retain six significant digits where that is closer than five decimals; other numeric columns use five decimals.

Parameters:

Name Type Description Default
path str or Path

Destination CSV, beside the plots table it reduces.

required
series TimestepSeries

The plots table as :func:plots_table_series reads it.

required
columns sequence of str

The plots table's columns, in its order.

required
reduction str

time_average, phase_locked or per_blade.

required
windows sequence of (first, last)

Inclusive solver-step windows, 1-based, each inside the table.

required
names mapping of str to str

The pproc dictionary renaming columns of the heading.

None
condition mapping

The point's condition block, written in every row.

None
reference ReferenceValues

Reference lengths and moment point written beside each row.

None
rotor str

The alias the reduction is cut for; NA for the time average.

None
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

The file written, one row per window.

Raises:

Type Description
ProductError

If a window reaches past the rows the table holds: a shorter history averaged as a whole one is the shape every reader here refuses, and the caller records the refusal as a skip.

pyflightstream.post.products.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 condition is not given.

required
step int

Solver step the distribution was sampled at; read from the export's header on a steady export when omitted, NA on an unsteady one.

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; NA where None.

None
advance_ratio float

Advance ratio of the point, used only when condition is not given.

None
condition mapping

The point's condition as :func:point_condition assembles it.

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 families, steps_per_revolution, blade1_azimuth_deg and signed rpm.

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: FAMILY_ID is the 1-based index of the family in it, NA where it names none.

None
rotor_ids mapping of str to int

Each rotor alias to its declared id, for ROTOR_ID.

None
split ('point', 'family', 'both')

[sections] split. The point table is always written; family and both also write one table per family, <point>_FAM-<FAMILY>_sections.csv, and the caller drops the point table where only the family files are asked for.

'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 iteration is passed.

ProductError

If the export cannot be read or carries fewer than seven columns.

pyflightstream.post.products.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; <polar stem>_trim.csv beside it by default.

None
moment str

As :func:trimmed_polar_row.

TRIM_MOMENT_COLUMN
angle str

As :func:trimmed_polar_row.

TRIM_MOMENT_COLUMN
overwrite bool

Replace a file already at out.

False

Returns:

Type Description
Path

The file written.

Raises:

Type Description
ProductError

As :func:trimmed_polar_row, naming the polar.

ProductExistsError

If out exists and overwrite is not set.