Skip to content

pyflightstream.probes.planar (stable)

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

Planar Cartesian probe grids on arbitrary coordinate frames.

Pipeline role: the controlled replacement for FlightStream volume sections. CREATE_NEW_RECTANGLE_VOLUME_SECTION places its sampling points internally (FSM-26.120 p.366); a :class:PlanarProbeGrid instead prescribes every probe position: element size or point distribution per in-plane axis, on a plane defined by an explicit :class:FrameDefinition (origin plus axes in the reference frame, mirroring the EDIT_COORDINATE_SYSTEM grammar). Points are transformed to the reference frame in Python and imported with FRAME 1, so the geometry culling of :mod:pyflightstream.probes.geometry always operates on the same coordinates the solver sees.

The grid is serializable like the cylindrical survey lattice: the JSON round trip is the cross-consumer contract, and the deterministic point ordering (base nodes row-major in u then v; refined nodes appended cell-major) is what a probe-export parser keys its rows on.

Units: every stored length is in simulation length units; the frame axes are dimensionless unit vectors in the reference frame.

Advanced

pyflightstream.probes.planar.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 extent / ceil(extent / spacing), so it never exceeds the requested one: for an extent of 1.0, a request of 0.7 gives two elements of 0.5, and a request of 0.4 gives three of 0.333.

count (int, optional)

Number of points (at least 2); required for the nonuniform distributions.

distribution str

uniform, cosine (smooth clustering), or geometric (element sizes in geometric progression away from the clustered end).

ratio (float, optional)

Geometric growth ratio, greater than 1; geometric only.

cluster str

Which end(s) get the small elements: start, end, or both.

extent property

extent: float

Axis length, stop - start.

points

points() -> np.ndarray

Return the axis points, increasing, endpoints exact.

pyflightstream.probes.planar.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.

basis property

basis: ndarray

Rows are the x, y, z axes in reference-frame components.

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.

from_reference

from_reference(points: ndarray) -> np.ndarray

Inverse of :meth:to_reference.

pyflightstream.probes.planar.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.

kept property

kept: int

Probes that survive the gate.

culled_fraction property

culled_fraction: float

Fraction of base nodes discarded inside the body.

pyflightstream.probes.planar.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, 0).

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).

shape property

shape: tuple[int, int]

Node counts (n_u, n_v) of the base grid.

point_count property

point_count: int

Base node count, before culling and refinement.

local_points

local_points() -> np.ndarray

Grid nodes in the local frame, shape (n_u, n_v, 3).

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.

to_json

to_json() -> str

Serialize the defining data; points are always derived.

from_json classmethod

from_json(text: str) -> PlanarProbeGrid

Rebuild a grid from :meth:to_json output (cross-consumer contract).

pyflightstream.probes.planar.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 (n, 3), in the deterministic order the export parser relies on: surviving base nodes first (row-major in u, v), then surviving refined nodes (cell-major, sub-row-major).

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 (n, 3), for example ProbePointsReport.positions.

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 rtol: the export does not belong to this plan, or the solver reordered the probes. Also if any exported row is not finite, which no tolerance can judge. Also if rtol is negative or not finite.

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.

from_json classmethod

from_json(text: str) -> PlannedProbes

Rebuild from :meth:to_json output.

pyflightstream.probes.planar.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.