From e980556a7aab4634b302c528a6cb51380c3c80e0 Mon Sep 17 00:00:00 2001 From: Robin Scheibler Date: Sat, 9 Nov 2024 22:12:02 +0900 Subject: [PATCH] lint --- examples/plot_directivity_2D.py | 1 + examples/plot_directivity_3D.py | 7 +++---- examples/plot_directivity_one_shot.py | 8 ++++---- pyroomacoustics/__init__.py | 4 ++-- pyroomacoustics/directivities/__init__.py | 2 +- pyroomacoustics/directivities/analytic.py | 2 +- pyroomacoustics/directivities/measured.py | 2 +- pyroomacoustics/doa/__init__.py | 2 +- pyroomacoustics/random/tests/test_spherical.py | 2 +- pyroomacoustics/tests/test_source_directivity_flipping.py | 1 + pyroomacoustics/tests/tests_libroom/test_microphone.py | 1 + 11 files changed, 17 insertions(+), 15 deletions(-) diff --git a/examples/plot_directivity_2D.py b/examples/plot_directivity_2D.py index 078bbea0..b380003c 100644 --- a/examples/plot_directivity_2D.py +++ b/examples/plot_directivity_2D.py @@ -1,5 +1,6 @@ import matplotlib.pyplot as plt import numpy as np + from pyroomacoustics import dB from pyroomacoustics.directivities import ( CardioidFamily, diff --git a/examples/plot_directivity_3D.py b/examples/plot_directivity_3D.py index d2193dac..7887ac57 100644 --- a/examples/plot_directivity_3D.py +++ b/examples/plot_directivity_3D.py @@ -1,13 +1,12 @@ -import numpy as np import matplotlib.pyplot as plt +import numpy as np from pyroomacoustics.directivities import ( - DirectivityPattern, - DirectionVector, CardioidFamily, + DirectionVector, + DirectivityPattern, ) - PATTERN = DirectivityPattern.HYPERCARDIOID ORIENTATION = DirectionVector(azimuth=0, colatitude=45, degrees=True) diff --git a/examples/plot_directivity_one_shot.py b/examples/plot_directivity_one_shot.py index 09160365..9a41c2c7 100644 --- a/examples/plot_directivity_one_shot.py +++ b/examples/plot_directivity_one_shot.py @@ -1,11 +1,11 @@ -import numpy as np import matplotlib.pyplot as plt +import numpy as np -from pyroomacoustics import dB, all_combinations +from pyroomacoustics import all_combinations, dB from pyroomacoustics.directivities import ( - DirectivityPattern, - DirectionVector, CardioidFamily, + DirectionVector, + DirectivityPattern, cardioid_func, ) from pyroomacoustics.doa import spher2cart diff --git a/pyroomacoustics/__init__.py b/pyroomacoustics/__init__.py index 843141dc..19b4e633 100644 --- a/pyroomacoustics/__init__.py +++ b/pyroomacoustics/__init__.py @@ -120,9 +120,9 @@ import warnings -from . import adaptive, bss, datasets, denoise, doa, experimental, random +from . import adaptive, bss, datasets, denoise, doa, experimental from . import libroom as libroom -from . import phase, transform +from . import phase, random, transform from .acoustics import * from .beamforming import * from .directivities import * diff --git a/pyroomacoustics/directivities/__init__.py b/pyroomacoustics/directivities/__init__.py index 5af56a09..27c0c0f3 100644 --- a/pyroomacoustics/directivities/__init__.py +++ b/pyroomacoustics/directivities/__init__.py @@ -84,11 +84,11 @@ from .analytic import ( Cardioid, CardioidFamily, + CardioidFamilySampler, FigureEight, HyperCardioid, Omnidirectional, SubCardioid, - CardioidFamilySampler, cardioid_func, ) from .base import Directivity diff --git a/pyroomacoustics/directivities/analytic.py b/pyroomacoustics/directivities/analytic.py index c7102089..73c35b21 100644 --- a/pyroomacoustics/directivities/analytic.py +++ b/pyroomacoustics/directivities/analytic.py @@ -59,11 +59,11 @@ """ import numpy as np +from .. import random from ..doa import spher2cart from ..utilities import all_combinations, requires_matplotlib from .base import Directivity from .direction import DirectionVector -from .. import random _FIGURE_EIGHT = 0 _HYPERCARDIOID = 0.25 diff --git a/pyroomacoustics/directivities/measured.py b/pyroomacoustics/directivities/measured.py index 3ecc28cc..d4b1f4fd 100644 --- a/pyroomacoustics/directivities/measured.py +++ b/pyroomacoustics/directivities/measured.py @@ -75,6 +75,7 @@ from scipy.interpolate import griddata from scipy.spatial import cKDTree +from .. import random from ..datasets import SOFADatabase from ..doa import Grid, GridSphere, cart2spher, fibonacci_spherical_sampling, spher2cart from ..utilities import requires_matplotlib @@ -82,7 +83,6 @@ from .direction import Rotation3D from .interp import spherical_interpolation from .sofa import open_sofa_file -from .. import random class MeasuredDirectivitySampler(random.sampler.DirectionalSampler): diff --git a/pyroomacoustics/doa/__init__.py b/pyroomacoustics/doa/__init__.py index 5ccc533a..bdf9b461 100644 --- a/pyroomacoustics/doa/__init__.py +++ b/pyroomacoustics/doa/__init__.py @@ -112,13 +112,13 @@ from .doa import * from .frida import * from .grid import * +from .histogram import SphericalHistogram from .music import * from .normmusic import * from .srp import * from .tops import * from .utils import * from .waves import * -from .histogram import SphericalHistogram # Create this dictionary as a shortcut to different algorithms algorithms = { diff --git a/pyroomacoustics/random/tests/test_spherical.py b/pyroomacoustics/random/tests/test_spherical.py index b15ed676..b119244b 100644 --- a/pyroomacoustics/random/tests/test_spherical.py +++ b/pyroomacoustics/random/tests/test_spherical.py @@ -15,9 +15,9 @@ def test_stat_prop_power_spherical(): if __name__ == "__main__": - import numpy as np import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as axes3d + import numpy as np # let's visualize samples in the sphere diff --git a/pyroomacoustics/tests/test_source_directivity_flipping.py b/pyroomacoustics/tests/test_source_directivity_flipping.py index d6fda3e0..c65abb87 100644 --- a/pyroomacoustics/tests/test_source_directivity_flipping.py +++ b/pyroomacoustics/tests/test_source_directivity_flipping.py @@ -1,6 +1,7 @@ from unittest import TestCase import numpy as np + import pyroomacoustics as pra from pyroomacoustics.simulation.ism import source_angle_shoebox diff --git a/pyroomacoustics/tests/tests_libroom/test_microphone.py b/pyroomacoustics/tests/tests_libroom/test_microphone.py index d2cedd0a..269229a9 100644 --- a/pyroomacoustics/tests/tests_libroom/test_microphone.py +++ b/pyroomacoustics/tests/tests_libroom/test_microphone.py @@ -1,5 +1,6 @@ import matplotlib.pyplot as plt import numpy as np + import pyroomacoustics as pra