MCPcopy
hub / github.com/LCAV/pyroomacoustics / test_issue_313

Function test_issue_313

tests/test_issue_313.py:7–50  ·  view source on GitHub ↗

Fixes an issue where the `visibility` attribute of the room is not set if there are no visible source or image source in the room.

()

Source from the content-addressed store, hash-verified

5
6
7def test_issue_313():
8 """
9 Fixes an issue where the `visibility` attribute of the room is not
10 set if there are no visible source or image source in the room.
11 """
12 # Room
13 sigma2 = 5e-4
14 fs = 16000
15
16 corners = np.array(
17 [
18 [0, 0],
19 [10, 0],
20 [10, 16],
21 [0, 16],
22 [0, 10],
23 [8, 10],
24 [8, 6],
25 [0, 6],
26 ]
27 ).T
28 room = pra.Room.from_corners(corners, fs=fs, max_order=1, sigma2_awgn=sigma2)
29
30 # Microphones
31 def mic_array_at(pos: np.ndarray) -> pra.MicrophoneArray:
32 mic_locations = pra.circular_2D_array(center=pos, M=6, phi0=0, radius=37.5e-3)
33 mic_locations = np.concatenate(
34 (mic_locations, np.array(pos, ndmin=2).T), axis=1
35 )
36 return pra.MicrophoneArray(mic_locations, room.fs)
37
38 mic = mic_array_at(np.array([3, 3]))
39 room.add_microphone_array(mic)
40
41 # Sources
42 rng = np.random.RandomState(23)
43 duration_samples = int(fs)
44 source_location = np.array([3, 13])
45 source_signal = rng.randn(duration_samples)
46 room.add_source(source_location, signal=source_signal)
47
48 room.image_source_model()
49
50 room.compute_rir()

Callers

nothing calls this directly

Calls 6

mic_array_atFunction · 0.85
from_cornersMethod · 0.80
add_microphone_arrayMethod · 0.80
add_sourceMethod · 0.80
image_source_modelMethod · 0.80
compute_rirMethod · 0.80

Tested by

no test coverage detected