Skip to content

pyflightstream.probes.layouts (stable)

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

The layouts of probe shapes: line, rectangle, circle, survey lattice, far-field plane.

Pipeline role: the one place probe positions are computed (FR-459). The line, rectangle and circle of a [[probes]] entry (FR-79) are laid out here, in the entry's frame and scale, rounded to five decimals as the script carries them; the arithmetic order and math.cos/math.sin are those the emitted scripts were written with, so a script is byte-identical whichever module laid its points out. The survey lattice of a lattices entry and the far-field plane of Trefftz C are laid out here too, and so are the script lines and the import csv that create and export probes (NEW_PROBE_POINT / PROBE_POINTS_IMPORT, UPDATE_PROBE_POINTS, EXPORT_PROBE_POINTS; FSM-26.120 pp.362-363).

The shapes are read by attribute (an entry of the pproc artifact, or any object with the same fields), so this module imports nothing above it.

Advanced

pyflightstream.probes.layouts.FarfieldPlane dataclass

FarfieldPlane(
    points: ndarray, y: ndarray, z: ndarray, axes: ndarray
)

The probe grid of a Trefftz C plane (FR-1033).

Attributes:

Name Type Description
points ndarray

Positions (n_y * n_z, 3) in the frame the origin and the direction were stated in, z fastest within y.

y, z ndarray

The grid axes in the plane, m, centered on the origin's projection.

axes ndarray

Rows x, y, z: the free-stream direction and the two in-plane directions, unit vectors in the same frame.

pyflightstream.probes.layouts.circle_points

circle_points(
    circle: _Circle, *, scale: float
) -> list[list[float]]

Lay out the polar grid of a circular probe plane (FR-79).

points_radial stations from the centre to the rim INCLUDING both, and points_azimuth around. THE CENTRE APPEARS ONCE rather than once per azimuth: a survey that sampled its own centre eight times would weight it eight times in anything that averages the file.

The two in-plane axes are built from the normal by taking the world axis least aligned with it, which is the standard way to get a stable basis and avoids the degenerate cross product a fixed choice hits when the normal happens to be that axis. math.cos and math.sin and not numpy's: the two may differ in the last bit and flip a fifth decimal of a script.

Parameters:

Name Type Description Default
circle _Circle

Declared circular probe pattern.

required
scale float

Factor converting declared coordinates to the output length unit.

required

Returns:

Type Description
list[list[float]]

Probe coordinate triples in the output length unit.

Raises:

Type Description
ProbeGeometryError

If the radius is not finite and positive, the normal has zero length, there are fewer than two radial stations or there is no azimuth point.

pyflightstream.probes.layouts.emit_probe_export

emit_probe_export(
    script: Script,
    path: str | Path,
    *,
    update: Toggle = True,
) -> None

Emit the post-solve probe refresh and export (FSM-26.120 pp.362-363).

UPDATE_PROBE_POINTS refreshes the probe values from the current solution and precedes the export by default; the exported file carries velocity components, both pressure coefficient forms, Mach and the boundary layer state flags (FSM-26.120 p.249).

Parameters:

Name Type Description Default
script Script

Version-bound script builder.

required
path str or Path

Export destination as the solver machine sees it.

required
update bool or 'ENABLE' or 'DISABLE'

Whether to refresh probe values first; disable only when an update was already emitted.

True

Raises:

Type Description
CommandArgumentError

If this script already exports to path. The solver writes one file per path, so two exports to one path meant the second silently replaced the first while the script carried two identical lines and nothing recorded that only one file survived (PFS-2011.02). The refusal names BOTH call sites: the earlier one by the entry point it used, and this one by raising here.

Notes

The register of exported paths lives on the :class:~pyflightstream.script.Script, because the collision is between two CALLS and only the script sees both. This function is a second entry point onto that register and re-stamps it with its own name, for the reason under the call below.

pyflightstream.probes.layouts.emit_probe_import

emit_probe_import(
    script: Script,
    path: str | Path,
    *,
    units: str,
    frame: int | str = 1,
) -> None

Emit PROBE_POINTS_IMPORT for a csv written by :func:write_probe_csv.

Parameters:

Name Type Description Default
script Script

Version-bound script builder.

required
path str or Path

Csv path as the solver machine sees it.

required
units str

Length unit token of the csv coordinates (FSM-26.120 p.362). The csv that :func:write_probe_csv and :func:write_points_csv write is in the case's simulation length unit (the lattice is scaled by tip_radius), so pass that unit's token; the unit must be stated explicitly.

required
frame int or str

