-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #191, a bug when setting air abosrption coefficients manually. …
…Improves the doc.
- Loading branch information
Showing
6 changed files
with
94 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import pyroomacoustics as pra | ||
import numpy as np | ||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def room(): | ||
fs = 16000 | ||
c = pra.constants.get("c") | ||
room_dim = np.array([c, c, 2 * c]) | ||
src = np.ones(3) * 0.5 * c | ||
mic = np.array([0.5, 0.5, 1.5]) * c | ||
mat = pra.Material(energy_absorption="hard_surface") | ||
room = ( | ||
pra.ShoeBox(room_dim, fs, max_order=1, materials=mat) | ||
.add_source(src) | ||
.add_microphone(mic) | ||
) | ||
return room | ||
|
||
|
||
def test_set_air_absorption_1(room): | ||
air_abs = 0.5 | ||
room.set_air_absorption([air_abs]) | ||
|
||
air_abs_coeffs = room.air_absorption | ||
assert len(air_abs_coeffs) == 7 | ||
assert all([a == air_abs for a in air_abs_coeffs]) | ||
|
||
|
||
def test_set_air_absorption_2(room): | ||
air_abs = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7] | ||
room.set_air_absorption(air_abs) | ||
|
||
air_abs_coeffs = room.air_absorption | ||
assert len(air_abs_coeffs) == 7 | ||
assert all(air_abs == air_abs_coeffs) |