From 3984eaacb101ffdac8bfcbc9f0d4a352bfbb5455 Mon Sep 17 00:00:00 2001 From: Robin Scheibler Date: Tue, 7 May 2024 21:15:49 +0900 Subject: [PATCH] black --- examples/adaptive_filter_stft_domain.py | 1 + examples/adaptive_filters.py | 1 + examples/beamforming_delay_and_sum.py | 1 + examples/bss_example.py | 1 + examples/datasets.py | 1 + examples/raytracing.py | 1 + examples/room_L_shape_3d_rt.py | 1 + examples/room_complex_wall_materials.py | 1 + examples/room_from_rt60.py | 1 + examples/room_from_stl.py | 1 + examples/simulation_with_measured_directivity.py | 1 - pyroomacoustics/adaptive/lms.py | 1 + pyroomacoustics/adaptive/subband_lms.py | 1 - pyroomacoustics/beamforming.py | 1 - pyroomacoustics/bss/fastmnmf.py | 4 +--- pyroomacoustics/datasets/cmu_arctic.py | 1 + pyroomacoustics/datasets/tests/test_corpus_base.py | 1 + pyroomacoustics/doa/grid.py | 1 + pyroomacoustics/doa/plotters.py | 1 + pyroomacoustics/doa/utils.py | 1 + pyroomacoustics/experimental/signals.py | 1 + pyroomacoustics/open_sofa_interpolate.py | 1 - pyroomacoustics/tests/test_bandpass_filterbank.py | 1 + pyroomacoustics/tests/test_issue_22.py | 1 + pyroomacoustics/tests/test_materials.py | 1 + pyroomacoustics/tests/test_random_ism.py | 1 + pyroomacoustics/tests/test_room_mix.py | 1 + pyroomacoustics/tests/test_sofa_directivities.py | 1 + pyroomacoustics/tests/tests_libroom/test_shoebox_simple.py | 1 + pyroomacoustics/transform/__init__.py | 1 - 30 files changed, 25 insertions(+), 8 deletions(-) diff --git a/examples/adaptive_filter_stft_domain.py b/examples/adaptive_filter_stft_domain.py index 256fe1ef..be64e57f 100644 --- a/examples/adaptive_filter_stft_domain.py +++ b/examples/adaptive_filter_stft_domain.py @@ -5,6 +5,7 @@ In this example, we will run adaptive filters for system identification, but in the frequeny domain. """ + from __future__ import division, print_function import matplotlib.pyplot as plt diff --git a/examples/adaptive_filters.py b/examples/adaptive_filters.py index ab27296d..e4b0df0e 100644 --- a/examples/adaptive_filters.py +++ b/examples/adaptive_filters.py @@ -4,6 +4,7 @@ In this example, we will run adaptive filters for system identification. """ + from __future__ import division, print_function import matplotlib.pyplot as plt diff --git a/examples/beamforming_delay_and_sum.py b/examples/beamforming_delay_and_sum.py index 4a83f1ec..9e882af2 100644 --- a/examples/beamforming_delay_and_sum.py +++ b/examples/beamforming_delay_and_sum.py @@ -1,6 +1,7 @@ """ This example shows how to create delay and sum beamformers """ + from __future__ import division, print_function import matplotlib.pyplot as plt diff --git a/examples/bss_example.py b/examples/bss_example.py index 22ead9b2..f16eb099 100755 --- a/examples/bss_example.py +++ b/examples/bss_example.py @@ -54,6 +54,7 @@ This script requires the `mir_eval` to run, and `tkinter` and `sounddevice` packages for the GUI option. """ + import time import numpy as np diff --git a/examples/datasets.py b/examples/datasets.py index 2e747359..ab9e1644 100644 --- a/examples/datasets.py +++ b/examples/datasets.py @@ -2,6 +2,7 @@ Example of the basic operations with ``pyroomacoustics.datasets.Dataset`` and ``pyroomacoustics.datasets.Sample`` classes """ + from pyroomacoustics.datasets import Dataset, Sample # Prepare a few artificial samples diff --git a/examples/raytracing.py b/examples/raytracing.py index f29410bb..59c414e5 100644 --- a/examples/raytracing.py +++ b/examples/raytracing.py @@ -2,6 +2,7 @@ This example program demonstrates the use of ray tracing for the simulation of rooms of different sizes. """ + from __future__ import print_function import argparse diff --git a/examples/room_L_shape_3d_rt.py b/examples/room_L_shape_3d_rt.py index 396be3d8..089acaa8 100644 --- a/examples/room_L_shape_3d_rt.py +++ b/examples/room_L_shape_3d_rt.py @@ -7,6 +7,7 @@ The simulation is done using the hybrid ISM/RT simulator. """ + from __future__ import print_function import time diff --git a/examples/room_complex_wall_materials.py b/examples/room_complex_wall_materials.py index fc9a2359..41bb1905 100644 --- a/examples/room_complex_wall_materials.py +++ b/examples/room_complex_wall_materials.py @@ -4,6 +4,7 @@ 2022 (c) @noahdeetzers, @fakufaku """ + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/room_from_rt60.py b/examples/room_from_rt60.py index 6b721fbe..9ee7ebfc 100644 --- a/examples/room_from_rt60.py +++ b/examples/room_from_rt60.py @@ -4,6 +4,7 @@ The simulation is pure image source method. The audio sample with the reverb added is saved back to `examples/samples/guitar_16k_reverb.wav`. """ + import argparse import matplotlib.pyplot as plt diff --git a/examples/room_from_stl.py b/examples/room_from_stl.py index 12d49086..12063d94 100644 --- a/examples/room_from_stl.py +++ b/examples/room_from_stl.py @@ -5,6 +5,7 @@ The STL file was kindly provided by Diego Di Carlo (@Chutlhu). """ + import argparse import os from pathlib import Path diff --git a/examples/simulation_with_measured_directivity.py b/examples/simulation_with_measured_directivity.py index 50f093ff..0b4053a0 100644 --- a/examples/simulation_with_measured_directivity.py +++ b/examples/simulation_with_measured_directivity.py @@ -60,7 +60,6 @@ class DirectionVector ~ Prerak SRIVASTAVA, 8/11/2022 """ - import os import matplotlib.pyplot as plt diff --git a/pyroomacoustics/adaptive/lms.py b/pyroomacoustics/adaptive/lms.py index a36446b2..dac915b8 100644 --- a/pyroomacoustics/adaptive/lms.py +++ b/pyroomacoustics/adaptive/lms.py @@ -5,6 +5,7 @@ Implementations of adaptive filters from the LMS class. These algorithms have a low complexity and reliable behavior with a somewhat slower convergence. """ + from __future__ import absolute_import, division, print_function import numpy as np diff --git a/pyroomacoustics/adaptive/subband_lms.py b/pyroomacoustics/adaptive/subband_lms.py index d9c0479c..70c0cf92 100644 --- a/pyroomacoustics/adaptive/subband_lms.py +++ b/pyroomacoustics/adaptive/subband_lms.py @@ -26,7 +26,6 @@ class SubbandLMS: - """ Frequency domain implementation of LMS. Adaptive filter for each subband. diff --git a/pyroomacoustics/beamforming.py b/pyroomacoustics/beamforming.py index 4ca448c2..1da8804d 100644 --- a/pyroomacoustics/beamforming.py +++ b/pyroomacoustics/beamforming.py @@ -347,7 +347,6 @@ def circular_microphone_array_xyplane( class MicrophoneArray(object): - """Microphone array class.""" def __init__(self, R, fs, directivity=None): diff --git a/pyroomacoustics/bss/fastmnmf.py b/pyroomacoustics/bss/fastmnmf.py index 6ba6b9d7..6caf833e 100644 --- a/pyroomacoustics/bss/fastmnmf.py +++ b/pyroomacoustics/bss/fastmnmf.py @@ -161,9 +161,7 @@ def separate(): Y_FTM = np.einsum("nft, nfm -> ftm", lambda_NFT, G_NFM) # update G_NFM (diagonal element of spatial covariance matrices) - numerator = np.einsum( - "nft, ftm -> nfm", lambda_NFT, Qx_power_FTM / (Y_FTM**2) - ) + numerator = np.einsum("nft, ftm -> nfm", lambda_NFT, Qx_power_FTM / (Y_FTM**2)) denominator = np.einsum("nft, ftm -> nfm", lambda_NFT, 1 / Y_FTM) + eps G_NFM *= np.sqrt(numerator / denominator) Y_FTM = np.einsum("nft, nfm -> ftm", lambda_NFT, G_NFM) diff --git a/pyroomacoustics/datasets/cmu_arctic.py b/pyroomacoustics/datasets/cmu_arctic.py index a3e42e96..f9836197 100644 --- a/pyroomacoustics/datasets/cmu_arctic.py +++ b/pyroomacoustics/datasets/cmu_arctic.py @@ -29,6 +29,7 @@ URL: http://www.festvox.org/cmu_arctic/ """ + import os import numpy as np diff --git a/pyroomacoustics/datasets/tests/test_corpus_base.py b/pyroomacoustics/datasets/tests/test_corpus_base.py index 4d356b24..b49a7b27 100644 --- a/pyroomacoustics/datasets/tests/test_corpus_base.py +++ b/pyroomacoustics/datasets/tests/test_corpus_base.py @@ -2,6 +2,7 @@ Example of the basic operations with ``pyroomacoustics.datasets.Dataset`` and ``pyroomacoustics.datasets.Sample`` classes """ + from pyroomacoustics.datasets import Dataset, Sample diff --git a/pyroomacoustics/doa/grid.py b/pyroomacoustics/doa/grid.py index 2c3d7b61..c0c4ed85 100644 --- a/pyroomacoustics/doa/grid.py +++ b/pyroomacoustics/doa/grid.py @@ -1,6 +1,7 @@ """ Routines to perform grid search on the sphere """ + from __future__ import absolute_import, division, print_function from abc import ABCMeta, abstractmethod diff --git a/pyroomacoustics/doa/plotters.py b/pyroomacoustics/doa/plotters.py index 8b1846bc..764f3d24 100644 --- a/pyroomacoustics/doa/plotters.py +++ b/pyroomacoustics/doa/plotters.py @@ -1,6 +1,7 @@ """ A collection of functions to plot maps and points on circles and spheres. """ + import numpy as np diff --git a/pyroomacoustics/doa/utils.py b/pyroomacoustics/doa/utils.py index fccc0144..0ff9d149 100644 --- a/pyroomacoustics/doa/utils.py +++ b/pyroomacoustics/doa/utils.py @@ -2,6 +2,7 @@ This module contains useful functions to compute distances and errors on on circles and spheres. """ + from __future__ import division import collections diff --git a/pyroomacoustics/experimental/signals.py b/pyroomacoustics/experimental/signals.py index e6659af0..24359110 100644 --- a/pyroomacoustics/experimental/signals.py +++ b/pyroomacoustics/experimental/signals.py @@ -1,6 +1,7 @@ """ A few test signals like sweeps and stuff. """ + from __future__ import division, print_function import numpy as np diff --git a/pyroomacoustics/open_sofa_interpolate.py b/pyroomacoustics/open_sofa_interpolate.py index 4feed104..d7770436 100644 --- a/pyroomacoustics/open_sofa_interpolate.py +++ b/pyroomacoustics/open_sofa_interpolate.py @@ -649,7 +649,6 @@ def plot(self, freq_bin=0, n_grid=100, ax=None, depth=False, offset=None): class SOFADirectivityFactory: - """ This class reads measured directivities from a `SOFA `_ format file. diff --git a/pyroomacoustics/tests/test_bandpass_filterbank.py b/pyroomacoustics/tests/test_bandpass_filterbank.py index 07c9c94d..1522d2bb 100644 --- a/pyroomacoustics/tests/test_bandpass_filterbank.py +++ b/pyroomacoustics/tests/test_bandpass_filterbank.py @@ -1,6 +1,7 @@ """ This tests the construction of a bank of octave filters """ + import numpy as np from scipy.signal import sosfreqz diff --git a/pyroomacoustics/tests/test_issue_22.py b/pyroomacoustics/tests/test_issue_22.py index 76f3cb66..31df1b8a 100644 --- a/pyroomacoustics/tests/test_issue_22.py +++ b/pyroomacoustics/tests/test_issue_22.py @@ -14,6 +14,7 @@ If the C module is not installed (pure python fallback version), then nothing is done. """ + import numpy as np import pyroomacoustics diff --git a/pyroomacoustics/tests/test_materials.py b/pyroomacoustics/tests/test_materials.py index 141d1d3d..a0954c35 100644 --- a/pyroomacoustics/tests/test_materials.py +++ b/pyroomacoustics/tests/test_materials.py @@ -2,6 +2,7 @@ Just run the Material command with a bunch of inputs to make sure it works as expected """ + import pyroomacoustics as pra scat_test = { diff --git a/pyroomacoustics/tests/test_random_ism.py b/pyroomacoustics/tests/test_random_ism.py index bcb809a4..43bc6743 100644 --- a/pyroomacoustics/tests/test_random_ism.py +++ b/pyroomacoustics/tests/test_random_ism.py @@ -5,6 +5,7 @@ Script to test removal of sweeping echoes with randomized image method """ + import pyroomacoustics as pra from pyroomacoustics import metrics as met diff --git a/pyroomacoustics/tests/test_room_mix.py b/pyroomacoustics/tests/test_room_mix.py index 336ebb3c..6cac9989 100644 --- a/pyroomacoustics/tests/test_room_mix.py +++ b/pyroomacoustics/tests/test_room_mix.py @@ -1,6 +1,7 @@ """ Tests the mixing function of ``Room.simulate`` """ + import unittest import numpy as np diff --git a/pyroomacoustics/tests/test_sofa_directivities.py b/pyroomacoustics/tests/test_sofa_directivities.py index 888517c3..7d5187a2 100644 --- a/pyroomacoustics/tests/test_sofa_directivities.py +++ b/pyroomacoustics/tests/test_sofa_directivities.py @@ -5,6 +5,7 @@ To generate the samples run this file: `python ./test_sofa_directivities.py` """ + import argparse import os import warnings diff --git a/pyroomacoustics/tests/tests_libroom/test_shoebox_simple.py b/pyroomacoustics/tests/tests_libroom/test_shoebox_simple.py index e0110d05..10d94b47 100644 --- a/pyroomacoustics/tests/tests_libroom/test_shoebox_simple.py +++ b/pyroomacoustics/tests/tests_libroom/test_shoebox_simple.py @@ -7,6 +7,7 @@ It was created to address Issue #293 on github. https://github.com/LCAV/pyroomacoustics/issues/293 """ + import numpy as np import pytest diff --git a/pyroomacoustics/transform/__init__.py b/pyroomacoustics/transform/__init__.py index 00559f93..e11fb411 100644 --- a/pyroomacoustics/transform/__init__.py +++ b/pyroomacoustics/transform/__init__.py @@ -15,7 +15,6 @@ """ - from . import stft from .dft import DFT from .stft import STFT