pyflightstream.post.axes (stable)¶
Generated from the docstrings at build time: every one of the 19 names in the __all__ of pyflightstream.post.axes has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
The ONE home of every axis rotation a product makes.
All products use these rotations so their force and moment components share the same axis and sign conventions.
THE CONVENTION. Direction-cosine matrices are
PASSIVE and right-handed: C @ v gives the components of the SAME vector in
the coordinate system turned by mu about n,
C_n(mu) = (1 - cos mu) n n^T + cos mu I - sin mu n~
with n~ the cross-product matrix of n. Body axes are forward, right,
down. C2 and C3 are that matrix about y and about z.
THREE FRAMES, in the order a force travels through them:
- THE EXPORT FRAME is the geometry's: x AFT, y RIGHT, z UP. Scored on the
recorded licensed exports rather than assumed (RPT-063, "emitted coefficients
are scored against recorded solver output", 2026-09-23: 48 recorded Total rows
of forces and lift, four at non-zero sideslip): the drag an export states is
the projection of its own
(Cx, Cy, Cz)on(ca cb, -ca sb, sa). - THE BODY FRAME, forward-right-down, is half a turn about y away:
v_b = C2(pi) v_G, which isdiag(-1, 1, -1)and a proper rotation. - THE WIND AXES follow Stevens and Lewis: stability axes by
C2(-alpha_s), then wind axes byC3(beta_w).x_wlies along the velocity andz_wstays in the aircraft's plane of symmetry.
THE ANGLES ARE GEOMETRIC, NOT THE WRITTEN ONES. The solver is taken to turn
sideslip about the body z axis FIRST and incidence second (the order that
reproduces the drag of the four sideslip rows of RPT-063, 2026-09-23; no
committed report isolates the order itself), so it flies
V (ca cb, ca sb, sa), which is not the V (ca cb, sb, sa cb) the
Stevens and Lewis angles describe. The two agree when either angle is zero and
differ at second order otherwise. The axes are a property of the velocity
VECTOR and the body, so the angles that enter the chain are read off that
vector: alpha_s = atan2(w, u) and beta_w = asin(v / V). A row's
ALPHA and BETA stay what the user wrote.
THE ROTOR FRAMES RC_R/B = C2(theta) C3(psi), so x_R lies along the
shaft in the sense that makes thrust positive forward (:func:rotor_frame).
:func:frame_rotations gives every frame of a polar file from the export frame,
and :func:airframe_axis_coefficients the six coefficients in each: CD positive
along -x of the frame, CL along -z of the frame, CY along +y of the
frame, in W, S, B and Rdocs/definitions/axes-and-signs.md).
Advanced¶
pyflightstream.post.axes.EXPORT_TO_BODY
module-attribute
¶
EXPORT_TO_BODY: Matrix = (
np.round(dcm(_Y, math.pi), 12) + 0.0
)
pyflightstream.post.axes.REFERENCE_UP
module-attribute
¶
REFERENCE_UP: tuple[float, float, float] = (0.0, 0.0, 1.0)
pyflightstream.post.axes.RotorFrame
dataclass
¶
RotorFrame(
rotor_id: int,
pitch_deg: float,
toe_deg: float,
sense: int,
declared_aft: bool,
body_to_rotor: Matrix,
)
The frame R
x_R lies along the shaft in the sense that makes thrust positive
forward; zero roll, so y_R is horizontal. Built by :func:rotor_frame.
Attributes:
| Name | Type | Description |
|---|---|---|
rotor_id |
int
|
The rotor's declared id; the frame is named |
pitch_deg |
float
|
|
toe_deg |
float
|
|
sense |
int
|
|
declared_aft |
bool
|
Whether the declared axis points aft (its body x is negative), the case whose thrust is counted against the sense of the declared axis. |
body_to_rotor |
ndarray
|
|
pyflightstream.post.axes.airframe_axis_coefficients
¶
airframe_axis_coefficients(
force_n: Sequence[float],
moment_nm: Sequence[float],
rotations: Mapping[str, Matrix],
*,
q_ref_pa: float,
sref_m2: float,
cref_m: float,
bref_m: float,
) -> dict[str, float | str]
Return the six airframe coefficients of every frame of rotations.
In each forward-right-down frame f, with F_f and M_f the force and
the moment about the moment reference point::
CD<f> = -F_f,x / (q SREF) Cl<f> = M_f,x / (q SREF BREF)
CY<f> = F_f,y / (q SREF) Cm<f> = M_f,y / (q SREF CREF)
CL<f> = -F_f,z / (q SREF) Cn<f> = M_f,z / (q SREF BREF)
so CD is positive along -x of the frame, CL along -z of the
frame and CY along +y of the frame, in W, S, B and R
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force_n
|
sequence of float
|
The force in N and the moment about the moment reference point in N m, in the export frame. |
required |
moment_nm
|
sequence of float
|
The force in N and the moment about the moment reference point in N m, in the export frame. |
required |
rotations
|
mapping of str to numpy.ndarray
|
The export-to-frame matrices, as :func: |
required |
q_ref_pa
|
float
|
The dynamic pressure the coefficients are taken against, |
required |
sref_m2
|
float
|
The reference area, chord and span. |
required |
cref_m
|
float
|
The reference area, chord and span. |
required |
bref_m
|
float
|
The reference area, chord and span. |
required |
Returns:
| Type | Description |
|---|---|
dict of str to float or str
|
|
Examples:
>>> turns = frame_rotations(0.0, 0.0)
>>> row = airframe_axis_coefficients((2.0, 0.0, 10.0), (0.0, 0.0, 0.0), turns,
... q_ref_pa=1.0, sref_m2=1.0, cref_m=1.0, bref_m=1.0)
>>> row["CDB"], row["CLB"], row["CDW"], row["CLW"]
(2.0, 10.0, 2.0, 10.0)
In a rotor frame the signs follow the shaft: a shaft up the export z axis
puts x_R along the export-up force, so that force is a negative CD:
>>> shaft_up = frame_rotations(0.0, 0.0, [rotor_frame((0.0, 0.0, 1.0), 0)])
>>> airframe_axis_coefficients((0.0, 0.0, 10.0), (0.0, 0.0, 0.0), shaft_up,
... q_ref_pa=1.0, sref_m2=1.0, cref_m=1.0, bref_m=1.0)["CDR0"]
-10.0
pyflightstream.post.axes.blade_azimuth_deg
¶
blade_azimuth_deg(
datum_deg: object,
*,
step: object,
steps_per_revolution: object,
rpm: object,
) -> float | None
Return where a blade is at a step, in degrees in [0, 360), or None.
datum_deg is where the blade sits at step zero, and it turns by one
revolution every steps_per_revolution steps, in the sense of the sign of
rpm. THE ONE HOME OF THIS RULE: the sections table, the per-blade table
and the per-blade rows each wrote it out, with their own reading of the sign
and of when the clock is not stated, and three copies of one rule are how
two published columns come to disagree about where a blade is.
None where the clock is not stated: a step, a datum, a positive number of
steps per revolution or a non-zero rpm that is not a finite number. A caller
publishes that as not applicable, never as zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
datum_deg
|
object
|
Where the blade sits at step zero, in degrees. |
required |
step
|
object
|
The time step. |
required |
steps_per_revolution
|
object
|
The rotor's clock, in time steps per revolution. |
required |
rpm
|
object
|
The rotor's signed speed in rev/min; only its sign is read. |
required |
Returns:
| Type | Description |
|---|---|
float or None
|
The azimuth in degrees in [0, 360), or None where the clock is not stated. |
Examples:
>>> blade_azimuth_deg(10.0, step=18, steps_per_revolution=72, rpm=2000.0)
100.0
>>> blade_azimuth_deg(10.0, step=18, steps_per_revolution=72, rpm=-2000.0)
280.0
>>> blade_azimuth_deg(10.0, step=18, steps_per_revolution=72, rpm=None) is None
True
pyflightstream.post.axes.body_to_stability
¶
body_to_stability(
alpha_deg: float, beta_deg: float = 0.0
) -> Matrix
Return C_s/b = C2(-alpha_s): body axes to stability axes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha_deg
|
float
|
Angle of attack as the solver was given it, in degrees. |
required |
beta_deg
|
float
|
Sideslip angle as the solver was given it, in degrees; it enters through |
0.0
|
Returns:
| Type | Description |
|---|---|
Matrix
|
The 3 by 3 direction cosine matrix. |
pyflightstream.post.axes.body_to_wind
¶
body_to_wind(alpha_deg: float, beta_deg: float) -> Matrix
Return C_w/b = C3(beta_w) C2(-alpha_s): body axes to wind axes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha_deg
|
float
|
Angle of attack as the solver was given it, in degrees. |
required |
beta_deg
|
float
|
Sideslip angle as the solver was given it, in degrees. |
required |
Returns:
| Type | Description |
|---|---|
Matrix
|
The 3 by 3 direction cosine matrix. |
pyflightstream.post.axes.clocked_blade_azimuth_deg
¶
clocked_blade_azimuth_deg(
datum_deg: object,
*,
blade: object,
blades: object,
clocking: object,
positions: object,
rpm: object,
) -> float | None
Return where blade blade of a quasi-steady wheel is at clocking clocking, or None.
A wheel of blades blades solved at positions clockings.
Blade n sits (n - 1) / N of a turn from blade one, right-handed about the
shaft, as the builder places the blade frames; clocking i turns the whole
wheel by theta_i = i * (360 / N) / k in the sense of the sign of rpm,
as the builder turns the surfaces. So
psi = (datum + (n - 1) * 360 / N + sign(rpm) * theta_i) mod 360,
in degrees in [0, 360). Both turns are counted by :func:blade_azimuth_deg,
the one home of a turn counted in steps: the blade's place is step n - 1 of
a revolution of N steps turned forwards, and the clocking is step i of a
revolution of N k steps turned in the sense of rpm.
None where anything is not stated: a datum, a blade from 1 to N, a count of
blades or of clockings that is not a positive integer, a clocking that is
not an integer, or an rpm that is zero or not a number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
datum_deg
|
object
|
Blade one's datum at clocking zero, in degrees. |
required |
blade
|
object
|
The blade, from 1 to |
required |
blades
|
object
|
The wheel's blade count N. |
required |
clocking
|
object
|
The clocking i, from 0. |
required |
positions
|
object
|
The number of clockings k. |
required |
rpm
|
object
|
The rotor's signed speed in rev/min; only its sign is read. |
required |
Returns:
| Type | Description |
|---|---|
float or None
|
The azimuth psi in degrees in [0, 360), or None where anything is not stated. |
Examples:
>>> clocked_blade_azimuth_deg(0.0, blade=2, blades=3, clocking=1, positions=3, rpm=1200.0)
160.0
>>> clocked_blade_azimuth_deg(0.0, blade=2, blades=3, clocking=1, positions=3, rpm=-1200.0)
80.0
>>> clocked_blade_azimuth_deg(0.0, blade=4, blades=3, clocking=0, positions=3, rpm=1.0) is None
True
pyflightstream.post.axes.dcm
¶
dcm(axis: Sequence[float], angle_rad: float) -> Matrix
Return the passive direction-cosine matrix of a turn angle_rad about axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis
|
sequence of float
|
The direction the coordinate system turns about; it need not be a unit vector, and it may not be null. |
required |
angle_rad
|
float
|
The right-handed angle, in radians. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The 3 by 3 matrix |
Raises:
| Type | Description |
|---|---|
ProductError
|
If |
Examples:
A quarter turn about z carries the old y axis onto the new x axis:
>>> import math
>>> [round(float(c), 12) + 0.0 for c in dcm((0, 0, 1), math.pi / 2) @ [0.0, 1.0, 0.0]]
[1.0, 0.0, 0.0]
pyflightstream.post.axes.frame_rotations
¶
frame_rotations(
alpha_deg: float,
beta_deg: float,
rotors: Sequence[RotorFrame] = (),
) -> dict[str, Matrix]
Return the export-to-frame matrix of every polar frame, in file order.
C_f/E = C_f/B C_B/E for f in W, S, B and each R<id>,
id ascending; C_B/B is the identity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha_deg
|
float
|
The angles the point flew, as written; W and S are turned by the
geometric angles of :func: |
required |
beta_deg
|
float
|
The angles the point flew, as written; W and S are turned by the
geometric angles of :func: |
required |
rotors
|
sequence of RotorFrame
|
The frames of every declared rotor. |
()
|
Returns:
| Type | Description |
|---|---|
dict of str to numpy.ndarray
|
|
Raises:
| Type | Description |
|---|---|
ProductError
|
If two rotor frames carry one id. |
Examples:
>>> list(frame_rotations(4.0, 2.0, [rotor_frame((-1.0, 0.0, 0.0), 1)]))
['W', 'S', 'B', 'R1']
pyflightstream.post.axes.free_stream_in_export_frame
¶
free_stream_in_export_frame(
alpha_deg: float, beta_deg: float
) -> Vector
Return the unit direction the AIR moves along, in the export's own frame.
It is the aircraft's velocity reversed and carried back to the export frame,
(ca cb, -ca sb, sa): aft, against the sideslip, and UP at positive
incidence. A force's projection on it is the drag along the free stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha_deg
|
float
|
Angle of attack as the solver was given it, in degrees. |
required |
beta_deg
|
float
|
Sideslip angle as the solver was given it, in degrees. |
required |
Returns:
| Type | Description |
|---|---|
Vector
|
The unit vector |
pyflightstream.post.axes.free_stream_on_rotor_axis
¶
free_stream_on_rotor_axis(
axis: Sequence[float], alpha_deg: float, beta_deg: float
) -> tuple[float, float] | None
Return (cos alpha_p, sin alpha_p): the flight direction on a rotor's axis.
alpha_p is the angle between the rotor's axis axis, in the sense
its thrust is counted positive, and the direction the free stream comes
FROM (the rotor's direction of flight through the air, the opposite of
:func:free_stream_in_export_frame). cos alpha_p is that direction's
component along the axis and sin alpha_p the length of its component
square to it, so alpha_p is 0 in axial flight along the thrust and 90
degrees edgewise. Both are taken from the vectors rather than through the
angle, so an axis along a geometry axis gives them exactly.
None where the axis names no direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis
|
sequence of float
|
The rotor's axis in the export frame, in the sense its thrust is counted positive. |
required |
alpha_deg
|
float
|
Angle of attack as the solver was given it, in degrees. |
required |
beta_deg
|
float
|
Sideslip angle as the solver was given it, in degrees. |
required |
Returns:
| Type | Description |
|---|---|
tuple of (float, float) or None
|
|
Examples:
>>> free_stream_on_rotor_axis((-1.0, 0.0, 0.0), 0.0, 0.0)
(1.0, 0.0)
>>> free_stream_on_rotor_axis((0.0, 0.0, 1.0), 0.0, 0.0)
(0.0, 1.0)
pyflightstream.post.axes.placed_blade_azimuth_deg
¶
placed_blade_azimuth_deg(
blade_one_deg: object, *, blade: object, blades: object
) -> float | None
Return where blade blade of blades is when blade one is at blade_one_deg.
Blade n sits (n - 1) / N of a turn from blade one, right-handed about
the shaft, whatever the sense of rotation, as the builder places the
blade frames and as :func:clocked_blade_azimuth_deg and the per-blade
table place them. The turn is counted by
:func:blade_azimuth_deg: the blade's place is step n - 1 of a revolution
of N steps turned forwards. The harmonic product reads blade one's
AZIMUTH of an unsteady sections series through here, so that a block
of blade n is fitted at that blade's own azimuth.
None where anything is not stated: an azimuth that is not a number, a blade from 1 to N, or a count of blades that is not a positive integer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blade_one_deg
|
object
|
Blade one's azimuth, in degrees. |
required |
blade
|
object
|
The blade, from 1 to |
required |
blades
|
object
|
The blade count N. |
required |
Returns:
| Type | Description |
|---|---|
float or None
|
The blade's azimuth in degrees in [0, 360), or None where anything is not stated. |
Examples:
>>> placed_blade_azimuth_deg(300.0, blade=2, blades=3)
60.0
>>> placed_blade_azimuth_deg(300.0, blade=4, blades=3) is None
True
pyflightstream.post.axes.rotor_frame
¶
rotor_frame(
axis_vector: Sequence[float], rotor_id: int = 0
) -> RotorFrame
Return the frame Raxis_vector in the export frame.
The shaft in body axes is a = C_B/E axis. THE SENSE RULE makes thrust
positive forward: if a_x < 0 the shaft is turned (a = -a); if
a_x = 0 and a_z > 0 it is turned too, so a lift rotor's thrust is
positive up; if both are 0, a_y >= 0. Then psi = atan2(a_y, a_x),
theta = asin(-a_z) and C_R/B = C2(theta) C3(psi), so x_R = a.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis_vector
|
sequence of float
|
The declared shaft, in the export frame (x aft, y right, z up); it need not be a unit vector. |
required |
rotor_id
|
int
|
The rotor's declared id. |
0
|
Returns:
| Type | Description |
|---|---|
RotorFrame
|
The frame, its angles in degrees and the sense applied. |
Raises:
| Type | Description |
|---|---|
ProductError
|
If the axis names no direction or the id is negative. |
Examples:
A tractor declared forward (export -x) flies in body axes, untouched:
>>> frame = rotor_frame((-1.0, 0.0, 0.0))
>>> frame.name, frame.pitch_deg, frame.toe_deg, frame.sense
('R0', 0.0, 0.0, 1)
pyflightstream.post.axes.section_station_shaft_loads
¶
section_station_shaft_loads(
force_x: float,
force_z: float,
offset: float,
*,
plane: str,
shaft: Sequence[float],
) -> tuple[float, float] | None
Return (axial, torque) of one station of a sectional loads export, per unit span.
force_x and force_z are the export's Fx and Fz of the
station and offset its Offset, all in the SECTION FRAME's own
axes, the frame the distribution was cut in; plane is the cut's plane
in that frame and shaft the rotor's axis stated in the same frame's
axes, in the sense its thrust is counted positive. The station's force is
F = Fx e_x + Fz e_z for an XZ cut, Fx e_x + Fz e_y for an XY cut
(:data:SECTION_FORCE_AXES), and it sits at r = Offset e_y (XZ) or
Offset e_z (XY) from the frame's origin, the rotor's hub for a
frame of the rotor:
axial = F . a, the force along the shafta;torque = (r x F) . a, its moment about the shaft, which only the in-plane (tangential) component ofFproduces.
None where the plane is not one whose force axes are known or the shaft names no direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force_x
|
float
|
The station's |
required |
force_z
|
float
|
The station's |
required |
offset
|
float
|
The station's |
required |
plane
|
str
|
The cut's plane in the section frame, |
required |
shaft
|
sequence of float
|
The rotor's axis in the section frame's axes, in the sense its thrust is counted positive. |
required |
Returns:
| Type | Description |
|---|---|
tuple of (float, float) or None
|
|
Examples:
A blade frame whose x is the shaft: the export's Fx is the thrust and
Offset Fz the torque; one whose z is the shaft: Fz is the thrust.
>>> section_station_shaft_loads(10.0, 2.0, 0.5, plane="XZ", shaft=(1.0, 0.0, 0.0))
(10.0, 1.0)
>>> section_station_shaft_loads(10.0, 2.0, 0.5, plane="XZ", shaft=(0.0, 0.0, 1.0))
(2.0, -5.0)
An XY cut in the hub frame of a rotor whose shaft is x, the blade along z:
Fx is the thrust and -Offset Fz the torque.
>>> section_station_shaft_loads(10.0, 2.0, 0.5, plane="XY", shaft=(1.0, 0.0, 0.0))
(10.0, -1.0)
>>> section_station_shaft_loads(10.0, 2.0, 0.5, plane="YZ", shaft=(1.0, 0.0, 0.0)) is None
True
pyflightstream.post.axes.velocity_in_body_frame
¶
velocity_in_body_frame(
alpha_deg: float, beta_deg: float
) -> Vector
Return the unit velocity of the AIRCRAFT in body axes, as the solver builds it.
Sideslip is turned about body z first and incidence second, so the vector
is (ca cb, ca sb, sa); see the module docstring for the measurement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha_deg
|
float
|
Angle of attack as the solver was given it, in degrees. |
required |
beta_deg
|
float
|
Sideslip angle as the solver was given it, in degrees. |
required |
Returns:
| Type | Description |
|---|---|
Vector
|
The unit vector |
pyflightstream.post.axes.wind_angles
¶
wind_angles(
alpha_deg: float, beta_deg: float
) -> tuple[float, float]
Return (alpha_s, beta_w) in RADIANS, read off the solver's velocity vector.
alpha_s turns the body axes onto the stability axes and beta_w turns
those onto the wind axes. They equal the written angles when either is zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha_deg
|
float
|
Angle of attack as the solver was given it, in degrees. |
required |
beta_deg
|
float
|
Sideslip angle as the solver was given it, in degrees. |
required |
Returns:
| Type | Description |
|---|---|
tuple of (float, float)
|
|
Examples:
>>> import math
>>> [round(math.degrees(angle), 4) for angle in wind_angles(4.0, 2.0)]
[4.0024, 1.9951]
pyflightstream.post.axes.wind_force_coefficients
¶
wind_force_coefficients(
force_in_export_frame: Sequence[float],
alpha_deg: float,
beta_deg: float,
) -> tuple[float, float, float]
Return (CD, CY, CL) in WIND axes of a force stated in the export frame.
Works on coefficients and on Newtons alike: the rotation does not care.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force_in_export_frame
|
sequence of float
|
The force (x, y, z) in the export frame, as coefficients or in newtons. |
required |
alpha_deg
|
float
|
Angle of attack as the solver was given it, in degrees. |
required |
beta_deg
|
float
|
Sideslip angle as the solver was given it, in degrees. |
required |
Returns:
| Type | Description |
|---|---|
tuple of float
|
|