pyflightstream.probes (stable)¶
Generated from the docstrings at build time: every one of the 19 names in the __all__ of pyflightstream.probes has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Probe geometry, the one home: survey lattices, planar grids, layouts and emission.
Pipeline role: the only place where probe positions are computed (FR-459). A
facade over :mod:.lattice (the cylindrical survey lattice of the far-field
extraction, DLV-006 Sec. 2), :mod:.layouts (the line, rectangle and circle
layouts of a [[probes]] entry, the lattice shape and the far-field plane),
:mod:.planar (the planar probe planner's types) and :mod:.geometry (the
geometry gate and the inside-the-body check); the script lines and the import
csv that create and export probes are :mod:.layouts' too.
Advanced¶
pyflightstream.probes.AxisSpec
¶
Bases: ProbeModel
Point distribution along one in-plane axis of a grid.
The primary path prescribes the element size directly
(spacing, uniform); the alternative prescribes a point
count with a distribution. Endpoints are always included
exactly.
Attributes:
| Name | Type | Description |
|---|---|---|
start, stop |
float
|
Axis extent in the local frame (simulation length units). |
spacing |
(float, optional)
|
Uniform element size; snapped so an integer number of elements
fills the extent exactly. The snapped size is
|
count |
(int, optional)
|
Number of points (at least 2); required for the nonuniform distributions. |
distribution |
str
|
|
ratio |
(float, optional)
|
Geometric growth ratio, greater than 1; geometric only. |
cluster |
str
|
Which end(s) get the small elements: |
pyflightstream.probes.FrameDefinition
¶
Bases: ProbeModel
A local coordinate frame expressed in the reference frame.
Mirrors what EDIT_COORDINATE_SYSTEM sends to the solver (origin
plus axis vectors in the reference frame, coordinate_systems
chapter): the same object can therefore both place probe grids in
Python and, optionally, create the matching solver-side frame via
:func:pyflightstream.script.helpers.coordinate_frame.
x_axis and y_axis are normalized on construction and
y_axis is orthogonalized against x_axis (Gram-Schmidt);
z_axis is their cross product, so the frame is always
right-handed orthonormal.
Attributes:
| Name | Type | Description |
|---|---|---|
origin |
tuple of float
|
Frame origin in the reference frame (simulation length units). |
x_axis, y_axis |
tuple of float
|
In-plane directions of the grid, reference-frame components; stored normalized and orthogonal. |
z_axis
property
¶
z_axis: tuple[float, float, float]
Plane normal, the right-handed cross product of x and y axes.
to_reference
¶
to_reference(local_points: ndarray) -> np.ndarray
Transform local (..., 3) coordinates into the reference frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
local_points
|
ndarray
|
Coordinates along the frame axes (simulation length units). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Same shape, reference-frame coordinates. |
pyflightstream.probes.GeometryGateReport
¶
Bases: ProbeModel
Accounting of what the geometry gate did to a grid.
Every run states how many probes it kept, discarded inside the body, and added in the refinement band, so no probe budget is spent silently (the design rule of the survey work: masked or dropped content is always reported, never implied).
Attributes:
| Name | Type | Description |
|---|---|---|
base_total |
int
|
Base grid nodes before the gate. |
base_culled |
int
|
Base nodes discarded because they fall inside the body. |
base_standoff_culled |
int
|
Base nodes discarded because they hug the surface closer than the standoff margin; a probe on or against the wall samples the body's surface state, not the flow (the on-surface probe of reports/RPT-004 exported zero velocity). |
refined_added |
int
|
Refinement-band nodes added (after their own culling). |
refined_culled |
int
|
Refinement-band candidates discarded inside the body. |
refined_standoff_culled |
int
|
Refinement-band candidates discarded by the standoff margin. |
band_distance |
(float, optional)
|
Refinement band thickness used; None when no refinement ran. |
standoff |
(float, optional)
|
Standoff margin used; None when no margin was requested. |
mesh_path |
(str, optional)
|
Surface mesh file the gate tested against; None when no path was given: either the gate ran without a mesh (no culling, no refinement) or it was handed a mesh object, which still culls and refines. |
pyflightstream.probes.PlanarProbeGrid
¶
Bases: ProbeModel
A planar Cartesian probe grid on an explicit frame.
Attributes:
| Name | Type | Description |
|---|---|---|
frame |
FrameDefinition
|
Plane placement; grid points live at local |
u, v |
AxisSpec
|
In-plane distributions along the frame x and y axes. |
refinement |
(RefinementBand, optional)
|
Near-surface two-level refinement, applied by the geometry gate (it needs the body mesh to know where the surface is). |
base_points
¶
base_points() -> np.ndarray
Grid nodes in the reference frame, flat, row-major in (u, v).
This ordering (u index major, v index minor) is part of the serialization contract: probe-export rows map back to grid nodes through it.
from_json
classmethod
¶
from_json(text: str) -> PlanarProbeGrid
Rebuild a grid from :meth:to_json output (cross-consumer contract).
pyflightstream.probes.PlannedProbes
dataclass
¶
PlannedProbes(
grid: PlanarProbeGrid,
points: ndarray,
report: GeometryGateReport,
)
Final probe positions of a grid after the geometry gate.
Attributes:
| Name | Type | Description |
|---|---|---|
grid |
PlanarProbeGrid
|
The prescribing grid. |
points |
ndarray
|
Reference-frame positions, shape |
report |
GeometryGateReport
|
The probe accounting of the gate. |
verify_positions
¶
verify_positions(
positions: ndarray, *, rtol: float = 0.0005
) -> None
Assert exported probe rows follow this plan's order and count.
The 26.120 round trip (reports/RPT-004) shows the solver preserves the count and row order of imported probes; this check re-validates that contract on every load, because a silent reordering would attach fields to the wrong positions. The default tolerance matches the export's four significant mantissa digits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
positions
|
ndarray
|
Exported probe positions, shape |
required |
rtol
|
float
|
Largest tolerated relative coordinate mismatch. |
0.0005
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the count differs or any row-aligned position deviates
beyond |
to_json
¶
to_json() -> str
Serialize grid, points, and report together.
The points are stored explicitly (not re-derived) because they depend on the surface mesh the gate ran against; the file is the complete loading contract for parsing the probe export.
pyflightstream.probes.ProbeGeometryError
¶
Bases: PyflightstreamError, ValueError
Survey geometry that does not describe a measurable arrangement.
Non-physical radii or stations, an axis specification that cannot be
walked, a refinement band outside its plane, a position set that does
not verify against the lattice it claims. Raised by the cylindrical
lattice, the planar grids and the geometry gate alike, so one
except covers the survey-geometry surface.
Also a ValueError so callers can catch either exception family (FR-39).
pyflightstream.probes.ProbeLattice
¶
Bases: ProbeModel
Serializable cylindrical probe lattice of a far-field survey.
The lattice is a set of transverse annular planes (constant x)
plus, optionally, rings on a lateral cylinder that closes the
control volume on the side (DLV-006 Sec. 2.1). Ring edges are
stored explicitly so the annular area weights of the quadrature are
exact (DLV-006 Sec. 2.2); ring centers are the sampling radii.
Attributes:
| Name | Type | Description |
|---|---|---|
tip_radius |
float
|
Reference radius R in simulation length units; every stored
coordinate is nondimensionalized by it. The far-field ledgers integrate
over areas of |
stations |
tuple of float
|
Axial positions x/R of the annular planes, strictly increasing, x positive downstream of the disk center. |
ring_edges |
tuple of float
|
Radial ring edges r/R, strictly increasing, at least two. The first edge must be positive: the axis r = 0 is a coordinate singularity of the cylindrical quadrature, so rings start off-axis (DLV-006 Sec. 2.2 starts them at 0.05 R). |
n_psi |
int
|
Number of uniformly spaced azimuths per ring. At least 8, so the FFT resolves the low-order harmonic content the ledgers need (order 0 forces, order 1 in-plane moments). |
lateral_radius |
(float, optional)
|
Radius r/R of the lateral closure cylinder; None when the lattice carries no lateral rings. |
lateral_stations |
tuple of float
|
Axial positions x/R of the lateral rings; empty exactly when
|
ring_centers
property
¶
ring_centers: ndarray
Sampling radii r/R, the midpoints of the stored ring edges.
area_weights
¶
area_weights() -> np.ndarray
Per-sample annular quadrature weights, in units of R squared.
Returns:
| Type | Description |
|---|---|
ndarray
|
Shape |
plane_points
¶
plane_points() -> np.ndarray
Nondimensional Cartesian probe positions of the annular planes.
Returns:
| Type | Description |
|---|---|
ndarray
|
Shape |
lateral_points
¶
lateral_points() -> np.ndarray
Nondimensional Cartesian positions of the lateral-cylinder rings.
Returns:
| Type | Description |
|---|---|
ndarray
|
Shape |
dimensional_points
¶
dimensional_points() -> np.ndarray
All probe positions in simulation length units, flat and ordered.
The order is the loading contract of the whole extraction chain: annular planes first (station-major, then ring, then azimuth), lateral rings last (station-major, then azimuth).
Returns:
| Type | Description |
|---|---|
ndarray
|
Shape |
from_json
classmethod
¶
from_json(text: str) -> ProbeLattice
Rebuild a lattice from :meth:to_json output.
The CFD extraction consumes the same serialized object to place its sampling points, which is what makes cross-solver loading transparent (DLV-006 requirement R1).
pyflightstream.probes.RefinementBand
¶
Bases: ProbeModel
Two-level near-surface refinement of a planar grid.
Base cells whose center lies within distance of the body
surface (and, when the gate culls, outside the body) are
re-sampled with elements factor times finer in both in-plane
directions, the boundary-layer band of the survey.
Attributes:
| Name | Type | Description |
|---|---|---|
distance |
float
|
Band thickness measured from the surface (simulation length units), positive. |
factor |
int
|
Integer subdivision factor per direction, at least 2. |
pyflightstream.probes.build_lattice
¶
build_lattice(
*,
tip_radius: float,
stations: tuple[float, ...] = (
-2.0,
-0.2,
0.2,
0.5,
1.0,
1.5,
2.0,
),
n_r: int = 40,
r_inner: float = 0.05,
r_outer: float = 2.5,
n_psi: int = 72,
lateral_radius: float | None = 2.5,
lateral_stations: tuple[float, ...] | None = None,
hub_width: float = 0.15,
tip_width: float = 0.1,
) -> ProbeLattice
Build the dense reference lattice of the far-field survey.
Defaults follow DLV-006 Sec. 2: inlet plane at -2 R, disk-adjacent
planes at +-0.2 R, wake planes to 2 R, 40 rings from 0.05 R
clustered near hub and tip, 72 uniform azimuths (5 degree step,
harmonics to order 35 without aliasing; order 36 is the Nyquist order and
is refused), lateral cylinder at 2.5 R.
If solver cost forces a reduction, cut n_r before n_psi and
record the change (DLV-006 Sec. 2.2).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tip_radius
|
float
|
Reference radius R in simulation length units. |
required |
stations
|
tuple of float
|
Annular plane positions x/R, strictly increasing. |
(-2.0, -0.2, 0.2, 0.5, 1.0, 1.5, 2.0)
|
n_r
|
(int, float, float)
|
Ring count and radial extent r/R of every annular plane. |
40
|
r_inner
|
(int, float, float)
|
Ring count and radial extent r/R of every annular plane. |
40
|
r_outer
|
(int, float, float)
|
Ring count and radial extent r/R of every annular plane. |
40
|
n_psi
|
int
|
Uniform azimuth count, at least 14 for the six stored harmonics (DLV-006 Sec. 3.2); uniformity is structural. |
72
|
lateral_radius
|
float
|
Lateral closure cylinder radius r/R, not smaller than |
2.5
|
lateral_stations
|
tuple of float
|
Lateral ring positions x/R; defaults to |
None
|
hub_width
|
float
|
Gaussian widths (in r/R) of the hub and tip clustering bands. |
0.15
|
tip_width
|
float
|
Gaussian widths (in r/R) of the hub and tip clustering bands. |
0.15
|
Returns:
| Type | Description |
|---|---|
ProbeLattice
|
Validated, serializable lattice. |
Raises:
| Type | Description |
|---|---|
ProbeGeometryError
|
If the survey has fewer than 14 azimuths for its six stored harmonics,
the lateral cylinder is smaller than the outer ring edge, or
|
pyflightstream.probes.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.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 |
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.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: |
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: |
1
|
pyflightstream.probes.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: |
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.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 |
required |
half_width
|
float
|
Half the plane's extent along its |
required |
half_height
|
float
|
Half the plane's extent along its |
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.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 |
Raises:
| Type | Description |
|---|---|
ProbeGeometryError
|
If the requested axis is not supported. |
pyflightstream.probes.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
|
|
Raises:
| Type | Description |
|---|---|
ProbeGeometryError
|
If |
pyflightstream.probes.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 |
pyflightstream.probes.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 |
required |
path
|
str or pathlib.Path or text stream
|
Destination csv path, or an open text stream (for example an
:class: |
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.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: |
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. |