Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1864,6 +1864,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
Changed). Both warn on use and are removed in 5.0, one release after the
3.x aliases.

### Removed

- The flat pre-3.2 module paths, as 3.2 announced when it deprecated them:
`phonometry.levels`, `phonometry.insulation`, `phonometry.room_ir` and the
eighty-odd siblings that the modularization grouped into domain subpackages
raise `ModuleNotFoundError` now, as does `phonometry.loudness`, deprecated
since 3.1. Only the module paths went. The names they held are still
exported flat, so `from phonometry import leq` reads as it always has, and
so does every other name in `phonometry.__all__`. The 4.0 taxonomy aliases
are untouched and stay until 5.0.

A pickle written by a 3.x release carries a flat path in the `__module__` of
its classes, and those no longer resolve; one written by 3.2 or later
through a subpackage path still does, until 5.0.

With one generation left, `_compat.py` keeps one table, and the alias
machinery no longer carries the per-entry wording overrides that the 3.1
deprecations needed.

### Fixed

- The committed example `.report()` fiches were not checked against the code
Expand Down
11 changes: 5 additions & 6 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,14 @@ contour = aircraft.noise_contour(path, powers, distances, sel, lmax, x=gx, y=gy)
| `phonometry.simulation` | 2D acoustic FDTD wave simulation (staggered grid, sources, probes, impedance boundaries, obstacles) |

Every name in the table below is also re-exported at the top level, so
`from phonometry import <name>` works for every row. Two generations of module
paths are still importable and warn on use. The pre-3.2 flat ones, written
without a subpackage, are removed in 4.0; the pre-4.0 ones that the taxonomy
moved are removed in 5.0. Reading a moved name from the namespace it left
warns and delegates as well.
`from phonometry import <name>` works for every row. The pre-4.0 module paths
that the taxonomy moved are still importable and warn on use; they are removed
in 5.0. Reading a moved name from the namespace it left warns and delegates as
well. The pre-3.2 flat paths, written without a subpackage, were removed in
4.0 as announced.

| Deprecated path | Resolves to | Removed in |
| :--- | :--- | :--- |
| `phonometry.insulation` | `phonometry.building.measurement.insulation` | 4.0 |
| `phonometry.metrology.levels` | `phonometry.signals.levels` | 5.0 |
| `phonometry.hearing.sti` | `phonometry.speech.sti` | 5.0 |
| `phonometry.vibration.human_vibration` | `phonometry.vibration.human.exposure` | 5.0 |
Expand Down
11 changes: 5 additions & 6 deletions llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2257,15 +2257,14 @@ contour = aircraft.noise_contour(path, powers, distances, sel, lmax, x=gx, y=gy)
| `phonometry.simulation` | 2D acoustic FDTD wave simulation (staggered grid, sources, probes, impedance boundaries, obstacles) |

Every name in the table below is also re-exported at the top level, so
`from phonometry import <name>` works for every row. Two generations of module
paths are still importable and warn on use. The pre-3.2 flat ones, written
without a subpackage, are removed in 4.0; the pre-4.0 ones that the taxonomy
moved are removed in 5.0. Reading a moved name from the namespace it left
warns and delegates as well.
`from phonometry import <name>` works for every row. The pre-4.0 module paths
that the taxonomy moved are still importable and warn on use; they are removed
in 5.0. Reading a moved name from the namespace it left warns and delegates as
well. The pre-3.2 flat paths, written without a subpackage, were removed in
4.0 as announced.

| Deprecated path | Resolves to | Removed in |
| :--- | :--- | :--- |
| `phonometry.insulation` | `phonometry.building.measurement.insulation` | 4.0 |
| `phonometry.metrology.levels` | `phonometry.signals.levels` | 5.0 |
| `phonometry.hearing.sti` | `phonometry.speech.sti` | 5.0 |
| `phonometry.vibration.human_vibration` | `phonometry.vibration.human.exposure` | 5.0 |
Expand Down
29 changes: 0 additions & 29 deletions scripts/generate_api_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,38 +774,9 @@ def build_model() -> tuple[list[ModuleDoc], dict[str, str], list[str]]:
if len(slugs) != len(pages):
raise ValueError("slug collision between module pages")

