pyflightstream.farfield.quadrature (stable)¶
Generated from the docstrings at build time: every one of the 10 names in the __all__ of pyflightstream.farfield.quadrature has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
The quadratures of the far field, each implemented once (FR-1003).
Pipeline role: the annular-plane quadrature of the survey lattice, its coverage, the trapezoid rule of a rectangular far-field plane, and the strip edges of a spanwise trace. Every balance and every Trefftz integral calls these functions; none of them has a second copy elsewhere in the package.
A missing sample is never dropped (PYFS-010): every sum here propagates NaN, and the coverage functions say how much of a plane was sampled.
Advanced¶
pyflightstream.farfield.quadrature.azimuthal_harmonics
¶
azimuthal_harmonics(
values: ndarray, *, psi: ndarray, m_max: int = 6
) -> np.ndarray
Azimuthal Fourier coefficients of a sampled field, the ledger spine.
Coefficients follow f(psi) = sum_m c_m exp(i m psi) with
c_m = (1/N) sum_k f_k exp(-i m psi_k); for real fields the negative
orders are the conjugates and are not stored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
ndarray
|
Field whose last axis runs over the uniform lattice azimuths. |
required |
psi
|
ndarray
|
The azimuths of that axis, radians. |
required |
m_max
|
int
|
Highest stored order; DLV-006 Sec. 3.2 requires at least 6. |
6
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Complex coefficients, the last axis replaced by the orders
|
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If the azimuth grid or requested harmonic order is invalid. |
pyflightstream.farfield.quadrature.grid_coverage
¶
grid_coverage(
integrand: ndarray,
*,
y: ndarray | None = None,
z: ndarray | None = None,
) -> float
Fraction of the plane's area whose samples are finite.
With the grid axes y and z each sample is weighted by the area the
trapezoid rule of :func:grid_integral gives it (:func:grid_weights:
a quarter cell at a corner, half at an edge, a whole cell inside), so the
figure is the fraction of the INTEGRAL's area that was sampled. Without the
axes every sample counts equally, which is the area fraction only when the
samples stand for equal areas.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
integrand
|
ndarray
|
Sampled scalar integrand, with shape (len(y), len(z)) for a grid. |
required |
y
|
ndarray
|
The grid axes, m; both or neither. |
None
|
z
|
ndarray
|
The grid axes, m; both or neither. |
None
|
Returns:
| Type | Description |
|---|---|
float
|
Fraction of the grid's represented area carrying finite integrand values. |
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If only one axis is given. |
pyflightstream.farfield.quadrature.grid_integral
¶
grid_integral(
y: ndarray, *, z: ndarray, integrand: ndarray
) -> float
Integrate a sampled field over a uniform rectangular grid by the trapezoid rule.
A missing or non-finite sample makes the integral NaN (PYFS-010).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
ndarray
|
Ordered spanwise grid coordinates in m. |
required |
z
|
ndarray
|
Ordered vertical grid coordinates in m. |
required |
integrand
|
ndarray
|
Sampled scalar integrand, with shape (len(y), len(z)) for a grid. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Trapezoidal integral over the rectangular grid. |
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If the integrand is not shaped |
pyflightstream.farfield.quadrature.grid_weights
¶
grid_weights(y: ndarray, *, z: ndarray) -> np.ndarray
Trapezoid weights of a uniform rectangular grid, in m^2.
Corners carry a quarter of a cell, edges a half, the inside a whole cell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
ndarray
|
Uniform grid axes, m. |
required |
z
|
ndarray
|
Uniform grid axes, m. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Weights shaped |
pyflightstream.farfield.quadrature.plane_integral
¶
plane_integral(
fields: LatticeFields, integrand: ndarray
) -> np.ndarray
Integrate a sampled field over each annular plane.
Implemented once and reused by every balance (DLV-006 Sec. 3.1): the ring-edge rule in radius times the rectangle rule in azimuth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fields
|
LatticeFields
|
Survey samples supplying the weights and the tip radius. |
required |
integrand
|
ndarray
|
Any array whose two trailing axes are |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The integral over the two trailing axes, the leading axes preserved, in integrand units times square meters; NaN where any sample is not finite. |
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If the trailing axes are not |
pyflightstream.farfield.quadrature.ring_sample_weights
¶
ring_sample_weights(fields: LatticeFields) -> np.ndarray
Per-sample annular quadrature weights of each ring.
Returns:
| Type | Description |
|---|---|
ndarray
|
|
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fields
|
LatticeFields
|
Survey samples in the shaft-aligned axes of
:mod: |
required |
pyflightstream.farfield.quadrature.sample_area_coverage
¶
sample_area_coverage(
integrand: ndarray, fields: LatticeFields
) -> np.ndarray
Fraction of the plane's AREA that was sampled, per leading index.
Each sample stands for the annular cell its quadrature weight
(:func:ring_sample_weights) integrates, so a missing sample at the rim,
which stands for far more of the disc than one at the hub, costs what the
integral loses by it. A count (:func:sample_coverage) would report the same
0.99 for a hole at the hub and for a hole at the rim whose cost in the
integral is many times larger.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
integrand
|
ndarray
|
Any array whose two trailing axes are |
required |
fields
|
LatticeFields
|
The survey whose ring edges give each ring's represented area. Its ring
count must be the integrand's |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Area coverage in |
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If |
pyflightstream.farfield.quadrature.sample_coverage
¶
sample_coverage(integrand: ndarray) -> np.ndarray
Fraction of (r, psi) samples that are finite, per leading index.
The diagnostic half of PYFS-010: :func:plane_integral returns NaN when
any sample is missing, which says THAT a plane is unusable and not how far
off it is; this says how much of the plane was actually sampled.
THIS IS A COUNT OF SAMPLES, every sample weighing the same. On an annular
lattice the samples stand for very different areas, so a missing sample at
the rim costs the integral far more than one at the hub and the count
reports them alike: use :func:sample_area_coverage for the fraction of
the plane that was sampled (PFS-2019.01).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
integrand
|
ndarray
|
Any array whose two trailing axes are |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Coverage in |
pyflightstream.farfield.quadrature.strip_edges
¶
strip_edges(
positions: ndarray,
*,
ends: Literal["station", "extended"] = "extended",
) -> np.ndarray
Return the edges of the strips around the stations of a trace.
Between two stations the edge is their midpoint. Beyond the end stations:
"extended"(the far field, FR-1012): half the adjacent spacing further out, sonuniform stations at the centers ofnequal strips tile exactly the extent the solver divided;"station": the end stations themselves, so the strips stop at the end stations and the span is shortened by half a spacing at each end; the integrated sectional loads of the sections table use the"extended"rule too, as the definitions page states.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
positions
|
ndarray
|
Station positions (one coordinate) in the order of the trace, shape
|
required |
ends
|
('extended', 'station')
|
The rule beyond the end stations. |
"extended"
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The |
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If positions is not one-dimensional with at least two stations, or
ends is neither |
pyflightstream.farfield.quadrature.symmetry_floor
¶
symmetry_floor(
values: ndarray,
*,
psi: ndarray,
m_max: int = 6,
excluded_orders: Sequence[int] = (),
) -> float
Largest azimuthal harmonic magnitude above order zero (gate G3).
At zero incidence every retained m >= 1 harmonic must vanish to the numerical
floor; the recorded floor becomes the detectability threshold for the
nonzero-incidence step (DLV-006 Sec. 3.2).
Returns:
| Type | Description |
|---|---|
float
|
|
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
ndarray
|
Sampled values with azimuth along the last dimension. |
required |
psi
|
ndarray
|
Uniform full-turn azimuth coordinates in radians. |
required |
m_max
|
int
|
Highest azimuthal harmonic order to retain, at least 1. |
6
|
excluded_orders
|
sequence of int
|
Orders omitted from the floor, such as multiples of a rotor's blade count. If no order remains, the floor is NaN rather than a measured zero. |
()
|
Raises:
| Type | Description |
|---|---|
FarfieldInputError
|
If the azimuth grid or the order is invalid, or |