Split the metrology catch-all into filters, signals and metrology - #472
Conversation
The package had grown to 21 modules over four unrelated subjects, and every layer above it had already worked around that: the generated reference split it into seven sections, the sidebar into four groups, and the name predicted neither cepstrum nor signals. The code was the only layer that had not split it. phonometry.filters takes the normalized frequency selectivity: the filter banks, the frequency and time weightings, the RBJ equalizer and the IEC 61260-1 / IEC 61672-1 class verification. phonometry.signal takes the general signal analysis: levels, spectra, coherence, time-frequency, correlation, envelope, cepstrum, phase, synchronous averaging and the test signals. phonometry.metrology keeps what gives it its name: calibration, GUM uncertainty and data qualification, plus the IEC 61043 intensity class checker that documents with the intensity chain. Four modules drop a prefix their package now carries: filter_design to filters.design, parametric_filters to filters.weighting, signals to signal.test_signals and random_data to metrology.data_qualification, the name its documentation page already had. The renderers follow the same cut, so _plot/metrology.py becomes three modules with their own string tables. Nothing breaks for a caller. The flat API is untouched, every 3.x module path still resolves in one hop, every pre-split path imports through a PEP 562 shim, and reading a moved name from the namespace it left keeps working with the same rename notice. That last one is not covered by module-path shims and the namespace form is what the documentation leads with, so it gets its own resolution through the public __all__ of the packages the names moved to: a name that stops being public stops resolving through the old namespace too. The aliases go in 5.0 rather than 4.0, so the notice now names the release that removes it instead of assuming the next major. The generated reference is keyed by subpackage from here on. Its sections were a fourth naming of the same material, so a reader who knew where a function lived could not predict where its page lived; they are now filters, signal and metrology, and the pages move with them. The taxonomy contract loses two of its cross-package exceptions in the process. The tests move with the modules, the frontloaded list keeps naming a file that exists, and the architecture whitelist treats the three packages as the transverse toolbox every domain may import, which is the policy metrology already had. Snippets across the documentation, the README and the landing page call through the package that now owns each function, so nothing published teaches a path that warns.
Follow-up to the split, from an adversarial review of it. The guides link to the generated reference by URL, and three of those directories no longer exist, so 43 links pointed at 404s: the pages under levels/, spectra/ and correlation/ moved, parametric-filters became weighting and random-data became data-qualification. The audit configuration had the same three stale URLs, so pa11y, lighthouse and the language-suggestion check were all requesting a page that is not built any more. Seven snippets imported the new `signal` package into a block that already does `from scipy import signal`, which rebinds the name and crashes on the next line. The package was not used from phonometry in any of them, so it comes back out; every fenced block that imports scipy's signal now runs. The llms snippet lost a line in the rewrite and called `metrology.ln_levels` without importing metrology, and the generated shards were a regeneration behind. The taxonomy docstring said `_parent_subpackage` returns `metrology` for a `signal` module, which a blind rewrite had made false. `dir()` on the narrowed metrology namespace was hiding the names that left it: a PEP 562 hook is invisible to it, so they disappeared from tab completion a release before they stop working. `__all__` stays narrow, so `from phonometry.metrology import *` gives the 4.0 API and not the deprecated names, which the changelog now says instead of claiming nothing changes.
The area labels are per subpackage, so filters and signal need their own globs; without them a change confined to either lands unlabelled.
There was a problem hiding this comment.
Sorry @jmrplens, your pull request is larger than the review limit of 150000 diff characters
|
Important Review skippedToo many files! This PR contains 239 files, which is 139 over the limit of 100. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (239)
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
You've reached the fair usage limit for the Bito Code Review Agent trial. Upgrade to a paid plan or contact support@bito.in for assistance. Learn more |
Reviewer's GuideSplits the large phonometry.metrology subpackage into three domain packages (filters, signal, metrology), updates plotting, compatibility shims, tests, taxonomy, docs, and labeler accordingly, while preserving the flat API and pre-4.0 module paths via PEP 562 shims and namespace redirects. Sequence diagram for namespace shim resolving moved signal namessequenceDiagram
actor User
participant phonometry as phonometry
participant metrology as phonometry.metrology
participant shim as _namespace_shim
participant signal_levels as phonometry.signal.levels
User->>phonometry: import metrology
phonometry-->>User: bind metrology
User->>metrology: leq(...)
metrology->>shim: __getattr("leq")
shim->>signal_levels: import_module(signal.levels)
signal_levels-->>shim: __all__ contains leq
shim->>shim: _warn_renamed("'phonometry.metrology.leq'","'phonometry.signal.leq'")
shim-->>User: return leq
User->>signal_levels: leq(x, fs)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Pull request overview
This pull request restructures the previously broad phonometry.metrology namespace into three clearer domain packages—phonometry.filters, phonometry.signal, and a narrowed phonometry.metrology—while updating internal imports, tests, and documentation to follow the new taxonomy (and preserving the flat top-level API per the PR description).
Changes:
- Introduce
phonometry.filtersandphonometry.signalpackages and retarget code/tests to import from their new homes. - Update plotting/report/rendering call sites and docs links/examples to reflect the new package layout.
- Add/relocate tests to validate behavior under the new module organization (including new signal/filter-specific tests).
Reviewed changes
Copilot reviewed 189 out of 205 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/vibration/test_machine_diagnostics.py | Update envelope-spectrum import to phonometry.signal. |
| tests/test_performance.py | Update filter-core imports and cache clearing to phonometry.filters. |
| tests/test_package_architecture.py | Allow cross-package imports into {filters, signal, metrology} toolbox. |
| tests/test_matplotlib_backend.py | Update filter-design module import path to phonometry.filters.design. |
| tests/test_errors_and_edge_cases.py | Update nominal-frequencies import to phonometry.filters. |
| tests/test_conformance_report.py | Update filter-class verifier import to phonometry.filters. |
| tests/test_basic.py | Update OctaveFilterBank imports and cache clearing to phonometry.filters. |
| tests/signal/test_synchronous_average.py | Update synchronous-average import to phonometry.signal. |
| tests/signal/test_signals.py | New tests for deterministic colored-noise generator behavior. |
| tests/signal/test_signal_toolbox.py | Update correlation helper import to phonometry.signal. |
| tests/signal/test_parametrized_signals.py | Update weighting/parametric-filters import to phonometry.filters.weighting. |
| tests/signal/test_miso.py | Update MISO helpers import to phonometry.signal. |
| tests/signal/test_levels.py | Update weighting-filter import to phonometry.filters.weighting. |
| tests/signal/test_correlation.py | Update correlation helper import to phonometry.signal. |
| tests/signal/test_cepstrum.py | Update phase-module import to phonometry.signal. |
| tests/metrology/test_metrology_plot_i18n.py | Update filter-class compliance import to phonometry.filters. |
| tests/metrology/test_data_qualification.py | Update metrology data-qualification module rename (random_data → data_qualification). |
| tests/filters/test_weighting_class_verifier.py | Update compliance table import to phonometry.filters. |
| tests/filters/test_stateful_octave_filter_bank.py | Update filter-bank imports to phonometry.filters. |
| tests/filters/test_nominal_frequencies.py | Update nominal-frequencies imports to phonometry.filters. |
| tests/filters/test_iec61260_report.py | Update compliance result import to phonometry.filters. |
| tests/filters/test_iec_weighting_table3.py | New IEC 61672-1 Table 3 weighting compliance tests. |
| tests/filters/test_iec_compliance.py | Update weighting-filter import to phonometry.filters.weighting. |
| tests/filters/test_filter_design.py | Update filter-design imports to phonometry.filters.design. |
| tests/filters/test_compliance.py | Update compliance imports to phonometry.filters. |
| tests/filters/test_b_au_d_weightings.py | Update compliance imports and doc references to phonometry.filters. |
| tests/conftest.py | Update skipped-path reference for moved IEC61260 report test. |
| tests/aircraft/test_aircraft_noise_system.py | Update directional-limit import to phonometry.filters.compliance. |
| src/phonometry/vibration/machine_diagnostics.py | Update doc references for moved signal-analysis functions into phonometry.signal. |
| src/phonometry/underwater/pile_driving_noise.py | Update nominal-frequencies import to phonometry.filters. |
| src/phonometry/signal/time_frequency.py | Update doc and plotting import paths to phonometry.signal/_plot.signal. |
| src/phonometry/signal/test_signals.py | Update internal plot imports and doc references to phonometry.signal paths. |
| src/phonometry/signal/synchronous_average.py | Update fractional-delay import to signal.test_signals and plotting to _plot.signal. |
| src/phonometry/signal/spectra.py | Update plotting imports to _plot.signal. |
| src/phonometry/signal/phase.py | Update cepstrum reference and plotting import to _plot.signal. |
| src/phonometry/signal/miso.py | Update spectra references and plotting import to _plot.signal. |
| src/phonometry/signal/levels.py | Move weighting/time-weighting dependency to phonometry.filters.weighting. |
| src/phonometry/signal/inversion.py | Update plotting import to _plot.signal. |
| src/phonometry/signal/envelope.py | Update plotting imports to _plot.signal. |
| src/phonometry/signal/correlation.py | Update spectra references, import _fractional_advance from signal.test_signals, and plotting imports to _plot.signal. |
| src/phonometry/signal/cepstrum.py | Update plotting imports to _plot.signal. |
| src/phonometry/signal/init.py | New phonometry.signal package re-export surface. |
| src/phonometry/room/room_acoustics.py | Update OctaveFilterBank import to phonometry.filters. |
| src/phonometry/psychoacoustics/tonality.py | Update Welch-core import to phonometry.signal.spectra. |
| src/phonometry/metrology/data_qualification.py | Update spectra imports to phonometry.signal.spectra. |
| src/phonometry/metrology/calibration.py | Update time-weighting import to phonometry.filters.weighting. |
| src/phonometry/hearing/sti.py | Update filter-bank and nominal-frequencies imports to phonometry.filters. |
| src/phonometry/filters/equalizer.py | Update plotting import to _plot.filters and doc reference to filters.weighting. |
| src/phonometry/filters/core.py | Update internal design-module import (filter_design → design). |
| src/phonometry/filters/compliance.py | Update weighting-filter class import and plotting import to _plot.filters. |
| src/phonometry/filters/init.py | New phonometry.filters package re-export surface. |
| src/phonometry/environmental/impulsive_sound.py | Update weighting/time-weighting imports to phonometry.filters.weighting. |
| src/phonometry/emission/intensity.py | Update _genfreqs/Welch-core imports to filters/signal. |
| src/phonometry/electroacoustics/frequency_response.py | Update shared Welch-core imports to phonometry.signal.spectra. |
| src/phonometry/electroacoustics/distortion.py | Update weighting-filter import to phonometry.filters.weighting. |
| src/phonometry/building/heavy_impact.py | Update doc reference to phonometry.filters.core.OctaveFilterBank. |
| src/phonometry/broadcast/program_loudness.py | Update doc reference to phonometry.signal.levels.lc_peak. |
| src/phonometry/_report/iso3382.py | Update band-fraction helpers import to phonometry.filters.frequencies. |
| src/phonometry/_report/iec61260.py | Update references/imports to phonometry.filters frequency helpers and result type. |
| src/phonometry/_report/_sound_power_fiche.py | Update band-label helper imports to phonometry.filters.frequencies. |
| src/phonometry/_plot/vibration.py | Update doc reference to phonometry.signal.envelope.EnvelopeSpectrumResult. |
| src/phonometry/_plot/room.py | Update nominal-frequency helpers import to phonometry.filters.frequencies. |
| src/phonometry/_plot/common.py | Update doc reference to phonometry.filters.design._showfilter. |
| src/phonometry/_internal/warnings.py | Extend _warn_renamed to parameterize removal major version in warning text. |
| src/phonometry/_internal/peaks.py | Update doc reference to phonometry.signal.levels.lc_peak. |
| site/src/generated/api-sidebar.mjs | Update API sidebar structure for filters, signal, and narrowed metrology. |
| site/src/data/home.ts | Update homepage example to use phonometry.filters. |
| site/src/content/docs/reference/theory/signal-analysis.mdx | Update examples to import from phonometry.filters. |
| site/src/content/docs/reference/api/vibration/machine-diagnostics.md | Update cross-links to moved signal-analysis pages. |
| site/src/content/docs/reference/api/signal/test-signals.md | Rename API page metadata and update cross-links for signal.test_signals. |
| site/src/content/docs/reference/api/signal/synchronous-average.md | Update page title and links to signal equivalents. |
| site/src/content/docs/reference/api/signal/phase.md | Update page title/links to signal equivalents. |
| site/src/content/docs/reference/api/signal/miso.md | Update page title/links to signal equivalents. |
| site/src/content/docs/reference/api/signal/levels.md | Update page title to signal.levels. |
| site/src/content/docs/reference/api/signal/inversion.md | Update links to signal inversion page. |
| site/src/content/docs/reference/api/signal/envelope.md | Update page title/links to signal equivalents. |
| site/src/content/docs/reference/api/signal/cepstrum.md | Update page title/links to signal equivalents. |
| site/src/content/docs/reference/api/rooms/room-ir.md | Update inversion link to new signal path. |
| site/src/content/docs/reference/api/metrology/data-qualification.md | Rename metadata/links for metrology.data_qualification. |
| site/src/content/docs/reference/api/metrology/calibration.md | Update links to the new metrology calibration page location. |
| site/src/content/docs/reference/api/hearing/occupational-exposure.md | Update links to point at signal/levels page (text still references phonometry.levels). |
| site/src/content/docs/reference/api/filters/weighting.md | Rename metadata/links for filters.weighting. |
| site/src/content/docs/reference/api/filters/frequencies.md | Update title to filters.frequencies. |
| site/src/content/docs/reference/api/filters/equalizer.md | Update title and weighting-filter link to filters.weighting. |
| site/src/content/docs/reference/api/filters/core.md | Update title to filters.core. |
| site/src/content/docs/reference/api/filters/compliance.md | Update title and plotting-reference string to filters. |
| site/src/content/docs/reference/api/broadcast/program-loudness.md | Update lc_peak doc link to signal/levels. |
| site/src/content/docs/guides/time-weighting.mdx | Update guide examples to use phonometry.filters. |
| site/src/content/docs/guides/time-frequency.mdx | Update guide narrative/API reference to phonometry.signal. |
| site/src/content/docs/guides/test-signals.mdx | Update guide narrative/API reference to phonometry.signal. |
| site/src/content/docs/guides/synchronous-averaging.mdx | Update API reference link to signal.synchronous_average. |
| site/src/content/docs/guides/swept-sine-distortion.mdx | Update narrative references from metrology to signal for phase utilities. |
| site/src/content/docs/guides/spectral-analysis.mdx | Update narrative references from metrology to signal. |
| site/src/content/docs/guides/sound-level-meter.mdx | Update examples to split usage across filters, signal, and metrology. |
| site/src/content/docs/guides/multichannel.mdx | Update examples to use phonometry.filters. |
| site/src/content/docs/guides/miso-coherence.mdx | Update narrative/API reference to phonometry.signal. |
| site/src/content/docs/guides/filter-compliance.mdx | Update examples/API references to phonometry.filters. |
| site/src/content/docs/guides/data-qualification.mdx | Update imports/links to metrology.data_qualification. |
| site/src/content/docs/guides/correlation-delay.mdx | Update narrative references from metrology to signal. |
| site/src/content/docs/guides/cepstrum-echoes.mdx | Update narrative references from metrology to signal. |
| site/src/content/docs/guides/calibration.mdx | Update examples to use phonometry.filters for octave filtering/time weighting. |
| site/src/content/docs/guides/block-processing.mdx | Update examples/API references to phonometry.filters. |
| site/src/content/docs/guides/aircraft-noise.mdx | Update example to use phonometry.filters.verify_aircraft_noise_system. |
| site/src/content/docs/getting-started.mdx | Update getting-started examples and narrative to phonometry.filters. |
| site/src/content/docs/es/reference/theory/signal-analysis.mdx | Spanish: update examples to import from phonometry.filters. |
| site/src/content/docs/es/guides/time-weighting.mdx | Spanish: update examples to phonometry.filters. |
| site/src/content/docs/es/guides/time-frequency.mdx | Spanish: update narrative/API reference to phonometry.signal. |
| site/src/content/docs/es/guides/test-signals.mdx | Spanish: update narrative/API reference to phonometry.signal. |
| site/src/content/docs/es/guides/synchronous-averaging.mdx | Spanish: update API reference to signal.synchronous_average. |
| site/src/content/docs/es/guides/swept-sine-distortion.mdx | Spanish: update narrative references to phonometry.signal. |
| site/src/content/docs/es/guides/spectral-analysis.mdx | Spanish: update narrative references to phonometry.signal. |
| site/src/content/docs/es/guides/sound-level-meter.mdx | Spanish: update examples to split across filters, signal, metrology. |
| site/src/content/docs/es/guides/multichannel.mdx | Spanish: update examples to phonometry.filters. |
| site/src/content/docs/es/guides/miso-coherence.mdx | Spanish: update narrative/API reference to phonometry.signal. |
| site/src/content/docs/es/guides/filter-compliance.mdx | Spanish: update examples/API references to phonometry.filters. |
| site/src/content/docs/es/guides/data-qualification.mdx | Spanish: update imports/links to metrology.data_qualification. |
| site/src/content/docs/es/guides/correlation-delay.mdx | Spanish: update narrative references to phonometry.signal. |
| site/src/content/docs/es/guides/cepstrum-echoes.mdx | Spanish: update narrative references to phonometry.signal. |
| site/src/content/docs/es/guides/calibration.mdx | Spanish: update examples to phonometry.filters. |
| site/src/content/docs/es/guides/block-processing.mdx | Spanish: update examples to phonometry.filters. |
| site/src/content/docs/es/guides/aircraft-noise.mdx | Spanish: update example to phonometry.filters.verify_aircraft_noise_system. |
| site/src/content/docs/es/getting-started.mdx | Spanish: update getting-started examples and narrative to phonometry.filters. |
| site/scripts/lighthouse-audit.mjs | Update audited API path for moved levels page. |
| site/scripts/check-lang-suggest.mjs | Update visited URL for moved levels page. |
| site/public/llms/llms-sound-power.txt | Regenerate LLM shard to reflect taxonomy changes/content updates. |
| site/public/llms/llms-sound-insulation.txt | Regenerate LLM shard; update example labels. |
| site/public/llms/llms-signals-spectra.txt | Regenerate LLM shard; update metrology→signal narrative. |
| site/public/llms/llms-electroacoustics.txt | Regenerate LLM shard; update metrology→signal narrative. |
| site/public/llms/llms-core-signal-analysis.txt | Regenerate LLM shard; update examples to filters/signal. |
| site/public/llms/llms-calibration-uncertainty.txt | Regenerate LLM shard; update examples to filters. |
| site/public/llms/llms-aircraft-wind.txt | Regenerate LLM shard; update example to filters. |
| site/.pa11yci.json | Update accessibility-check URLs for moved levels page. |
| scripts/generate_llms.py | Update summary snippet to use filters and signal. |
| scripts/generate_graphs.py | Update references/imports to moved filter-design and compliance modules. |
| scripts/generate_api_docs.py | Update index snippet to import from phonometry.filters. |
| scripts/conformance_report.py | Update imports to phonometry.filters/phonometry.signal. |
| scripts/check_jit_kernel.py | Update weighting-module imports to phonometry.filters.weighting. |
| README.md | Update README examples and namespace coverage table for split. |
| README_PYPI.md | Update PyPI README examples and namespace coverage table for split. |
| docs/why-phonometry.md | Update time-weighting example imports to phonometry.filters. |
| docs/time-weighting.md | Update guide examples to use phonometry.filters. |
| docs/time-frequency.md | Update narrative from metrology to signal. |
| docs/theory-signal-analysis.md | Update examples to import from phonometry.filters. |
| docs/test-signals.md | Update narrative from metrology to signal. |
| docs/swept-sine-distortion.md | Update narrative from metrology to signal. |
| docs/spectral-analysis.md | Update narrative from metrology to signal. |
| docs/sound-level-meter.md | Update examples to split across filters, signal, and metrology. |
| docs/multichannel.md | Update examples to use phonometry.filters. |
| docs/miso-coherence.md | Update narrative from metrology to signal. |
| docs/getting-started.md | Update examples and narrative to phonometry.filters. |
| docs/filter-compliance.md | Update examples/API reference to phonometry.filters. |
| docs/filter-banks.md | Update examples to use phonometry.filters. |
| docs/data-qualification.md | Update imports to metrology.data_qualification. |
| docs/correlation-delay.md | Update narrative from metrology to signal. |
| docs/cepstrum-echoes.md | Update narrative from metrology to signal. |
| docs/calibration.md | Update examples to use phonometry.filters. |
| docs/block-processing.md | Update examples to use phonometry.filters. |
| docs/api-reference.md | Update namespace count and table to reflect filters/signal split. |
| docs/aircraft-noise.md | Update example to use phonometry.filters.verify_aircraft_noise_system. |
| CHANGELOG.md | Document the taxonomy split and updated deprecation/removal schedule. |
| .github/labeler.yml | Add label rules for new filters and signal areas. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| levels themselves come from the dosimetry primitives in | ||
| [`phonometry.levels`](/phonometry/reference/api/levels/levels/) ([`leq`](/phonometry/reference/api/levels/levels/#leq)/[`lex_8h`](/phonometry/reference/api/levels/levels/#lex_8h)); this module adds the three | ||
| [`phonometry.levels`](/phonometry/reference/api/signal/levels/) ([`leq`](/phonometry/reference/api/signal/levels/#leq)/[`lex_8h`](/phonometry/reference/api/signal/levels/#lex_8h)); this module adds the three |
There was a problem hiding this comment.
Good catch, and it was wider than this page. The docstring said phonometry.levels, a 3.1 flat alias that warns on use, while the generator resolved the link to the module's real home. Fourteen other docstrings across the package cited pre-3.2 flat paths the same way, so all of them now name the module they point at, resolved from the alias table itself rather than by hand. Fixed in 9924aae.
|
The module path |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #472 +/- ##
=======================================
Coverage 96.97% 96.98%
=======================================
Files 249 253 +4
Lines 38433 38487 +54
=======================================
+ Hits 37271 37327 +56
+ Misses 1162 1160 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Numerical conformance report✅ 533/533 conformance checks pass across 57 domains and 362 standards - filters class 1 - weightings within IEC 61672-1 class 1. Each row pins a standard clause to its expected normative value and the value the library computes. Every section below is collapsible and stays collapsed while all of its rows pass; a section with any failing row opens automatically. ✅ Numerical validation - filters & weightings: class showcase (IEC 61260-1 · IEC 61672-1 · ISO 7196)IEC 61260-1:2014 class per filter architecture (order 6, one-third-octave, 100 Hz-10 kHz, fs = 48 kHz). For each architecture the table shows, at its binding band, the measured relative attenuation and the class-1 limit it must clear, so the number and the range it must sit in are both visible. A positive margin means the acceptance limits are met with that much room.
Only Butterworth (the library default) and Chebyshev-II are class-compliant architectures. Chebyshev-I and elliptic trade the mask for passband ripple, and Bessel for a maximally-flat group delay (soft rolloff); they cannot satisfy the IEC 61260-1 Class 1/2 attenuation mask by construction, so they are labelled By design - this is expected, not a failure or regression. Frequency-weighting conformance (A/C: IEC 61672-1 Table 3; G: ISO 7196 A.3). The max deviation from nominal is informational (it falls at a frequency extreme where the tolerance is widest and asymmetric); compliance is judged at the binding frequency - the one with the least headroom - where the deviation, the applicable tolerance band and the headroom are shown together.
✅ Filters & weightings: 100% (10/10)
✅ Levels & dosimetry: 100% (9/9)
✅ Room & building acoustics: 100% (72/72)
✅ Room acoustics: 100% (16/16)
✅ Psychoacoustics: 100% (14/14)
✅ Speech transmission (IEC 60268-16): 100% (10/10)
✅ System measurement (Golay / Kirkeby / Mueller-Massarani): 100% (5/5)
✅ Intensity & sound power: 100% (10/10)
✅ Building prediction & uncertainty: 100% (15/15)
✅ Outdoor propagation & occupational exposure: 100% (10/10)
✅ Materials: absorption, airflow & impedance: 100% (6/6)
✅ Scattering & diffusion (ISO 17497): 100% (14/14)
✅ In-situ road absorption (ISO 13472): 100% (3/3)
✅ Precision sound power (ISO 3745 / 9614-3): 100% (4/4)
✅ Human vibration (ISO 8041 / 2631 / 5349): 100% (15/15)
✅ Speech intelligibility (ANSI S3.5-1997): 100% (24/24)
✅ Objective intelligibility (STOI / ESTOI): 100% (3/3)
✅ Impulsive-sound prominence (NT ACOU 112): 100% (2/2)
✅ Impulsive-sound prominence (ISO/PAS 1996-3): 100% (2/2)
✅ Room noise (ANSI S12.2-2019): 100% (3/3)
✅ Hearing threshold (ISO 7029 / ISO 389-7): 100% (3/3)
✅ Measurement uncertainty (GUM / Supplement 1): 100% (7/7)
✅ Noise-induced hearing loss (ISO 1999): 100% (6/6)
✅ Multiple-shock whole-body vibration (ISO 2631-5): 100% (6/6)
✅ Sound absorption in enclosed spaces (EN 12354-6): 100% (2/2)
✅ Prominent discrete tones (ECMA-418-1): 100% (2/2)
✅ Tonal audibility (ISO/PAS 20065): 100% (11/11)
✅ Psychoacoustic annoyance & fluctuation strength (Fastl & Zwicker): 100% (3/3)
✅ Electroacoustics: distortion & frequency response: 100% (20/20)
✅ Calibrated spectral analysis (Bendat & Piersol): 100% (12/12)
✅ Multiple-input coherence (Bendat & Piersol): 100% (5/5)
✅ Time-frequency analysis (Bendat & Piersol): 100% (3/3)
✅ Correlation, time delay and envelope (B&P / Knapp & Carter): 100% (7/7)
✅ Cepstrum, liftering and envelope spectrum (Havelock / B&P): 100% (3/3)
✅ Time synchronous averaging (McFadden 1987): 100% (5/5)
✅ Data qualification and Rice statistics (Bendat & Piersol): 100% (8/8)
✅ Underwater acoustics (ISO 18405/17208/18406): 100% (6/6)
✅ Underwater sound propagation (transmission loss): 100% (16/16)
✅ Underwater propagation regimes (Weston flux theory): 100% (3/3)
✅ Marine-mammal auditory weighting (NMFS / Southall): 100% (4/4)
✅ Underwater numerical propagation (modes / rays / PE): 100% (4/4)
✅ Aircraft noise (ICAO Annex 16 / IEC 61265): 100% (15/15)
✅ Rotorcraft noise (ECAC Doc 32 / NORAH2): 100% (12/12)
✅ CNOSSOS-EU road source (Directive 2002/49/EC Annex II): 100% (6/6)
✅ Wind-turbine noise (IEC 61400-11): 100% (3/3)
✅ Porous & multilayer absorbers (Mechel / Bies / Cox & D'Antonio): 100% (20/20)
✅ Slow-sound perfect absorbers (Jimenez et al. Appl. Sci. 2017): 100% (3/3)
✅ Program loudness (ITU-R BS.1770 / EBU R 128): 100% (8/8)
✅ 2D FDTD wave simulation (Attenborough & Van Renterghem 2021, Ch. 4): 100% (4/4)
✅ Swept-sine distortion & phase utilities (Farina / Novak): 100% (7/7)
✅ Spherical ground & barriers (Attenborough / Salomons / Bies): 100% (7/7)
✅ Panel & aperture sound insulation (Bies / Hopkins / Cremer): 100% (17/17)
✅ Bending-wave plate-junction transmission (Cremer / Craik / Hopkins): 100% (6/6)
✅ Atmospheric refraction (Salomons rays / GFPE): 100% (3/3)
✅ Electroacoustics: 100% (9/9)
✅ Industrial noise control: 100% (22/22)
✅ CNOSSOS-EU railway source (Directive 2002/49/EC Annex II): 100% (8/8)
Tests & coverage — 47238 tests, 0 failures (✅ all green)
Conformance harness: |
Second review pass, on the prose and the leftovers rather than the mechanics. The evidence table of "Why phonometry" cites the test file that proves each normative claim, and five of those files moved in this change, so the page that exists to be checkable was pointing at paths that are not there. Every quoted test path now names the file it names today, in both languages and in the GitHub mirror. Three sentences did not survive counting. The reference spread metrology over six sections, not seven. The taxonomy contract keeps its three deliberate cross-parent sections, so nothing "loses two exceptions": what collapses is five sections drawing from one package under four names. And section keys are subpackage names only where the taxonomy allows it, which the same docstring contradicts nineteen lines above, where the exceptions are listed. The narrowed metrology docstring omitted the IEC 61043 class check, a quarter of what the package still owns, and the README credited the Golay and swept-sine system measurement to signal when it lives in room. The curated API table only knew about the 3.2 deprecation generation; it now describes both, including the namespace reads, since the CHANGELOG was the only place a 3.x user could learn that metrology paths are deprecated too. The renderer tests stayed in tests/metrology after the renderers were split, so 21 of the 28 exercised another package's module; they follow the split now, one file per package. The correlation normalization label, which is a translation key reached through the result rather than written in the renderer, gets the test it never had, and dir() on the narrowed namespace gets one too. SonarCloud raised ten repeated-literal issues, nine in the files the split created, because axis labels that were written once per renderer now sit in three modules: they become module constants, keyed the same way in the translation table. The tenth is the sample-rate rejection message repeated by the three entry points of the weighting module. Also: the design and weighting module docstrings describe what those modules do rather than what their old names said, the filter-design test file follows its module, and the namespace shim takes the release it deprecates from instead of hardcoding it.
|
You've reached the fair usage limit for the Bito Code Review Agent trial. Upgrade to a paid plan or contact support@bito.in for assistance. Learn more |
The package holds both halves of the subject: it generates signals (the IEC 60268-1 tone bursts, the white, pink and brown noise, the resampler) and it analyses them (levels, spectra, coherence, correlation, cepstrum). The singular collided with the one module its own readers import next to it: 75 fenced blocks across 24 pages do `from scipy import signal`, and 14 more bind `signal` as a variable, so `from phonometry import signal` rebinds a name that is already taken and the snippet fails several lines later with an error that points nowhere near the import. The plural leaves that surface at one guide, which is fixed here by renaming its local variable. It also reads as what the package is: the sidebar has called this material "Signals and spectra" all along. `signal_analysis` was the alternative and it is wrong by exclusion, since it would deny the generators. That collision is worth a gate rather than a habit, because Python does not warn about it and the reader is the one who pays. scripts/check_doc_snippets.py runs every Python block the guides print: the blocks of a page are concatenated in reading order and executed, since a guide is a narrative and its later blocks use what the earlier ones bound. Two static checks run first and cost nothing: no name imported from phonometry may be rebound later on the page, by an assignment or by another import, and the Spanish page must import the same names as its English twin, so a translation cannot quietly teach a different API. Whole-token comparison was tried for that second check and is wrong: it fails on `plot(language="es")`, the one difference the pages are supposed to have. Twenty-five pages cannot run as a script and are listed with a reason each. Most are excerpts of a workflow that starts from a record the prose introduces. One is a defect the gate found rather than an excerpt: the multiple-shock guide prints `vibration.RISK_THRESHOLDS_MALE`, and the constant is real but the vibration namespace does not export it, so the fiche example cannot run as printed. It is left in the list, named, for the vibration work to fix. The list is checked for staleness in both directions: a page that starts running has to leave it. The gate has its own tests, one per defect it exists for, because a check that only ever passes proves nothing.
The guides render fiches, so the job needs requirements-reports as well as requirements-figures: without reportlab twenty-three pages fail on an import the reader would never hit.
Sonar wanted the composite assertion in the snippet-gate test split, and the one line Codecov reports as uncovered is a guard the public verifier cannot reach: it is marked as such, with the reason it is kept.
|
|
You've reached the fair usage limit for the Bito Code Review Agent trial. Upgrade to a paid plan or contact support@bito.in for assistance. Learn more |



What and why
phonometry.metrologyhad grown to 21 modules over four unrelated subjects, and every layer above it had already worked around that: the generated reference spread it over six sections, the sidebar over four groups, and the name predicted neithercepstrumnorsignals. The code was the only layer that had not split it.It becomes three packages:
phonometry.filters: the normalized frequency selectivity. Filter banks, frequency and time weightings, the RBJ equalizer, IEC 61260-1 and IEC 61672-1 class verification.phonometry.signals: the signals themselves and what is done to them. Levels, Welch and multitaper spectra, coherence, time-frequency, correlation, envelope, cepstrum, phase, synchronous averaging, and the test-signal generators (tone bursts, white/pink/brown noise, resampling).phonometry.metrology: what gives it its name. Calibration, GUM uncertainty, data qualification and the IEC 61043 intensity-instrument class check.Four modules drop a prefix their package now carries:
filter_designtofilters.design,parametric_filterstofilters.weighting,signalstosignal.test_signalsandrandom_datatometrology.data_qualification, the name its documentation page already had. The renderers follow the same cut, so_plot/metrology.pybecomes three modules with their own string tables, and the tests move with the modules.The generated reference is keyed by subpackage from here on. Its sections were a fourth naming of the same material, so a reader who knew where a function lived could not predict where its page lived; they are now
filters,signalsandmetrology, and the pages move with them: five sections drew frommetrologyunder four different names, three now draw from three packages under their own. The three sections that deliberately span two parents are untouched, and one of them is why the rule is not yet universal:metrology.intensity_complianceis still documented with the intensity chain it verifies, in thepowersection.Compatibility. The flat API is untouched:
from phonometry import leq, octave_filteris what it always was. Every pre-split module path still imports through a PEP 562 shim and delegates, and reading a moved name from the namespace it left (metrology.leqafterfrom phonometry import metrology) keeps working with the same rename notice, which module-path shims alone would not have covered and which is the form the documentation leads with. The 3.x aliases still resolve in one hop, retargeted to the modules' new homes. The new aliases go in 5.0, so the notice now names the release that removes it instead of assuming the next major. The one form a PEP 562 hook cannot serve isfrom phonometry.metrology import *, which now brings the narrowed API;dir()still lists the moved names so they do not vanish from tab completion a release early.Documentation snippets, the README, the PyPI long description and the landing page call through the package that now owns each function, and the guide cross-links follow the pages that moved.
Validation
No new computation: this moves code, it does not change any result. The full suite passes unchanged (7840 passed, 23 skipped) and the conformance report, the committed figures and the example fiches are all byte-for-byte identical to what is on
main, which is the evidence that nothing was recomputed.The compatibility surface is covered by new tests: a frozen snapshot of the 18 pre-split module paths, the release named in the notice, the namespace shim delegating and raising for unknown names, and the module-or-function ambiguity (
metrology.correlationresolves to the function, as the pre-split package did).Checklist
Ran locally, same as CI:
ruff check .mypy src scriptsbandit -r srcpytest -qRegenerated where this change touches them:
make conformance(no diff: 533/533 checks, 57 domains)make api-docs, with the reference tree andapi-sidebar.mjscommittedmake llms, withllms.txt,llms-full.txtand the shards committedmake graphspluscheck_figures.pyandcheck_figure_contrast.py(no diff: all 1692 figures match)make reportspluscheck_reports.py(no diff: all 67 fiches match)make pypi-readmeafter editingREADME.mdApplies to new API:
scripts/api_taxonomy.pydocs/api-reference.mdcovers every__all__name.plot()renderers split alongside their packages undersrc/phonometry/_plot/.github/labeler.ymlAlways:
[Unreleased]Also run: the site builds clean with the link validator green (it caught the guide cross-links to the moved API pages, which is what closed them),
check:math,html-validate, and every fenced snippet that calls through one of the three packages was executed against this branch and againstmain, with an identical pass and failure set.Summary by Sourcery
Split the monolithic metrology API into dedicated filters and signal subpackages while preserving the flat top-level interface and adding compatibility shims for pre-4.0 module and namespace access.
New Features:
Enhancements:
CI:
Documentation:
Tests:
Chores:
Review notes
Two rounds of adversarial review ran on this branch. What they changed is in the follow-up commits; two of their findings were rejected and are worth stating:
redirectsmap inastro.config.mjsdoes not grow with the taxonomy work. The safety net isstarlight-links-validator, which is what caught the guide cross-links this branch had to fix.verify_aircraft_noise_systemsitting infilters.compliance. It verifies an IEC 61265 aircraft-noise measurement system, not a filter, so the narrower package name does expose an old inconsistency. Moving a public function between modules is a different decision from moving modules, and it is not what this change is about.The package is plural because it holds both halves of the subject, the generators and the analysis, and because the singular collided with
scipy.signal: 75 fenced blocks import it and 14 more bindsignalas a variable, sofrom phonometry import signalrebinds a name that is already taken and fails several lines later.scripts/check_doc_snippets.pynow runs every snippet the guides print and rejects that shadowing statically, in both languages, with its own tests.Also known and deliberate:
from phonometry.metrology import *now brings the narrowed API rather than the pre-split re-export surface, because a PEP 562 hook cannot serve a star import. Every explicit form keeps working anddir()still lists the moved names.