Coordinate system of the csv coordinates; index 1 is the reference frame, and created frames may be cited by their creation label, as in :func:pyflightstream.script.helpers.probes_from_file.

1

pyflightstream.probes.layouts.emit_probe_points

emit_probe_points(
    script: Script,
    lattice: ProbeLattice,
    *,
    axis: str | Sequence[float] | None = None,
    origin: Sequence[float] | None = None,
    scale: float = 1.0,
    decimals: int | None = None,
) -> int

Emit one NEW_PROBE_POINT line per lattice probe (FSM-26.120 p.362).

Every probe is a VOLUME probe: the lattice samples the flow field, never the body surface. Emission is version-validated by the script's command view; NEW_PROBE_POINT is verified on 26.101 through 26.125 in the command database (CMP-26101_2026-08-08_full to CMP-26125_2026-10-05_probe-campaign), and a version without recorded evidence (for example 26.000) refuses with a citation.

The placement is the one the workspace plan applies to a lattice it lays: along a shaft axis (:func:lattice_points), moved to the hub or frame origin, scaled to the simulation's length unit, then each coordinate rounded with round(value, decimals), as the script's other probe layouts are. Without them the points are :meth:ProbeLattice.dimensional_points, unrounded.

Parameters:

Name Type Description Default
script Script

Version-bound script builder.

required
lattice ProbeLattice

Lattice to instantiate; points are emitted in the documented loading order of :meth:ProbeLattice.dimensional_points.

required
axis ('X', 'Y', 'Z')

The frame axis along the shaft; None keeps the lattice's own axes.

"X"
origin sequence of float

Where the lattice's origin stands, in the lattice's length unit.

None
scale float

Factor from the lattice's length unit to the script's, applied after the origin.

1.0
decimals int

Decimals each emitted coordinate is rounded to; None leaves them unrounded.

None

Returns:

Type Description
int

Number of probe points emitted.

pyflightstream.probes.layouts.farfield_plane

farfield_plane(
    origin: Sequence[float],
    *,
    direction: Sequence[float],
    distance: float,
    half_width: float,
    half_height: float,
    spacing: float,
) -> FarfieldPlane

Lay out the Trefftz C plane: normal to the free stream, a uniform grid.

The plane's normal is the free-stream direction (downstream); its in-plane y is horizontal, up x direction normalized with up = (0, 0, 1), and its z completes the right-handed set, so at zero incidence and sideslip the plane's axes are the frame's. The grid is centered on the point origin + distance direction.

Parameters:

Name Type Description Default
origin sequence of float

The point the plane is measured from (on the free-stream line through the moment reference point, level with the most downstream point of the selected families), m.

required
direction sequence of float

The free-stream direction, any length.

required
distance float

How far downstream of origin the plane stands, m.

required
half_width float

Half the plane's extent along its y and z, m.

required
half_height float

Half the plane's extent along its y and z, m.

required
spacing float

The grid spacing, m; each half extent holds a whole number of spacings, rounded to the nearest. Each axis must retain at least three points for the Trefftz-plane integration.

required

Returns:

Type Description
FarfieldPlane

The grid.

Raises:

Type Description
ProbeGeometryError

If direction, extent or spacing cannot define a finite plane.

pyflightstream.probes.layouts.lattice_basis

lattice_basis(axis: str | Sequence[float]) -> np.ndarray

Return shaft, radial and quadrature unit vectors in global coordinates.

A letter retains the cyclic lattice convention. An installed shaft uses the nearest letter's radial axis projected onto its disk plane.

Parameters:

Name Type Description Default
axis str or sequence of float

Global shaft direction, as X, Y, Z or three components.

required

Returns:

Type Description
ndarray

Three orthonormal row vectors, with the first along the shaft.

Raises:

Type Description
ProbeGeometryError

If the shaft has no finite direction or the letter is unknown.

pyflightstream.probes.layouts.lattice_points

lattice_points(
    lattice: ProbeLattice,
    *,
    axis: str | Sequence[float] = "X",
) -> np.ndarray

Lay out a survey lattice in a frame whose axis is the shaft (FR-1072).

The lattice's own coordinates (x along the shaft, y = r sin psi, z = r cos psi) are carried onto the frame's axes in cyclic order: for a shaft along the frame's Y, the lattice x is the frame's Y, its y the frame's Z and its z the frame's X, so the lattice stays right-handed. The order of the points is the loading contract of :meth:~pyflightstream.probes.lattice.ProbeLattice.dimensional_points.

Parameters:

Name Type Description Default
lattice ProbeLattice

