pyflightstream.workspace (stable)¶
Generated from the docstrings at build time: every one of the 81 names in the __all__ of pyflightstream.workspace has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Managed campaign workspace: inputs, run files, and the manifest.
Pipeline role: owns where campaign files live, inputs and outputs
alike. Folder layout, the reusable input-artifact library, staging of
solver inputs, collection of outputs, and archiving are managed by the
package, not by the user: folder identity mistakes were a recurring
failure mode in the predecessor toolchain. Run identity lives in the
manifest (runs.json), never in folder or file names; names are
generated, English, and stable, and are never parsed for meaning (SAD
Section 6). Human-readable names come from the output-only
:class:~pyflightstream.workspace.naming.NamingTemplate.
The managed layout under a user-chosen campaign root, created by
:meth:CampaignWorkspace.init (or pyfs-workspace init):
runs.json: the authoritative manifest, one record per executed point.inputs/: the reusable input-artifact library (:mod:pyflightstream.workspace.inputs):geometries/,references/,setups/,pproc/(groups/in legacy releases),profiles/,freestreams/,calibrations/,hpc/,fsi/,matrices/andmanagement/, plus theexecutables.tomlbuild registry; artifacts are declarative TOML resolved by stable id.sims/sim_<sim_id>/: per-simulation folder withinputs/(staged copies with recorded sha256),scripts/(generated script text per point) anddatapoints/(what each point collects). Theoutputs/folder (solver outputs as produced; calledraw/in earlier releases, FR-84) is no longer created, and a workspace that holds one is still read. In legacy releases a fourth folder,parsed/, was created here and written by nothing (PFS-2032.01): the typed extracts it was named for are built at campaign level underpost/, so a workspace made by an earlier release may still carry an emptyparsed/per simulation, which is left where it is and refused by nothing.post/: post-processing products (sweep tables and exports built by reading the manifest).archive/: zipped completed simulations, manifest-driven.
The preparation, solver, submission, collection, continuation and post
stages also append their activity, with duration, outcome and failure
context, to logs/activity.log and logs/activity.log.jsonl, a
logs/ folder created on the first event
(:mod:pyflightstream._progress). The log observes a stage and never
changes its result: a log that cannot be written is said on stderr.
Archiving and cleaning refuse to act when the manifest is missing or does not record the target simulation, so file management can never destroy an unrecorded run.
Use pyflightstream.workspace for the managed workspace API.
The workspace adds declarative FSI inputs under inputs/fsi/
and matrix storage under inputs/matrices/. Resolved inputs and explicit
calibration overrides feed the existing coupling implementation; provenance
distinguishes base properties from effective properties.
Generated complete s9XX setups and SETUP_GUIDELINES.md live under
inputs/setups/ and use the same model and emitter as authored setups.
Mesh-sidecar port identities and geometric TE/wake/base declarations remain
with the mesh; setup choices select their application, while MATRIX supplies
operating values and profile filenames. False setup application selectors
never clear inherited native state.
Optional Excel editing remains a file adapter to the ASCII matrix model.
:mod:pyflightstream.workspace.excel creates a macro-free workbook; its
module CLI previews and explicitly applies synchronization in either
direction through the existing sync engine. Dictionary column names and
MATRIX/POL identities govern mapping. Saved-file hashes reject stale
previews; recoverable originals and untouched workbook parts are retained.
There is no background synchronization or macro execution.
The workspace manages its own disk and its other copies:
:mod:pyflightstream.workspace.storage holds pyfs-workspace space-in-use,
free-space, delete-sims and sync, each previewing until applied
and recorded in storage_management.json at the root. The directory
links it and this module stage and remove are
:mod:pyflightstream.workspace._links, private to both.
The workspace builds custom free-stream files out of other fields:
:mod:pyflightstream.workspace.fields mirrors, moves, subtracts and
time-averages the fields of inputs/freestreams/, previewing until applied
and writing each result beside a provenance record
(pyfs-workspace field). The calibration files of a quasi-steady wheel's
correction live under inputs/calibrations/
(:mod:pyflightstream.cases.corrections).
The workspace has two equal homes for its matrices, the root and
inputs/matrices/: :func:matrix_by_stem and :func:find_matrix read one
matrix per stem across both, once when the two files are identical, and the
plan and sync refuse a stem whose two copies differ, naming both paths.
sync names every sims/sim_* folder of both workspaces, recorded or
not, skips every folder named archive unless asked, holds the
runs.json lease for the whole of its merge and copy, and copies each file
under a temporary name that is renamed in place once its digest matches.
The long commands write a live log logs/<command>-<stamp>.log beside the
activity log while they run. A manifest other than runs.json may sit in
the root, read when a command names it (resolved by
:func:pyflightstream.workspace.naming.resolve_manifest).
The workspace sits one row below the run layer: nothing of it imports
run, at module level, inside a function or for the type checker. The
rebuild of orphaned records that sync --restore asks for is registered
with :mod:pyflightstream.workspace.storage by the run layer when it loads,
and the sync calls it after it has released the runs.json lease. The
input library is cut along its kinds: :mod:pyflightstream.workspace.inputs
keeps the artifact resolvers and every name it offered, the files beside a
geometry are :mod:pyflightstream.workspace.sidecars, the HPC profile
:mod:pyflightstream.workspace.hpc, the build registry
:mod:pyflightstream.workspace.builds and the rule on empty entity
selections :mod:pyflightstream.workspace.selections. Three private modules
carry 0.33 features: workspace._matrix_homes, the one lookup of a matrix
by name over both homes, which every command that takes a matrix reads;
workspace._row_setup, the setup keys a matrix row states over its
preset; and workspace._geometry_clean, a geometry reduced to its meshes
and boundary conditions and the plan warning that asks for it. A private
module carries a 0.34 feature: workspace._degenerate, the thin blade
derived from a blade mesh and written beside it; its three names,
:func:derive_thin_blade, :class:ThinBlade and :func:thin_blade_path, are
offered here.
The 0.38 workspace refines and coarsens a panel mesh from its OBJ:
:func:refine_mesh writes a new geometry folder and returns a
:class:RefinedMesh (FR-424, FR-425). It audits a panel mesh: :func:audit_mesh judges an OBJ's
topology, trailing edge and panel quality, alone or against the source it was
made from, and returns a :class:MeshAudit (FR-426). It lives in the private
package workspace._refine.
Used in the guides¶
pyflightstream.workspace.CampaignWorkspace
¶
CampaignWorkspace(
root: str | Path, naming: NamingTemplate | None = None
)
The managed folder layout of one campaign root.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str or Path
|
User-chosen campaign root; everything below it is managed by this class and never hand-built. |
required |
naming
|
NamingTemplate
|
Output-only naming template for generated scripts, rendered
export names, and archive names; the default reproduces the
historical names ( |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
root |
Path
|
The campaign root, ABSOLUTE. A relative root is resolved once, here, against the working directory of the process that built the workspace; see the constructor's own note for why that is a correctness property rather than a convenience. |
naming |
NamingTemplate
|
The active naming template. |
additional_path
property
¶
additional_path: Path
Location of the extraction manifest of the additional post, additional.json.
init
classmethod
¶
init(
root: str | Path, naming: NamingTemplate | None = None
) -> CampaignWorkspace
Create the full campaign tree under root, idempotently.
Creates the input-artifact library skeleton (one inputs/<kind>
folder for each of geometries, references, setups,
pproc, profiles, freestreams, calibrations, hpc,
fsi, matrices and management),
sims/, post/, and archive/; existing folders and
files are kept untouched, so re-running init on a live
campaign root is safe. When no build registry exists yet, a
comment-only inputs/executables.toml template is written
showing the entry shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str or Path
|
Campaign root to create or complete. |
required |
naming
|
NamingTemplate
|
Naming template of the returned workspace. |
None
|
Returns:
| Type | Description |
|---|---|
CampaignWorkspace
|
The workspace over the created tree. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
If the library already holds two files answering to one
geometry or profile id. The creation contract is untouched:
every folder and the registry template are written first, and
only the RETURN becomes a refusal, so re-running init on a
campaign that has grown an ambiguity still completes the tree
and then says what is wrong with it
(:func: |
open
classmethod
¶
open(
root: str | Path, naming: NamingTemplate | None = None
) -> CampaignWorkspace
Open an existing campaign root, checking what it already holds.
The validating constructor. CampaignWorkspace(root) READS
NOTHING OF THE CAMPAIGN, refuses nothing and raises nothing, so a
campaign can be described before its tree exists; this one asks
the questions that are worth asking once, when the library opens,
rather than when a single id happens to resolve.
The constructor normalises the root with
:meth:pathlib.Path.resolve, which consults the working
directory and the filesystem without reading campaign contents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str or Path
|
Existing campaign root. |
required |
naming
|
NamingTemplate
|
Naming template of the returned workspace. |
None
|
Returns:
| Type | Description |
|---|---|
CampaignWorkspace
|
The workspace over that root. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
If two files under |
Examples:
>>> from pyflightstream.workspace import CampaignWorkspace
>>> workspace = CampaignWorkspace.open("campaign")
resolve_reference
¶
resolve_reference(artifact_id: str) -> ReferenceArtifact
Load the reference-data artifact one id names.
See :func:pyflightstream.workspace.inputs.resolve_reference;
the id is the file name stem under inputs/references/, and
a miss lists the available ids.
resolve_setup
¶
resolve_setup(artifact_id: str) -> SetupArtifact
Load the solver-setup preset one id names.
See :func:pyflightstream.workspace.inputs.resolve_setup; the
raw settings table is kept verbatim for the future formal
solver-setup model.
resolve_pproc
¶
resolve_pproc(artifact_id: str) -> PprocArtifact
Load the post-processing artifact one id names.
See :func:pyflightstream.workspace.inputs.resolve_pproc; group
members are boundary labels or indices, stored verbatim.
expand_group
¶
expand_group(
artifact_id: str,
name: str,
*,
boundaries: Mapping[str, int] | None = None,
) -> dict[str, int]
Expand one named boundary group into its per-member names.
The group Blade becomes Blade1 through BladeN over the members'
1-based positions. See :func:expand_group, which this loads the artifact for.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artifact_id
|
str
|
File name stem under |
required |
name
|
str
|
Group to expand, and the stem of the generated names. |
required |
boundaries
|
mapping of str to int
|
Boundary label to 1-based index; members written as names resolve through it. |
None
|
Returns:
| Type | Description |
|---|---|
dict of str to int
|
|
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
Unknown artifact or group, or members that are labels with no inventory. |
reference_points
¶
reference_points() -> dict[str, PointXyz]
Read the named reference points this campaign declares.
The points live in inputs/reference_points.toml, one TOML
table per name, and the user writes them once: ARP for the
airframe reference point, ERP for the rotor one with a
single propulsor, ERP1 through ERPn with more. Nothing
emitted to the solver takes a pivot, so a named point becomes a
local coordinate system at those coordinates, which is why the
declaration is the authority and not a downstream guess
(PFS-2025.15).
Returns:
| Type | Description |
|---|---|
dict of str to PointXyz
|
Declared points keyed by name, in declaration order. Empty when the campaign declares no points, which is the ordinary case for a study that needs none. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
If the file is not valid TOML, does not validate as
coordinates, or declares names outside the convention
(:func: |
Examples:
>>> from pyflightstream.workspace import CampaignWorkspace
>>> workspace = CampaignWorkspace("campaign")
>>> workspace.reference_points()
{'ARP': PointXyz(x_m=1.5, y_m=0.0, z_m=0.25)}
reference_point
¶
reference_point(name: str) -> PointXyz
Resolve one named reference point by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Point name, for example |
required |
Returns:
| Type | Description |
|---|---|
PointXyz
|
Its coordinates in the simulation geometry frame, m. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
If the campaign declares no reference points at all, or declares none by that name; the message lists the ones it does declare, because a point the workspace never defined cannot be turned into a coordinate system. |
engine_point
¶
engine_point(name: str) -> PointXyz
Refuse the spelling of :meth:rotor_point, naming it.
The retirement registry supplies a refusal naming rotor_point so callers receive the replacement instead of a bare missing-attribute error.
Raises:
| Type | Description |
|---|---|
RetiredAttributeError
|
Always. The message names :meth: |
rotor_point
¶
rotor_point(name: str) -> PointXyz
Resolve a declared reference point that a rotor may turn about.
PFS-2029.11.02, the design decision recorded in the plan: a point's KIND
is stated, kind = "rotor", or left to the convention, where
ERP and ERPn are rotors and ARP is the airframe; a
motion on a point that is not a rotor is refused naming the
point and its kind, so a rotor turning about the airframe
reference point is a decision the file shows and never a side
effect of a name.
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
The point is not declared (as :meth: |
resolve_geometry
¶
resolve_geometry(artifact_id: str) -> Path
Resolve the staged geometry file one id (file stem) names.
See :func:pyflightstream.workspace.inputs.resolve_geometry.
resolve_profile
¶
resolve_profile(artifact_id: str) -> Path
Resolve the input profile file one id (file stem) names.
See :func:pyflightstream.workspace.inputs.resolve_profile.
resolve_executable
¶
resolve_executable(
build_id: str, override: str | Path | None = None
) -> Path
Resolve the FlightStream executable of one build id.
Registry mode reads inputs/executables.toml; an explicit
override path bypasses the registry and is the only way to
run an unregistered build. See
:func:pyflightstream.workspace.inputs.resolve_executable.
Returns the PATH alone, which is what it has always returned and
what most callers want. Use :meth:resolve_build where the
version the registry declares for the build matters too.
resolve_build
¶
resolve_build(
build_id: str, override: str | Path | None = None
) -> RegisteredBuild
Resolve the executable AND the declared version of one build id.
The sibling of :meth:resolve_executable, and the one a caller
wants when a run matrix sends different rows to different builds:
a registry entry written as a table declares the version that
build's scripts are emitted under, and a bare path entry declares
none.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
build_id
|
str
|
Build identifier key of the registry. |
required |
override
|
str or Path
|
Explicit executable path bypassing the registry. It declares no version, exactly as it declares no registry entry. |
None
|
Returns:
| Type | Description |
|---|---|
RegisteredBuild
|
The path, and the declared version or None. |
See Also
pyflightstream.workspace.inputs.resolve_build : the free function this delegates to, which carries the full refusal rules.
plan_dir
¶
plan_dir(matrix_stem: str | None) -> Path
Where plan.json lands: post/<matrix stem>/, or the root without a matrix.
sweep_dir
¶
sweep_dir(matrix_stem: str | None) -> Path
Where the sweep tables land: post/<matrix stem>/, or post/ without one.
products_dir
¶
products_dir(matrix_stem: str | None) -> Path
Where the products and products.json land.
post/<matrix stem>/ for a matrix, post/products/ without one.
The matrix-less fallback is the historical products folder.
reports_root
¶
reports_root(matrix_stem: str | None) -> Path
Return the folder whose reports/ receives a post's measurement reports.
The products folder (:meth:products_dir): post/<matrix>/reports/.
A post of other records (:class:pyflightstream.run.records.ManifestWorkspace)
names its own products folder, so its reports sit apart too.
sim_dir
¶
sim_dir(sim_id: str) -> Path
Return the managed folder of one simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_id
|
str
|
Simulation identity; letters, digits, underscore, and hyphen only, so the derived folder name is stable and portable (NFR-10). |
required |
create_sim
¶
create_sim(sim_id: str) -> Path
Create the managed subfolders of one simulation and return its path.
Creates inputs/, scripts/ and datapoints/; existing
folders are kept, so the call is idempotent. Existing legacy
parsed/ (PFS-2032.01), outputs/ and raw/ (FR-92) folders
are retained but not created.
stage_inputs
¶
stage_inputs(
sim_id: str, sources: Sequence[str | Path]
) -> dict[str, str]
Stage input files under inputs/ and record their hashes.
Staging happens before execution so the manifest can tie the run to the exact input content (NFR-07).
THROUGH A LINK, NOT A COPY (PFS-2029.17, the first sentence of
item #6). in legacy releases every point carried a byte copy of the
geometry it opened, and production meshes are the size that sends every
.fsm to cloud storage rather than to git. When every source sits
in the workspace's own geometry library, sims/<sim>/inputs is
made a directory junction on Windows and a symbolic link
elsewhere, pointing at that library, so the staged path resolves
to the one file on disk and the hash recorded is that file's. A
filesystem that refuses the link, a source outside the library, or
an inputs folder that already holds copies from an earlier
release each fall back to a copy, and :meth:staged_as says which
was made and why, because a junction is not a copy and a scan
that crosses one double-counts; the run record carries the answer.
AT THE GEOMETRY'S OWN FOLDER WHEN IT HAS ONE (PFS-2032.04). A
library laid out one folder per geometry
(inputs/geometries/30_WB/30_WB.fsm) is linked at that folder,
so the point's inputs show that geometry's files, its boundary
inventory beside it, and never the whole library; a flat library
is linked as before. A link left by an earlier staging that points
elsewhere, the whole library after a migration for instance, is
replaced rather than kept.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_id
|
str
|
Target simulation. |
required |
sources
|
sequence of str or Path
|
Files to stage; each must exist. |
required |
Returns:
| Type | Description |
|---|---|
dict of str to str
|
sha256 per staged file name, ready for
:attr: |
staging_would_change
¶
staging_would_change(
sim_id: str, sources: Sequence[str | Path]
) -> str | None
Say what staging sources would change in a simulation's inputs, or None.
A dry run of :meth:stage_inputs that writes nothing, for a simulation
with a point still in a scheduler's queue: that job opens what the
inputs folder presents when it starts, so staging may leave it exactly
as it is and nothing else. A folder that links to the library keeps
its target only when the sources sit in that same folder; a folder of
copies is left alone only when every source already has its bytes
there. Anything else (a link retargeted, removed or made, a copy with
other bytes) is named.
staged_as
¶
staged_as(sim_id: str) -> tuple[str | None, str | None]
Say how one simulation's inputs were staged: link or copy, and why.
Returns (None, None) for a simulation with nothing staged. A
simulation this object did not stage is read off the disk, where
a link is a link and a folder with files is a copy whose reason
was not kept.
recorded_inventory
¶
recorded_inventory(
record: RunRecord,
) -> tuple[str, ...] | None
Return the boundary names of the geometry one record's run opened, or None.
A record written states them (:attr:RunRecord.inventory)
and they are returned as written, with nothing hashed. An older record
states none, and they are read from the mesh block of the file whose
sha256 the record carries in inputs_sha256 (R04): the
simulation's own staged copy first, then the geometry library's file
of that name, flat or in its own folder.
THE HASH, NEVER THE NAME, SAYS A FILE IS THE ONE THAT RAN. A geometry
edited or deleted since the run recovers nothing, and neither does a
file carrying no mesh block. The file is hashed on each call, before
and after its names are read, and both digests must be the recorded
one; nothing is remembered by path, size or time, which a replacement
can keep. The <stem>.boundaries.toml sidecar is not read, because
nothing hashed it; at run time the builder refused a sidecar that
disagreed with the mesh block, so the block of the hash-matched file
is the authority.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
RunRecord
|
The run whose geometry is asked for. |
required |
Returns:
| Type | Description |
|---|---|
tuple of str or None
|
The names in the solver's order, the name at position |
write_script
¶
write_script(
sim_id: str, name: str, text: str
) -> tuple[Path, str]
Write one generated script into scripts/ and hash it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_id
|
str
|
Target simulation. |
required |
name
|
str
|
Script file name, for example |
required |
text
|
str
|
Rendered script text from the builder. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Location of the written script. |
str
|
sha256 of the written text, for
:attr: |
collect_outputs
¶
collect_outputs(
sim_id: str,
produced: Sequence[str | Path],
*,
datapoint: PointName,
ran_in_datapoint: bool = False,
) -> list[str]
Move declared solver outputs into the datapoint's folder (FR-92).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_id
|
str
|
Target simulation. |
required |
ran_in_datapoint
|
bool
|
Accept a declared output that is ALREADY in this point's own folder and record it without moving it. For a job that RAN in that folder, which is a submitted point whose solver wrote its outputs where they are filed. Keyword-only and False by default, and the default is the guard: a caller who has not said the job ran there is refused a file sitting in a datapoint folder, because that file is otherwise a record an earlier run already collected. |
False
|
datapoint
|
PointName
|
THE POINT these outputs belong to, by its checked name
(:class: A CHECKED NAME AND NOT A BARE STRING, deliberately. A string
argument once accepted a tag with the |
required |
produced
|
sequence of str or Path
|
Output files the run declared it would produce. Anywhere OUTSIDE this campaign root, which is where a solver working directory normally sits; inside the root, only in this simulation's own folder and not in one of its managed subdirectories. See Raises. |
required |
Returns:
| Type | Description |
|---|---|
list of str
|
Collected names relative to the simulation folder
( |
Raises:
| Type | Description |
|---|---|
MissingOutputsError
|
If a declared output does not exist, AFTER every declared output
that does has been filed: its |
WorkspaceError
|
If a declared output RESOLVES INSIDE this campaign root but
outside this simulation's own folder, or inside one of that
folder's managed subdirectories. Collection MOVES, so
without this a run could take another run's collected
evidence: naming A source resolving OUTSIDE the root is still accepted, and that is deliberate rather than an oversight: it is the ordinary case, since the solver's working directory is not managed by this class.
If two declared outputs of one call would collect to the same name, or if a declared output's base name is already held in the destination folder from an earlier run. Both are FR-33e and neither takes an overwrite argument: the remedies are a per-point output name and an archived simulation. THE SECOND ONE NARROWED and that is the fix for the swept row, not a relaxation: the destination is now one datapoint rather than the whole simulation, so re-running a point still refuses to overwrite its own evidence, while the NEXT point of the same sweep never meets the previous point's files at all. Both are pre-scans (PFS-2038.06, GEO-039-F07). A refusal must leave sources and destinations untouched rather than moving some outputs before discovering a later collision. |
Notes
An existing <stem>_wakes.vtk beside a declared surface VTK is
collected and recorded with it. This solver-created companion is
optional, so its absence never makes collection incomplete: the
default selection of the VTK export writes it and -1 DISABLE
does not (reports/RPT-074, 2026-09-25).
Collection MOVES rather than copies. Every refusal here exists because of that and a reader has had to infer it from the collision message until now.
output_digests
¶
output_digests(
sim_id: str, collected: Sequence[str]
) -> dict[str, str]
Return the sha256 of each collected output, keyed by its name.
:attr:RunRecord.outputs_sha256 carries these hashes so collected
evidence can be checked for edits, truncation or replacement (PYFS-006).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_id
|
str
|
Simulation the outputs were collected into. |
required |
collected
|
sequence of str
|
Names as :meth: |
required |
Returns:
| Type | Description |
|---|---|
dict of str to str
|
Hex sha256 keyed by the same relative name. |
Raises:
| Type | Description |
|---|---|
WorkspaceError
|
If a named output is not there to hash. Collection has just moved these files, so a miss here means something removed one in between, and hashing what remains would produce a record quieter than the truth. |
read_raw_manifest
¶
read_raw_manifest() -> list[dict]
Read runs.json as written, without validating or defaulting.
This is the manifest AS EVIDENCE: the fields each row actually
carries, with nothing filled in. :meth:read_manifest is the
typed view built from it, and :meth:append_record writes
through this one so that reading a historical manifest cannot
change it (REV010-014).
Returns:
| Type | Description |
|---|---|
list of dict
|
One dict per row, in file order; empty when the manifest does not exist yet. |
read_manifest
¶
read_manifest() -> list[RunRecord]
Read and validate every record of runs.json.
Returns an empty list when the manifest does not exist yet.
The typed view fills defaults for fields a row does not carry;
use :meth:read_raw_manifest when the question is what the row
actually asserts rather than how this version reads it.
Raises:
| Type | Description |
|---|---|
WorkspaceError
|
When a |
append_record
¶
append_record(record: RunRecord) -> None
Append one record to the manifest, atomically.
The manifest is rewritten through a temporary file and an
atomic replace, so a crash never leaves it half-written; a
duplicate run_id is rejected because the manifest is the
run identity (PP-6).
Existing rows are carried across AS THEY WERE WRITTEN. REV010-014: do not re-serialize existing rows through validated models, which would add defaulted fields and a manifest_schema not recorded by their writer. Historical evidence is not this method's to edit; migrating a manifest is a separate, deliberate, auditable act.
Raises:
| Type | Description |
|---|---|
WorkspaceError
|
If the |
read_additional
¶
read_additional() -> list[AdditionalRecord]
Read every record of the extraction manifest, additional.json (G12).
Returns an empty list when no extraction has been recorded. Several
records may share an extraction_id: the manifest is append-only and
the latest record of an identity is the one that counts.
Returns:
| Type | Description |
|---|---|
list of AdditionalRecord
|
One per recorded extraction, in the order they were written. |
append_additional
¶
append_additional(record: AdditionalRecord) -> None
Append one extraction record to additional.json, atomically (G12).
Under a lease of its own, never the lease of runs.json, and through a
temporary file and an atomic replace, as :meth:append_record writes the
manifest of runs. Existing records are carried across as they were
written, and runs.json is not opened.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
AdditionalRecord
|
The extraction to record. |
required |
changed_extraction_file
¶
changed_extraction_file(
record: AdditionalRecord,
) -> str | None
Say which file of one extraction is gone or changed, or None while all are (G12).
THE ONE PREDICATE of whether an extraction's files are still the ones it
wrote, read by both halves of the additional post: an extraction is
reused (ALREADY_EXTRACTED) only while this answers None, and the post
writes its products only while this answers None. A file the post
refuses is therefore one the next --additional-pproc extracts again,
where a check of existence alone would call it done forever. Every file
is hashed on each call against outputs_sha256; an extraction that
recorded no file has nothing to vouch for it and answers too.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
AdditionalRecord
|
The extraction whose files are asked for. |
required |
Returns:
| Type | Description |
|---|---|
str or None
|
The sentence naming the first file gone or no longer hashing as recorded, or None when every one does. |
supersede_records
¶
supersede_records(
run_ids: Sequence[str], *, stamp: datetime | None = None
) -> Path | None
Copy the manifest into archive/ and take the named rows out of it.
For a FORCED RE-RUN: a point whose matrix row was wrong keeps its identity when the correction does not change its name, so the recorded row has to leave before the point can run again. The copy is made FIRST and the write is atomic, so there is no instant at which the workspace holds neither the old manifest nor a whole one.
THE COPY GOES WHERE THIS PACKAGE ALREADY PUTS ONE. pyfs-matrix
rename archives the manifest to archive/runs-<stamp>.json before
rewriting it, and a second home for one artifact name is how a reader
who knows the first never finds the second.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run_ids
|
sequence of str
|
The run identities to remove. One that the manifest does not hold is not an error here: the caller decides what an unmatched name means, and for a forced re-run it refuses before reaching this. |
required |
stamp
|
datetime
|
The moment the copy is named for. Injected so a test does not race the clock; the default is now. |
None
|
Returns:
| Type | Description |
|---|---|
Path or None
|
Where the manifest was copied, or None when there is no manifest to copy, which is a workspace nothing has run in yet. |
archive_datapoint
¶
archive_datapoint(
sim_id: str,
datapoint: PointName,
*,
stamp: datetime | None = None,
) -> Path | None
Move a datapoint's collected outputs aside, under a day-and-hour stamp.
A continuation archives what it replaces into folders
stamped with the day and the hour, the same structure post
already uses, because there can be more than one restart. Two
continuations of one point would collide in a flat folder, and the
stamp orders them for free.
IT APPLIES PER DATAPOINT FOLDER, which every point has even under
warm start: FR-95 shares the SCRIPT across a steady sweep and never
the folder, so datapoints/DP-<tag>/ is a stable address whatever
the run model is.
The datapoint folder stays where it is and its CONTENTS move into
archive/<stamp>/ inside it. That keeps the address a reader
already knows and makes the history a subfolder of it rather than a
sibling nobody finds.
Returns:
| Type | Description |
|---|---|
Path or None
|
Where the outputs were moved, or None where the datapoint folder does not exist or holds nothing to move. NOTHING IS NOT AN ERROR: a first run of a point has no previous outputs, and a continuation of one that was never collected is the ordinary case rather than a mistake. |
complete_submitted_record
¶
complete_submitted_record(record: RunRecord) -> None
Replace a SUBMITTED row with the completed run it became (FR-99).
THE ONE METHOD THAT REWRITES A ROW, and the narrowness is the
whole design. :meth:append_record carries existing rows across
AS THEY WERE WRITTEN because historical evidence is not this
class's to edit; a manifest that any code may rewrite is a
manifest whose rows are opinions.
A SUBMITTED row is the ONE deliberate exception, and it is an
exception in a precise sense: it is not a finished record that a
later reading disagrees with, it is a record that says in its own
status that the run has not come back yet. Completing it is not
editing evidence. It is the evidence ARRIVING.
So the refusal is on the existing row rather than on the new one:
a row in any other status is a run that finished, and this
refuses to touch it whatever the caller passes. That is what
stops this method becoming the general-purpose rewrite that
append_record's docstring exists to prevent.
Raises:
| Type | Description |
|---|---|
WorkspaceError
|
When the manifest holds no row with that |
archive_sim
¶
archive_sim(
sim_id: str, campaign: str | None = None
) -> Path
Zip one recorded simulation into archive/ and remove its folder.
The zip name comes from the workspace naming template
(default sim_<sim_id>.zip); like every generated name it
is output only and never parsed back.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_id
|
str
|
Recorded simulation to archive. |
required |
campaign
|
str
|
Campaign name, needed only when the archive template uses
the |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Location of the written zip file. |
Raises:
| Type | Description |
|---|---|
WorkspaceError
|
If the manifest is missing, does not record |
clean_sim
¶
clean_sim(sim_id: str) -> None
Remove one recorded simulation folder without archiving it.
Raises:
| Type | Description |
|---|---|
WorkspaceError
|
Same refusals as :meth: |
pyflightstream.workspace.RunRecord
¶
Bases: BaseModel
One manifest record: a single executed campaign point.
The record plus the staged inputs reproduce the run (NFR-07).
Attributes:
| Name | Type | Description |
|---|---|---|
run_id |
str
|
Unique identity of the executed point, for example
|
sim_id |
str
|
Simulation identity; ties the record to |
point |
dict of str to float
|
Sweep point coordinates, for example alpha and beta in deg. |
fs_version_requested |
str
|
Canonical FlightStream version the script was built for. |
fs_version_reported |
(str, optional)
|
Version printed in the solver outputs; filled by the parsers and cross-checked against the requested one (FR-18). |
fs_build |
(str, optional)
|
Build string reported by the solver, when available. |
fs_version_source |
str or None
|
Where the build this point ran on came from: None means the row PREDATES the field and is not a claim that the
build was inherited, exactly as |
velocity_requested_m_s |
float or None
|
Free-stream velocity in m/s the case ASKED for, as
:attr: None means the run did not request a velocity, which includes every row written before the field existed, and is NOT zero: a binding treats an unrequested axis as unasked rather than as agreed, and zero would be a request the export could contradict. |
package_version |
str
|
pyflightstream version that produced the run. Read from the
installed distribution's metadata, which is a static string, so
every commit between two tags reports the tag: use
|
package_commit |
(str, optional)
|
Git commit the package's code came from, when it came from a tracked work tree; None for a wheel install, where there is no repository to ask (PYFS-017). |
package_dirty |
(bool, optional)
|
Whether that work tree had uncommitted changes. None travels
with a None |
script_sha256 |
str
|
Hash of the executed script text. |
inputs_sha256 |
dict of str to str
|
Hash per staged input file name, recorded at staging time. |
raw_flag |
bool
|
True when the script used the |
manifest_schema |
str or None
|
Identifier of the record layout this row was written under. A reader that does not know the value should refuse rather than guess which fields exist (PYFS-015). None means the row PREDATES the field and is not a claim that it was written under the current schema. Reading an older row does not stamp it with the current schema (REV010-014). "The field is absent because the row is old" and "the row asserts the current schema" are different facts about the evidence. |
conditions |
list of dict, optional
|
The operating-point binding recorded by the assessor, one
entry per requested axis the export printed back: |
fs_exe |
(str, optional)
|
Solver executable the run invoked, as resolved. |
fs_exe_sha256 |
(str, optional)
|
Hash of that executable, so a later reader can tell whether the same binary is still installed. None when it could not be read. |
argv |
list of str
|
The exact command line, argument by argument. Reproducing a run from the record needs the flags, not a guess at how the executor builds them. |
cwd |
(str, optional)
|
Working directory the solver process ran in. |
timeout_s |
(float, optional)
|
Wall-clock limit actually applied to the process. |
recipe |
(str, optional)
|
Recipe identifier as the case declared it. |
recipe_sha256 |
(str, optional)
|
Hash of the recipe function's source at run time. A recipe is user code that can be edited between runs, so the name alone does not identify what built the script; None when the source is not introspectable. |
script_path |
(str, optional)
|
Generated script, relative to the simulation folder. |
outputs_sha256 |
dict of str to str
|
Hash per collected output, keyed by the same relative name that
appears in |
waived_commands |
list of BrokenCommandRecord
|
Serialized
:class: The key was
|
executor |
ExecutorRecord or None
|
Which executor ran the point and the argv it ran, read off the
run rather than asserted (PFS-2012.04); None on a point where
no solver ran, and on every row written in legacy releases. Adding
it did not move :data: |
export_window |
ExportThresholdRecord or None
|
The export threshold the row states for its unsteady exports
(PFS-2031.18), as resolved for this run: |
solver_setup |
(dict, optional)
|
Serialized solver-setup snapshot
(:class: |
status |
RunStatus
|
Terminal status of the point. |
iterations |
(int, optional)
|
Solver iterations reached, when parsed. |
residual |
(float, optional)
|
Final residual, when parsed. |
wall_time_s |
(float, optional)
|
Wall-clock duration of the solver process in seconds. |
started_at |
(str, optional)
|
When the solver process was started, ISO 8601 in UTC to the
second, as the executor read its clock (PFS-2012.08.01); the
provenance document the products stage writes states it as the
run activity's start. None where no solver ran, where the
executor reports no clock, and on every row written in legacy releases. Adding it did
not move :data: |
finished_at |
(str, optional)
|
When the process ended, or was killed on timeout, the same way. |
outputs |
list of str
|
Collected output files, relative to the simulation folder
(for example |
error |
(str, optional)
|
Error text for failed points. |
flight_condition_defaults |
dict of str to float
|
The fluid pins the row's SETUP artifact supplied, with the values
used, for the keys the row did not state (PFS-2030.08). Empty
means the row stated everything its resolution used, which is
every record written in legacy releases; it is NOT a claim that the
setup carried no table. HOW TO READ THE PAIR: a pin in
|
flight_condition_defaults_from |
str
|
Which setup supplied those pins, id and path, for example
|
angles_not_stated |
list of str
|
The flow angles ( |
matrix_stem |
(str, optional)
|
The stem of the run matrix the point came from, when the campaign
was converted from one (PFS-2031.04). A workspace may hold several
matrices sharing this one manifest, and the sweep table and the
products of each are rebuilt from the records that name it. None
means the record predates the field or the campaign was authored
in Python; such a record belongs to no matrix and is left out of a
per-matrix table rather than counted in every one. Adding it did
not move :data: |
reductions |
dict or None
|
The windows of every reduction the products stage writes beside
the point's plots table (PFS-2015.04), resolved off the row by
:func: a row that names its rotors by alias also carries
|
flight_condition |
dict of str to float
|
The flight condition AS WRITTEN in the row, canonical key to
value, in the units the key names ( |
density_kg_m3 |
(float, optional)
|
Resolved density in kg/m3. |
temperature_k |
(float, optional)
|
Resolved static temperature in K, including any ISA deviation. |
viscosity_pa_s |
(float, optional)
|
Resolved dynamic viscosity in Pa s, from Sutherland's law at
|
density_source |
({'atmosphere', 'solved-from-reynolds'}, optional)
|
WHICH BRANCH produced |
reference_length_m |
(float, optional)
|
The reference length in m that the resolution used, which is
|
action_program |
(str, optional)
|
The counter program the run layer wrote for a row stating
|
action_script |
(str, optional)
|
The file the SCRIPT action points at and the program rewrites,
relative to the simulation folder; |
action_count |
(int, optional)
|
The invocation count the program reached, read from its count file after the solver exited: the number of time steps the solver completed, since the count is the step count exactly (RPT-041). None when the file was never written: a row with no threshold, or a solver that never reached a time step. |
Examples:
A synthetic record illustrates serialization without running a solver:
>>> from pyflightstream.workspace import RunRecord, RunStatus
>>> record = RunRecord(
... run_id="demo/sim_1/AL+000", sim_id="1",
... fs_version_requested="25.0", package_version="0.36.0",
... script_sha256="0" * 64, raw_flag=False, status=RunStatus.SUBMITTED,
... )
>>> record.model_dump(mode="json")["status"]
'SUBMITTED'
>>> record.as_points()[0] is record
True
as_points
¶
as_points() -> list[RunRecord]
Return this record as one record per POINT.
THE MANIFEST STORES JOBS and a steady matrix row is one job over several points, so a consumer that reasons per point (the physics reduction, a per-point table, an assessor comparing angles) would see one point where three ran. Rather than have each of them learn the job shape, they ask here.
A record that is one point returns itself, unchanged and not copied, so every caller can use this unconditionally and the common path costs nothing.
pyflightstream.workspace.RunStatus
¶
Bases: StrEnum
Terminal status of one executed campaign point (SAD Section 7).
Every executed point lands in exactly one of these; a silent skip is structurally impossible in the campaign loop.
Examples:
>>> from pyflightstream.workspace import RunStatus
>>> RunStatus("SUBMITTED") is RunStatus.SUBMITTED
True
>>> str(RunStatus.CONVERGED)
'CONVERGED'
pyflightstream.workspace.apply_mark_boundaries
¶
apply_mark_boundaries(
plan: BoundaryMarkingPlan,
*,
runner: Callable,
overwrite: bool = False,
package_version: str = "unknown",
) -> dict[str, Any]
Run once and admit all five outputs only after saved-state checks succeed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plan
|
BoundaryMarkingPlan
|
Validated preview to execute. |
required |
runner
|
callable
|
Higher-layer execution callback taking script and working directory. |
required |
overwrite
|
bool
|
Whether to replace an existing saved simulation. With the FSM absent the other outputs are replaced regardless, each warned by name. |
False
|
package_version
|
str
|
Package version recorded with the solver outcome. |
'unknown'
|
Returns:
| Type | Description |
|---|---|
dict
|
The promoted marking record. |
Raises:
| Type | Description |
|---|---|
BoundaryMarkingError
|
Execution fails or the saved state does not match the declarations. |
Examples:
Running needs a licensed solver behind runner. Offline, a runner that
reports a failure shows the contract: nothing is promoted and the error
names the staging directory to inspect.
>>> from pathlib import Path
>>> from tempfile import TemporaryDirectory
>>> from types import SimpleNamespace
>>> from pyflightstream.workspace import (
... BoundaryMarkingError,
... apply_mark_boundaries,
... plan_mark_boundaries,
... )
>>> from pyflightstream.workspace.sidecars import write_inventory
>>> def unlicensed(script, working_directory):
... return SimpleNamespace(log="", failed=True, diagnosis="no licence")
>>> with TemporaryDirectory() as folder:
... mesh = Path(folder) / "wing.obj"
... _ = mesh.write_text("v 0 0 0\nv 1 0 0\nv 0 1 0\ng Wing\nf 1 2 3\n")
... with write_inventory(mesh).open("a") as stream:
... _ = stream.write('\nfs_build = "26.125"\n[import]\nunits = "METER"\n')
... _ = stream.write("[trailing_edges]\nnone = true\n")
... plan = plan_mark_boundaries(mesh)
... try:
... apply_mark_boundaries(plan, runner=unlicensed)
... except BoundaryMarkingError as error:
... print(str(error).split(";")[0])
... print(plan.outputs[0].exists())
mark-boundaries failed: no licence
False
pyflightstream.workspace.plan_mark_boundaries
¶
plan_mark_boundaries(
mesh: str | Path,
*,
registry: CommandRegistry | None = None,
progress: Callable[[str], None] | None = None,
) -> BoundaryMarkingPlan
Validate declarations and render a marking pass without writing any file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
str or Path
|
OBJ with a kind-qualified or legacy boundary sidecar. |
required |
registry
|
CommandRegistry
|
Command evidence and grammar, injectable for offline tests. |
None
|
progress
|
callable
|
Receives one line at each stage of the preview (reading, matching and placing each entry, rendering), so a long preview on a fine mesh is not silent (FR-3478). The command line prints them through the console's own progress route. |
None
|
Returns:
| Type | Description |
|---|---|
BoundaryMarkingPlan
|
Preview, input digests and staging destinations. |
Examples:
>>> from pathlib import Path
>>> from tempfile import TemporaryDirectory
>>> from pyflightstream.workspace import plan_mark_boundaries
>>> from pyflightstream.workspace.sidecars import write_inventory
>>> with TemporaryDirectory() as folder:
... mesh = Path(folder) / "wing.obj"
... _ = mesh.write_text("v 0 0 0\nv 1 0 0\nv 0 1 0\ng Wing\nf 1 2 3\n")
... with write_inventory(mesh).open("a") as stream:
... _ = stream.write('\nfs_build = "26.125"\n[import]\nunits = "METER"\n')
... _ = stream.write("[trailing_edges]\nnone = true\n")
... plan = plan_mark_boundaries(mesh)
... print(plan.outputs[0].name, plan.work.exists())
wing.fsm False
pyflightstream.workspace.refuse_mark_boundaries
¶
refuse_mark_boundaries(
plan: BoundaryMarkingPlan, *, overwrite: bool
) -> None
Refuse unverified markings, stale inputs and an unapproved replacement before execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plan
|
BoundaryMarkingPlan
|
Preview whose evidence, inputs and output paths are checked. |
required |
overwrite
|
bool
|
Whether replacement of an existing saved simulation is allowed. |
required |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
Evidence is missing, an input changed or output replacement is refused. |
Examples:
>>> from pathlib import Path
>>> from tempfile import TemporaryDirectory
>>> from pyflightstream._errors import InputArtifactError
>>> from pyflightstream.workspace import plan_mark_boundaries, refuse_mark_boundaries
>>> from pyflightstream.workspace.sidecars import write_inventory
>>> with TemporaryDirectory() as folder:
... mesh = Path(folder) / "wing.obj"
... _ = mesh.write_text("v 0 0 0\nv 1 0 0\nv 0 1 0\ng Wing\nf 1 2 3\n")
... with write_inventory(mesh).open("a") as stream:
... _ = stream.write('\nfs_build = "26.125"\n[import]\nunits = "METER"\n')
... _ = stream.write("[trailing_edges]\nnone = true\n")
... plan = plan_mark_boundaries(mesh)
... refuse_mark_boundaries(plan, overwrite=False)
... _ = plan.outputs[0].write_text("")
... try:
... refuse_mark_boundaries(plan, overwrite=False)
... except InputArtifactError as error:
... print(str(error).endswith("pass overwrite=True (CLI: --overwrite) to replace it"))
True
Advanced¶
pyflightstream.workspace.ADDITIONAL_MANIFEST
module-attribute
¶
ADDITIONAL_MANIFEST = 'additional.json'
pyflightstream.workspace.ADDITIONAL_MANIFEST_SCHEMA
module-attribute
¶
ADDITIONAL_MANIFEST_SCHEMA = 'pyfs-additional/1'
pyflightstream.workspace.AdditionalRecord
¶
Bases: BaseModel
One extraction of the additional post: a saved simulation reopened, with no solve.
Written to :data:ADDITIONAL_MANIFEST and never to runs.json, so the
point's own record stays exactly as its run wrote it. Every path is
relative to the point's simulation folder, as a run record's are.
Attributes:
| Name | Type | Description |
|---|---|---|
manifest_schema |
str
|
:data: |
extraction_id |
str
|
|
run_id |
str
|
The point's run id, as :meth: |
job_id |
str or None
|
The run id of the job record the point belongs to, for a steady row run as one job; None for a point recorded on its own. |
sim_id, point_name, matrix_stem |
str or None
|
Copied from the point's record. |
pproc |
str
|
The ADDITIONAL pproc id, which the products are marked with. |
pproc_sha256 |
str or None
|
sha256 of |
fsm |
str
|
The point's saved simulation, as its record names it. |
fsm_sha256 |
str
|
Its sha256 in the point's record, which the file on disk matched and the copy the solver opened matched too. |
fsm_sha256_after |
str or None
|
The ORIGINAL file hashed again after the launch; it equals
|
unsteady |
bool
|
Whether the point marched in time; its extraction is then one instant, the last. |
note |
str or None
|
What a reader of the extraction must know: the one-instant sentence on an unsteady point. |
fs_version_requested, fs_exe, fs_exe_sha256 |
str or None
|
The build the extraction was emitted under and run on. |
package_version, package_commit, package_dirty |
As on a run record. |
|
script_path, script_sha256 |
str
|
The extraction script, under |
working_dir |
str
|
Where the solver ran and wrote: |
argv, cwd, timeout_s, executor, started_at, finished_at, wall_time_s |
How the solver was called, as on a run record. |
|
status |
ExtractionStatus
|
The terminal status. |
error |
str or None
|
Why a failed extraction failed. |
outputs |
list of str
|
The files written, relative to the simulation folder. |
outputs_sha256 |
dict of str to str
|
sha256 of each, keyed by the same name. |
sections_layout |
list of dict
|
Which rows of the sections exports are which distribution: the run's own layout first, then the additional pproc's blocks, numbered on after the run's and marked with the pproc (RPT-062: a reopened export carries the run's distributions first and the new ones after them). |
leading_sections |
int
|
How many rows at the head of those exports are the run's own. |
frames |
dict
|
The frames the extraction cited, by name, as the run created them. |
inventory |
list of str or None
|
The boundary names the saved simulation holds, in the solver's order. |
surface_translations |
list of dict or None
|
The Tecplot surfaces the package wrote from the extraction's VTK (G45), as a run record states them. |
pyflightstream.workspace.BoundaryMarkingError
¶
Bases: PyflightstreamError
A marking pass failed its solver execution or saved-state read-back.
pyflightstream.workspace.BoundaryMarkingPlan
dataclass
¶
BoundaryMarkingPlan(
mesh: Path,
sidecar: Path,
declarations: BoundaryDeclarations,
work: Path,
script: str,
pending: dict[str, bytes],
awaiting_evidence: tuple[str, ...],
names: tuple[str, ...],
faces: tuple[int, ...],
sets: list[dict[str, Any]],
nodes: dict[str, tuple[int, ...]],
inputs: dict[str, str],
steps: tuple[str, ...],
)
Validated inputs, rendered script and the outputs admitted together.
outputs
property
¶
outputs: tuple[Path, ...]
Return the five products promoted only after read-back succeeds.
group_spans
¶
group_spans() -> list[tuple[int, int]]
Return (first group, number of groups) per entry, then per base region's rim.
Saved groups stand in the order the script marked them. A declared unit is one group,
except on 26.100, where each rim file is a group of its own (measured), a file warned
and skipped is none, and on the builds of :data:RIM_GROUP_BUILDS, where each rim of a
file is a group of its own. On the builds of :data:RIMS_FIRST_BUILDS and
:data:CREATES_FIRST_BUILDS an auto rim follows the file rims.
group_of
¶
group_of(unit: int, groups) -> str | None
Return the saved group of one unit of :meth:group_spans, its first; None if none.
pyflightstream.workspace.BrokenCommandRecord
¶
Bases: TypedDict
One serialized :class:~pyflightstream.script.BrokenCommandUse.
The JSON shape of a waived_commands entry of the manifest,
declared here rather than imported so the workspace layer keeps its
manifest schema and the script layer keeps the model. The model is
the single home of what each field MEANS: read
:class:~pyflightstream.script.BrokenCommandUse for that, including
why two of these are versions and are not interchangeable.
Every key is optional (total=False) and no member type is
narrower than the model's, which is the compatibility half: a
manifest row written before a key existed still reads back, exactly
as :attr:RunRecord.manifest_schema may be None. Unknown keys are
KEPT rather than dropped, so reading a manifest a later version
wrote never quietly edits the evidence.
pyflightstream.workspace.ExecutorRecord
¶
Bases: TypedDict
How the solver was called, as the run layer read it off the run.
The JSON shape of the executor entry of a manifest row
(PFS-2012.04). class_name is the executor's class as it ran
(LocalExecutor today; an HPC executor the day FR-15 lands) and
argv the command line it returned, which is the same list as the
row's own argv and travels here as well so the entry is one
self-contained fact a report can be built from. Both keys are
required: the entry is written whole or, on a point where no solver
ran, not at all, and the row says None. forced_local is
present, and true, only on a point the run's local switch kept on a
machine that would otherwise have submitted; a record
written before it, or by a run that did not ask, has no key, and a legacy reader refuses a
manifest that carries one.
pyflightstream.workspace.ExtractionStatus
¶
Bases: StrEnum
Status of one extraction of the additional post (G12).
There is no convergence verdict among them: an extraction solves nothing, so it is judged by its process and by the files it declared.
pyflightstream.workspace.INPUT_KINDS
module-attribute
¶
INPUT_KINDS = (
"geometries",
"references",
"setups",
"pproc",
"profiles",
"freestreams",
"calibrations",
"hpc",
"fsi",
"matrices",
"management",
)
pyflightstream.workspace.InputArtifactError
¶
InputArtifactError(
message: str,
*,
kind: str | None = None,
artifact_id: str | None = None,
available: tuple[str, ...] = (),
where: dict | None = None,
)
Bases: PyflightstreamError, RuntimeError
An input artifact cannot be resolved or validated.
Raised when an id is unknown (the message lists the available ids of that kind), when an artifact file does not validate against its model, or when a geometry or profile id matches more than one staged file. Input mistakes must surface at resolution time, before any solver run consumes the artifact.
Import it from :mod:pyflightstream.workspace, which owns the input
library it describes, or from :mod:pyflightstream.exceptions:
from pyflightstream.workspace import InputArtifactError
It is DEFINED here rather than there because two layers name it: the
workspace layer raises it, and the layers that bind a run matrix to
the input library catch it and re-raise with the row and the file
they were resolving. Defining it in the workspace package made the
lower one import upward, which is the deferred-import shape the
layering guard refuses (OPS-2007.02.01). The public name is
unchanged and so is the pair of bases, so except RuntimeError
catches exactly what it always did.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
str or None
|
Artifact kind of the failed resolution ( |
artifact_id |
str or None
|
The id that failed to resolve, when the refusal is a miss. |
available |
tuple of str
|
Ids that would have resolved for the kind, so callers can
offer choices without parsing the message. It is populated on a
NOT-FOUND refusal and is EMPTY on a refusal about the id's own
shape, which is about what the caller wrote rather than about
what the library holds. The distinction is stated because an
empty tuple would otherwise be read as an empty library;
|
where |
dict
|
Optional diagnostic locations: family names, zero-based mesh vertex
indices in |
pyflightstream.workspace.KIND_LETTERS
module-attribute
¶
KIND_LETTERS = {
"reference": "r",
"setup": "s",
"pproc": "p",
}
pyflightstream.workspace.KNOWN_MANIFEST_SCHEMAS
module-attribute
¶
KNOWN_MANIFEST_SCHEMAS = (
"pyfs-manifest/1",
"pyfs-manifest/2",
"pyfs-manifest/3",
)
pyflightstream.workspace.MATRIX_FOLDERS
module-attribute
¶
MATRIX_FOLDERS: tuple[str, ...] = ('.', 'inputs/matrices')
pyflightstream.workspace.MergedMesh
dataclass
¶
MergedMesh(
obj: Path | None,
record: Path | None,
boundaries: Path | None,
audit: MeshAudit | None,
interface_edges: int = 0,
moved_nodes: int = 0,
band_faces: int = 0,
triangles_created: int = 0,
open_edges_left: int = 0,
facing_edges_left: int = 0,
turned_faces: int = 0,
renamed: Mapping[str, str] = dict(),
)
What one merge did.
Attributes:
| Name | Type | Description |
|---|---|---|
obj |
Path or None
|
The merged OBJ; None when no interface was found and nothing was written. |
record |
Path or None
|
Its |
boundaries |
Path or None
|
Its inventory sidecar |
audit |
MeshAudit or None
|
The audit of the output. |
interface_edges |
int
|
The edges the two parts now share. |
moved_nodes |
int
|
The adapted nodes replaced by kept nodes with no change of face. |
band_faces |
int
|
The adapted faces a remesh replaced. |
triangles_created |
int
|
The triangles in the output's band beyond the triangles the source band held. |
open_edges_left |
int
|
Every open edge of the output. |
facing_edges_left |
int
|
The open edges of the output still facing the other part's open boundary. |
turned_faces |
int
|
The adapted faces turned against the source face nearest them. |
renamed |
dict
|
Each adapted family that took a new name, to that name. |
pyflightstream.workspace.MeshAudit
dataclass
¶
MeshAudit(
mesh: Path,
source: Path | None,
gates: tuple[AuditItem, ...],
checks: tuple[AuditItem, ...],
figures: Mapping[str, Mapping[str, Value]],
path: Path,
degenerate_faces: tuple[Mapping[str, object], ...] = (),
)
The audit of one mesh, alone or against its source (FR-426).
Attributes:
| Name | Type | Description |
|---|---|---|
mesh |
Path
|
The OBJ audited. |
source |
Path or None
|
The source it was audited against, or None (FR-941). |
gates |
tuple of AuditItem
|
G1 to G6 (FR-938), each with its family, its values and its verdict. |
checks |
tuple of AuditItem
|
The relative checks of FR-939, per family and on the whole mesh. |
figures |
Mapping
|
Per family (and |
path |
Path
|
The |
degenerate_faces |
tuple of Mapping
|
Each face G1 counts degenerate (FR-938, FR-3403): its |
failures
property
¶
failures: tuple[AuditItem, ...]
Return the gates and checks that failed, gates first.
as_json
¶
as_json() -> dict[str, object]
Return the audit as written in audit.json (schema_version 1).
summary
¶
summary() -> list[str]
Return the console summary: each gate, the checks counted, each failure.
files_read
staticmethod
¶
files_read(
mesh: str | PathLike[str],
against: str | PathLike[str] | None = None,
) -> list[tuple[str, Path]]
Return the files an audit of mesh reads, each with what it is (FR-937).
The one list every caller uses (PFS-2117.027). The OBJ, its boundaries
file, its refinement record (<stem>.refine.json), <stem>.te.txt and the
trailing-edge points file the boundaries file names, read through the one
reader of the boundaries file the refinement and the audit use, so a command
that must not write over an input names the same files. With against,
the source's OBJ, boundaries file and points files follow. A boundaries
file that cannot be read names no points file here; the audit refuses
it on its own.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
path - like
|
The OBJ an audit would read. |
required |
against
|
path - like
|
The source the audit would compare it with. |
None
|
Returns:
| Type | Description |
|---|---|
list of (str, pathlib.Path)
|
What each file is, and its path; a file may not exist. |
Examples:
>>> from pyflightstream.workspace import MeshAudit
>>> [what for what, _ in MeshAudit.files_read("W1/W1.obj")][:2]
['the OBJ', 'its boundaries file']
write_csv
¶
write_csv(path: str | Path) -> Path
Write one row per family and figure (--out, alias --csv) and return the path.
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
The path is a file this audit reads (:meth: |
pyflightstream.workspace.MissingOutputsError
¶
MissingOutputsError(
message: str,
*,
collected: list[str],
missing: list[str],
)
Bases: WorkspaceError
Declared outputs were not produced, and the ones that were ARE collected.
Raised by the workspace's collect_outputs after it has filed every
declared output that exists, so a run that failed to write one file
never strands the others outside the point's folder.
A :class:WorkspaceError, so a caller that caught that still catches
this; a caller that records the point reads what was filed from
collected.
Attributes:
| Name | Type | Description |
|---|---|---|
collected |
list of str
|
The outputs filed, relative to the simulation folder, as the
workspace's |
missing |
list of str
|
The declared outputs that do not exist, as they were declared. |
pyflightstream.workspace.NamingTemplate
¶
Bases: BaseModel
User-configurable output names for scripts, exports, and archives.
The template is output only: it decorates files for human reading,
while run identity stays in the manifest. Configure it per
workspace by passing it to
:class:~pyflightstream.workspace.CampaignWorkspace.
Attributes:
| Name | Type | Description |
|---|---|---|
point_name |
str
|
Template of per-point file stems (generated scripts and
rendered export names). Default |
archive_name |
str
|
Template of simulation archive stems; only |
Examples:
>>> template = NamingTemplate()
>>> template.render_output("loads_{point}.txt", campaign="polar", sim="9001",
... point={"alpha": 2.0}, point_name="AL+020")
'loads_AL+020.txt'
render_point
¶
render_point(
*,
campaign: str,
sim: str,
point: dict[str, float],
mach: float | None = None,
advance_ratio: float | None = None,
name: str | None = None,
) -> str
Render the file stem of one sweep point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
campaign
|
str
|
Campaign name for |
required |
sim
|
str
|
Case |
required |
point
|
dict of str to float
|
Sweep point coordinates (alpha and beta in deg,
advance_ratio dimensionless), as produced by
:meth: |
required |
mach
|
float
|
Free-stream Mach number of the case for |
None
|
advance_ratio
|
float
|
The case's advance ratio for |
None
|
name
|
str
|
The point's name (:func: |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The rendered stem, without extension. |
render_output
¶
render_output(
name: str,
*,
campaign: str,
sim: str,
point: dict[str, float],
mach: float | None = None,
advance_ratio: float | None = None,
stem: str | None = None,
point_name: str | None = None,
) -> str
Render the placeholders inside one declared output name.
A name without placeholders passes through unchanged, which
only a single-point case may declare: with placeholders (for
example "loads_{point}.txt") each point exports under a
unique name, and the campaign loop blocks a case whose points
would render the same name, because a later point of the same
simulation would otherwise overwrite an earlier export.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Declared output name, possibly holding placeholders. |
required |
campaign
|
str
|
Same meaning as in :meth: |
required |
sim
|
str
|
Same meaning as in :meth: |
required |
point
|
str
|
Same meaning as in :meth: |
required |
mach
|
str
|
Same meaning as in :meth: |
required |
stem
|
str
|
The point's rendered stem, for |
None
|
point_name
|
str
|
The point's name, for |
None
|
advance_ratio
|
float
|
The case's advance ratio for |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The rendered output name. |
render_archive
¶
render_archive(
*, sim: str, campaign: str | None = None
) -> str
Render the archive file stem of one simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
str
|
The |
required |
campaign
|
str
|
Campaign name for |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The rendered stem; the workspace appends |
pyflightstream.workspace.NamingTemplateError
¶
Bases: PyflightstreamError, ValueError
A naming template cannot be validated or rendered.
Raised when a template names an unknown placeholder, when a
placeholder has no value on the current point (for example
{mach} on a case without a Mach number), or when a rendered
name would not be a portable file name. The message lists what is
available, because a naming mistake must surface before any solver
run, not as a cryptic OS error mid-campaign.
pyflightstream.workspace.PointName
¶
Bases: str
A point's name, as :func:pyflightstream.cases.point_name wrote it.
A str that has been CHECKED: not empty, a portable file name, and not
already carrying the DP- folder prefix. The datapoint folder is rendered
from it and never from a bare string, because a string that already held the
prefix, or a tag of the earlier scheme, put files in a folder the assessor
never looks in.
THE CALLER OF THE LEGACY NAMING SCHEME:
:func:datapoint_name_of builds one of these from a folder that ALREADY
EXISTS under a legacy tag, for a collector that read that folder off the
record rather than recomputing it. The harm above is a name INVENTED in the
old scheme, which files outputs where nothing looks; reading back a folder
that is already there is its opposite. That function answers None rather
than raising for anything it cannot check, which is what keeps this class's
refusal out of a caller that could not handle it.
Examples:
>>> PointName("M144AL+020")
'M144AL+020'
>>> try:
... PointName("a b")
... except ValueError as error:
... print(type(error).__name__)
NamingTemplateError
pyflightstream.workspace.PointXyz
¶
Bases: BaseModel
One point in the simulation geometry reference frame, meters.
Attributes:
| Name | Type | Description |
|---|---|---|
x_m |
float
|
X coordinate in m. |
y_m |
float
|
Y coordinate in m. |
z_m |
float
|
Z coordinate in m. |
kind |
str or None
|
What the point is, |
pyflightstream.workspace.PprocArtifact
¶
Bases: PprocSpec
The post-processing artifact (inputs/pproc/<id>.toml).
PFS-2029.07.01, the groups artifact IS the
home of post-processing and is renamed. The file carries twelve tables,
every one optional: [groups] maps each product name to one alias string;
define several members in the reference's [aliases] table;
[exports] which of the export kinds a point writes, where the
loads table and the saved simulation cannot be switched off and a steady point's solver
plots (plot_residuals,
plot_loads, plot_sections_cp) can;
[sections], [plots] and [[probes]] the solver definitions
the builders emit; [products] the post-processed files written
after the run; [phase_locked], [equations],
[glossary] and [names], which the post stage reads;
[time_averaging] the surface window; and [volume_section], the one flow-field plane
a steady point cuts and
exports. Group aliases are stored
verbatim and resolved by the script layer at emission time. Member lists,
including empty lists, are refused. The
shape is
:class:pyflightstream.cases.PprocSpec; this class is the file.
Validation refusals raise :class:InputArtifactError, including refusals
from nested tables. Field constraints retain the invalid field's location;
the artifact loader adds the source file's path.
Examples:
Use the built-in all only when no reference alias or boundary has that
name; otherwise declare a unique reference alias with the intended members.
The input is one string; the model normalizes it to a one-member list.
TOTAL and AIRFRAME are automatic groups; custom groups use other names.
>>> PprocArtifact(groups={"ALL_SURFACES": "all"}).groups
{'ALL_SURFACES': ['all']}
>>> PprocArtifact(groups={"WING_BODY": "wing_body"}).groups
{'WING_BODY': ['wing_body']}
pyflightstream.workspace.PreparedMesh
dataclass
¶
PreparedMesh(
obj: Path,
config: Path,
nodes: Path,
patches: dict[str, list[str]],
governing: tuple[str, ...] = (),
inspect: Path | None = None,
)
What prepare-to-refine wrote: the patches OBJ, the refine file, the node list, the patches.
patches maps each original family to its patch names in order.
pyflightstream.workspace.REFERENCE_POINTS_FILE
module-attribute
¶
REFERENCE_POINTS_FILE = 'reference_points.toml'
pyflightstream.workspace.ReferenceArtifact
¶
Bases: BaseModel
Reference data of one configuration (inputs/references/<id>.toml).
Attributes:
| Name | Type | Description |
|---|---|---|
area_m2 |
float
|
Reference area S_ref in m^2; must be positive. |
chord_m |
float
|
Reference chord c_ref in m; must be positive. |
span_m |
float
|
Reference span b_ref in m; must be positive. |
rotor_diameter_m |
(float, optional)
|
Rotor diameter D in m; must be positive. IT LIVES HERE, BESIDE THE OTHER THREE LENGTHS, and not in
:class: Optional because a configuration with no rotor has no diameter, and stating a placeholder would be worse than stating nothing. A row asking for an advance ratio without it is refused naming this field. |
moment_point |
PointXyz
|
Moment reference point in the simulation geometry frame, m. |
body_axes |
dict of str to str
|
Which model axis, |
rotor |
(RotorReference, optional)
|
Rotor block, present for propulsive configurations. |
aliases |
dict of str to list of str
|
Names for groups of boundaries, each standing for the boundary names, families or aliases listed under it. |
frames |
list of FrameSpec
|
The custom coordinate systems of the configuration, in the order written. |
rotors |
dict of str to RotorBlock
|
One rotor per top-level table stating |
actuators |
dict of str to ActuatorBlock
|
One actuator disc per top-level table stating |
points |
dict of str to PointXyz
|
One named point per top-level table stating another point |
pyflightstream.workspace.ReferencePoints
¶
Bases: BaseModel
The named reference points one campaign declares.
Loaded from inputs/reference_points.toml, one TOML table per
point name, each holding the coordinates of a
:class:~pyflightstream.workspace.inputs.PointXyz in the simulation
geometry reference frame (m).
The names are a convention, not free text: ARP is the airframe
reference point, and the rotor reference point is ERP with one
propulsor or ERP1 through ERPn with more.
:func:check_reference_point_names is what enforces that.
Attributes:
| Name | Type | Description |
|---|---|---|
points |
dict of str to PointXyz
|
Declared points, keyed by name, in declaration order. |
pyflightstream.workspace.RefinedMesh
dataclass
¶
RefinedMesh(
folder: Path,
obj: Path,
files: tuple[Path, ...],
report: dict[str, Any],
audit: MeshAudit | None = None,
)
What a refinement wrote: the level folder, its files and the report of each family.
Attributes:
| Name | Type | Description |
|---|---|---|
folder |
Path
|
The level folder |
obj |
Path
|
The level's OBJ. |
files |
tuple of pathlib.Path
|
Every file written, the OBJ first. |
report |
dict
|
The |
audit |
MeshAudit or None
|
The audit written beside the level (FR-426), or None when audit=False. |
pyflightstream.workspace.RegisteredBuild
dataclass
¶
RegisteredBuild(
fs_exe: Path,
fs_version: str | None,
accept_unregistered_build: bool = False,
)
One entry of the workspace build registry, as the registry states it.
Attributes:
| Name | Type | Description |
|---|---|---|
fs_exe |
Path
|
The executable this build id names. Existence is checked by the executor at construction, so a campaign can be authored away from the licensed machine. |
fs_version |
str or None
|
The FlightStream version the registry DECLARES this build's
scripts are emitted under, canonical identifier ( It is a DECLARATION and never an inference. Nothing here reads a
version out of the executable path or out of the build id, which
is the rule :class: |
accept_unregistered_build |
bool
|
The entry of this machine's overlay accepts the build installed at
|
pyflightstream.workspace.RemeshResult
dataclass
¶
RemeshResult(
written: bool,
output: Path | None = None,
files: list[Path] = list(),
report: dict[str, Any] = dict(),
summary: list[str] = list(),
)
What a remesh or power-off-body run did: whether it wrote, the files and the checks.
Attributes:
| Name | Type | Description |
|---|---|---|
written |
bool
|
False, with nothing written, when the topology or the saved layout is not handled. |
output |
Path or None
|
The saved simulation written; None when nothing was written. |
files |
list of Path
|
Every file written, the |
report |
dict
|
What that record holds: the source sha256 and the checks. |
summary |
list of str
|
The printed lines of the checks. |
pyflightstream.workspace.RotorReference
¶
Bases: BaseModel
The recorded rotor of a reference artifact ([rotor]).
Attributes:
| Name | Type | Description |
|---|---|---|
radius_m |
(float, optional)
|
Rotor radius. Optional (PFS-2029.05): the diameter at the artifact's root is the length the package reads, and a radius stated beside it must be half of it. |
hub_radius_m |
(float, optional)
|
Hub radius. |
n_blades |
int
|
The RESOLVED blade count of the mesh a row opens, not the physical one: a periodic sector meshing one blade states 1 and the row's symmetry supplies the wheel. |
pitch_deg, toe_deg |
(float, optional)
|
Recorded installation angles; read by nothing in the package. |
position |
PointXyz
|
The rotor position, the one field of this block a builder
reads: the two unsteady run types turn it into the rotor's hub frame
(PFS-2030.03), the frame the reference probe lines and rotor plots
are defined in and the frame a rotor row turns about unless it
states |
Rotor motion belongs to the row, not the reference block (PFS-2029.08). The reference declares |
|
|
geometry; the builder reads the row's motion declaration. |
|
pyflightstream.workspace.SOURCE_VERSION_REQUIRED_SINCE
module-attribute
¶
SOURCE_VERSION_REQUIRED_SINCE = 'pyfs-manifest/2'
pyflightstream.workspace.STEM_REGISTERED_KINDS
module-attribute
¶
STEM_REGISTERED_KINDS = ('profiles',)
pyflightstream.workspace.SetupArtifact
¶
Bases: BaseModel
A named solver-setup preset (inputs/setups/<id>.toml).
The file's solver fields are validated at read time with SolverSettings.
The raw values remain in :attr:settings alongside non-solver entries
for matrix binding, without inserting defaults or coercing stored values.
Attributes:
| Name | Type | Description |
|---|---|---|
settings |
dict
|
The raw TOML table of the preset, verbatim (keys are setting names, values are TOML scalars, arrays, or nested tables). |
pyflightstream.workspace.ThinBlade
dataclass
¶
ThinBlade(
mesh: Path,
sidecar: Path,
boundary: str,
root_offset: float,
span_direction: tuple[float, float, float],
root_span: float,
tip_span: float,
stations: int,
unit: str | None,
)
What :func:derive_thin_blade wrote.
Attributes:
| Name | Type | Description |
|---|---|---|
mesh |
Path
|
The thin blade, an OBJ beside the source. |
sidecar |
Path
|
Its boundary inventory, |
boundary |
str
|
The one boundary (OBJ group) of the thin blade, named as the source's. |
root_offset |
float
|
The offset the root was moved outward by, in the mesh's length unit. |
span_direction |
tuple of float
|
The unit vector from the blade's root to its tip. |
root_span, tip_span |
float
|
The span coordinates (along |
stations |
int
|
The spanwise sections the sheet passes through. |
unit |
str or None
|
The length unit written in the sidecar's |
pyflightstream.workspace.TrailingEdge
dataclass
¶
TrailingEdge(
nodes: ndarray,
span: ndarray,
axis: ndarray,
hub: ndarray,
sections: int,
)
One extracted trailing edge, and what it was extracted with.
Coordinates are in the MESH's own length units throughout. This
class never learns what that unit is, because the mesh file does not
carry one; the unit is declared when the points file is written
(:func:write_trailing_edge_node_file).
Attributes:
| Name | Type | Description |
|---|---|---|
nodes |
ndarray
|
The trailing-edge node coordinates, shape (n, 3), in the mesh's reference frame and length units, ordered by increasing span. One node per section. |
span |
ndarray
|
Spanwise coordinate of each node, shape (n,), in mesh length units: the distance from the rotor axis, measured perpendicular to it. Increasing, by construction. |
axis |
ndarray
|
The rotor axis the extraction used, shape (3,), normalised to unit length. Its SENSE carries the rotation sense by the right-hand rule; see the module docstring. |
hub |
ndarray
|
The hub position the extraction used, shape (3,), in mesh length units and the mesh's reference frame. |
sections |
int
|
Number of chordwise sections the span was cut into, which is
also |
write_node_file
¶
write_node_file(
path: str | Path, *, unit: str, overwrite: bool = False
) -> Path
Refuse: a list of section vertices marks nothing.
This wrote the extraction's vertices as the node list in legacy releases.
The wake-edge import matches an edge by its MID-POINT, and a file of
the edges' end vertices marks nothing, in silence (RPT-061); the
vertices here are one per section, not even consecutive mesh
vertices, so no pairing of them gives the edges either. The points
file is written from the mesh's edges by
:func:write_trailing_edge_node_file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
The destination that is not written. |
required |
unit
|
str
|
Unused. |
required |
overwrite
|
bool
|
Unused. |
False
|
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
Always, naming the report and the call that writes the mid-points. |
pyflightstream.workspace.WheelResult
dataclass
¶
WheelResult(
written: bool,
output: Path | None = None,
files: list[Path] = list(),
report: dict[str, Any] = dict(),
)
What a sector-to-wheel run did: whether it wrote, the files and the checks.
Attributes:
| Name | Type | Description |
|---|---|---|
written |
bool
|
False, with nothing written, when a saved layout was not recognized. |
output |
Path or None
|
The wheel (an OBJ or a saved simulation); None when nothing was written. |
files |
list of Path
|
Every file written: the wheel, its boundaries file and rim points files for an OBJ,
and |
report |
dict
|
What |
pyflightstream.workspace.WorkspaceError
¶
Bases: PyflightstreamError, RuntimeError
A file-management operation was refused or impossible.
The refusals protect run evidence: archiving or cleaning without a manifest record would destroy a run the manifest cannot account for, and collection of a declared output that the solver never produced points at an incomplete run.
pyflightstream.workspace.audit_mesh
¶
audit_mesh(
mesh: str | Path,
*,
against: str | Path | None = None,
unchanged_grids: Sequence[str] = (),
) -> MeshAudit
Audit an OBJ, alone or against its source, and write its audit beside it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
str or Path
|
The OBJ to audit; its trailing-edge points file is the one its
|
required |
against
|
str or Path
|
The source the mesh was made from. Without it only G1, G2 and G4 are judged and the rest is reported (FR-941). |
None
|
unchanged_grids
|
sequence of str
|
The grid families a refinement wrote at factor 1, whose faces G6
compares with the source's. Without them they are read from the
level's |
()
|
Returns:
| Type | Description |
|---|---|
MeshAudit
|
Each gate and check with its values and verdict, the figures, and
|
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
A mesh or source that is not a readable OBJ, or a trailing-edge points file named and missing or malformed; nothing is written. |
pyflightstream.workspace.check_reference_point_names
¶
check_reference_point_names(names: Sequence[str]) -> None
Refuse a set of point names that is not the standard convention.
The convention carries information a free-text name would not: how
many propulsors the campaign describes. ERP alone says one;
ERP1 through ERPn say n, which is why a gap is refused
rather than tolerated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
names
|
sequence of str
|
The declared point names, in declaration order. |
required |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
If a name is outside the convention, if the singular and the numbered rotor names both appear, or if the numbered ones do not run from 1 without a gap. Each refusal names the offending name and the remedy. |
pyflightstream.workspace.check_unique_stems
¶
check_unique_stems(inputs_dir: str | Path) -> None
Refuse a library in which two files answer to one id.
Profiles register by file-name stem with any extension
(:data:STEM_REGISTERED_KINDS), so thrust.csv beside
thrust.txt leaves the id thrust ambiguous. Geometries register
by the whole file name (:data:FILE_NAME_REGISTERED_KINDS), so
wing.fsm beside wing.obj is two ids and is accepted; only two
names equal but for case are refused. Until this check existed the
ambiguity was found lazily, by the resolver, for the one id a caller
happened to ask for, and only once a campaign was already being built.
The check is per directory: ids are namespaced per kind, so the same
stem under references/ and setups/ is two different ids and
both are legal. That idiom is used by real run matrices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs_dir
|
str or Path
|
The workspace |
required |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
If any stem is carried by more than one file, naming the stem and the full path of every file carrying it. |
Examples:
>>> from pyflightstream.workspace import check_unique_stems
>>> check_unique_stems("campaign/inputs")
pyflightstream.workspace.collection_name
¶
collection_name(declared: str | Path) -> str
Return the name a declared output takes once collected.
Collection MOVES each declared output into that point's own
datapoints/DP-<point>/ under its base name, so any directory part
of the declared name is dropped: both loads.txt and
out/loads.txt become datapoints/DP-<point>/loads.txt.
This is a module-level function rather than an inline expression
because two layers have to agree on it, and when they did not, the
disagreement cost a licensed solver seat. :meth:collect_outputs
keyed on the base name and the campaign's plan-time check keyed on
the DECLARED string, so a case declaring a/loads.txt and
b/loads.txt planned as READY and was refused only after the
solver had run (PLN-20260802-1904). Both sides now call this, so
neither can re-derive the rule.
Both separators are accepted regardless of platform, because the
declared name comes from a campaign file that may have been
authored anywhere, while the produced path is local. Treating
a\loads.txt as a directory on Windows and as a filename on
POSIX would make the two boundaries disagree by operating system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
declared
|
str or Path
|
Declared output name, or a produced path. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Base name, with any directory part removed. |
pyflightstream.workspace.datapoint_dir_name
¶
datapoint_dir_name(name: PointName) -> str
Return the folder name one datapoint collects its outputs into (FR-92).
:data:DATAPOINT_PREFIX and the point name that already ends the
run_id and is the stem of every file of the point, so the folder, the
files and the run record carry ONE identity
(DP-M144RE438AL+000BE+000J+080).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
PointName
|
The point's name, checked. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Folder name, relative to :data: |
Raises:
| Type | Description |
|---|---|
NamingTemplateError
|
If |
pyflightstream.workspace.datapoint_name_of
¶
datapoint_name_of(folder: str) -> PointName | None
Return the point a datapoint FOLDER belongs to, or None if it names none.
The inverse of :func:datapoint_dir_name, and it lives beside it because a
rule and its inverse drifting apart is the defect this module already
records for :data:ARCHIVE_STAMP.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder
|
str
|
A folder name read off disk. |
required |
Returns:
| Type | Description |
|---|---|
PointName or None
|
The checked name, or None when |
The collector reads arbitrary folder names from disk. Returning ``None`` for a name that is
|
|
not a point folder lets it continue examining other folders and report the refusal in its
|
|
own vocabulary.
|
|
pyflightstream.workspace.derive_thin_blade
¶
derive_thin_blade(
geometry: str | Path,
*,
root_offset: float,
overwrite: bool = False,
boundary: str | None = None,
) -> ThinBlade
Derive the thin blade of a blade mesh and write it beside the source (FR-330).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geometry
|
str or Path
|
The blade mesh: a saved simulation ( |
required |
root_offset
|
float
|
How far the root is moved outward along the span, in the mesh's own length unit, so the thin blade does not cross the spinner. Required, positive and shorter than the blade. |
required |
overwrite
|
bool
|
Rewrite an existing thin blade and its sidecar. Without it an existing one is refused. |
False
|
boundary
|
str
|
The name of the one boundary (OBJ group) that is the blade, for a
file that holds the blade with a spinner, a nacelle or other bodies
(FR-636). Only its faces are read, and the output is written
under the name :func: |
None
|
Returns:
| Type | Description |
|---|---|
ThinBlade
|
The paths written and the frame and stations used. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
Naming the source and the reason, with nothing written: a file that
is not a saved simulation or an OBJ or cannot be read, one holding
more than one boundary, an OBJ whose sidecar states a CAD or CCS
conversion, a root offset that is not a positive length shorter
than the blade, a blade whose root cannot be told from its tip, a
section that is not one closed loop (open, or one of several) or
whose two sides cannot be separated, and an existing output without
|
pyflightstream.workspace.expand_group
¶
expand_group(
artifact: PprocArtifact,
name: str,
artifact_id: str,
*,
boundaries: Mapping[str, int] | None = None,
) -> dict[str, int]
Expand one named boundary group into its per-member names.
Blade with three members becomes Blade1, Blade2 and
Blade3, numbered 1-based in the members' declared order and
mapped to the boundary index each member names. The workspace
descriptor is the AUTHORITY for that expansion: it is read from the
inputs a study ships with, so re-resolving it later gives the same
names in the same order rather than whatever an inspection of the
mesh concluded that day (PFS-2025.03).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artifact
|
PprocArtifact
|
The loaded groups descriptor. |
required |
name
|
str
|
Group to expand, which is also the stem of the generated names. |
required |
artifact_id
|
str
|
Id the descriptor was loaded under. It is a parameter because
:class: |
required |
boundaries
|
mapping of str to int
|
The opened geometry's boundary inventory, label to 1-based index. A group member written as a NAME resolves through it (PFS-2028.00); its absence is the only thing that refuses one, and that refusal names this argument rather than telling the user to rewrite their artifact in positions. |
None
|
Returns:
| Type | Description |
|---|---|
dict of str to int
|
|
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
If the group is written EMPTY, which means every family the geometry carries and leaves this expansion no positions to number; if the descriptor declares no group of that name (the message lists the ones it does declare), if a member is a boundary label and no inventory was given to resolve it against, or if a member names a boundary the given inventory does not carry (the message lists the ones it does). |
Examples:
>>> from pyflightstream.workspace import PprocArtifact, expand_group
>>> artifact = PprocArtifact(groups={"Blade": "Blade1"})
>>> expand_group(artifact, "Blade", "prop", boundaries={"Blade1": 3})
{'Blade1': 3}
A list is refused with the one-alias line to write:
>>> PprocArtifact(groups={"Blade": ["Blade1"]})
Traceback (most recent call last):
...
pyflightstream._errors.InputArtifactError: ... Write Blade = "Blade1" instead.
pyflightstream.workspace.extract_trailing_edge
¶
extract_trailing_edge(
mesh: Any,
*,
axis: Any = None,
hub: Any = None,
sections: int = DEFAULT_SECTIONS,
) -> TrailingEdge
Extract the trailing edge of a blade mesh in the rotor frame.
The criterion is the aftmost vertex of each chordwise section, with the chordwise direction taken from the section's own extent. Read the module docstring for why it is not a crease criterion and how the aft sense is fixed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
(str, Path or Trimesh)
|
The blade surface, as a mesh file to read ( |
required |
axis
|
array_like
|
REQUIRED. There is no default and the Rotor axis of rotation, three components in the mesh's reference
frame. Normalised internally, so only the direction matters, but
the SENSE matters: the rotor is taken to turn the right-handed
way about it, and that is what decides which end of the chord is
aft. It is a second vocabulary for which way a rotor turns,
beside the sign a matrix row states in |
None
|
hub
|
array_like
|
REQUIRED, on the same terms as |
None
|
sections
|
int
|
Number of chordwise sections to cut the span into, which is the number of nodes returned. At least two: one section yields one point, and a single point names no edge. |
DEFAULT_SECTIONS
|
Returns:
| Type | Description |
|---|---|
TrailingEdge
|
The node list and what it was extracted with. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
If NOT among them, and named because the list would otherwise read as exhaustive of what can go wrong: two sections choosing one vertex. The sections partition the vertices, so that cannot happen; it is an internal invariant rather than a refusal (see the comment at the end of this function). |
Examples:
>>> from pyflightstream.workspace.trailing_edges import extract_trailing_edge
>>> edge = extract_trailing_edge(
... "blade.obj", axis=(0.0, 0.0, 1.0), hub=(0.0, 0.0, 0.0)
... )
>>> edge.nodes.shape
(20, 3)
pyflightstream.workspace.find_matrix
¶
find_matrix(root: str | Path, stem: str) -> Path | None
Return the matrix stem of the workspace at root, from either home, or None.
The rule of :func:matrix_by_stem asked of ONE stem, so a differing pair
of another stem does not refuse this lookup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str or Path
|
The campaign workspace directory. |
required |
stem
|
str
|
Matrix name without its |
required |
Returns:
| Type | Description |
|---|---|
Path or None
|
The matching matrix path, or None when neither home holds the stem. |
Raises:
| Type | Description |
|---|---|
WorkspaceError
|
When |
pyflightstream.workspace.matrix_by_stem
¶
matrix_by_stem(root: str | Path) -> dict[str, Path]
Every matrix of the workspace at root, one path per stem (P0320-MATRICES-HOME).
inputs/matrices/ is a home equal to the root (RST-1): a stem held in
both is read ONCE when the two files hold the same bytes, and the path
returned is the root's; with different bytes the workspace is refused,
naming both paths, because which one ran cannot be told. The files are
the ones :func:matrix_files lists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str or Path
|
The campaign workspace directory. |
required |
Returns:
| Type | Description |
|---|---|
dict of str to Path
|
One matrix path per stem, preferring the root for identical copies. |
Raises:
| Type | Description |
|---|---|
WorkspaceError
|
When one stem is in both homes with different content. |
pyflightstream.workspace.matrix_files
¶
matrix_files(root: str | Path) -> list[Path]
Every matrix of the workspace at root: its *.fs and inputs/matrices/*.fs.
THE ONE DEFINITION of where a workspace's matrices are (P0310-POL-CENSUS).
sync, the storage layer and the repeated-POL census of the plan all
read this list, so they cannot disagree about which matrices exist. A file
that is a link or junction is never followed and is not listed: the link
test reads the entry itself before anything stats its target. A
cloud-backed regular file, whose reparse tag designates no link, is
listed. Each folder is listed in name order, the root first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str or Path
|
The campaign workspace directory. |
required |
Returns:
| Type | Description |
|---|---|
list of Path
|
Matrix files in folder and name order, excluding links and junctions. |
pyflightstream.workspace.merge_objs
¶
merge_objs(
first: str | Path,
second: str | Path,
*,
threshold: float,
adapt: str | Path,
out: str | Path,
overwrite: bool = False,
say: Callable[[str], None] | None = None,
) -> MergedMesh
Merge two trimmed OBJ along their open boundaries within a threshold (FR-3480).
The command is pyfs-mesh merge; docs/geometry.md states the
method and its limits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
first
|
str or Path
|
The two parts. |
required |
second
|
str or Path
|
The two parts. |
required |
threshold
|
float
|
The largest distance, in the OBJ's own length unit, between an interface node and the other part's open boundary. |
required |
adapt
|
str or Path
|
The part that is adapted, one of the two, by its path or its file name; a path elsewhere with a part's file name selects that part and is warned. The other is kept unchanged. |
required |
out
|
str or Path
|
The merged OBJ; |
required |
overwrite
|
bool
|
Replace an existing output. |
False
|
say
|
callable
|
Receives one line of progress per stage. |
None
|
Returns:
| Type | Description |
|---|---|
MergedMesh
|
What was written and measured. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
A part that is not a readable OBJ, |
InputValueError
|
A threshold that is not a length of zero or more. |
pyflightstream.workspace.missing_log_warning
¶
missing_log_warning(
run_id: str, *, check_frozen: bool
) -> str
Return the one post.log WARNING of a RAN_MISSING_LOG point (FR-862).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run_id
|
str
|
Recorded point identifier used in the warning. |
required |
check_frozen
|
bool
|
Whether the missing log also prevents a frozen-solve check. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Warning explaining which checks the missing log prevents. |
pyflightstream.workspace.post_diagnostics
¶
post_diagnostics(log_paths: Sequence[Path]) -> str
Render saved diagnostics through the post layer without running stages.
pyflightstream.workspace.post_stages
¶
post_stages() -> tuple[Callable[..., list[Path]], ...]
Return the registered post stages, in registration order.
pyflightstream.workspace.power_off_body
¶
power_off_body(
sector: str | Path,
*,
blades: list[str],
copies: int,
axis: str = "x",
spinner_theta: int = 6,
spinner_rings: int = 12,
nacelle_theta: int = 6,
nacelle_cells: int = 28,
nose_radius_r: float = 0.038,
tip_radius: float | None = None,
out: str | Path | None = None,
overwrite: bool = False,
) -> RemeshResult
Write the power-off body of a saved sector: a closed spinner and the remesh's nacelle.
The body is the whole turn (copies sectors merged across the seams), full quad, with
no blade surface. Its nacelle is built by the function sector-remesh uses, with the same
arguments, so the nacelle of the remeshed wheel and of this body have the same nodes.
A sector marked with merge_into holds the nacelle's base region and rim group under the
merged family's name: that name is read through the faces it lies on and kept, and a warning
names every merged family, which the body keeps and which it removes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sector
|
str or Path
|
The saved sector the body is made from (the source, as |
required |
blades
|
list of str
|
The boundary that is the blade; it gives the spinner, the nacelle and the tip radius. |
required |
axis
|
str
|
|
'x'
|
copies
|
int
|
Sectors in a turn; the sector's angle is warned when it is not 360/copies. |
required |
spinner_theta
|
int
|
Cells of the closed spinner around the sector and along its meridian, and of the nacelle. |
6
|
spinner_rings
|
int
|
Cells of the closed spinner around the sector and along its meridian, and of the nacelle. |
6
|
nacelle_theta
|
int
|
Cells of the closed spinner around the sector and along its meridian, and of the nacelle. |
6
|
nacelle_cells
|
int
|
Cells of the closed spinner around the sector and along its meridian, and of the nacelle. |
6
|
nose_radius_r
|
float
|
The nose kite's radius, a fraction of the tip radius. |
0.038
|
tip_radius
|
float
|
The tip radius in metres; default the blade's largest radius, warned. |
None
|
out
|
str or Path
|
The body; default |
None
|
overwrite
|
bool
|
Replace existing outputs. |
False
|
Returns:
| Type | Description |
|---|---|
RemeshResult
|
|
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
A sector that is no existing saved simulation, or an output that exists. |
InputValueError
|
An odd cell count, or fewer than two copies. |
pyflightstream.workspace.prepare_to_refine
¶
prepare_to_refine(
mesh: str | Path,
*,
warning_refusals: bool | None = None,
max_angle: float = MAX_ANGLE,
aft: tuple[float, float, float] = _obj.AFT,
overwrite: bool = False,
unit: str = "MILLIMETER",
obj_unit: str = "METER",
visual_inspect: bool = False,
keep_within_component: bool = False,
) -> PreparedMesh
Split a mesh's families into patches and write its refine file and node list.
The mesh is an OBJ, whose families are cut at their sharp edges, or an ANSA
NASTRAN export (.nas, .bdf, .dat) written with the FE perimeters
on, whose families are cut along those perimeters, so each patch is one of
the pre-processor's meshing macros (:mod:._nastran).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warning_refusals
|
bool
|
Restore demoted refusals for this call; None uses the runtime option. |
None
|
mesh
|
str or Path
|
The source OBJ or NASTRAN export; it is never modified. |
required |
max_angle
|
float
|
The largest angle, in degrees, between a listed edge and the plane
across |
MAX_ANGLE
|
aft
|
tuple of float
|
The direction from the nose to the tail (default +x). |
AFT
|
overwrite
|
bool
|
Replace the prepared files of an earlier run. |
False
|
unit
|
str
|
A NASTRAN source's length unit (default MILLIMETER); read only for one. |
'MILLIMETER'
|
obj_unit
|
str
|
The length unit a NASTRAN source is written in (default METER). |
'METER'
|
visual_inspect
|
bool
|
Also write |
False
|
keep_within_component
|
bool
|
Select one governor per direction across each original family's grid patches,
including disconnected layouts, and persist the option under |
False
|
Returns:
| Type | Description |
|---|---|
PreparedMesh
|
The three files written and the patches of each family. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
The mesh cannot be read, or a prepared file exists and |
pyflightstream.workspace.refine_mesh
¶
refine_mesh(
mesh: str | PathLike[str],
factor: float | None = None,
*,
warning_refusals: bool | None = None,
families: Sequence[str] | None = None,
parallel: float | None = None,
normal: float | None = None,
config: str | Path | None = None,
out_dir: str | Path | None = None,
overwrite: bool = False,
keep_first_row: object = None,
progress: Callable[[str], None] | None = None,
accept_remesh: bool = False,
accept_unknown: bool = False,
force_factors: bool = True,
visual_inspect: bool = False,
keep_within_component: bool | None = None,
audit: bool = True,
chordwise: object = None,
spanwise: object = None,
) -> RefinedMesh | None
Refine or coarsen a panel mesh from its OBJ into a new geometry folder (FR-424, FR-425).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warning_refusals
|
bool
|
Restore demoted refusals for this call; None uses the runtime option. |
None
|
mesh
|
path - like
|
The source OBJ, kept unchanged. A refusal may write a diagnostic PDF beside it. |
required |
factor
|
float
|
The factor of every selected family; without it, and without
|
None
|
families
|
sequence of str
|
The families to change (default: every family). |
None
|
parallel
|
float
|
The factor of every selected grid family along its reference perimeter
( |
None
|
normal
|
float
|
The factor of every selected grid family along its reference perimeter
( |
None
|
config
|
path - like
|
The refinement file (default: |
None
|
out_dir
|
path - like
|
Where the level folder goes (default: the parent of the source's folder). |
None
|
overwrite
|
bool
|
Replace an existing level folder. |
False
|
keep_first_row
|
optional
|
Removed keywords, refused by name when given: |
None
|
chordwise
|
optional
|
Removed keywords, refused by name when given: |
None
|
spanwise
|
optional
|
Removed keywords, refused by name when given: |
None
|
progress
|
callable
|
Called with one line per stage and per family as the work goes (read, decide, grid, remesh, write, audit), so a long refinement shows it is moving; the command prints them. None says nothing. |
None
|
accept_remesh
|
bool
|
Remesh with |
False
|
accept_unknown
|
bool
|
Warn and skip, instead of refusing, an entry the refinement does not know or cannot read: an unknown table or key of the refinement file, a value it cannot read (the key takes its default), an implicit refinement file that cannot be read, a family table or component member the mesh does not hold, and a selected family it does not hold. |
False
|
force_factors
|
bool
|
Raise a grid factor below the least its grid allows ( |
True
|
visual_inspect
|
bool
|
Write |
False
|
keep_within_component
|
bool
|
Share directional governors across each declared component. None (the default) reads
|
None
|
audit
|
bool
|
Audit the written level against its source. False skips the audit and records that choice; the level can be audited later with pyfs-mesh audit (FR-3321). |
True
|
Returns:
| Type | Description |
|---|---|
RefinedMesh or None
|
The level folder, its files, the per-family report and the audit. None, with an EmptySelectionWarning and no level written, when no family is selected. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
A refinement refusal. After reading the source, a diagnostic PDF is attempted. |
Examples:
>>> from pyflightstream.workspace import refine_mesh
>>> level = refine_mesh("geometries/W1/W1.obj", 2)
>>> level.folder.name
'W1_R2'
pyflightstream.workspace.register_input_guide
¶
register_input_guide(
writer: Callable[[Path], list[Path]],
) -> Callable[[Path], list[Path]]
Register a writer of generated input guides; returns it.
A writer takes the workspace's inputs directory and returns the pages it
actually CHANGED, none when they already say what it would write.
pyflightstream.workspace.register_post_diagnostics
¶
register_post_diagnostics(
renderer: Callable[[Sequence[Path]], str],
) -> Callable[[Sequence[Path]], str]
Register the renderer of recorded post logs; return the renderer.
pyflightstream.workspace.register_post_stage
¶
register_post_stage(
stage: Callable[..., list[Path]],
) -> Callable[..., list[Path]]
Register a post stage the campaign loop runs after collection; returns it.
pyflightstream.workspace.resolve_build
¶
resolve_build(
inputs_dir: Path,
build_id: str,
override: str | Path | None = None,
) -> RegisteredBuild
Read the registry entry of one build id: its executable and its version.
Two explicit modes, translated from the run matrix's MANUAL pattern:
- Registry mode (default): the build id must exist in
inputs/executables.toml, a top-level TOML table mapping build ids to entries. - Override mode: an explicit
overridepath wins over the registry and is the only way to run an unregistered build; it is never guessed from the environment. An override declares NO version, because it is a bare path with no registry entry behind it to carry one.
TWO ENTRY SHAPES, and the difference is what a build may say about itself:
"26.120" = "C:/fs26120/FlightStream.exe"is the shape this registry has always had and means exactly what it meant: the build id names an executable and declares no version, so a campaign that sends a row to it emits that row's script under the campaign default version."26.123" = { path = "C:/fs26123/FlightStream.exe", version = "26.123" }declares the version as well, which is what lets ONE run matrix send its rows to two solver builds and record each row against the version its own build emits under (PFS-2009.05).
The table is where the declaration lives because it is already the
file in which the user says what a build id MEANS on this machine.
Deriving the version from the build id instead would be the
inference :class:pyflightstream.run.SolverBuild refuses, and the
two are not the same thing: a registry key is a name the campaign
user chose, and nothing stops it naming an installation whose
command database is anything at all.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs_dir
|
Path
|
The workspace |
required |
build_id
|
str
|
Build identifier key of the registry, for example |
required |
override
|
str or Path
|
Explicit executable path bypassing the registry. |
None
|
Returns:
| Type | Description |
|---|---|
RegisteredBuild
|
The executable, and the declared version or None. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
Registry file missing; build id not registered (the message
lists the registered build ids and the override mode); an entry
that is neither a path string nor a table; a table with no
|
Examples:
>>> from pyflightstream.workspace.inputs import resolve_build
>>> build = resolve_build(workspace.inputs_dir, "26.123")
>>> build.fs_version
'26.123'
pyflightstream.workspace.resolve_pproc
¶
resolve_pproc(
inputs_dir: Path, artifact_id: str
) -> PprocArtifact
Load the post-processing artifact one id names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs_dir
|
Path
|
The workspace |
required |
artifact_id
|
str
|
File name stem under |
required |
Returns:
| Type | Description |
|---|---|
PprocArtifact
|
The validated artifact, group members stored verbatim. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
Unknown id (the message lists the available ids), a file that does not validate, or a file in the shape the groups artifact had, which is named with the command that moves it. |
Notes
An old-shape groups file is told by its BARE LISTS: a group name to
its members at the top level, with no [groups] table. The
top-level base_regions list is refused by name before that check,
naming the boundaries file and the row's BASE_REGIONS column (PFS-2252),
so it is never read as a legacy group.
pyflightstream.workspace.sector_remesh
¶
sector_remesh(
sector: str | Path,
*,
blades: list[str],
chord_cells: int,
le: float,
span_cell: float,
axis: str = "x",
tip_ratio: float = 0.6,
tip_length: float = 0.2,
tip_radius: float | None = None,
spinner_theta: int = 12,
spinner_layers: int = 4,
spinner_rings: int = 7,
nacelle_theta: int = 6,
nacelle_cells: int = 28,
root_margin_r: float = 0.038,
nose_radius_r: float = 0.038,
out: str | Path | None = None,
overwrite: bool = False,
) -> RemeshResult
Rebuild a saved sector's blade, spinner and nacelle as full-quad surfaces (PFS-2186.06).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sector
|
str or Path
|
A saved simulation of one sector: one blade, a spinner and a nacelle with a flat base, the blade's quads ending in two trailing-edge rim lines (a blunt trailing edge). |
required |
blades
|
list of str
|
The one boundary that is the blade; the spinner and the nacelle are found from it (the spinner is the boundary the blade's root loop lies on, the nacelle the one with a flat base). |
required |
chord_cells
|
int
|
Chord cells on the side with fewer; the other side has one more. |
required |
le
|
float
|
The first chord cell, as a fraction of the side's arc. |
required |
span_cell
|
float
|
The constant span cell, in metres. |
required |
axis
|
str
|
|
'x'
|
tip_ratio
|
float
|
The last span cell over the constant one, and the length in metres of the finer region. |
0.6
|
tip_length
|
float
|
The last span cell over the constant one, and the length in metres of the finer region. |
0.6
|
tip_radius
|
float
|
The tip radius in metres; default the blade's largest radius about the axis, warned. |
None
|
spinner_theta
|
int
|
Cells of the spinner around the sector, O-grid layers around the root, rings forward to the nose, and the nacelle's cells around the sector and along its meridian. The two around-the-sector counts are even. |
12
|
spinner_layers
|
int
|
Cells of the spinner around the sector, O-grid layers around the root, rings forward to the nose, and the nacelle's cells around the sector and along its meridian. The two around-the-sector counts are even. |
12
|
spinner_rings
|
int
|
Cells of the spinner around the sector, O-grid layers around the root, rings forward to the nose, and the nacelle's cells around the sector and along its meridian. The two around-the-sector counts are even. |
12
|
nacelle_theta
|
int
|
Cells of the spinner around the sector, O-grid layers around the root, rings forward to the nose, and the nacelle's cells around the sector and along its meridian. The two around-the-sector counts are even. |
12
|
nacelle_cells
|
int
|
Cells of the spinner around the sector, O-grid layers around the root, rings forward to the nose, and the nacelle's cells around the sector and along its meridian. The two around-the-sector counts are even. |
12
|
root_margin_r
|
float
|
The spinner's margin ahead of the root loop and the radius of its nose kite, as fractions of the tip radius. |
0.038
|
nose_radius_r
|
float
|
The spinner's margin ahead of the root loop and the radius of its nose kite, as fractions of the tip radius. |
0.038
|
out
|
str or Path
|
The remeshed sector; default |
None
|
overwrite
|
bool
|
Replace existing outputs. |
False
|
Returns:
| Type | Description |
|---|---|
RemeshResult
|
|
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
A sector that is no existing saved simulation, or an output that exists. |
InputValueError
|
An option no mesh can follow (an odd cell count, a chord law that cannot be reached). |
pyflightstream.workspace.sector_to_wheel
¶
sector_to_wheel(
sector: str | Path,
*,
copies: int,
blades: Sequence[str],
axis: str | Sequence[float] = "x",
hub: Sequence[float] | None = None,
center: Sequence[float] | None = None,
tolerance: float = DEFAULT_TOLERANCE_M,
out: str | Path | None = None,
overwrite: bool = False,
wake_terminations: bool = True,
) -> WheelResult
Copy one sector about an axis into a full wheel and write it (PFS-2186.01, PFS-2186.02).
An OBJ sector gives an OBJ wheel, with its boundaries file and the rim points files; a
saved simulation (.fsm) gives a saved wheel, written from the saved file with no
solver. The layout of the saved file is inferred from saved files (see
:func:pyflightstream.workspace._wheel_fsm.sector_fsm_to_wheel). In both the nodes of the
seams are merged within tolerance and the faces keep the sector's order inside each copy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sector
|
str or Path
|
The sector: an OBJ with its |
required |
copies
|
int
|
The number of copies, 2 or more; copy |
required |
blades
|
sequence of str
|
The surfaces that are blades (OBJ groups, or boundary names of a saved simulation);
each is numbered one per copy, |
required |
axis
|
str or sequence of float
|
|
'x'
|
center
|
sequence of float
|
A point of the axis, in the mesh's unit (default the origin).
Independent of the repitch pitch-plane or off-axis |
None
|
hub
|
sequence of float
|
The retired spelling of |
None
|
tolerance
|
float
|
The distance, in metres, within which two nodes are one. |
DEFAULT_TOLERANCE_M
|
out
|
str or Path
|
The wheel; default |
None
|
overwrite
|
bool
|
Replace the files of a wheel that exists; without it an existing file is refused. |
False
|
wake_terminations
|
bool
|
Carry the wake terminations of the sector's trailing-edge entries into every copy
(default), so the OBJ route builds the wheel the saved route builds; False drops them
(CLI: |
True
|
Returns:
| Type | Description |
|---|---|
WheelResult
|
|
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
A sector that is neither an OBJ nor a saved simulation, a file that cannot be read, or
an output that exists without |
InputValueError
|
Fewer than two copies, a blade surface the sector lacks, a bad axis or tolerance. |
pyflightstream.workspace.selected_sims
¶
selected_sims(
records: Iterable[RunRecord],
sims: Iterable[str],
*,
scope: str,
) -> frozenset[str]
Return the simulations sims names, each refused by name unless records hold it.
FR-307: the one refusal of post --sims and collect --sims,
raised before either touches anything. records are the records the
command may select from (one matrix's for the post), and scope says
which in the refusal, for example "of matrix 'matriz'".
pyflightstream.workspace.thin_blade_path
¶
thin_blade_path(
geometry: str | Path, boundary: str | None = None
) -> Path
Return the path the thin blade of geometry is written at (FR-631).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geometry
|
str or Path
|
The source blade mesh. |
required |
boundary
|
str
|
The boundary the blade was selected by (FR-636); its name, with every character that is not a letter, a digit or a hyphen turned into an underscore, joins the stem so two blades of one file do not share an output. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
|
pyflightstream.workspace.trailing_edge_midpoints
¶
trailing_edge_midpoints(
mesh: Any,
*,
axis: Any = None,
hub: Any = None,
sections: int = DEFAULT_SECTIONS,
) -> numpy.ndarray
Return the mid-point of every mesh edge on a blade's trailing edge.
The form the wake-edge import matches (RPT-061): an edge is marked when a point in the file lies within the tolerance of its mid-point, and the edges' end vertices mark nothing. The criterion is in the module docstring: the aftmost vertex of each chordwise section, joined section to section along the edges that are the aft ridge of both their faces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
(str, Path or Trimesh)
|
The blade surface, as a mesh file to read ( |
required |
axis
|
array_like
|
REQUIRED. Rotor axis of rotation; see :func: |
None
|
hub
|
array_like
|
REQUIRED. A point on the axis of rotation; see
:func: |
None
|
sections
|
int
|
Chordwise sections the span is cut into. Unlike the vertex extraction it does NOT set how many points come back: every mesh edge on the trailing edge gives one, whatever the count, as long as each section holds a vertex of it. |
DEFAULT_SECTIONS
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The mid-points, shape (m, 3), in the mesh's reference frame and length unit, in order along the edge from the root to the tip. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
Every refusal of :func: |
Examples:
>>> from pyflightstream.workspace.trailing_edges import trailing_edge_midpoints
>>> points = trailing_edge_midpoints(
... "blade.obj", axis=(0.0, 0.0, 1.0), hub=(0.0, 0.0, 0.0)
... )
pyflightstream.workspace.visual_inspect
¶
visual_inspect(
mesh: str | Path,
*,
nodes: Sequence[str | Path] = (),
te: Sequence[str | Path] = (),
out: str | Path | None = None,
cmap: str | None = None,
families: Sequence[str] | None = None,
box: Sequence[float] | None = None,
mesh_unit: str | None = None,
points_unit: str | None = None,
nastran_unit: str = "MILLIMETER",
iso_from: Sequence[float] = (1.0, -1.0, 1.0),
labels: bool = False,
edges: bool = True,
perimeter_width: float = 0.9,
dpi: int = 300,
overwrite: bool = False,
png: bool = False,
) -> Path
Write the PDF of a mesh's views with its marked points and return its path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
str or Path
|
An OBJ, or a NASTRAN export written in |
required |
nodes
|
sequence of path
|
Node lists saved from an ANSA SET. |
()
|
te
|
sequence of path
|
Trailing-edge points files, each drawn in its own color. |
()
|
out
|
path
|
The PDF (default: |
None
|
cmap
|
str
|
The matplotlib colormap of the patches (default: matplotlib's default). |
None
|
families
|
sequence of str
|
Draw only these patches; a name the mesh does not hold is warned and skipped. |
None
|
box
|
six floats
|
|
None
|
mesh_unit
|
str
|
The mesh's length unit: the scale bar names it and gives the ratio, and a points file that states another unit is converted to it. For a NASTRAN mesh it is the unit the drawing is converted to. |
None
|
points_unit
|
str
|
The unit of the node lists and points files that state none; needs |
None
|
nastran_unit
|
str
|
A NASTRAN mesh's length unit (default MILLIMETER; CLI: |
'MILLIMETER'
|
iso_from
|
three floats
|
The direction the isometric view is seen from (default (1, -1, 1), from +x, -y, +z). |
(1.0, -1.0, 1.0)
|
labels
|
bool
|
Write each patch's name at its centre; draw the face edges. |
False
|
edges
|
bool
|
Write each patch's name at its centre; draw the face edges. |
False
|
perimeter_width
|
float
|
Width of the patch perimeters in points (0 draws none). |
0.9
|
dpi
|
int
|
Resolution of the rasterized surface. |
300
|
overwrite
|
bool
|
Replace an existing PDF (and PNGs). |
False
|
png
|
bool
|
Also write each page of views as a PNG beside the PDF. |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
The PDF written. |
Raises:
| Type | Description |
|---|---|
InspectError
|
(an InputArtifactError) The mesh cannot be read, the PDF exists without
|
pyflightstream.workspace.write_input_guides
¶
write_input_guides(inputs_dir: str | Path) -> list[Path]
Write every registered input guide under inputs_dir; return the pages that changed.
Idempotent: a second call returns nothing and touches nothing. Called by
:meth:CampaignWorkspace.init, by the matrix plan and by the post stage, so
the guides reach a new workspace, one made before they existed, and one
whose pproc gained a [glossary].
pyflightstream.workspace.write_trailing_edge_node_file
¶
write_trailing_edge_node_file(
mesh: Any,
path: str | Path,
*,
axis: Any = None,
hub: Any = None,
unit: str,
sections: int = DEFAULT_SECTIONS,
overwrite: bool = False,
) -> Path
Extract a blade's trailing edge and write it as its points file.
The whole route PFS-2025.16 names, in one call: read the mesh,
find the mid-point of every mesh edge on the trailing edge
(:func:trailing_edge_midpoints), and write them under a unit line
(:func:pyflightstream.workspace.wake_edges.write_trailing_edge_points),
the points file a geometry names. The run converts it into the node
file the wake-edge import reads. Nothing of the mesh library crosses
into the file: what is written is coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
(str, Path or Trimesh)
|
The blade surface; see :func: |
required |
path
|
str or Path
|
Destination points file. |
required |
axis
|
array_like
|
Rotor axis of rotation; see :func: |
None
|
hub
|
array_like
|
A point on the axis of rotation; see
:func: |
None
|
unit
|
str
|
Length unit the MESH coordinates are in, one of
:func: |
required |
sections
|
int
|
Number of chordwise sections; see :func: |
DEFAULT_SECTIONS
|
overwrite
|
bool
|
Replace an existing destination. |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
The file written. |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
Every refusal of :func: |
Examples:
>>> from pyflightstream.workspace.trailing_edges import (
... write_trailing_edge_node_file,
... )
>>> write_trailing_edge_node_file(
... "blade.obj",
... "blade.te.txt",
... axis=(0.0, 0.0, 1.0),
... hub=(0.0, 0.0, 0.0),
... unit="METER",
... )