adds sofa database as attrdict #501
30 errors
Black found 30 errors
Annotations
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/examples/beamforming_delay_and_sum.py#L1-L9
"""
This example shows how to create delay and sum beamformers
"""
+
from __future__ import division, print_function
import matplotlib.pyplot as plt
import numpy as np
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/examples/adaptive_filters.py#L2-L12
Adaptive Filters Example
========================
In this example, we will run adaptive filters for system identification.
"""
+
from __future__ import division, print_function
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import fftconvolve
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/examples/adaptive_filter_stft_domain.py#L3-L13
======================================
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
import numpy as np
from scipy.signal import fftconvolve
Check failure on line 10 in /home/runner/work/pyroomacoustics/pyroomacoustics/examples/datasets.py
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/examples/datasets.py#L1-L10
"""
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
samples = [
{
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/examples/room_L_shape_3d_rt.py#L5-L15
one source and two microphones in the room and compute the room impulse
responses.
The simulation is done using the hybrid ISM/RT simulator.
"""
+
from __future__ import print_function
import time
import matplotlib.pyplot as plt
Check failure on line 10 in /home/runner/work/pyroomacoustics/pyroomacoustics/examples/raytracing.py
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/examples/raytracing.py#L1-L10
"""
This example program demonstrates the use of ray tracing
for the simulation of rooms of different sizes.
"""
+
from __future__ import print_function
import argparse
import sys
import time
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/examples/room_complex_wall_materials.py#L2-L12
This examples demonstrates how to build a 3D room for multi-band simulation
with rich wall materials.
2022 (c) @noahdeetzers, @fakufaku
"""
+
import matplotlib.pyplot as plt
import numpy as np
import pyroomacoustics as pra
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/examples/bss_example.py#L52-L62
5. Save the separated sources as .wav files
6. Show a GUI where a mixed signals and the separated sources can be played
This script requires the `mir_eval` to run, and `tkinter` and `sounddevice` packages for the GUI option.
"""
+
import time
import numpy as np
from mir_eval.separation import bss_eval_sources
from scipy.io import wavfile
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/examples/room_from_rt60.py#L2-L12
This example creates a room with reverberation time specified by inverting Sabine's formula.
This results in a reverberation time slightly longer than desired.
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
import numpy as np
from scipy.io import wavfile
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/examples/room_from_stl.py#L3-L13
Currently, the materials need to be set in the program which is not very practical
when different walls have different materials.
The STL file was kindly provided by Diego Di Carlo (@Chutlhu).
"""
+
import argparse
import os
from pathlib import Path
import matplotlib.pyplot as plt
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/pyroomacoustics/adaptive/lms.py#L3-L13
=========================
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
import scipy.linalg as la
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/examples/simulation_with_measured_directivity.py#L58-L69
We can also use the objects separately.
~ Prerak SRIVASTAVA, 8/11/2022
"""
-
import os
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/pyroomacoustics/adaptive/subband_lms.py#L24-L35
import numpy as np
class SubbandLMS:
-
"""
Frequency domain implementation of LMS. Adaptive filter for each
subband.
Parameters
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/pyroomacoustics/bss/fastmnmf.py#L159-L172
lambda_NFT = W_NFK @ H_NKT + eps
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)
# udpate Q (matrix for joint diagonalization)
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/pyroomacoustics/datasets/tests/test_corpus_base.py#L1-L10
"""
Example of the basic operations with ``pyroomacoustics.datasets.Dataset``
and ``pyroomacoustics.datasets.Sample`` classes
"""
+
from pyroomacoustics.datasets import Dataset, Sample
def test_dataset():
# Prepare a few artificial samples
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/pyroomacoustics/datasets/cmu_arctic.py#L27-L37
Price: Free
URL: http://www.festvox.org/cmu_arctic/
"""
+
import os
import numpy as np
from scipy.io import wavfile
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/pyroomacoustics/doa/grid.py#L1-L9
"""
Routines to perform grid search on the sphere
"""
+
from __future__ import absolute_import, division, print_function
from abc import ABCMeta, abstractmethod
import numpy as np
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/pyroomacoustics/doa/plotters.py#L1-L9
"""
A collection of functions to plot maps and points on circles and spheres.
"""
+
import numpy as np
def polar_plt_dirac(
self,
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/pyroomacoustics/doa/utils.py#L1-L10
"""
This module contains useful functions to compute distances and errors on on
circles and spheres.
"""
+
from __future__ import division
import collections
import numpy as np
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/pyroomacoustics/experimental/signals.py#L1-L9
"""
A few test signals like sweeps and stuff.
"""
+
from __future__ import division, print_function
import numpy as np
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/pyroomacoustics/beamforming.py#L345-L356
# =========================================================================
import copy
class MicrophoneArray(object):
-
"""Microphone array class."""
def __init__(self, R, fs, directivity=None):
R = np.array(R)
self.dim = R.shape[0] # are we in 2D or in 3D
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/pyroomacoustics/tests/test_bandpass_filterbank.py#L1-L9
"""
This tests the construction of a bank of octave filters
"""
+
import numpy as np
from scipy.signal import sosfreqz
import pyroomacoustics as pra
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/pyroomacoustics/tests/test_issue_22.py#L12-L22
Room.image_source_model() 25000 times.
If the C module is not installed (pure python
fallback version), then nothing is done.
"""
+
import numpy as np
import pyroomacoustics
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/pyroomacoustics/open_sofa_interpolate.py#L647-L658
return ax
class SOFADirectivityFactory:
-
"""
This class reads measured directivities from a
`SOFA <https://www.sofaconventions.org>`_ format file.
Optionally, it can perform interpolation of the impulse responses onto a finer grid.
The interpolation is done in the spherical harmonics domain.
github-actions / Black
/home/runner/work/pyroomacoustics/pyroomacoustics/pyroomacoustics/tests/test_random_ism.py#L3-L13
@author: od0014
Script to test removal of sweeping echoes with randomized image method
"""
+
import pyroomacoustics as pra
from pyroomacoustics import metrics as met
# create an example with sweeping echo - from Enzo's paper
room_size = [4, 4, 4]