The survey lattice.

required
axis str or sequence of float

The shaft letter or installed direction in the global frame.

'X'

Returns:

Type Description
ndarray

Positions (point_count, 3) in the frame, in the lattice's length unit (the tip radius times the nondimensional positions).

Raises:

Type Description
ProbeGeometryError

If the requested axis is not supported.

pyflightstream.probes.layouts.line_points

line_points(
    start: Sequence[float],
    *,
    end: Sequence[float],
    points: int,
    scale: float,
) -> list[list[float]]

Lay out the points of a probe line, both ends included (FR-77).

Parameters:

Name Type Description Default
start sequence of float

The line's ends in the entry's frame, in the entry's unit.

required
end sequence of float

The line's ends in the entry's frame, in the entry's unit.

required
points int

The point count, at least two.

required
scale float

The factor from the entry's unit to the simulation's length unit.

required

Returns:

Type Description
list of list of float

points rows [x, y, z], rounded to five decimals.

Raises:

Type Description
ProbeGeometryError

If points is below two, since a line with both ends has no spacing otherwise.

pyflightstream.probes.layouts.rectangle_points

rectangle_points(
    rectangle: _Rectangle, *, scale: float
) -> list[list[float]]

Lay out the grid of a rectangular probe plane, row by row (FR-79).

Three corners give two edge vectors from origin, and the grid runs along both with BOTH ENDS INCLUDED, so a declaration of 3 by 4 is twelve points and three of its corners are the three declared vertices. The order is v fastest within u, which is the reading order of a row of stations.

Parameters:

Name Type Description Default
rectangle _Rectangle

Declared rectangular probe pattern.

required
scale float

Factor converting declared coordinates to the output length unit.

required

Returns:

Type Description
list[list[float]]

Probe coordinate triples in the output length unit.

Raises:

Type Description
ProbeGeometryError

If the two edges from origin are collinear, zero or not finite, or either direction has fewer than two points.

pyflightstream.probes.layouts.write_points_csv

write_points_csv(
    points: ndarray, path: str | Path | TextIO
) -> int

Write any probe positions as a PROBE_POINTS_IMPORT csv.

Shared by the cylindrical survey lattice, the planar grids and the far-field plane and lattice a steady row's plan adds: the documented format (FSM-26.120 pp.362-363) is the point count on the first line, then one X,Y,Z,TYPE row per probe with TYPE 1 for volume probes. Rows follow the order of points, which is the loading contract of the caller.

Parameters:

Name Type Description Default
points ndarray

Positions, shape (n, 3), reference frame, simulation length units.

required
path str or pathlib.Path or text stream

Destination csv path, or an open text stream (for example an :class:io.StringIO) the csv text is written to, which is how the workspace plan stages the far-field csv beside its script. Missing parent directories of a path are created before the file is written.

required

Returns:

Type Description
int

Number of probe rows written.

Raises:

Type Description
ProbeGeometryError

If the point array is not a finite array of coordinate triples.

pyflightstream.probes.layouts.write_probe_csv

write_probe_csv(
    lattice: ProbeLattice,
    path: str | Path | TextIO,
    *,
    axis: str | Sequence[float] | None = None,
    origin: Sequence[float] | None = None,
    scale: float = 1.0,
    decimals: int | None = None,
) -> int

Write the PROBE_POINTS_IMPORT csv for the whole lattice.

The documented format (FSM-26.120 pp.362-363) is the point count on the first line, then one X,Y,Z,TYPE row per probe with TYPE 1 for volume probes. This is the practical path for the full ~20k point lattice, where one NEW_PROBE_POINT line per probe would be unwieldy. The coordinates are in simulation length units (scaled by tip_radius), so the import must cite that unit's token in :func:emit_probe_import.

The placement is the one the workspace plan applies to a far-field lattice it adds, as in :func:emit_probe_points, except that the coordinates are rounded as an array, with :func:numpy.round, as the plan's staged csv is.

Parameters:

Name Type Description Default
lattice ProbeLattice

Lattice to write, in the documented loading order.

required
path str or pathlib.Path or text stream

Destination csv path, or an open text stream (:func:write_points_csv).

required
axis ('X', 'Y', 'Z')

The frame axis along the shaft; None keeps the lattice's own axes.

"X"
origin sequence of float

Where the lattice's origin stands, in the lattice's length unit.

None
scale float

Factor from the lattice's length unit to the csv's, applied after the origin.

1.0
decimals int

Decimals the coordinates are rounded to; None leaves them unrounded.

None

Returns:

Type Description
int

Number of probe rows written.