pyflightstream.cases.acoustics (provisional)¶
Generated from the docstrings at build time: every one of the 32 names in the __all__ of pyflightstream.cases.acoustics has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
The acoustic signals of a point: their emission by the run and the contract of their reading.
Pipeline role: the cases row, because both sides of the contract name it: the
setup and the end of an unsteady point emit the solver's acoustic toolbox and
declare its export (work package E2, here), and the post stage reads that
export back (work package E1, :mod:pyflightstream.post.acoustics), and the
post row may import the cases row and never the reverse. The contract the two
packages code against:
- :class:
AcousticSignal, one observer's signal as the post stage hands it on; - :data:
ACOUSTIC_SIGNALS_SUFFIX, the end of the name of the file a point's acoustic export is written to.
WHAT A ROW STATES (FR-265 to FR-269). Five keys of the
VAR_NAMES_VALUES cell, registered on the two unsteady run types
(unsteady and unsteady_rotor) and on no steady one:
ACOUSTIC_SOURCES: ENABLE(orDISABLE, the control) switches the recording of acoustic sources during the march. It is a setup command the manual places before the solver initialises, and the builder emits it there;ACOUSTIC_OBSERVERS: MIC1 0.0 10.0 0.0, MIC2 0.0 -10.0 0.0declares named observer points, eachNAME X Y Zin metres in the reference coordinate system, observers separated by commas;ACOUSTIC_OBSERVERS_FILE: <stem>namesinputs/acoustics/<stem>.csv, the solver's own observer file (a count line, then that manyx,y,zlines), resolved when the row binds and imported by the solver from the point's own copy;ACOUSTIC_OBSERVER_TIME: T0 T1 Nis the observers' time window in seconds and its number of samples, required whenever an observer is declared;ACOUSTIC_SECTION: {PLANE:YZ / OFFSET:0.0 / RADIAL_OBSERVERS:2 / AZIMUTH_OBSERVERS:4 / INNER_RADIUS:5.0 / OUTER_RADIUS:10.0}declares one annular grid of observers (an arc or a disc in a plane), lengths in metres, in the frameFRAMEnames (a frame the run creates, such asMRP) or in the reference coordinate system when it names none.
At the end of the march, after the solve and before the export phase, a row
that declares any observer emits COMPUTE_ACOUSTIC_SIGNALS; a row with
point or file observers then exports every observer's signal to ONE file,
<point>_acoustic_signals.txt, which the point declares, collects and
hashes like its other outputs; a section then writes its VTK files into the
folder <point>_acoustic_section/ beside them, which the run creates, and
the collect lists and hashes each file it holds. The order is the one the
licensed round-1 probe A1 ran on FlightStream 26.124 (the compat report
reports/compat/CMP-26124_2026-09-30_acoustics.yaml).
WHAT THE PROBE MEASURED about the export (A1 against its control A0, which
differ in the ACOUSTIC_SOURCES token only): one block per observer, a
line Observer: <name>, a line Position: x,y,z, a line Columns:
Observer time (sec), PL (Pa), PT (Pa), PO (Pa), then one row per sample of
the observer time window, the first at T0 and N rows spaced by
(T1 - T0) / N; an imported observer is named Observer <n>, its place in
the solver's own list; with DISABLE every pressure is zero. The section
wrote one VTK file per sample of the time window, VTK_output-NNN.vtk, each
holding every observer of the grid. The name the export is written under is
this package's choice, and the probe confirmed the solver writes the path it
is given: the suffix below stands.
WHAT STAYS UNMEASURED: whether the solver creates a section folder that does
not exist (the run creates it, so it need not), how a relative STORAGE_PATH
resolves (the builder writes the folder's full path wherever the run names
the folder the point runs in), and the length unit of the exported
coordinates on a simulation not in metres. The metre and pascal of
:class:AcousticSignal are the contract's units, so a reader converts to
them; they are not a claim about the file.
Advanced¶
pyflightstream.cases.acoustics.ACOUSTIC_KEYS
module-attribute
¶
ACOUSTIC_KEYS: tuple[str, ...] = (
ACOUSTIC_SOURCES_VARIABLE,
ACOUSTIC_OBSERVERS_VARIABLE,
ACOUSTIC_OBSERVERS_FILE_VARIABLE,
ACOUSTIC_OBSERVER_TIME_VARIABLE,
ACOUSTIC_SECTION_VARIABLE,
)
pyflightstream.cases.acoustics.ACOUSTIC_KEY_MEANINGS
module-attribute
¶
ACOUSTIC_KEY_MEANINGS: Mapping[str, InputKey] = {
ACOUSTIC_SOURCES_VARIABLE: InputKey(
"Record the acoustic sources during the unsteady march, set up before the solver initialises; DISABLE is the control, whose signals are zero.",
"ENABLE or DISABLE",
"ACOUSTIC_SOURCES",
),
ACOUSTIC_OBSERVERS_VARIABLE: InputKey(
"Named acoustic observer points, each NAME X Y Z in metres in the reference coordinate system, observers separated by commas; their signals are computed and exported to <point>_acoustic_signals.txt at the end of the run.",
"NAME X Y Z, NAME X Y Z (metres)",
"CREATE_NEW_ACOUSTIC_OBSERVER, COMPUTE_ACOUSTIC_SIGNALS, EXPORT_ACOUSTIC_SIGNALS",
),
ACOUSTIC_OBSERVERS_FILE_VARIABLE: InputKey(
"Acoustic observers imported by the solver from a file of the input library (a count line, then that many x,y,z lines in the simulation's length unit, which must be metres); the point imports its own hashed copy.",
"the stem of a file of inputs/acoustics/ (<stem>.csv)",
"ACOUSTIC_OBSERVERS_IMPORT, COMPUTE_ACOUSTIC_SIGNALS, EXPORT_ACOUSTIC_SIGNALS",
),
ACOUSTIC_OBSERVER_TIME_VARIABLE: InputKey(
"The observers' time window and its number of samples, required with any observer: the signal is sampled N times from T0, spaced by (T1 - T0) / N.",
"T0 T1 N (seconds, seconds, a count)",
"SET_ACOUSTIC_OBSERVER_TIME",
),
ACOUSTIC_SECTION_VARIABLE: InputKey(
"One annular grid of acoustic observers in a plane, whose VTK files are written into <point>_acoustic_section/ after the signals are computed; lengths in metres, FRAME a frame the run creates or the reference coordinate system.",
"{PLANE:YZ / OFFSET:0.0 / RADIAL_OBSERVERS:2 / AZIMUTH_OBSERVERS:4 / INNER_RADIUS:5.0 / OUTER_RADIUS:10.0}, FRAME optional",
"CREATE_ACOUSTIC_SECTION",
),
}
pyflightstream.cases.acoustics.ACOUSTIC_OBSERVERS_FILE_VARIABLE
module-attribute
¶
ACOUSTIC_OBSERVERS_FILE_VARIABLE = "ACOUSTIC_OBSERVERS_FILE"
pyflightstream.cases.acoustics.ACOUSTIC_OBSERVERS_VARIABLE
module-attribute
¶
ACOUSTIC_OBSERVERS_VARIABLE = 'ACOUSTIC_OBSERVERS'
pyflightstream.cases.acoustics.ACOUSTIC_OBSERVER_TIME_VARIABLE
module-attribute
¶
ACOUSTIC_OBSERVER_TIME_VARIABLE = 'ACOUSTIC_OBSERVER_TIME'
pyflightstream.cases.acoustics.ACOUSTIC_SECTION_NOTE
module-attribute
¶
ACOUSTIC_SECTION_NOTE = 'pyfs-acoustic-section.txt'
pyflightstream.cases.acoustics.ACOUSTIC_SECTION_SUFFIX
module-attribute
¶
ACOUSTIC_SECTION_SUFFIX = '_acoustic_section'
pyflightstream.cases.acoustics.ACOUSTIC_SECTION_VARIABLE
module-attribute
¶
ACOUSTIC_SECTION_VARIABLE = 'ACOUSTIC_SECTION'
pyflightstream.cases.acoustics.ACOUSTIC_SIGNALS_SUFFIX
module-attribute
¶
ACOUSTIC_SIGNALS_SUFFIX = '_acoustic_signals.txt'
pyflightstream.cases.acoustics.ACOUSTIC_SOURCES_VARIABLE
module-attribute
¶
ACOUSTIC_SOURCES_VARIABLE = 'ACOUSTIC_SOURCES'
pyflightstream.cases.acoustics.AcousticObserver
dataclass
¶
AcousticObserver(
name: str, x_m: float, y_m: float, z_m: float
)
One named observer point a row declares, in metres, reference coordinate system.
pyflightstream.cases.acoustics.AcousticRequest
dataclass
¶
AcousticRequest(
sources: str | None,
observers: tuple[AcousticObserver, ...],
observers_file: str | None,
time: ObserverTime | None,
section: AcousticSection | None,
)
What a row's acoustic keys ask of the run, read and checked once.
Attributes:
| Name | Type | Description |
|---|---|---|
sources |
str or None
|
|
observers |
tuple of AcousticObserver
|
The named points of |
observers_file |
str or None
|
The absolute path of the file |
time |
ObserverTime or None
|
|
section |
AcousticSection or None
|
|
pyflightstream.cases.acoustics.AcousticSection
dataclass
¶
AcousticSection(
frame: str | None,
plane: str,
offset_m: float,
radial_observers: int,
azimuth_observers: int,
inner_radius_m: float,
outer_radius_m: float,
)
The one annular grid of observers a row declares, lengths in metres.
pyflightstream.cases.acoustics.AcousticSignal
dataclass
¶
AcousticSignal(
observer: str,
x_m: float,
y_m: float,
z_m: float,
time_s: tuple[float, ...],
pressure_pa: tuple[float, ...],
)
One observer's acoustic pressure signal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observer
|
str
|
The observer's name, as its creation named it. |
required |
x_m
|
float
|
The observer's position in the reference coordinate system, in metres. |
required |
y_m
|
float
|
The observer's position in the reference coordinate system, in metres. |
required |
z_m
|
float
|
The observer's position in the reference coordinate system, in metres. |
required |
time_s
|
tuple of float
|
The observer's time samples, in seconds. |
required |
pressure_pa
|
tuple of float
|
The acoustic pressure at each time sample, in pascals. |
required |
pyflightstream.cases.acoustics.OBSERVERS_COPY_SUFFIX
module-attribute
¶
OBSERVERS_COPY_SUFFIX = '.acoustic_observers.csv'
pyflightstream.cases.acoustics.ObserverTime
dataclass
¶
ObserverTime(initial_s: float, final_s: float, steps: int)
The observers' time window, in seconds, and its number of samples.
pyflightstream.cases.acoustics.SECTION_KEYS
module-attribute
¶
SECTION_KEYS: tuple[str, ...] = (
"FRAME",
"PLANE",
"OFFSET",
"RADIAL_OBSERVERS",
"AZIMUTH_OBSERVERS",
"INNER_RADIUS",
"OUTER_RADIUS",
)
pyflightstream.cases.acoustics.SECTION_PLANES
module-attribute
¶
SECTION_PLANES: tuple[str, ...] = ('XY', 'XZ', 'YZ')
pyflightstream.cases.acoustics.SOURCE_MODES
module-attribute
¶
SOURCE_MODES: tuple[str, ...] = ('ENABLE', 'DISABLE')
pyflightstream.cases.acoustics.acoustic_request
¶
acoustic_request(case: SimCase) -> AcousticRequest | None
Read and check the row's acoustic keys, or return None when it states none.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
SimCase
|
The case, its variables as the matrix row wrote them and
:attr: |
required |
Returns:
| Type | Description |
|---|---|
AcousticRequest or None
|
None for a case stating no acoustic key. |
Raises:
| Type | Description |
|---|---|
CampaignConfigError
|
A value not in its form; an observer, a file or a section without
|
pyflightstream.cases.acoustics.acoustic_section_leftovers
¶
acoustic_section_leftovers(
work_dir: Path, sim_dir: Path
) -> str | None
Return the refusal of a point whose section folder already holds a file, or None.
E2, FR-268: The section's files are listed after the run from the folder the solver writes into, so a file already there before the solver starts (an aborted run's, a hand copy) would be listed and hashed as this run's evidence, which is the defect a declared output is refused for when it exists before its run (PYFS-006). The run's own note is not a leftover: the run writes it before this is asked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
work_dir
|
Path
|
The folder the point runs in, its datapoint folder. |
required |
sim_dir
|
Path
|
The simulation folder, for the names the sentence gives. |
required |
Returns:
| Type | Description |
|---|---|
str or None
|
The sentence of the refusal, naming each leftover; None where no section folder of the point holds a file other than the note. |
pyflightstream.cases.acoustics.acoustic_section_outputs
¶
acoustic_section_outputs(
sim_dir: Path, collected: Sequence[str]
) -> list[str]
Return the collected outputs with every file of the point's acoustic sections added.
E2, FR-268: A section writes one VTK file per sample of the observer
time window into <point>_acoustic_section/, a folder in the point's own
datapoint folder, and how many files that is the solver decides, so they
are not declared before the run: they are listed here, after the declared
outputs are collected, from the datapoint folders those outputs sit in,
each file but the note the run itself wrote to create the folder, sorted.
The caller hashes the list, so each file is named in the record and bound
to its bytes like any declared output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_dir
|
Path
|
The simulation folder the names are relative to. |
required |
collected
|
sequence of str
|
The collected outputs, |
required |
Returns:
| Type | Description |
|---|---|
list of str
|
|
pyflightstream.cases.acoustics.acoustic_signals_output
¶
acoustic_signals_output(
case: SimCase, stem: str
) -> str | None
Return the name a point exports its signals to, or None when it exports none.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
SimCase
|
The case whose row may declare observers. |
required |
stem
|
str
|
The point's rendered stem, the name every export of the point carries. |
required |
Returns:
| Type | Description |
|---|---|
str or None
|
|
pyflightstream.cases.acoustics.emit_acoustic_setup
¶
emit_acoustic_setup(
case: SimCase,
script: Script,
*,
from_metres: Callable[[str], float],
) -> None
Emit the acoustic setup a row states, before the solver initialises.
ACOUSTIC_SOURCES, then each named observer, then the imported file (the
point's own copy, parked for the run to write and hash), then the observer
time window: the order of the round-1 probe A1. A case stating no acoustic
key emits nothing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
SimCase
|
The point's case. |
required |
script
|
Script
|
The script being built, still in its setup phase. |
required |
from_metres
|
callable
|
The builder's factor from metres to the simulation's length unit, asked with a description of what is converted. |
required |
Raises:
| Type | Description |
|---|---|
CampaignConfigError
|
The script already initialised the solver: sources switched on after
|
pyflightstream.cases.acoustics.emit_acoustic_signals
¶
emit_acoustic_signals(
case: SimCase,
script: Script,
*,
unsteady: bool,
frames: Mapping[str, object] | None,
from_metres: Callable[[str], float],
) -> None
Emit the computation and the exports of the signals, after the solve.
COMPUTE_ACOUSTIC_SIGNALS where the row declares any observer, then
EXPORT_ACOUSTIC_SIGNALS to the point's declared
<point>_acoustic_signals.txt where it declares a point or a file
observer, then CREATE_ACOUSTIC_SECTION into <point>_acoustic_section/
where it declares a section, whose folder the run creates by writing
:data:ACOUSTIC_SECTION_NOTE into it. The analysis phase, before the
point's other exports. A case stating no observer emits nothing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
SimCase
|
The point's case, carrying its acoustic keys. |
required |
script
|
Script
|
The script being built; the commands are appended to it. |
required |
unsteady
|
bool
|
Whether the run is unsteady; a steady run with acoustic keys is refused. |
required |
frames
|
mapping of str to object, or None
|
The frames this run creates, by name, each with its index; a section stated in a frame the run does not create is refused, and one stating none is placed in the reference frame. |
required |
from_metres
|
callable
|
The builder's factor from metres to the simulation's length unit, asked with a description of what is converted. |
required |
Raises:
| Type | Description |
|---|---|
CampaignConfigError
|
The request computes signals and the run is steady, or the script has not started the solver: the three commands read the sources an unsteady march recorded, and there is none; the point declares no acoustic export for its point or file observers. |
pyflightstream.cases.acoustics.is_acoustic_output
¶
is_acoustic_output(name: str | PurePath) -> bool
Whether a declared or recorded output is an acoustic file, never a surface export.
The signals export ends in .txt like the loads table, and a section's
files end in .vtk like the surface export, so the classifier asks this
before it pairs a name with a kind.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str or PurePath
|
A declared or recorded output name. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True for the signals export and for any file inside an acoustic section folder. |
pyflightstream.cases.acoustics.read_observers_file
¶
read_observers_file(
path: str | Path,
) -> tuple[tuple[float, float, float], ...]
Read the solver's observer file: a count line, then that many x,y,z lines.
The form the manual gives ACOUSTIC_OBSERVERS_IMPORT and the round-1
probe A1 imported on 26.124. Blank lines are skipped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
The observer file. |
required |
Returns:
| Type | Description |
|---|---|
tuple of (float, float, float)
|
The observer positions, in the order written. |
Raises:
| Type | Description |
|---|---|
CampaignConfigError
|
The file cannot be read, its first line is not a count of at least one, a line is not three comma-separated numbers, or the count is not the number of lines that follow. |
pyflightstream.cases.acoustics.refuse_acoustics_on_a_continuation
¶
refuse_acoustics_on_a_continuation(case: SimCase) -> None
Refuse a continuation of a row that asks for acoustic signals.
A continuation reopens the simulation a stopped march saved and runs the steps it owes; whether the sources recorded before the stop survive the save is not measured, so a signal computed at its end could cover part of the march with nothing saying which part.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
SimCase
|
The case of the continuation. |
required |
Raises:
| Type | Description |
|---|---|
CampaignConfigError
|
The case states any acoustic key. |
pyflightstream.cases.acoustics.resolve_observers_file
¶
resolve_observers_file(
inputs_dir: str | Path,
variables: Mapping[str, object],
*,
pol: str,
legacy: bool,
) -> str | None
Resolve a row's ACOUSTIC_OBSERVERS_FILE to its file's absolute path, when it binds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs_dir
|
str or Path
|
The workspace's input library, whose |
required |
variables
|
mapping
|
The row's |
required |
pol
|
str
|
The row's POL, for the message. |
required |
legacy
|
bool
|
Whether the row is |
required |
Returns:
| Type | Description |
|---|---|
str or None
|
The absolute path of |
Raises:
| Type | Description |
|---|---|
InputArtifactError
|
The key on a |
pyflightstream.cases.acoustics.with_acoustic_signals
¶
with_acoustic_signals(
outputs: Sequence[str], case: SimCase, stem: str
) -> list[str]
Return a point's outputs with its acoustic export declared last, where it has one.
The run layer's one hook (run._ids._point_names), for the plan and the run
alike, so the plan judges the script the run will execute and the collect
looks for the file the script writes. Declared last so the loads table,
which :func:~pyflightstream.cases.classify_outputs finds by its .txt,
is claimed first; the classifier leaves the acoustic export out anyway.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
outputs
|
sequence of str
|
The point's declared outputs. |
required |
case
|
SimCase
|
The point's case. |
required |
stem
|
str
|
The point's rendered file stem. |
required |
Returns:
| Type | Description |
|---|---|
list of str
|
|