Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/jmrplens/phonometry. Standards-conformant acoustics library for Python: measurement and metrology, docs.jmrp.io/phonometry
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016# Copyright (c) 2026. Jose Manuel Requena Plens"""Taxonomy for the generated API reference (scripts/generate_api_docs.py).
Maps every public phonometry module to a documentation section. Sectionsbecome directories under ``site/src/content/docs/reference/api/<section>/``and collapsed subgroups in the site sidebar; their order here is the displayorder on the index page and in the sidebar.
Modules are keyed by their full dotted name (``phonometry.<subpackage>.<mod>``)so the mapping is unambiguous after the subpackage modularization. The bare``"phonometry"`` entry is the package top level: the handful of names thatlive in ``phonometry/__init__.py`` itself (``__version__`` and:class:`PhonometryWarning`).
Consistency is enforced at import time (fails loudly):
- every module appears in exactly one section;- each section only contains modules from the subpackages declared for it in ``_SECTION_SUBPACKAGES``. One section deliberately spans more than one parent: ``filters`` adds the package top level (``phonometry`` itself).
Section keys are subpackage names wherever the taxonomy allows it, so areader who knows where a function lives in the code can predict where itspage lives. The section listed above is the exception, and it isdeliberate.
A mapped module may be private. A module that a function of its package names(``signals/correlation.py`` beside ``signals.correlation()``) is private, sothat the package attribute and the module never compete for one address; itsnames are published by the package, and its page keeps its URL and takes thetitle :data:`PRIVATE_MODULE_TOPICS` gives it.
The generator additionally checks the taxonomy against reality: every modulethat owns a public name must be mapped here, and every mapped module muststill exist (see ``scripts/generate_api_docs.py``)."""
from __future__ import annotations
import dataclassesimport inspectfrom typing import TYPE_CHECKING
if TYPE_CHECKING: from types import ModuleType
@dataclasses.dataclass(frozen=True)class Section: """One API-reference section (a sidebar subgroup and URL directory)."""
key: str label_en: str label_es: str modules: tuple[str, ...]
_SECTION_LIST: tuple[Section, ...] = ( Section( key="filters", label_en="Filters and frequencies", label_es="Filtros y frecuencias", modules=( "phonometry", "phonometry.filters.core", "phonometry.filters.weighting", "phonometry.filters.equalizer", "phonometry.filters.frequencies", "phonometry.filters.compliance", "phonometry.filters.time_invariance", "phonometry.filters.periodic_tests", "phonometry.filters.weighting_compliance", ), ), Section( key="signals", label_en="Signal analysis", label_es="Análisis de señal", modules=( "phonometry.signals.levels", "phonometry.signals.spectra", "phonometry.signals.multitaper", "phonometry.signals.windows", "phonometry.signals.miso", "phonometry.signals.time_frequency", "phonometry.signals._test_signals", "phonometry.signals.phase", "phonometry.signals._cepstrum", "phonometry.signals.synchronous_average", "phonometry.signals.inversion", "phonometry.signals._correlation", "phonometry.signals._envelope", ), ), Section( key="metrology", label_en="Calibration and uncertainty", label_es="Calibración e incertidumbre", modules=( "phonometry.metrology.calibration", "phonometry.metrology.sound_calibrator", "phonometry.metrology.conformance", "phonometry.metrology.uncertainty", "phonometry.metrology.data_qualification", "phonometry.metrology.reference_values", "phonometry.metrology.random_incidence", "phonometry.metrology.free_field_corrections", "phonometry.metrology.sound_level_meter", "phonometry.metrology.comparison_calibration", "phonometry.metrology.reciprocity_calibration", "phonometry.metrology.reciprocity_coupler", "phonometry.metrology.reciprocity_free_field", ), ), Section( key="fluids", label_en="Fluids", label_es="Fluidos", modules=( "phonometry.fluids", "phonometry.fluids._air", "phonometry.fluids.gas", "phonometry.fluids.water", "phonometry.fluids.catalogue", "phonometry.fluids.nonlinearity", ), ), Section( key="solids", label_en="Elastic solids", label_es="Sólidos elásticos", # The relations live in ``elastic`` and the published rows in # ``catalogue``; the ``__init__`` only re-exports, so it holds no # public name of its own. modules=( "phonometry.solids.elastic", "phonometry.solids.catalogue", "phonometry.solids.damping", "phonometry.solids.damping_treatments", "phonometry.solids.nonlinearity", "phonometry.solids.orthotropic_wood", "phonometry.solids.plateau", ), ), Section( key="io", label_en="Files", label_es="Archivos", # The whole public surface of the subpackage lives in its # ``__init__`` (the implementation modules are private), so the one # documented module is the package itself. modules=("phonometry.io",), ), Section( key="psychoacoustics", label_en="Psychoacoustics", label_es="Psicoacústica", modules=( "phonometry.psychoacoustics.loudness.zwicker", "phonometry.psychoacoustics.loudness.moore_glasberg", "phonometry.psychoacoustics.loudness.moore_glasberg_time", "phonometry.psychoacoustics.loudness.ecma", "phonometry.psychoacoustics.loudness.contours", "phonometry.psychoacoustics.quality.sharpness", "phonometry.psychoacoustics.quality._roughness_ecma", "phonometry.psychoacoustics.quality.tonality", "phonometry.psychoacoustics.quality._tonality_ecma", "phonometry.psychoacoustics.quality._tone_audibility", "phonometry.psychoacoustics.quality._fluctuation_strength", "phonometry.psychoacoustics.quality._fluctuation_strength_ecma", "phonometry.psychoacoustics.quality.annoyance", "phonometry.psychoacoustics.erb_scale", ), ), Section( key="speech", label_en="Speech", label_es="Habla", modules=( "phonometry.speech.sti", "phonometry.speech.sii", "phonometry.speech.objective_intelligibility", ), ), Section( key="hearing", label_en="Hearing and exposure", label_es="Audición y exposición", modules=( "phonometry.hearing.threshold", "phonometry.hearing.audiometry", "phonometry.hearing.sound_field_audiometry", "phonometry.hearing.noise_induced_hearing_loss", "phonometry.hearing.occupational_exposure", "phonometry.hearing._real_ear_attenuation", "phonometry.hearing.hearing_protectors", "phonometry.hearing.active_noise_reduction", "phonometry.hearing._earmuff_insertion_loss", ), ), Section( key="rooms", label_en="Room acoustics", label_es="Acústica de salas", modules=( "phonometry.room.acoustics", "phonometry.room.auditorium", "phonometry.room._impulse_response", "phonometry.room.noise_criteria", "phonometry.room.open_plan", "phonometry.room.reverberation_prediction", "phonometry.room.enclosed_space_absorption", "phonometry.room.image_source", "phonometry.room.steady_field", "phonometry.room.modes", "phonometry.room._crowd_noise", "phonometry.room.spatial_decay", "phonometry.room.workroom_prediction", ), ), Section( key="building", label_en="Building acoustics", label_es="Acústica de la edificación", modules=( "phonometry.building.measurement.insulation", "phonometry.building.measurement.low_frequency", "phonometry.building.measurement.ratings", "phonometry.building.catalogue", "phonometry.building.impact_catalogue", "phonometry.building.datasheets", "phonometry.building.prediction.panel_transmission", "phonometry.building.prediction.masonry_cavity_wall", "phonometry.building.measurement.heavy_impact", "phonometry.building.prediction.ceiling_plenum", "phonometry.building.prediction.aperture_transmission", "phonometry.building.measurement.laboratory_insulation", "phonometry.building.measurement.laboratory_improvement", "phonometry.building.measurement.joint_insulation", "phonometry.building.measurement._rainfall_sound", "phonometry.building.measurement.survey_insulation", "phonometry.building.measurement.service_equipment", "phonometry.building.measurement.intensity_insulation", "phonometry.building.measurement.flanking_transmission", "phonometry.building.prediction.facade", "phonometry.building.prediction.simplified_model", "phonometry.building.prediction.detailed_model", "phonometry.building.measurement.uncertainty", "phonometry.building.measurement.floor_covering_improvement", "phonometry.building.prediction.resilient_layers", "phonometry.building.prediction.linings", "phonometry.building.measurement.structure_borne_power", "phonometry.building.prediction.installed_structure_borne", "phonometry.building.regulation.spain", ), ), Section( key="materials", label_en="Materials and surfaces", label_es="Materiales y superficies", modules=( "phonometry.materials.absorbers.sound_absorption", "phonometry.materials.absorbers.rating", "phonometry.materials.absorbers.uncertainty", "phonometry.materials.absorbers._airflow_resistance", "phonometry.materials.resilient.dynamic_stiffness", "phonometry.materials.resilient.moduli", "phonometry.materials.absorbers.impedance_tube", "phonometry.materials.absorbers.four_microphone", "phonometry.materials.absorbers.standing_wave", "phonometry.materials.absorbers.porous", "phonometry.materials.absorbers.catalogue", "phonometry.materials.absorbers.resistive_sheets", "phonometry.materials.absorbers.measured", "phonometry.materials.absorbers.datasheets", "phonometry.materials.absorbers.carpets", "phonometry.materials.absorbers.layered", "phonometry.materials.absorbers.biot", "phonometry.materials.absorbers.slow_sound", "phonometry.materials.absorbers.suspended_ceilings", "phonometry.materials.diffusers.scattering_diffusion", "phonometry.materials.diffusers.reverberation_room_scattering", "phonometry.materials.diffusers.design", "phonometry.materials.diffusers.metadiffuser", "phonometry.materials.diffusers.measured_scattering", "phonometry.materials.diffusers.predicted_diffusion", "phonometry.materials.diffusers.predicted_scattering", "phonometry.materials.surfaces.road_absorption", ), ), Section( key="vibration", label_en="Vibration and structure-borne sound", label_es="Vibración y ruido estructural", modules=( "phonometry.vibration.structural.mechanical_mobility", "phonometry.vibration.structural.point_mobility", "phonometry.vibration.structural._impact_mobility", "phonometry.vibration.structural._radiation_efficiency", "phonometry.vibration.structural._junction_transmission", "phonometry.vibration.structural.experimental_sea", "phonometry.vibration.machinery.diagnostics", "phonometry.vibration.machinery.evaluation", "phonometry.vibration.structural.transfer_stiffness", "phonometry.vibration.structural.building_damage", "phonometry.vibration.structural.building_response", "phonometry.vibration.human.exposure", "phonometry.vibration.human.multiple_shock", "phonometry.vibration.human.seat_vibration", "phonometry.vibration.human.instrumentation", "phonometry.vibration.human.signal_burst", "phonometry.vibration.immission.vibration_meter", "phonometry.vibration.immission.railway", "phonometry.vibration.immission.ground", "phonometry.vibration.immission.coupling", "phonometry.vibration.immission.people", "phonometry.vibration.immission.train_categories", "phonometry.vibration.immission.railway_prediction", "phonometry.vibration.immission.prediction", ), ), Section( key="environment", label_en="Environmental acoustics", label_es="Acústica ambiental", modules=( "phonometry.environment.propagation.outdoor_propagation", "phonometry.environment.sources.cnossos_road", "phonometry.environment.sources._statistical_pass_by", "phonometry.environment.propagation.ground_barriers", "phonometry.environment.propagation.ground_surfaces", "phonometry.environment.propagation.noise_reducing_devices", "phonometry.environment.propagation.barrier_in_situ", "phonometry.environment.propagation.barrier_reflection", "phonometry.environment.propagation.software_quality", "phonometry.environment.propagation.refraction", "phonometry.environment.propagation.air_absorption", "phonometry.environment.sources.cnossos_rail", "phonometry.environment.sources.rolling_stock_noise", "phonometry.environment.sources.acoustic_roughness", "phonometry.environment.sources.track_decay", "phonometry.environment.assessment.impulsive_sound", "phonometry.environment.assessment.exposure_distribution", "phonometry.environment.assessment.rating", "phonometry.environment.sources.wind_turbine", "phonometry.environment.assessment.wind_turbine_receptor", "phonometry.environment.assessment.wind_turbine_modulation", "phonometry.environment.assessment.measurement", "phonometry.environment.assessment.spain", "phonometry.environment.assessment.soundscape", "phonometry.environment.assessment.soundscape_binaural", ), ), Section( key="aeroacoustics", label_en="Aircraft noise", label_es="Ruido de aeronaves", modules=( "phonometry.aircraft.certification", "phonometry.aircraft.atmospheric_absorption", "phonometry.aircraft.airport_noise", "phonometry.aircraft.anp_fleet", "phonometry.aircraft.npd_atmosphere", "phonometry.aircraft.flight_performance", "phonometry.aircraft.rotorcraft_noise", "phonometry.aircraft.rotorcraft_propagation", "phonometry.aircraft.measurement_system", ), ), Section( key="underwater", label_en="Underwater acoustics", label_es="Acústica submarina", modules=( "phonometry.underwater.acoustics", "phonometry.underwater.propagation.closed_form", "phonometry.underwater.propagation.weston_regimes", "phonometry.underwater.propagation.sound_speed", "phonometry.underwater.sonar_equation", "phonometry.underwater.sources.ambient_noise", "phonometry.underwater.propagation._seabed_reflection", "phonometry.underwater.sources.ship_radiated_noise", "phonometry.underwater.sources.ship_traffic_noise", "phonometry.underwater.sources.pile_driving_noise", "phonometry.underwater.bioacoustics.audiograms", "phonometry.underwater.bioacoustics.weighting", "phonometry.underwater.propagation.numerical", ), ), Section( key="power", label_en="Sound power and intensity", label_es="Potencia acústica e intensidad", modules=( "phonometry.emission.sound_power", "phonometry.emission._sound_power_anechoic", "phonometry.emission.free_field_qualification", "phonometry.emission.reference_sound_source", "phonometry.emission._sound_power_intensity", "phonometry.emission._sound_power_intensity_points", "phonometry.emission._sound_power_reverberation", "phonometry.emission._sound_power_in_situ", "phonometry.emission._sound_power_hard_walled", "phonometry.emission._sound_power_special_room", "phonometry.emission._sound_power_in_duct", "phonometry.emission.sound_power_plant", "phonometry.emission.sound_power_high_frequency", "phonometry.emission.turbine_noise", "phonometry.emission.intensity", "phonometry.emission.intensity_compliance", "phonometry.emission.vibration_sound_power", "phonometry.emission.workstation", "phonometry.emission.declaration", ), ), Section( key="electroacoustics", label_en="Electroacoustics", label_es="Electroacústica", modules=( "phonometry.electroacoustics.distortion", "phonometry.electroacoustics.intermodulation", "phonometry.electroacoustics.noise_measurements", "phonometry.electroacoustics.frequency_response", "phonometry.electroacoustics.swept_sine", "phonometry.electroacoustics.piston", "phonometry.electroacoustics.loudspeaker", "phonometry.electroacoustics.microphone", "phonometry.electroacoustics.sound_reinforcement", "phonometry.electroacoustics.induction_loop", "phonometry.electroacoustics.induction_loop_components", "phonometry.electroacoustics.program_signal", "phonometry.electroacoustics.headphones", ), ), Section( key="noise_control", label_en="Industrial noise control", label_es="Control de ruido industrial", modules=( "phonometry.noise_control.silencers", "phonometry.noise_control.silencer_measurement", "phonometry.noise_control.hvac", "phonometry.noise_control._duct_path", "phonometry.noise_control.duct_modes", "phonometry.noise_control.duct_walls", "phonometry.noise_control.enclosures", "phonometry.noise_control.enclosure_insulation", "phonometry.noise_control._cabin_insulation", "phonometry.noise_control.silencer_in_situ", "phonometry.noise_control.screen_in_situ", "phonometry.noise_control.room_to_room", "phonometry.noise_control.valves", "phonometry.noise_control.valves_hydrodynamic", ), ), Section( key="broadcast", label_en="Broadcast metering", label_es="Medición en radiodifusión", modules=( "phonometry.broadcast._program_loudness", "phonometry.broadcast.quasi_peak", ), ), Section( key="simulation", label_en="Wave simulation", label_es="Simulación de ondas", modules=( "phonometry.simulation.fdtd", "phonometry.simulation.ntff", "phonometry.simulation.elastic_fdtd", "phonometry.simulation.compute", "phonometry.simulation.video", ), ),)
#: Sections in display order, keyed by section key.SECTIONS: dict[str, Section] = {s.key: s for s in _SECTION_LIST}
#: Parent subpackages allowed per section (the hard consistency contract).#: ``""`` is the package top level (``phonometry/__init__.py``). Sections#: spanning more than one parent are deliberate and documented in the module#: docstring above._SECTION_SUBPACKAGES: dict[str, tuple[str, ...]] = { "filters": ("", "filters"), # ``phonometry.io`` is documented as the package itself (two dotted # parts), which the parent derivation reports as the top level. "fluids": ("", "fluids"), "solids": ("solids",), "io": ("",), "signals": ("signals",), "psychoacoustics": ("psychoacoustics",), "speech": ("speech",), "hearing": ("hearing",), "rooms": ("room",), "building": ("building",), "materials": ("materials",), "vibration": ("vibration",), "environment": ("environment",), "aeroacoustics": ("aircraft",), "underwater": ("underwater",), "power": ("emission",), "electroacoustics": ("electroacoustics",), "noise_control": ("noise_control",), "broadcast": ("broadcast",), "metrology": ("metrology",), "simulation": ("simulation",),}
#: Public names whose home module cannot be derived from ``__module__``:#: objects defined in private modules but exported publicly, module-level#: constants without ``__module__``, and constants re-exported by more than#: one public module. Maps public name -> full module key in the taxonomy.OBJECT_MODULE_OVERRIDES: dict[str, str] = { # Defined in phonometry/__init__.py (reported as module "phonometry"). "__version__": "phonometry", # The 24 noy bands are the certification module's; the SAE ARP 866A, ANP # spectral-class and Doc 29 Appendix D modules import them to name the # same 50 Hz to 10 kHz bands. "NOY_BANDS_HZ": "phonometry.aircraft.certification", # The filter bank's warning is emitted by the bank and by the band-centre # calculation the bank imports, so it is defined in the private # phonometry/filters/_warnings.py that both can import, and documented with # the bank. "FilterBankWarning": "phonometry.filters.core", # The fluid state type and its diagnostics are defined in the private # phonometry/fluids/_state.py and published by the package, which is where # they are documented. "Fluid": "phonometry.fluids", "FluidAssumptionWarning": "phonometry.fluids", "FluidPropertyUnavailableError": "phonometry.fluids", "FluidWarning": "phonometry.fluids", "characteristic_impedance": "phonometry.fluids", # A Fluid instance reports its class's module, so the published air of # the Johnson-Champoux-Allard model is credited to fluids unless said # otherwise. It belongs to the model that publishes those constants. "ABSORBER_AIR": "phonometry.materials.absorbers.porous", "ANNEX_A_AIR": "phonometry.materials.absorbers._airflow_resistance", "EN12354_AIR": "phonometry.building.prediction.detailed_model", "SIMULATION_AIR": "phonometry.simulation.ntff", # The same holds for an uncertainty budget: the ISO 4869-6 one is an # instance of the ISO 4869-1 budget type and belongs to the standard that # prints it. "ANR_WITHIN_LABORATORY_UNCERTAINTY": "phonometry.hearing.active_noise_reduction", # The three assumed conditions are owned by the air model and re-exported # by the package, so a plain scan sees them in both. "DEFAULT_CO2_MOLE_FRACTION": "phonometry.fluids._air", "DEFAULT_RELATIVE_HUMIDITY_PERCENT": "phonometry.fluids._air", "DEFAULT_STATIC_PRESSURE_PA": "phonometry.fluids._air", # The speed of sound the critical-frequency columns are printed for is # owned by the module that uses it and re-exported by the package, the # same shape as the three above. "DEFAULT_SPEED_OF_SOUND_M_S": "phonometry.solids.elastic", # The two decay-rate directions are owned by EN 15461 and imported by the # ISO 3095 module, which judges the rates in both of them. "TRACK_DECAY_DIRECTIONS": "phonometry.environment.sources.track_decay", # The published catalogue is a mapping, so a plain scan sees it in the # module that builds it and in the package that re-exports it. "PUBLISHED_DAMPING": "phonometry.solids.damping", "PUBLISHED_DAMPING_TREATMENTS": "phonometry.solids.damping_treatments", "PUBLISHED_SOLID_NONLINEARITY": "phonometry.solids.nonlinearity", "PUBLISHED_RESILIENT_MODULI": "phonometry.materials.resilient.moduli", "PUBLISHED_CARPETS": "phonometry.materials.absorbers.carpets", "PUBLISHED_ORTHOTROPIC_WOOD": "phonometry.solids.orthotropic_wood", "PUBLISHED_PLATEAU_DATA": "phonometry.solids.plateau", "PUBLISHED_DUCT_TRANSMISSION_LOSS": "phonometry.noise_control.duct_walls", "DUCT_WALL_BANDS_HZ": "phonometry.noise_control.duct_walls", "PUBLISHED_SOLIDS": "phonometry.solids.catalogue", "PUBLISHED_GROUND_SURFACES": "phonometry.environment.propagation.ground_surfaces", "PUBLISHED_POROUS_MATERIALS": "phonometry.materials.absorbers.catalogue", "PUBLISHED_RESISTIVE_SHEETS": "phonometry.materials.absorbers.resistive_sheets", "PUBLISHED_ABSORPTION": "phonometry.materials.absorbers.measured", "PUBLISHED_TRANSMISSION_LOSS": "phonometry.building.catalogue", "TRANSMISSION_LOSS_BANDS_HZ": "phonometry.building.catalogue", "TransmissionLossSpectrum": "phonometry.building.catalogue", "transmission_loss_named": "phonometry.building.catalogue", "PUBLISHED_IMPACT_INSULATION": "phonometry.building.impact_catalogue", "PUBLISHED_SCATTERING": "phonometry.materials.diffusers.measured_scattering", "SCATTERING_BANDS_HZ": "phonometry.materials.diffusers.measured_scattering", "ScatteringCoefficientSpectrum": "phonometry.materials.diffusers.measured_scattering", "scattering_named": "phonometry.materials.diffusers.measured_scattering", "PUBLISHED_DIFFUSION": "phonometry.materials.diffusers.predicted_diffusion", "DIFFUSION_BANDS_HZ": "phonometry.materials.diffusers.predicted_diffusion", "NormalizedDiffusionSpectrum": "phonometry.materials.diffusers.predicted_diffusion", "diffusion_named": "phonometry.materials.diffusers.predicted_diffusion", "PUBLISHED_PREDICTED_SCATTERING": "phonometry.materials.diffusers.predicted_scattering", "PredictedScatteringSpectrum": "phonometry.materials.diffusers.predicted_scattering", "predicted_scattering_named": "phonometry.materials.diffusers.predicted_scattering", "PUBLISHED_ABSORPTION_AREAS": "phonometry.materials.absorbers.measured", # The ISO 11654 band sets the data-sheet rows rate over are imported into # phonometry/materials/absorbers/datasheets.py; they are defined, and # documented, beside the rating. "RATING_OCTAVE_BANDS_HZ": "phonometry.materials.absorbers.rating", "RATING_THIRD_OCTAVE_BANDS_HZ": "phonometry.materials.absorbers.rating", "PUBLISHED_FLUIDS": "phonometry.fluids.catalogue", "PUBLISHED_GASES": "phonometry.fluids.catalogue", "PUBLISHED_NONLINEARITY": "phonometry.fluids.nonlinearity", "Gas": "phonometry.fluids.catalogue", "gases_named": "phonometry.fluids.catalogue", # The ideal-gas closure and its two published constants are owned by the # module that computes with them and re-exported by the package. "IDEAL_GAS_VALIDITY": "phonometry.fluids.gas", "MOLAR_GAS_CONSTANT_J_MOL_K": "phonometry.fluids.gas", "ideal_gas": "phonometry.fluids.gas", # The band ranges, the leak ratio and the seal ratio are printed in the # same words by ISO 11546 and ISO 11957, so they are defined once, in the # private noise_control._insulation_shared, and published by the module of # the older document, the enclosure. The cabin module uses the band range # too, so a plain scan sees it in both. "MANDATORY_BAND_RANGE_HZ": "phonometry.noise_control.enclosure_insulation", "PREFERRED_BAND_RANGE_HZ": "phonometry.noise_control.enclosure_insulation", "leak_ratio": "phonometry.noise_control.enclosure_insulation", "seal_ratio": "phonometry.noise_control.enclosure_insulation", # The two sound speeds and the jet diameter are owned by the aerodynamic # valve module and imported by the hydrodynamic one, which IEC 60534-8-4 # sends to IEC 60534-8-3 for all three, so a plain scan sees them twice. "AIR_SPEED_OF_SOUND_M_S": "phonometry.noise_control.valves", "PIPE_SPEED_OF_SOUND_M_S": "phonometry.noise_control.valves", "jet_diameter_m": "phonometry.noise_control.valves", # The running r.m.s. time constant is owned by the DIN 45669-1 meter and # imported by the DIN 45672-2 evaluation, whose Formula (1) is the same # integral with the same "Fast", so a plain scan sees it in both. "KB_TIME_CONSTANT_S": "phonometry.vibration.immission.vibration_meter", # The KB corner and the clock interval are the meter's, and the DIN 4150-2 # assessment imports them for Formula (6) and the interval count N_r. "KB_CORNER_HZ": "phonometry.vibration.immission.vibration_meter", "TAKT_DURATION_S": "phonometry.vibration.immission.vibration_meter", "TAKT_SUPPRESSION_THRESHOLD": "phonometry.vibration.immission.vibration_meter", # The draft railway assessment and the draft prediction share names # with the people module, the meter and the Part 2 evaluation. "ASSESSMENT_TAKT_COUNT": "phonometry.vibration.immission.people", "GUIDE_VALUES": "phonometry.vibration.immission.people", "GUIDE_VALUES_2023": "phonometry.vibration.immission.people", "GuideValues": "phonometry.vibration.immission.people", "TRAIN_KB_FMAX_FACTOR": "phonometry.vibration.immission.train_categories", "VELOCITY_LEVEL_REFERENCE_MM_S": "phonometry.vibration.immission.railway", "band_sum_level": "phonometry.vibration.immission.railway", # The ERB_N / Cam constants are owned by erb_scale and imported by the # ISO 532-2 loudness model, so a plain scan sees them in both modules. "ERB_C1_HZ": "phonometry.psychoacoustics.erb_scale", "ERB_C2_PER_HZ": "phonometry.psychoacoustics.erb_scale", "CAM_C": "phonometry.psychoacoustics.erb_scale", # The tapping-machine hammer mass is owned by resilient_layers and imported # by installed_structure_borne, where EN 12354-5 clause D.1.3 uses the same # 0,5 kg as the source mass of Formula (D.9b), so a plain scan sees it in # both modules. "TAPPING_HAMMER_MASS_KG": "phonometry.building.prediction.resilient_layers", # The ISO 20816-1 tables and factors are plain containers, so a scan # by module finds no owner for them; they belong to the evaluation # module that publishes them. "TYPICAL_BOUNDARY_LADDER_MM_S": "phonometry.vibration.machinery.evaluation", "TYPICAL_ZONE_BOUNDARY_RANGES_MM_S": "phonometry.vibration.machinery.evaluation", "ZONE_LIMIT_FACTORS": "phonometry.vibration.machinery.evaluation", # Likewise the ISO 10816-3 tables and the two fractions its operational # limits are built from. "INDUSTRIAL_MACHINE_ZONES": "phonometry.vibration.machinery.evaluation", "SIGNIFICANT_CHANGE_FRACTION": "phonometry.vibration.machinery.evaluation", "OPERATIONAL_LIMIT_HEADROOM": "phonometry.vibration.machinery.evaluation", # And the ISO 20816-9 rating tables, curve corners and slopes. "GEAR_UNIT_ZONES": "phonometry.vibration.machinery.evaluation", "GEAR_UNIT_CLASSES": "phonometry.vibration.machinery.evaluation", "GEAR_ACCEPTANCE_HEADROOM": "phonometry.vibration.machinery.evaluation", "GEAR_DISPLACEMENT_CORNER_HZ": "phonometry.vibration.machinery.evaluation", "GEAR_DISPLACEMENT_SLOPE_DB_PER_DECADE": "phonometry.vibration.machinery.evaluation", "GEAR_VELOCITY_CORNERS_HZ": "phonometry.vibration.machinery.evaluation", "GEAR_VELOCITY_SLOPE_DB_PER_DECADE": "phonometry.vibration.machinery.evaluation", # The nine weighting names are owned by the exposure module and imported # by the instrumentation one, which grades a meter against those same # nine, so a plain scan sees them in both. "WEIGHTING_NAMES": "phonometry.vibration.human.exposure", # The ISO 8041-1 tolerance tables are plain containers too, so a scan by # module finds no owner; they belong to the instrumentation module that # publishes them. "TRANSITION_FREQUENCIES_HZ": "phonometry.vibration.human.instrumentation", "CENTRAL_TOLERANCE_PERCENT": "phonometry.vibration.human.instrumentation", "SKIRT_TOLERANCE_PERCENT": "phonometry.vibration.human.instrumentation", "TAIL_TOLERANCE_PERCENT": "phonometry.vibration.human.instrumentation", "REFERENCE_FREQUENCY_HZ": "phonometry.vibration.human.instrumentation", "REFERENCE_ACCELERATION_M_S2": "phonometry.vibration.human.instrumentation", # The ISO 1683 table is a mapping, so a scan by module finds no owner for # it; it belongs to the module that publishes it, which is where every # private reference value in the package points. "REFERENCE_VALUES": "phonometry.metrology.reference_values", # The IEC 60942:2017 tables are tuples and read-only mappings, so a scan # by module finds no owner; they belong to the module that grades a # calibrator against them. "ABBREVIATED_FREQUENCY_ACCEPTANCE_LIMITS_PERCENT": "phonometry.metrology.sound_calibrator", "ABBREVIATED_LEVEL_REDUCTIONS": "phonometry.metrology.sound_calibrator", "CALIBRATOR_CLASSES": "phonometry.metrology.sound_calibrator", "CALIBRATOR_REQUIREMENTS": "phonometry.metrology.sound_calibrator", "DISTORTION_ACCEPTANCE_LIMITS_PERCENT": "phonometry.metrology.sound_calibrator", "DISTORTION_MAX_UNCERTAINTY_PERCENT": "phonometry.metrology.sound_calibrator", "ENVIRONMENTAL_FREQUENCY_ACCEPTANCE_LIMITS_PERCENT": "phonometry.metrology.sound_calibrator", "ENVIRONMENTAL_FREQUENCY_MAX_UNCERTAINTY_PERCENT": "phonometry.metrology.sound_calibrator", "ENVIRONMENTAL_LEVEL_ACCEPTANCE_LIMITS_DB": "phonometry.metrology.sound_calibrator", "ENVIRONMENTAL_LEVEL_MAX_UNCERTAINTY_DB": "phonometry.metrology.sound_calibrator", "FIELD_IMMUNITY_ACCEPTANCE_LIMITS_DB": "phonometry.metrology.sound_calibrator", "FIELD_IMMUNITY_MAX_UNCERTAINTY_DB": "phonometry.metrology.sound_calibrator", "FLUCTUATION_ACCEPTANCE_LIMITS_DB": "phonometry.metrology.sound_calibrator", "FLUCTUATION_MAX_UNCERTAINTY_DB": "phonometry.metrology.sound_calibrator", "FREQUENCY_ACCEPTANCE_LIMITS_PERCENT": "phonometry.metrology.sound_calibrator", "FREQUENCY_MAX_UNCERTAINTY_PERCENT": "phonometry.metrology.sound_calibrator", "LEVEL_ACCEPTANCE_LIMITS_DB": "phonometry.metrology.sound_calibrator", "LEVEL_MAX_UNCERTAINTY_DB": "phonometry.metrology.sound_calibrator", "SUPPLY_VOLTAGE_ACCEPTANCE_LIMITS_DB": "phonometry.metrology.sound_calibrator", "SUPPLY_VOLTAGE_MAX_UNCERTAINTY_DB": "phonometry.metrology.sound_calibrator", # IEC 61183 Table B.1 is a mapping as well, owned by the module whose # diffuse-field routes read their defaults from it. "IEC61183_TABLE_B1": "phonometry.metrology.random_incidence", # The IEC 61260-3:2016 Table 1 limits are a read-only mapping, so a scan # by module finds no owner; they belong to the periodic tests they grade. "PERIODIC_TEST_ATTENUATION_LIMITS_DB": "phonometry.filters.periodic_tests", # IEC 62585 Table I.1 likewise, owned by the module whose budget builder # reads its divisors. "IEC62585_TABLE_I1": "phonometry.metrology.free_field_corrections", # The IEC 61672-1:2013 tables and the IEC 61672-3:2013 test plan are # tuples and read-only mappings too, owned by the module that grades a # sound level meter's periodic tests against them. "ACOUSTIC_TEST_FREQUENCIES_HZ": "phonometry.metrology.sound_level_meter", "ELECTRICAL_TEST_FREQUENCIES_HZ": "phonometry.metrology.sound_level_meter", "IEC61672_TABLE_4": "phonometry.metrology.sound_level_meter", "IEC61672_TABLE_5": "phonometry.metrology.sound_level_meter", "IEC61672_TABLE_B1": "phonometry.metrology.sound_level_meter", "PERIODIC_TEST_ENVIRONMENT": "phonometry.metrology.sound_level_meter", "SLM_PERIODIC_REQUIREMENTS": "phonometry.metrology.sound_level_meter", "TONEBURST_TEST_DURATIONS_MS": "phonometry.metrology.sound_level_meter", # The IEC 61094-5 and IEC 61094-8 tables of the comparison calibration are # read-only mappings too, owned by the module whose functions read them. "IEC61094_5_TABLE_A1": "phonometry.metrology.comparison_calibration", "IEC61094_5_TABLE_D1": "phonometry.metrology.comparison_calibration", "IEC61094_8_TABLE_1": "phonometry.metrology.comparison_calibration", "IEC61094_8_TABLE_2": "phonometry.metrology.comparison_calibration", # So are the tables of the reciprocity calibration: Table 1 of both parts # with the budget that reads it, the coupler tables of IEC 61094-2 Annex C # with the coupler physics. "IEC61094_2_TABLE_1": "phonometry.metrology.reciprocity_calibration", "IEC61094_3_TABLE_1": "phonometry.metrology.reciprocity_calibration", "IEC61094_2_TABLE_C1": "phonometry.metrology.reciprocity_coupler", "IEC61094_2_TABLE_C2": "phonometry.metrology.reciprocity_coupler", "IEC61094_2_TABLE_C3": "phonometry.metrology.reciprocity_coupler", # Defined in phonometry._internal.warnings, exported at the top level. "PhonometryWarning": "phonometry", # The io subpackage keeps its implementation modules private and # re-exports everything from phonometry/io/__init__.py, so every one of # its public names reports a private ``__module__`` and is documented # with the package itself. "AudioFileInfo": "phonometry.io", "BroadcastMetadata": "phonometry.io", "CalibrationSidecar": "phonometry.io", "ClippingWarning": "phonometry.io", "CuePoint": "phonometry.io", "LossyCompressionWarning": "phonometry.io", "Signal": "phonometry.io", "SignalOrigin": "phonometry.io", "convert": "phonometry.io", "info": "phonometry.io", "read": "phonometry.io", "read_blocks": "phonometry.io", "read_sidecar": "phonometry.io", "sidecar_path": "phonometry.io", "write": "phonometry.io", "write_sidecar": "phonometry.io", "write_video": "phonometry.io", "VideoOptions": "phonometry.io", "FFmpegNotFoundError": "phonometry.io", "VideoEncoderError": "phonometry.io", # The catalogue row types are defined in phonometry._internal.catalogue, # because the domain packages whose tables hand out rows import them and # io importing a domain would close a cycle; io publishes them, as it # publishes Signal, and they are documented there. "CATALOGUE_BASES": "phonometry.io", "PROVENANCE_KINDS": "phonometry.io", "BandedRow": "phonometry.io", "CatalogueError": "phonometry.io", "CatalogueIssue": "phonometry.io", "CatalogueRow": "phonometry.io", "Provenance": "phonometry.io", # The reader and the writer of a caller's catalogue file, private like # the rest of the implementation modules of io. "Catalogue": "phonometry.io", "CatalogueWarning": "phonometry.io", "parse_catalogue": "phonometry.io", "read_catalogue": "phonometry.io", "write_catalogue": "phonometry.io", "catalogue_schema": "phonometry.io", # Defined in phonometry.emission._shared, where the three sound power # standards share it; documented with the free-field method that raises it # most often. "SoundPowerWarning": "phonometry.emission.sound_power", # The ISO 9614-1 Table B.3 limit on F1, defined beside the F1 it bounds and # imported by the discrete-point determination that gates on it. "TEMPORAL_VARIABILITY_LIMIT": "phonometry.emission.intensity", # Defined in phonometry._plot.room; documented helper for the ISO 18233 # excitation signals, beside room.impulse_response that measures with them. "plot_excitation": "phonometry.room._impulse_response", # Defined in phonometry._plot.geometry; documented with the materials # module whose devices each drawing depicts. "plot_absorber_stack": "phonometry.materials.absorbers.porous", "plot_helmholtz_resonator_geometry": "phonometry.materials.absorbers.slow_sound", "plot_slit_absorber_geometry": "phonometry.materials.absorbers.slow_sound", "plot_qrd_geometry": "phonometry.materials.diffusers.design", "plot_metadiffuser_panel_geometry": "phonometry.materials.diffusers.metadiffuser", "DEFAULT_POLAR_ANGLES_DEG": "phonometry.materials.diffusers.design", "plot_impedance_tube_geometry": "phonometry.materials.absorbers.impedance_tube", "plot_transmission_tube_geometry": "phonometry.materials.absorbers.impedance_tube", "plot_silencer_geometry": "phonometry.noise_control.silencers", "plot_plenum_geometry": "phonometry.noise_control.hvac", "plot_barrier_geometry": "phonometry.environment.propagation.ground_barriers", "plot_microphone_positions": "phonometry.emission.sound_power", "plot_aperture_geometry": "phonometry.building.prediction.aperture_transmission", "plot_piston_geometry": "phonometry.electroacoustics.piston", "plot_sound_reinforcement_geometry": "phonometry.electroacoustics.sound_reinforcement", "plot_facade_elements": "phonometry.building.prediction.facade", "plot_double_wall_geometry": "phonometry.building.prediction.panel_transmission", "plot_junction_geometry": "phonometry.vibration.structural._junction_transmission", "plot_in_situ_geometry": "phonometry.materials.surfaces.road_absorption", "plot_dynamic_stiffness_rig": "phonometry.materials.resilient.dynamic_stiffness", "plot_goniometer_geometry": "phonometry.materials.diffusers.scattering_diffusion", "plot_plate_geometry": "phonometry.vibration.structural._radiation_efficiency", "plot_open_plan_geometry": "phonometry.room.open_plan", "plot_pp_probe_geometry": "phonometry.emission.intensity", # Defined in underwater.acoustics, also re-exported by # underwater.ship_radiated_noise (identity scan is ambiguous). "UNDERWATER_REFERENCE_PRESSURE_PA": "phonometry.underwater.acoustics", # Likewise the exposure reference, which the pile-driving SEL spectrum # imports for its band levels. "UNDERWATER_REFERENCE_EXPOSURE_PA2_S": "phonometry.underwater.acoustics", # Defined in the private phonometry._report package; documented with the # building insulation ratings whose report() method it drives. "ReportMetadata": "phonometry.building.measurement.insulation",}
#: The page title of each private module the reference documents, as words.#: A module that a function of its package names (``signals/correlation.py``#: beside ``signals.correlation()``) is private, because the package attribute#: of that name is the function and ``import phonometry.signals.correlation``#: would bind it. Its names are published by the package and its page keeps the#: URL it always had, but the page cannot be titled with a module address that#: no longer exists, so it is titled by its domain and its subject instead#: (``signals: correlation``) and opens by naming the package to import from.#: The subject is words, never a standard's designation: the site search weighs#: a title above the standards a guide's bibliography declares, so a reference#: page titled with a designation competes with the guides written to it. The#: three ECMA-418-2 pages are told from their neighbours by the hearing model#: they implement, and their summaries still name the standard.#: Every private module a section lists needs its words here, and nothing else#: may have them.PRIVATE_MODULE_TOPICS: dict[str, str] = { "phonometry.broadcast._program_loudness": "program loudness and true peak", "phonometry.building.measurement._rainfall_sound": "rainfall sound", "phonometry.emission._sound_power_anechoic": "sound power in an anechoic room", "phonometry.emission._sound_power_hard_walled": "sound power in a hard-walled room", "phonometry.emission._sound_power_in_duct": "sound power in a duct", "phonometry.emission._sound_power_in_situ": "sound power in situ", "phonometry.emission._sound_power_intensity": "sound power by intensity scanning", "phonometry.emission._sound_power_intensity_points": ( "sound power by intensity at points" ), "phonometry.emission._sound_power_reverberation": ( "sound power in a reverberation room" ), "phonometry.emission._sound_power_special_room": ( "sound power in a special reverberation room" ), "phonometry.environment.sources._statistical_pass_by": "statistical pass-by", "phonometry.fluids._air": "humid air", "phonometry.hearing._earmuff_insertion_loss": "earmuff insertion loss", "phonometry.hearing._real_ear_attenuation": "real-ear attenuation", "phonometry.materials.absorbers._airflow_resistance": "airflow resistance", "phonometry.noise_control._cabin_insulation": "cabin insulation", "phonometry.noise_control._duct_path": "duct path", "phonometry.psychoacoustics.quality._fluctuation_strength": "fluctuation strength", "phonometry.psychoacoustics.quality._fluctuation_strength_ecma": ( "fluctuation strength (Sottek model)" ), "phonometry.psychoacoustics.quality._roughness_ecma": "roughness (Sottek model)", "phonometry.psychoacoustics.quality._tonality_ecma": "tonality (Sottek model)", "phonometry.psychoacoustics.quality._tone_audibility": "tone audibility", "phonometry.room._crowd_noise": "crowd noise", "phonometry.room._impulse_response": "impulse response", "phonometry.signals._cepstrum": "cepstrum", "phonometry.signals._correlation": "correlation", "phonometry.signals._envelope": "envelope", "phonometry.signals._test_signals": "test signals", "phonometry.underwater.propagation._seabed_reflection": "seabed reflection", "phonometry.vibration.structural._impact_mobility": "impact mobility", "phonometry.vibration.structural._junction_transmission": "junction transmission", "phonometry.vibration.structural._radiation_efficiency": "radiation efficiency",}
def is_private_module(module: str) -> bool: """Whether ``module`` (full dotted name) is private: a part starts with ``_``.
:param module: Full module name, e.g. ``"phonometry.signals._correlation"``. """ return any(part.startswith("_") for part in module.split(".")[1:])
def is_documented_module(module: str) -> bool: """Whether the reference has a page for ``module`` (full dotted name).
:param module: Full module name, public or private. """ return module in _MODULE_TO_SECTION
def module_section(module: str) -> Section: """Return the section that documents ``module`` (full dotted name).
:param module: Full module name, e.g. ``"phonometry.signals.levels"``. :raises KeyError: If the module is not mapped; new public modules must be added to a section in ``scripts/api_taxonomy.py``. """ section = _MODULE_TO_SECTION.get(module) if section is None: msg = ( f"module {module!r} is not mapped to any API-reference section; " "add it to the matching Section in scripts/api_taxonomy.py" ) raise KeyError(msg) return section
def _parent_subpackage(module: str) -> str: """``phonometry.signals.levels`` -> ``signals``; top level -> ``""``.""" parts = module.split(".") return parts[1] if len(parts) > 2 else ""
def _build_module_index() -> dict[str, Section]: index: dict[str, Section] = {} for section in _SECTION_LIST: allowed = _SECTION_SUBPACKAGES[section.key] for module in section.modules: if module in index: msg = ( f"module {module!r} is assigned to both " f"{index[module].key!r} and {section.key!r}" ) raise ValueError(msg) parent = _parent_subpackage(module) if parent not in allowed: msg = ( f"module {module!r} (subpackage {parent!r}) does not " f"belong to section {section.key!r}, which only accepts " f"subpackages {allowed!r}" ) raise ValueError(msg) index[module] = section titled = set(PRIVATE_MODULE_TOPICS) private = {module for module in index if is_private_module(module)} if titled != private: msg = ( "every private module a section lists needs its page title in " "PRIVATE_MODULE_TOPICS, and nothing else may have one: untitled " f"{sorted(private - titled)}, unlisted {sorted(titled - private)}" ) raise ValueError(msg) for name, module in OBJECT_MODULE_OVERRIDES.items(): if module not in index: msg = ( f"OBJECT_MODULE_OVERRIDES[{name!r}] points to unmapped " f"module {module!r}" ) raise ValueError(msg) return index
_MODULE_TO_SECTION: dict[str, Section] = _build_module_index()
def public_names() -> dict[str, ModuleType]: """Every public name in the library, mapped to the package that owns it.
Since 4.0 the top level publishes the twenty-one domain packages and the four names that belong to no domain, and a function is reached through its package. "The public API" is therefore the union of the domain ``__all__`` plus those four, which is what the coverage gate walks and what the generator renders. Reading ``phonometry.__all__`` instead would now see twenty-four names and call the other thirteen hundred private.
The value is the module to read the name off, which is the owning package for a domain name and ``phonometry`` itself for the four at the top. """ import phonometry
packages = [ getattr(phonometry, name) for name in phonometry.__all__ if inspect.ismodule(getattr(phonometry, name)) ] owners: dict[str, ModuleType] = {} for package in packages: for member in getattr(package, "__all__", ()): previous = owners.get(member) if previous is not None: msg = ( f"{member!r} is published by both {previous.__name__} and " f"{package.__name__}; one name, one owner" ) raise ValueError(msg) owners[member] = package # The names the top level holds itself, which is every one it publishes # that no package does. `Signal` is not among them: it is published at the # top level and by `phonometry.io`, which owns it, and the top-level # re-export is a shortcut to the same object. for name in phonometry.__all__: attribute = getattr(phonometry, name) if not inspect.ismodule(attribute) and name not in owners: owners[name] = phonometry return owners