pyflightstream.post.guides (stable)¶
Generated from the docstrings at build time: every one of the 22 names in the __all__ of pyflightstream.post.guides has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
The generated input guides: the pproc guides, INPUTS.md and input_template.md.
The pproc guides are VARIABLES.md and WRITING-EQUATIONS.md. These two pages
are written into the pproc input folder: every variable a product states with
its definition; and how to write a custom equation, a glossary entry, the
phase-locked table and a group rename. INPUTS.md is written at the root of
the inputs folder and describes every key an
INPUT artifact may state, the matrix row, the setup, the pproc, the reference
and the geometry sidecar, with what it sets, its unit or values, the run types
or builds that accept it and the solver command it reaches.
A fourth (G47) at the ROOT of the inputs folder: the input
template, one section per kind of input file a user writes, the files of
profiles/ among them, each with a complete example to copy. Every example
is a file the package reads as it stands, which its test holds by writing each
one where its title says and reading it with the reader the run uses; the
matrix's header is the layout's registry, the values a comment lists are read
from the registries that check them, and every key of the glossary's tables is
either stated by an example or named on the page as left out, with the reason.
THE INPUT GLOSSARY READS THE REGISTRIES THE CODE USES: the run types' key
tables, the matrix columns, the flight-condition vocabulary, the preset tables,
the export kinds, the sidecar readers' keys and the fields of every input
model. The MEANING of a key is the code's too: a model field's description,
its Attributes entry or its #: comment, or the :class:InputKey its
registry carries. A key added without one is a row with no meaning, which the
glossary's test refuses; nothing is written in the page by hand.
GENERATED FROM THE CODE, which is the property that matters and why this is a function and not two files in the repository. A page written by hand beside a schema goes stale the first time the schema moves, and nothing notices. These read the models and the constants they document, so a table or a column added without a line here produces a guide that is MISSING it rather than one that is WRONG about it, and a test turns the missing line into a failure.
WHERE A USER MEETS THEM. pyfs-workspace init writes them with the rest of the
input library, pyfs-matrix plan writes them again for a workspace made
before they existed, carrying the [glossary] of every pproc artifact it
holds, and pyfs-matrix post does the same; the input glossary is written
by the same three, and so is the input template. Writing is IDEMPOTENT: a page
whose content would not change is not touched, so a run does not dirty a
versioned workspace. Only the names in :data:PPROC_GUIDE_NAMES,
:data:INPUT_GLOSSARY_NAME and :data:INPUT_TEMPLATE_NAME are ever written;
any other file of the folder is the user's.
THREE MODULES (AD-11). This one writes the two pproc guides and
keeps every name of the three pages at its public path; the input glossary
and the parts the pages share are :mod:pyflightstream.post.glossary, and the
input template is :mod:pyflightstream.post.input_template, which this module
re-exports unchanged.
THIS MODULE IS IN post AND NOT IN workspace because it documents the pproc
spec (cases) AND the products (post), and the input glossary reads the
preset tables and the sidecar readers of workspace besides, so it belongs in
the layer that may depend on all of them. The lower layers reach it through
the registry :func:pyflightstream.workspace.register_input_guide, never by an
import.
Advanced¶
pyflightstream.post.guides.ARTIFACT_HEADINGS
module-attribute
¶
ARTIFACT_HEADINGS: Mapping[str, str] = MappingProxyType(
{
"matrix": "The run matrix",
"setup": "The setup artifact, `inputs/setups/<id>.toml`",
"pproc": "The post-processing artifact, `inputs/pproc/<id>.toml`",
"reference": "The reference artifact, `inputs/references/<id>.toml`",
"geometry": "The geometry sidecar, `inputs/geometries/<stem>.boundaries.toml`",
}
)
pyflightstream.post.guides.GLOSSARY_COLUMNS
module-attribute
¶
GLOSSARY_COLUMNS: tuple[str, ...] = (
"Key",
"What it sets",
"Unit or values",
"Accepted by",
"Command",
)
pyflightstream.post.guides.GlossaryRow
dataclass
¶
GlossaryRow(
key: str,
meaning: str,
values: str = "",
accepted: str = "",
commands: tuple[str, ...] = (),
)
One key of an input artifact, as the input glossary states it.
Attributes:
| Name | Type | Description |
|---|---|---|
key |
str
|
The key as the file spells it. |
meaning |
str
|
What it sets, read from the code. |
values |
str
|
Its unit, or the values it takes. |
accepted |
str
|
The run types or builds that accept it, where the code says. |
commands |
tuple of str
|
The solver commands it reaches. |
pyflightstream.post.guides.GlossaryTable
dataclass
¶
GlossaryTable(
artifact: str,
heading: str,
intro: str,
rows: tuple[GlossaryRow, ...],
commands: tuple[str, ...] = (),
)
One table of the input glossary: the keys of one table of one artifact.
Attributes:
| Name | Type | Description |
|---|---|---|
artifact |
str
|
Which artifact, a key of :data: |
heading |
str
|
The table as the file spells it, or its name. |
intro |
str
|
What the table is. |
rows |
tuple of GlossaryRow
|
One per key the table may hold. |
commands |
tuple of str
|
The solver commands the key holding this table reaches. |
pyflightstream.post.guides.INPUT_TEMPLATE_NAME
module-attribute
¶
INPUT_TEMPLATE_NAME = 'input_template.md'
pyflightstream.post.guides.PACKAGE_SET_FIELDS
module-attribute
¶
PACKAGE_SET_FIELDS: frozenset[tuple[str, str]] = frozenset(
{
("ProbesSpec", "resolved_points_file"),
("PortBoundary", "profile_sha256"),
("PortBoundary", "boundary"),
("PortBoundary", "velocity"),
("PortBoundary", "profile"),
("RawCommand", "setup"),
("RawCommand", "source"),
("CustomFlag", "setup"),
}
)
pyflightstream.post.guides.PPROC_GUIDE_NAMES
module-attribute
¶
PPROC_GUIDE_NAMES: tuple[str, ...] = (
"VARIABLES.md",
"WRITING-EQUATIONS.md",
)
pyflightstream.post.guides.REFERENCE_BLOCK_HEADINGS
module-attribute
¶
REFERENCE_BLOCK_HEADINGS: Mapping[str, str] = (
MappingProxyType(
{
"rotors": '`[<NAME>]` with `kind = "rotor"`',
"actuators": '`[<NAME>]` with `kind = "actuator"`',
"points": "`[<NAME>]` with any other `kind`",
}
)
)
pyflightstream.post.guides.TemplateExample
dataclass
¶
TemplateExample(
path: str, language: str, text: str, note: str = ""
)
One example file of the input template.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
str
|
Where the file goes, relative to the workspace root; the example block's title, so a reader copies it there and the suite writes it there before reading it back. |
language |
str
|
The language of the block's fence: |
text |
str
|
The file, ending in a newline. |
note |
str
|
What to know about this file before copying it, above the block. |
pyflightstream.post.guides.TemplateSection
dataclass
¶
TemplateSection(
heading: str,
intro: str,
examples: tuple[TemplateExample, ...],
after: str = "",
left_out: Mapping[
str, Mapping[str, tuple[str, ...]]
] = MappingProxyType({}),
pages: tuple[tuple[str, str], ...] = (),
)
One kind of input file on the input template.
Attributes:
| Name | Type | Description |
|---|---|---|
heading |
str
|
The section's heading; for the five artifacts the glossary covers, the glossary's own heading of that artifact. |
intro |
str
|
What the file is for and where it lives. |
examples |
tuple of TemplateExample
|
The files the section shows, each complete and valid as it stands. |
after |
str
|
What the examples do not say by themselves, below them. |
left_out |
mapping
|
By the glossary's heading of a table, each reason to the keys of that table the examples leave out; an empty tuple of keys stands for every key of the table. It is written on the page, and the template's test holds that every key of every table is shown or named here. |
pages |
tuple of (str, str)
|
The documentation pages the section links, as (name, title): |
pyflightstream.post.guides.VARIABLE_DEFINITIONS
module-attribute
¶
VARIABLE_DEFINITIONS: dict[str, str] = {
POLAR_ID_COLUMN: "-. The polar a row comes from, the matrix row's POL; the first column of every table the post writes",
STRIP_LENGTH: "m. Midpoint-to-midpoint strip length; endpoint lengths equal their adjacent spacing, extending half that spacing beyond the endpoint station",
FX_INT: "N. Fx times Strip_length, in the recorded section axes at this row's STEP and azimuth",
FZ_INT: "N. Fz times Strip_length, in the recorded section axes at this row's STEP and azimuth",
MY_INT: "N m. Moment times Strip_length, about the simulation's moment reference point (MRP), not the station's quarter chord (X_QC, Z_QC), retaining the export's section-plane moment sense at this STEP and azimuth",
"ALPHA": "deg. The angle of attack the solver reports it ran at, as the row wrote it",
"BETA": "deg. The sideslip angle the solver reports it ran at, as the row wrote it",
"MACH": "-. The Mach number of that point",
"RE": "millions. The Reynolds number the solver reports",
"VINF": "m/s. The free-stream velocity the solver reports",
"VREF": "m/s. The solver's reference velocity, which it normalises a coefficient by",
"ALT": "ft. The altitude the row states; NA where it states none",
"RHO": "kg/m3. The air density the run resolved for that point",
"TEMP": "K. The air temperature the run resolved for that point",
"MU": "Pa s. The dynamic viscosity",
"J": "-. The advance ratio the row requested; NA on a row that turns no rotor, and on one that states its speed as RPM. In the two quasi-steady tables, where the row requested none, J is the ratio the rotor ran at",
"J_CLOCK": "-. The advance ratio the CLOCK rotor RAN at, V/(n D) from this point's free stream, the speed the record kept and that rotor's diameter; NA where the record or the reference does not say",
"RPM_CLOCK": "rev/min. The speed the CLOCK rotor turned at, with its hand. The CLOCK rotor is the one CLOCK_MOTION names, or the only rotor the row turns; a row turning several and naming none has no clock and both columns are NA",
"SREF": "m2. The reference area",
"CREF": "m. The reference chord",
"BREF": "m. The reference span",
"XMOM": "m. The x of the moment reference point",
"YMOM": "m. The y of the moment reference point",
"ZMOM": "m. The z of the moment reference point",
"FIRST_STEP": "-. The first solver step of the window a row was averaged over, 1-based",
"LAST_STEP": "-. The last solver step of that window, inclusive",
"STEPS": "-. How many solver steps the window holds",
"REDUCTION": "-. Which reduction a row is: time_average, phase_locked, per_blade or per_revolution",
"ROTOR": "-. The alias of the rotor a row is about; NA where it is about none",
"AZIMUTH": "deg. Where blade one of that rotor is, 0 to 360, from its datum and its sense",
"STEP": "-. The solver step a row states; in a phase-locked table, of the LAST revolution",
"REVOLUTIONS": "-. How many revolutions entered the mean at that azimuth",
"CT": "-. Thrust coefficient, T / (rho n^2 D^4)",
"CQ": "-. Torque coefficient, Q / (rho n^2 D^5)",
"CP": "-. Power coefficient, 2 pi CQ sign(RPM)",
"ETA": "-. Propulsive efficiency, J CT / CP",
"ETAW": "-. The efficiency with the wind-axis force in place of the thrust, J CTW / CP",
"CN": "-. In-plane normal-force coefficient, N / (rho n^2 D^4): the rotor's force along N, the part of the reference frame's up (+z) square to the rotor's axis; NA where the axis lies along up",
"CS": "-. In-plane side-force coefficient, S / (rho n^2 D^4): the rotor's force along S = N x T, which completes the right-handed axes (T, S, N), T the rotor's axis",
"CMN": "-. Moment coefficient about N at the hub, MN / (rho n^2 D^5)",
"CMS": "-. Moment coefficient about S at the hub, MS / (rho n^2 D^5)",
**{
f"C{part}{axes}{at}": f"-. {what} coefficient in {system} axes{about}"
for axes, system in (
("W", "wind"),
("S", "stability"),
("B", "body"),
)
for part, what, at, about in (
("D", "Drag", "", ""),
("Y", "Side-force", "", ""),
("L", "Lift", "", ""),
(
"R",
"Rolling-moment",
"25",
", about the moment reference point",
),
(
"M",
"Pitching-moment",
"25",
", about the moment reference point",
),
(
"N",
"Yawing-moment",
"25",
", about the moment reference point",
),
)
},
}
pyflightstream.post.guides.input_glossary_markdown
¶
input_glossary_markdown() -> str
Return the input glossary, INPUTS.md, as Markdown.
One section per input artifact and one table per table of the artifact, each row a key with its meaning, its unit or values, where it is accepted and the command it reaches. Generated from the code on every call.
Returns:
| Type | Description |
|---|---|
str
|
The Markdown page, ending with a newline. |
Examples:
>>> text = input_glossary_markdown()
>>> text.splitlines()[0]
'# Inputs'
>>> "| `analysis_families` |" in text
True
pyflightstream.post.guides.input_glossary_tables
cached
¶
input_glossary_tables() -> tuple[GlossaryTable, ...]
Every table of the input glossary, in the page's order.
Read from the registries the readers and the builders use and from the
models' own fields, so a key the package gains is a row here; its meaning
comes from the code beside it (a field's description, its Attributes
entry or its #: comment, or the registry's :class:InputKey), and a
key that has none is a row with an empty meaning, which the glossary's
test refuses.
Returns:
| Type | Description |
|---|---|
tuple of GlossaryTable
|
The matrix, the setup, the pproc, the reference and the geometry sidecar, each artifact's tables together. |
pyflightstream.post.guides.input_template_markdown
¶
input_template_markdown() -> str
Return the input template, input_template.md, as Markdown.
One section per kind of input file a user writes, each with what the file
is for, where it lives and a complete example: the run matrix, the setup,
the pproc, the reference, the named points, the geometry sidecar and the
trailing-edge points file beside it, the provenance record, the actuator
profile and the probe survey of profiles/, the custom free stream, the
HPC profile and the build registry with its overlay. Each example is a
file the package reads as it stands, and the keys an example leaves out are
named with the reason. Generated on every call.
Returns:
| Type | Description |
|---|---|
str
|
The Markdown page, ending with a newline. |
Examples:
>>> text = input_template_markdown()
>>> text.splitlines()[0]
'# Input templates'
>>> 'title="inputs/setups/s001.toml"' in text
True
pyflightstream.post.guides.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.guides.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.guides.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.guides.write_workspace_input_glossary
¶
write_workspace_input_glossary(
inputs_dir: str | Path, *, overwrite: bool = True
) -> list[Path]
Write INPUTS.md into inputs_dir; return it if it CHANGED.
The input-guide writer this package registers with
:func:pyflightstream.workspace.register_input_guide beside the pproc
guides, which is how pyfs-workspace init, pyfs-matrix plan and
pyfs-matrix post reach it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs_dir
|
str or Path
|
The workspace's |
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 |
|---|---|
list of pathlib.Path
|
The page when this call wrote it, otherwise an empty list. |
pyflightstream.post.guides.write_workspace_input_template
¶
write_workspace_input_template(
inputs_dir: str | Path, *, overwrite: bool = True
) -> list[Path]
Write input_template.md at the root of inputs_dir; return it if it CHANGED.
The input-guide writer this package registers with
:func:pyflightstream.workspace.register_input_guide beside the glossary,
which is how pyfs-workspace init, pyfs-matrix plan and
pyfs-matrix post reach it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs_dir
|
str or Path
|
The workspace's |
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 |
|---|---|
list of pathlib.Path
|
The page when this call wrote it, otherwise an empty list. |
pyflightstream.post.guides.write_workspace_pproc_guides
¶
write_workspace_pproc_guides(
inputs_dir: str | Path, *, overwrite: bool = True
) -> list[Path]
Write the two guides into <inputs_dir>/pproc; return the pages that CHANGED.
The input-guide writer this package registers with
:func:pyflightstream.workspace.register_input_guide, which is how
pyfs-workspace init, pyfs-matrix plan and pyfs-matrix post reach
it. The [glossary] of EVERY pproc artifact in the folder is listed, each
entry naming the artifact it came from. An artifact that does not parse is
left to the stage that reads it, which names the fault; it costs the guides
nothing but its own glossary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs_dir
|
str or Path
|
The workspace's |
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 |
|---|---|
list of pathlib.Path
|
The pages this call wrote, none when nothing would change. |