pyflightstream.post.superfile (stable)¶
Generated from the docstrings at build time: every one of the 7 names in the __all__ of pyflightstream.post.superfile has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
FR-89: one derived file per polar and group that carries everything the workspace knows.
A super file combines the polar table, campaign sweep table, matrix row, setup, reference and unsteady plots into one tabular view of a simulation and its products.
post/<matrix>/polars/SUPER-0001-M150RE438AL+000BE+000J+sweep_g01.csv
THE NAME FOLLOWS THE CONVENTION: the point file name with SUPER- in
place of P (POLAR- in legacy releases), so it is told apart at a
glance, the swept field written <code>+sweep, and the group suffix at
the end.
IT IS WRITTEN AFTER THE UNSTEADY POST-PROCESS, which settles its shape: one
row per CONVERGED point and no time series, so nothing is repeated down the
file and a reader cannot tell from it whether the run behind a row was steady
or unsteady. That transparency is the point of it rather than a consequence,
and it is why the COLUMN SET IS THE CAMPAIGN'S rather than the polar's: a
steady polar's file carries the same header as the rotor's beside it, with
NA cells where that run produced nothing.
A value that does not apply is written as NA. Zero is reserved for a measured or computed
zero, so missing rotor quantities cannot be mistaken for zero loads.
ITS COLUMN SET IS A SUPERSET of the union of what the workspace knows about that simulation, and the rule is a superset rather than a list because a list is a judgement about what matters and the requirement asks for completeness. The acceptance is one sentence: if a reader has to open a second file to know something about that simulation, it failed.
WHERE EVERY VALUE COMES FROM, and NONE of them is assembled a second time here. Each block is a table some other writer already built, carried across under its own column names:
the polar table's own row `products._polar_table_rows`, the one
assembly the polar table is written from
the flight condition the manifest record: what the row stated,
what the setup pinned, and what the
resolver solved
the matrix row `cases.matrix.read_matrix`, the row whose
POL is this polar
the rotor speed the record's reduction windows, per rotor
the campaign sweep table `results.tables.sweep_table`, the frame
`campaign_sweep.csv` is written from
the solver flags the record's solver-setup snapshot, keyed
by the solver command
the unsteady plots the plots table this stage has just
written, at its LAST time step
A field already carried by an earlier block is NOT overwritten by a later
one: the blocks overlap on purpose (MACH is a polar column and a flight
condition key; DESCRIPTION is a polar column and a matrix cell), and the
first writer of a name is the one whose precision and units the column
documents.
THE ORDER IS THEREFORE THE PRECEDENCE, and the recorded flight condition comes before the matrix row for that reason (PFS-2038.02). A superfile row is a RECORDED point. Its conditions are what the run actually used; the matrix cell is what the workspace intends next, read from the current file and bound to nothing, so editing it after a run would otherwise relabel a result that had already happened. The matrix still supplies every key the record does not.
Advanced¶
pyflightstream.post.superfile.SUPERFILE_FORMATS
module-attribute
¶
SUPERFILE_FORMATS: tuple[str, ...] = ("csv", "legacy_polar")
pyflightstream.post.superfile.SUPERFILE_REPORT_PREFIX
module-attribute
¶
SUPERFILE_REPORT_PREFIX = 'superfile-'
pyflightstream.post.superfile.SuperfileDraft
dataclass
¶
SuperfileDraft(
path: Path,
rows: tuple[dict[str, str], ...],
entry: dict[str, object],
fmt: str | None = None,
)
One superfile before the campaign's column set is known.
The rows are complete and the COLUMNS are not: the header is the union over every draft of the campaign, so that a steady polar's file and an unsteady one's carry the same header and a reader cannot tell them apart by their shape.
pyflightstream.post.superfile.matrix_rows
¶
matrix_rows(
root: Path, matrix_stem: str | None
) -> dict[str, MatrixRow]
Return the rows of the campaign's own matrix, keyed by POL; empty when there is none.
A matrix can live at the workspace root under its recorded stem, so
matrix_stem = "matriz" is <root>/matriz.fs. (P0320-MATRICES-HOME)
inputs/matrices/matriz.fs is an equal home
(:func:pyflightstream.workspace.find_matrix): one stem in both is read
once when the bytes are the same, and refused when they differ, which
here, as for a matrix kept elsewhere, is no rows; the post stage says
which. The consequence is stated rather than hidden: its cells are then
absent from the superfile AND from the union of what the workspace
knows, so the two still agree and no field is silently dropped from a
file that claims to be complete.
EVERY ROW, active or not. active_only would drop a row whose RUN
cell was set back to 0 after it ran, and the records of that run are
in the manifest either way; a superfile of a recorded point must be
able to say what its row said.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
The workspace root. |
required |
matrix_stem
|
str or None
|
The matrix stem the records name. |
required |
Returns:
| Type | Description |
|---|---|
dict of str to MatrixRow
|
Every row by POL; empty when the matrix is not found or is refused. |
pyflightstream.post.superfile.release_tag
¶
release_tag(version: str) -> str
Return an unambiguous release tag from the three numeric version components.
Historical compact tags are retained when major and patch each have one digit.
Otherwise hyphens separate all three components, so a patch of 10 after
minor 1 (tag 0-1-10) cannot overwrite the compact 0110 report of
minor 11. Development suffixes do not enter the tag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str
|
A package version. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Its major, minor and patch numbers in compact or hyphen-separated form, and a
pre-release's label after them ( |
Raises:
| Type | Description |
|---|---|
ProductError
|
If the version has no major, minor and patch, a part carries no digits, or the patch is followed by something other than a pre-release label. |
Examples:
>>> release_tag("0.16.0.dev0")
'0160'
>>> release_tag("0.10.1")
'0101'
>>> release_tag("0.8.0")
'080'