# Docstrings still reference the flat pre-modularization module names
# (":mod:`phonometry.insulation`"); alias them to the current pages.
labels: dict[str, list[str]] = {}
for page in pages:
if page.module != "phonometry":
labels.setdefault(page.label, []).append(page.url)
for label, urls in labels.items():
alias = f"phonometry.{label}"
if alias not in xref and len(urls) == 1:
xref[alias] = urls[0]
for old, new in _LEGACY_MODULE_ALIASES.items():
if old not in xref and new in xref:
xref[old] = xref[new]
return pages, xref, issues


#: Flat pre-modularization module names whose basename also changed; the
#: unchanged ones are aliased automatically from the page basenames above.
_LEGACY_MODULE_ALIASES = {
"phonometry.aircraft_atmospheric_absorption": (
"phonometry.aircraft.atmospheric_absorption"
),
"phonometry.environmental_measurement": (
"phonometry.environment.assessment.measurement"
),
"phonometry.underwater_acoustics": "phonometry.underwater.acoustics",
"phonometry.underwater_propagation":
"phonometry.underwater.propagation.closed_form",
"phonometry.underwater_sound_speed": "phonometry.underwater.propagation.sound_speed",
}


_TOP_LEVEL_INTRO = (
"Package-level names defined in `phonometry/__init__.py` itself. "
"Every public name in the library can also be imported directly from "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Aircraft noise certification (14 CFR Part 36, ICAO Annex 16 Vol. I) works with
one-third-octave-band spectra, and correcting a measured flyover to reference
atmospheric conditions requires the band attenuation over the propagation path.
The pure-tone attenuation coefficient is the ISO 9613-1 one (identical, per ARP
5534 §3.1) already provided by [`phonometry.air_absorption.air_attenuation`](/phonometry/reference/api/environment/air-absorption/#air_attenuation);
5534 §3.1) already provided by [`air_attenuation`](/phonometry/reference/api/environment/air-absorption/#air_attenuation);
this module adds the **SAE Method** (ARP 5534 §3.2.2), a regression that turns
the pure-tone mid-band path-length attenuation into the one-third-octave-band
attenuation and stays consistent with the ISO/ANSI Exact Method well beyond the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Two excitation/deconvolution pairs are implemented:
* **Exponential sweep with the Farina inverse filter** -- the classical
ESS of [`phonometry.sweep_signal`](/phonometry/reference/api/rooms/impulse-response/#sweep_signal) deconvolved by the time-reversed,
amplitude-compensated sweep (Farina 2000; ISO 18233:2006 Figure B.2,
the machinery of [`phonometry.impulse_response`](/phonometry/reference/api/rooms/impulse-response/)). The harmonic
the machinery of [`phonometry.impulse_response`](/phonometry/reference/api/rooms/impulse-response/#impulse_response)). The harmonic
*magnitudes* are correct, but the sweep is not synchronized: its `-1`
phase term breaks the time-shift/harmonic equivalence, so the phases of
`H_n` for $n \ge 2$ depend on the excitation and are not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ $f_m = 1000 \cdot 10^{k/10}$, `k` integer. Pass
`exact_midband=True` to snap the requested frequencies onto that grid and
reproduce Table 1 exactly.

This module closes the loop with [`phonometry.materials.absorbers.sound_absorption`](/phonometry/reference/api/materials/sound-absorption/) (ISO 354),
This module closes the loop with [`sound_absorption`](/phonometry/reference/api/materials/sound-absorption/) (ISO 354),
whose air power-attenuation coefficient `m` (1/m) is defined only through
the ISO 9613-1 `alpha` via $m = \alpha / (10 \log_{10} e)$.
[`air_attenuation_m`](/phonometry/reference/api/environment/air-absorption/#air_attenuation_m) returns that `m` directly.
Expand Down Expand Up @@ -99,7 +99,7 @@ scalars.
ISO 354:2003 defers its air power-attenuation coefficient `m` (1/m)
entirely to this `alpha` via $m = \alpha / (10 \log_{10} e)$. Use
[`air_attenuation_m`](/phonometry/reference/api/environment/air-absorption/#air_attenuation_m) to obtain that `m` for
[`phonometry.sound_absorption.absorption_area`](/phonometry/reference/api/materials/sound-absorption/#absorption_area) /
[`absorption_area`](/phonometry/reference/api/materials/sound-absorption/#absorption_area) /
[`absorption_coefficient`](/phonometry/reference/api/materials/sound-absorption/#absorption_coefficient).
:::

Expand All @@ -121,7 +121,7 @@ ISO 354 air power-attenuation coefficient `m` (1/m) from conditions.
Convenience composition of [`air_attenuation`](/phonometry/reference/api/environment/air-absorption/#air_attenuation) (ISO 9613-1 `alpha` in
dB/m) with the ISO 354:2003 (8.1.2.1) conversion
$m = \alpha / (10 \log_{10} e)$
(via [`phonometry.sound_absorption.attenuation_from_alpha`](/phonometry/reference/api/materials/sound-absorption/#attenuation_from_alpha)). It lets an
(via [`attenuation_from_alpha`](/phonometry/reference/api/materials/sound-absorption/#attenuation_from_alpha)). It lets an
ISO 354 caller feed real atmospheric conditions into
[`absorption_area`](/phonometry/reference/api/materials/sound-absorption/#absorption_area) /
[`absorption_coefficient`](/phonometry/reference/api/materials/sound-absorption/#absorption_coefficient) instead of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Implemented here are the four general terms of clause 7:

* `Adiv` geometrical divergence, $20 \log_{10}(d/d_0) + 11$ (Eq. (7));
* `Aatm` atmospheric absorption, $\alpha d$ (Eq. (8)) with `alpha`
the ISO 9613-1 coefficient supplied by [`phonometry.environment.propagation.air_absorption`](/phonometry/reference/api/environment/air-absorption/);
the ISO 9613-1 coefficient supplied by [`air_absorption`](/phonometry/reference/api/environment/air-absorption/);
* `Agr` ground effect, both the general per-region method of 7.3.1 with the
Table 3 functions `a'/b'/c'/d'` (Eq. (9)) and the alternative simplified
method of 7.3.2 (Eq. (10));
Expand Down Expand Up @@ -66,7 +66,7 @@ Attenuation due to atmospheric absorption (ISO 9613-2:1996, Eq. (8)).

$A_{atm} = \alpha d$ with `alpha` the ISO 9613-1 atmospheric
attenuation
coefficient (here in dB/m, from [`phonometry.air_absorption.air_attenuation`](/phonometry/reference/api/environment/air-absorption/#air_attenuation))
coefficient (here in dB/m, from [`air_attenuation`](/phonometry/reference/api/environment/air-absorption/#air_attenuation))
at each octave-band midband frequency. Eq. (8) writes `alpha` in dB/km
with $A_{atm} = \alpha_{\text{dB/km}} \, d / 1000$; the two forms
are identical.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Two closed-form quantities of the standard:
`ΔL_a` that decides whether a tone is audible.

The tonal-audibility formula itself is the ISO 1996-2 Annex C one already in
[`phonometry.environment.assessment.measurement`](/phonometry/reference/api/environment/measurement/); what is specific to IEC 61400-11 is
[`measurement`](/phonometry/reference/api/environment/measurement/); what is specific to IEC 61400-11 is
how the tone and masking-noise levels and the (Zwicker) critical band are
determined from the narrowband spectrum. The rating adjustment `K_T` is the
ISO 1996-2 [`tonal_adjustment`](/phonometry/reference/api/environment/measurement/#tonal_adjustment). The
Expand Down Expand Up @@ -49,7 +49,7 @@ pressure doubling; $S_0 = 1$ m².

| Name | Description |
| :--- | :--- |
| `band_levels` | Background-corrected A-weighted band sound pressure levels `L_p,i`, in dB (scalar or per band). The 61400-11-specific background correction (Formula 23 subtraction with the 3-6 dB asterisk marking and the \<= 3 dB not-reported rule, subclause 9.3) is out of scope here and must be applied beforehand; note its rule set differs from the ISO 1996-2 correction in [`phonometry.environment.assessment.measurement.residual_sound_correction`](/phonometry/reference/api/environment/measurement/#residual_sound_correction). |
| `band_levels` | Background-corrected A-weighted band sound pressure levels `L_p,i`, in dB (scalar or per band). The 61400-11-specific background correction (Formula 23 subtraction with the 3-6 dB asterisk marking and the \<= 3 dB not-reported rule, subclause 9.3) is out of scope here and must be applied beforehand; note its rule set differs from the ISO 1996-2 correction in [`residual_sound_correction`](/phonometry/reference/api/environment/measurement/#residual_sound_correction). |
| `r1` | Slant distance `R1` to the rotor centre, in m. |

**Returns:** The apparent sound power level `L_WA`, in dB re 1 pW.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ opposite ends of the absorption scale and are **not** interchangeable:
(measured `alpha` below ~0.15). Part 2 does not restate the
transfer-function / reflection-factor / absorption mathematics; Clauses 4,
5.7 and 6.6 defer it to ISO 10534-2. The core computation therefore lives in
[`phonometry.impedance_tube.two_microphone_impedance`](/phonometry/reference/api/materials/impedance-tube/#two_microphone_impedance) and is **not**
[`two_microphone_impedance`](/phonometry/reference/api/materials/impedance-tube/#two_microphone_impedance) and is **not**
reimplemented here. This module contributes only the Part-2 tube
geometry/validity helpers (upper usable frequency, microphone-spacing bounds,
the 250-1600 Hz one-third-octave working range) and the Annex A internal-loss
Expand Down
2 changes: 1 addition & 1 deletion site/src/content/docs/reference/api/rooms/acoustics.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ integrated impulse response, Clause 6).

| Name | Description |
| :--- | :--- |
| `ir` | Measured impulse response (1D), e.g. from [`phonometry.impulse_response`](/phonometry/reference/api/rooms/impulse-response/) (ISO 18233). |
| `ir` | Measured impulse response (1D), e.g. from [`phonometry.impulse_response`](/phonometry/reference/api/rooms/impulse-response/#impulse_response) (ISO 18233). |
| `fs` | Sample rate in Hz. |
| `band` | Optional band centre frequency in Hz. When given, the impulse response is first filtered with the matching IEC 61260 fractional-octave filter; when None the broadband response is integrated directly. |
| `fraction` | Bandwidth fraction of the band filter (1 = octave, 3 = one-third octave). Only used when `band` is not None. |
Expand Down
2 changes: 1 addition & 1 deletion site/src/content/docs/reference/api/rooms/image-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ reproduces the Eyring reverberation time of the room (Kuttruff Equation
| `fs` | Sample rate, Hz. |
| `max_order` | Reflection-order cut-off (total wall reflections). The shoebox has $(2/3)(2 i_0^3 + 3 i_0^2 + 4 i_0)$ audible images up to order `i0` (Kuttruff Equation (9.23)). Default 20. |
| `speed_of_sound` | Speed of sound `c`, m/s (default [`DEFAULT_SPEED_OF_SOUND`](/phonometry/reference/api/materials/road-absorption/#default_speed_of_sound)). |
| `air_attenuation` | Air *intensity* attenuation constant `m`, in neper per metre (scalar or per-band); the pressure amplitude of each path is scaled by $e^{-m r / 2}$ (Kuttruff 4.1). Default 0 (air absorption neglected). Obtain a physical `m` from [`phonometry.air_absorption.air_attenuation_m`](/phonometry/reference/api/environment/air-absorption/#air_attenuation_m). |
| `air_attenuation` | Air *intensity* attenuation constant `m`, in neper per metre (scalar or per-band); the pressure amplitude of each path is scaled by $e^{-m r / 2}$ (Kuttruff 4.1). Default 0 (air absorption neglected). Obtain a physical `m` from [`air_attenuation_m`](/phonometry/reference/api/environment/air-absorption/#air_attenuation_m). |
| `duration` | RIR length, s; default the latest image arrival rounded up to the next sample. |
| `frequencies` | Optional band centre frequencies, Hz, labelling a per-band result. When given, its length must match the band count of `absorption` (or broadcast against it). |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ default $c_0 = 343$ m/s it takes the familiar textbook value
Air absorption enters every model through the `air_attenuation` power
coefficient `m` (in neper per metre) as the additive term $4 m V$;
obtain a physical `m` from temperature and humidity with
[`phonometry.air_absorption.air_attenuation_m`](/phonometry/reference/api/environment/air-absorption/#air_attenuation_m).
[`air_attenuation_m`](/phonometry/reference/api/environment/air-absorption/#air_attenuation_m).

Each model enforces its own mathematical domain on the absorption
coefficients. Sabine's linear sum is finite for any non-negative coefficient,
Expand Down Expand Up @@ -390,7 +390,7 @@ error (a percentage passed instead of a fraction).
| :--- | :--- |
| `volume` | Room volume `V`, m3. |
| `surfaces` | Sequence of `(area, absorption_coefficient)` pairs; each coefficient a scalar or a per-band array in `[0, 2]`. |
| `air_attenuation` | Air power-attenuation coefficient `m`, in neper per metre (scalar or per-band); see [`phonometry.air_absorption.air_attenuation_m`](/phonometry/reference/api/environment/air-absorption/#air_attenuation_m). Default `0` (air absorption neglected). |
| `air_attenuation` | Air power-attenuation coefficient `m`, in neper per metre (scalar or per-band); see [`air_attenuation_m`](/phonometry/reference/api/environment/air-absorption/#air_attenuation_m). Default `0` (air absorption neglected). |
| `speed_of_sound` | Speed of sound `c0`, m/s (default [`DEFAULT_SPEED_OF_SOUND`](/phonometry/reference/api/materials/road-absorption/#default_speed_of_sound), giving the factor `0.161`). |

**Returns:** The reverberation time `T`, s; a float for scalar inputs, otherwise a per-band array.
2 changes: 1 addition & 1 deletion site/src/content/docs/reference/api/signals/inversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Sec. 2.4).

Both regularization levels are *relative* to the peak of
$\lvert H \rvert^2$
(like the scalar `regularization` of [`phonometry.impulse_response`](/phonometry/reference/api/rooms/impulse-response/),
(like the scalar `regularization` of [`phonometry.impulse_response`](/phonometry/reference/api/rooms/impulse-response/#impulse_response),
which this generalises): in-band the equalized magnitude deviates from
unity by at most `regularization_inside * max|H|**2 / min|H|**2` --
the analytic residue
Expand Down
2 changes: 1 addition & 1 deletion site/src/content/docs/reference/api/signals/phase.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ phase.
Sampling precautions (documented, and the reason for the `oversample`
padding): the estimate operates on a *uniformly sampled* one-sided response
(DC to Nyquist inclusive, the layout of `numpy.fft.rfft` and of
[`phonometry.impulse_response`](/phonometry/reference/api/rooms/impulse-response/) spectra). The real cepstrum of the
[`phonometry.impulse_response`](/phonometry/reference/api/rooms/impulse-response/#impulse_response) spectra). The real cepstrum of the
sampled log-magnitude is time-aliased when the grid is coarse relative to
how sharp the response is, so the magnitude is resampled onto an
`oversample` times denser grid by exact trigonometric (zero-padded
Expand Down
6 changes: 3 additions & 3 deletions src/phonometry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2851,7 +2851,7 @@ def __getattr__(name: str) -> Any:
return globals()[canonical]


# Deprecated module-path aliases for the 3.2 package reorganization: importing
# the package installs sys.modules shims for every moved public module (see
# phonometry/_compat.py; removed in 4.0).
# Deprecated module-path aliases for the 4.0 taxonomy: importing the package
# installs sys.modules shims for every moved public module (see
# phonometry/_compat.py; removed in 5.0).
from . import _compat as _compat
Loading