From fdaaea2e9b7a91f18cf79a5a197081012378f9c0 Mon Sep 17 00:00:00 2001 From: Marco Berzborn Date: Wed, 20 Mar 2024 15:28:54 +0100 Subject: [PATCH 1/7] update author information --- pyrato/__init__.py | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyrato/__init__.py b/pyrato/__init__.py index 8472f80..2384d1f 100644 --- a/pyrato/__init__.py +++ b/pyrato/__init__.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- __author__ = \ - """Marco Berzborn - Institute for Hearing Technology and Acoustics""" -__email__ = 'marco.berzborn@akustik.rwth-aachen.de' + """The pyfar developers""" +__email__ = 'info@pyfar.org' __version__ = '0.3.2' from .rap import ( diff --git a/setup.py b/setup.py index defef73..7c5bfcd 100644 --- a/setup.py +++ b/setup.py @@ -32,8 +32,8 @@ ] setup( - author="Marco Berzborn - Institute for Hearing Technology and Acoustics", - author_email='marco.berzborn@akustik.rwth-aachen.de', + author="The pyfar developers", + author_email='info@pyfar.org', classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Science/Research', From 7da504c3f264071a0ecb4e499be79db9a688341f Mon Sep 17 00:00:00 2001 From: Marco Berzborn Date: Mon, 23 Dec 2024 18:14:53 +0100 Subject: [PATCH 2/7] rewrite init based on current files --- pyrato/__init__.py | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/pyrato/__init__.py b/pyrato/__init__.py index 2384d1f..aef4da0 100644 --- a/pyrato/__init__.py +++ b/pyrato/__init__.py @@ -5,44 +5,24 @@ __email__ = 'info@pyfar.org' __version__ = '0.3.2' -from .rap import ( - reverberation_time_linear_regression -) + from .roomacoustics import ( reverberation_time_energy_decay_curve, energy_decay_curve_analytic, air_attenuation_coefficient, ) -from .dsp import ( - find_impulse_response_maximum, - find_impulse_response_start, - time_shift, - preprocess_rir, - estimate_noise_energy, -) -from .edc import ( - schroeder_integration, - energy_decay_curve_chu, - energy_decay_curve_chu_lundeby, - energy_decay_curve_lundeby, - energy_decay_curve_truncation, - intersection_time_lundeby, -) + +from . import edc +from . import rap +from . import dsp +from . import analytic __all__ = [ - 'reverberation_time_linear_regression', + 'edc', + 'rap', + 'dsp', + 'analytic', 'reverberation_time_energy_decay_curve', - 'schroeder_integration', 'energy_decay_curve_analytic', 'air_attenuation_coefficient', - 'find_impulse_response_maximum', - 'find_impulse_response_start', - 'time_shift', - 'preprocess_rir', - 'energy_decay_curve_chu', - 'energy_decay_curve_chu_lundeby', - 'energy_decay_curve_lundeby', - 'energy_decay_curve_truncation', - 'estimate_noise_energy', - 'intersection_time_lundeby', ] From 27e080011d6204215609116be87e99d268496ee0 Mon Sep 17 00:00:00 2001 From: Marco Berzborn Date: Mon, 13 Jan 2025 17:11:10 +0100 Subject: [PATCH 3/7] create parametric submodule --- pyrato/{roomacoustics.py => parametric.py} | 71 ---------------------- 1 file changed, 71 deletions(-) rename pyrato/{roomacoustics.py => parametric.py} (64%) diff --git a/pyrato/roomacoustics.py b/pyrato/parametric.py similarity index 64% rename from pyrato/roomacoustics.py rename to pyrato/parametric.py index 64f5fea..30ae5e9 100644 --- a/pyrato/roomacoustics.py +++ b/pyrato/parametric.py @@ -1,77 +1,6 @@ # -*- coding: utf-8 -*- import numpy as np -from pyrato.rap import reverberation_time_linear_regression -import warnings - - -def reverberation_time_energy_decay_curve( - energy_decay_curve, - T='T20'): - """Estimate the reverberation time from a given energy decay curve. - The linear regression is performed using least squares error minimization - according to the ISO standard 3382 [#]_. - - Parameters - ---------- - energy_decay_curve : ndarray, double - Energy decay curve. The time needs to be the arrays last dimension. - times : ndarray, double - Time vector corresponding to each sample of the EDC. - T : 'T20', 'T30', 'T40', 'T50', 'T60', 'EDT', 'LDT' - Decay interval to be used for the reverberation time extrapolation. EDT - corresponds to the early decay time extrapolated from the interval - [0, -10] dB, LDT corresponds to the late decay time extrapolated from - the interval [-25, -35] dB. - normalize : bool, True - Normalize the EDC to the steady state energy level - - Returns - ------- - reverberation_time : double - The reverberation time - - References - ---------- - .. [#] ISO 3382, Acoustics - Measurement of the reverberation time of - rooms with reference to other acoustical parameters. - - Examples - -------- - - Estimate the reverberation time from an energy decay curve. - - >>> import numpy as np - >>> import pyfar as pf - >>> import pyrato as ra - >>> from pyrato.analytic import rectangular_room_rigid_walls - ... - >>> L = np.array([8, 5, 3])/10 - >>> source_pos = np.array([5, 3, 1.2])/10 - >>> receiver_pos = np.array([1, 1, 1.2])/10 - >>> rir, _ = rectangular_room_rigid_walls( - ... L, source_pos, receiver_pos, - ... reverberation_time=1, max_freq=1.5e3, n_samples=2**12, - ... speed_of_sound=343.9, samplingrate=3e3) - >>> rir = rir/rir.time.max() - ... - >>> awgn = pf.signals.noise( - ... rir.n_samples, rms=10**(-50/20), - ... sampling_rate=rir.sampling_rate) - >>> rir = rir + awgn - ... - >>> edc = ra.energy_decay_curve_chu_lundeby(rir) - >>> t_20 = ra.reverberation_time_energy_decay_curve(edc, 'T20') - >>> t_20 - ... array([0.99526253]) - - """ - warnings.warn( - "This function will be deprecated in version 0.5.0 " - "Use pyrato.reverberation_time_linear_regression instead", - DeprecationWarning) - - return reverberation_time_linear_regression(energy_decay_curve, T) def energy_decay_curve_analytic( From 7a831c7e18c61d4aa38560487b2ffc08382f508f Mon Sep 17 00:00:00 2001 From: Marco Berzborn Date: Mon, 13 Jan 2025 17:31:29 +0100 Subject: [PATCH 4/7] adapt import to new parametric submodule --- pyrato/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyrato/__init__.py b/pyrato/__init__.py index aef4da0..5c36b26 100644 --- a/pyrato/__init__.py +++ b/pyrato/__init__.py @@ -6,9 +6,7 @@ __version__ = '0.3.2' -from .roomacoustics import ( - reverberation_time_energy_decay_curve, - energy_decay_curve_analytic, +from .parametric import ( air_attenuation_coefficient, ) @@ -16,6 +14,7 @@ from . import rap from . import dsp from . import analytic +from . import parametric __all__ = [ 'edc', @@ -25,4 +24,5 @@ 'reverberation_time_energy_decay_curve', 'energy_decay_curve_analytic', 'air_attenuation_coefficient', + 'parametric', ] From 2fc010dc157d41c54c4f7f1bba25af621809919f Mon Sep 17 00:00:00 2001 From: Marco Berzborn Date: Mon, 13 Jan 2025 17:32:38 +0100 Subject: [PATCH 5/7] deprecate air attenuation function --- pyrato/parametric.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyrato/parametric.py b/pyrato/parametric.py index 30ae5e9..6400210 100644 --- a/pyrato/parametric.py +++ b/pyrato/parametric.py @@ -100,6 +100,13 @@ def air_attenuation_coefficient( The resulting attenuation coefficient. """ + from pyfar.classes.warnings import PyfarDeprecationWarning + import warnings + + warnings.warn( + 'Will be replaced by respective function in pyfar before v1.0.0', + PyfarDeprecationWarning) + # room temperature in Kelvin t_K = temperature + 273.16 p_ref_kPa = 101.325 From 36c2737d59df971e72cfa289ab61d3f5a9b7777a Mon Sep 17 00:00:00 2001 From: Marco Berzborn Date: Mon, 13 Jan 2025 17:35:17 +0100 Subject: [PATCH 6/7] add module docstrings --- pyrato/edc.py | 4 ++-- pyrato/parametric.py | 4 ++++ pyrato/rap.py | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pyrato/edc.py b/pyrato/edc.py index 080e6f3..9f91450 100644 --- a/pyrato/edc.py +++ b/pyrato/edc.py @@ -2,8 +2,8 @@ # -*- coding: utf-8 -*- """ - The edc_noise_handling module provides various methods for noise - compensation of room impulse responses. +Sub-module implementing different methods for the calculation of energy decay +curves (EDCs) from measured or simulated room impulse responses (RIRs). """ import numpy as np diff --git a/pyrato/parametric.py b/pyrato/parametric.py index 6400210..4408228 100644 --- a/pyrato/parametric.py +++ b/pyrato/parametric.py @@ -1,5 +1,9 @@ # -*- coding: utf-8 -*- +"""Parametric room acoustics calculations using simple geometric considerations +such as Sabine's theory of sound in rooms. +""" + import numpy as np diff --git a/pyrato/rap.py b/pyrato/rap.py index 06acb0c..c491df6 100644 --- a/pyrato/rap.py +++ b/pyrato/rap.py @@ -1,4 +1,6 @@ -"""Room acoustic parameters +""" +Sub-module implementing calculations of room acoustic parameters from +simulated or experimental data. """ import re import numpy as np From a59fa1241c5cb7553c6cf62c061a1809346f9c7b Mon Sep 17 00:00:00 2001 From: Marco Berzborn Date: Mon, 13 Jan 2025 18:45:06 +0100 Subject: [PATCH 7/7] removed obsolete catching of not imported functions --- pyrato/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyrato/__init__.py b/pyrato/__init__.py index 5c36b26..0e67353 100644 --- a/pyrato/__init__.py +++ b/pyrato/__init__.py @@ -21,8 +21,6 @@ 'rap', 'dsp', 'analytic', - 'reverberation_time_energy_decay_curve', - 'energy_decay_curve_analytic', - 'air_attenuation_coefficient', 'parametric', + 'air_attenuation_coefficient' ]