Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor of room.py and finalize of DIRPat pull request #305

Open
wants to merge 2 commits into
base: dev/dirpat
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "pyroomacoustics/libroom_src/ext/eigen"]
path = pyroomacoustics/libroom_src/ext/eigen
path = src/ext/eigen
url = https://github.com/eigenteam/eigen-git-mirror.git
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import sys

# mock modules for compilation without installing all packages
MOCK_MODULES = [
Expand Down
3 changes: 2 additions & 1 deletion examples/adaptive_filter_stft_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"""
from __future__ import division, print_function

import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import fftconvolve
import matplotlib.pyplot as plt

import pyroomacoustics as pra

# parameters
Expand Down
3 changes: 2 additions & 1 deletion examples/adaptive_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
"""
from __future__ import division, print_function

import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import fftconvolve
import matplotlib.pyplot as plt

import pyroomacoustics as pra

# parameters
Expand Down
5 changes: 3 additions & 2 deletions examples/beamforming_delay_and_sum.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
This example shows how to create delay and sum beamformers
"""
from __future__ import print_function, division
from __future__ import division, print_function

import numpy as np
import matplotlib.pyplot as plt
import numpy as np

import pyroomacoustics as pra

# Create a 4 by 6 metres anechoic room
Expand Down
3 changes: 2 additions & 1 deletion examples/beamforming_time_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
from __future__ import division, print_function

import os
import numpy as np

import matplotlib.pyplot as plt
import numpy as np
from scipy.io import wavfile

import pyroomacoustics as pra
Expand Down
7 changes: 4 additions & 3 deletions examples/bss_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
This script requires the `mir_eval` to run, and `tkinter` and `sounddevice` packages for the GUI option.
"""
import time
import numpy as np
from scipy.io import wavfile

import numpy as np
from mir_eval.separation import bss_eval_sources
from scipy.io import wavfile

# We concatenate a few samples to make them long enough
wav_files = [
Expand Down Expand Up @@ -292,7 +292,8 @@ def convergence_callback(Y):

if args.gui:
# Make a simple GUI to listen to the separated samples
from tkinter import Tk, Button, Label
from tkinter import Button, Label, Tk

import sounddevice as sd

# Now comes the GUI part
Expand Down
7 changes: 3 additions & 4 deletions examples/bss_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,17 @@
This script requires the `sounddevice` packages to run.
"""

import numpy as np

# important to avoid a crash when tkinter is called
import matplotlib
import numpy as np

matplotlib.use("TkAgg")

import pyroomacoustics as pra
from tkinter import Button, Label, Tk

from tkinter import Tk, Label, Button
import sounddevice as sd

import pyroomacoustics as pra

if __name__ == "__main__":
choices = ["ilrma", "auxiva", "sparseauxiva", "fastmnmf", "fastmnmf2"]
Expand Down
3 changes: 2 additions & 1 deletion examples/cmu_arctic_corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
CMU, 2003.
"""

import pyroomacoustics as pra
import argparse
import os

import pyroomacoustics as pra

if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Example of using the CMUArcticCorpus wrapper"
Expand Down
2 changes: 1 addition & 1 deletion examples/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Example of the basic operations with ``pyroomacoustics.datasets.Dataset``
and ``pyroomacoustics.datasets.Sample`` classes
"""
from pyroomacoustics.datasets import Sample, Dataset
from pyroomacoustics.datasets import Dataset, Sample

# Prepare a few artificial samples
samples = [
Expand Down
5 changes: 2 additions & 3 deletions examples/directivities/cardioid_function.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
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 cardioid_func
from pyroomacoustics.doa import spher2cart


azimuth = np.radians(np.linspace(start=0, stop=360, num=361, endpoint=True))
colatitude = np.radians(np.linspace(start=0, stop=180, num=180, endpoint=True))
lower_gain = -40
Expand Down
6 changes: 3 additions & 3 deletions examples/directivities/circular_mic_array.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import matplotlib.pyplot as plt

import pyroomacoustics as pra
from pyroomacoustics.directivities import (
DirectionVector,
CardioidFamily,
DirectionVector,
DirectivityPattern,
)
import matplotlib.pyplot as plt


three_dim = True # 2D or 3D

Expand Down
10 changes: 5 additions & 5 deletions examples/directivities/mic_array.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pyroomacoustics as pra
import numpy as np
import matplotlib.pyplot as plt
import numpy as np

import pyroomacoustics as pra
from pyroomacoustics.directivities import (
DirectivityPattern,
DirectionVector,
CardioidFamily,
DirectionVector,
DirectivityPattern,
)


pattern = DirectivityPattern.HYPERCARDIOID
orientation = DirectionVector(azimuth=0, colatitude=0, degrees=True)

Expand Down
10 changes: 5 additions & 5 deletions examples/directivities/mic_array_diff_directivities.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pyroomacoustics as pra
import numpy as np
import matplotlib.pyplot as plt
import numpy as np

import pyroomacoustics as pra
from pyroomacoustics.directivities import (
DirectivityPattern,
DirectionVector,
CardioidFamily,
DirectionVector,
DirectivityPattern,
)


dir_1 = CardioidFamily(
orientation=DirectionVector(azimuth=180, colatitude=30, degrees=True),
pattern_enum=DirectivityPattern.HYPERCARDIOID,
Expand Down
6 changes: 3 additions & 3 deletions examples/directivities/plot_directivity_2D.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import numpy as np
import matplotlib.pyplot as plt
import numpy as np

from pyroomacoustics import dB
from pyroomacoustics.directivities import (
DirectivityPattern,
DirectionVector,
CardioidFamily,
DirectionVector,
DirectivityPattern,
)

orientation = DirectionVector(azimuth=0, colatitude=90, degrees=True)
Expand Down
7 changes: 3 additions & 4 deletions examples/directivities/plot_directivity_3D.py
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
9 changes: 5 additions & 4 deletions examples/directivities/source_and_microphone.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import pyroomacoustics as pra
import numpy as np
import matplotlib.pyplot as plt
import numpy as np

import pyroomacoustics as pra
from pyroomacoustics.directivities import (
DirectivityPattern,
DirectionVector,
CardioidFamily,
DirectionVector,
DirectivityPattern,
)

three_dim = True # 2D or 3D
Expand Down
2 changes: 1 addition & 1 deletion examples/doa_algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@

"""

import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import fftconvolve
import matplotlib.pyplot as plt

import pyroomacoustics as pra
from pyroomacoustics.doa import circ_dist
Expand Down
1 change: 1 addition & 0 deletions examples/google_speech_commands_corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import argparse
import os

import pyroomacoustics as pra

if __name__ == "__main__":
Expand Down
4 changes: 3 additions & 1 deletion examples/hmm_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
Then we train a second models on these examples.
"""

from __future__ import print_function, division
from __future__ import division, print_function

import numpy as np

from pyroomacoustics import HMM, CircularGaussianEmission, GaussianEmission

if __name__ == "__main__":
Expand Down
6 changes: 4 additions & 2 deletions examples/noise_reduction_spectral_subtraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
`pyroomacoustics.denoise.apply_spectral_sub` can be used.
"""

import os

import matplotlib.pyplot as plt
import numpy as np
from scipy.io import wavfile
import os

import pyroomacoustics as pra
import matplotlib.pyplot as plt
from pyroomacoustics.denoise import SpectralSub

"""
Expand Down
8 changes: 5 additions & 3 deletions examples/noise_reduction_subspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
`pyroomacoustics.denoise.apply_subspace` can be used.
"""

import os
import time

import matplotlib.pyplot as plt
import numpy as np
from scipy.io import wavfile
import os

import pyroomacoustics as pra
import matplotlib.pyplot as plt
import time
from pyroomacoustics.denoise import Subspace

"""
Expand Down
9 changes: 5 additions & 4 deletions examples/noise_reduction_wiener_filtering.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import os
import time

import matplotlib.pyplot as plt
import numpy as np
from scipy.io import wavfile
import os

import pyroomacoustics as pra
import matplotlib.pyplot as plt
import time
from pyroomacoustics.denoise import IterativeWiener


"""
Test and algorithm parameters
"""
Expand Down
8 changes: 4 additions & 4 deletions examples/randomized_image_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
image method to remove sweeping echoes in RIRs simulated with ISM.
"""

import numpy as np
import pyroomacoustics as pra
import matplotlib.pyplot as plt
from pyroomacoustics.transform import stft
from pyroomacoustics import metrics as met
import numpy as np
from mpl_toolkits.mplot3d import Axes3D

import pyroomacoustics as pra
from pyroomacoustics import metrics as met
from pyroomacoustics.transform import stft

# create an example with sweeping echo - from Enzo's paper
room_size = [4, 4, 4]
Expand Down
1 change: 1 addition & 0 deletions examples/room_complex_wall_materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""
import matplotlib.pyplot as plt
import numpy as np

import pyroomacoustics as pra

# Define the materials array
Expand Down
3 changes: 2 additions & 1 deletion examples/room_from_rt60.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@

import matplotlib.pyplot as plt
import numpy as np
import pyroomacoustics as pra
from scipy.io import wavfile

import pyroomacoustics as pra

methods = ["ism", "hybrid"]

if __name__ == "__main__":
Expand Down
17 changes: 9 additions & 8 deletions examples/simulation_with_measured_directivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,21 @@ class DirectionVector
"""


import pyroomacoustics as pra
import os

import numpy as np
from scipy.io import wavfile
from scipy import signal
from scipy.fft import fftfreq, fft
from scipy.fft import fft, fftfreq
from scipy.io import wavfile
from scipy.signal import fftconvolve

import pyroomacoustics as pra
from pyroomacoustics.directivities import (
DirectivityPattern,
DirectionVector,
CardioidFamily,
DirectionVector,
DirectivityPattern,
DIRPATRir,
)
from scipy.signal import fftconvolve
import os


path_DIRPAT_file = os.path.join(
os.path.dirname(__file__).replace("examples", ""),
Expand Down
Loading