Skip to content

Commit

Permalink
Fixes some bugs
Browse files Browse the repository at this point in the history
1) There was a but in the bounding box computation of AnechoicRoom
2) There were some inconsistensies in the build of ``rir_build``
  • Loading branch information
fakufaku committed Aug 7, 2024
1 parent cd9fb84 commit b1052c4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ adheres to `Semantic Versioning <http://semver.org/spec/v2.0.0.html>`_.
`Unreleased`_
-------------

Nothing yet
Bugfix
~~~~~~

- Fixes a bug when plotting an anechoic room
- Fixes a buggy assert from ``rir_build.cpp``
- Makes the build system consistent for all source files in ``pyroomacoustics/libroom_src``

`0.7.6`_ - 2024-08-05
---------------------
Expand Down
2 changes: 0 additions & 2 deletions pyroomacoustics/libroom_src/rir_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ void threaded_rir_builder_impl(
int max_sample = int(std::ceil(fs * t_max)) + fdl2;
int min_sample = int(std::floor(fs * t_min)) - fdl2;

assert(min_samples >= 0);

if (min_sample < 0)
throw std::runtime_error("minimum time recorded is less than 0");
if (max_sample >= int(rir_len))
Expand Down
2 changes: 2 additions & 0 deletions pyroomacoustics/libroom_src/rir_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ void delay_sum(const py::buffer irs, const py::buffer delays, py::buffer output,
void fractional_delay(py::buffer out, const py::buffer time, size_t lut_gran,
size_t num_threads);

#include "rir_builder.cpp"

#endif // __RIR_BUILDER_HPP__
8 changes: 4 additions & 4 deletions pyroomacoustics/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -3153,12 +3153,12 @@ def get_bbox(self):
upper = -np.inf * np.ones((self.dim,))

if self.mic_array is not None:
lower = np.min(np.r_[lower[None, :], self.mic_array.R], axis=0)
upper = np.max(np.r_[upper[None, :], self.mic_array.R], axis=0)
lower = np.min(np.column_stack((lower, self.mic_array.R)), axis=1)
upper = np.max(np.column_stack((upper, self.mic_array.R)), axis=1)

for i, source in enumerate(self.sources):
lower = np.min(np.r_[lower[None, :], source.position[None, :]], axis=0)
upper = np.max(np.c_[upper[None, :], source.position[None, :]], axis=0)
lower = np.min(np.row_stack((lower, source.position)), axis=0)
upper = np.max(np.row_stack((upper, source.position)), axis=0)

return np.c_[lower, upper]

Expand Down
2 changes: 1 addition & 1 deletion pyroomacoustics/tests/test_build_rir.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def measure_runtime(dtype=np.float32, num_threads=4):

test_fractional_delay(np.float32, 2e-2)
test_fractional_delay(np.float64, 2e-2)
test_delay_sum(np.float32, 1e-6)
test_delay_sum(np.float32, 1e-4)

for t, a, v in zip(times, alphas, visibilities):
ir_ref, ir_cython = build_rir_wrap(t, a, v, fs, fdl)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __str__(self):
ext_modules = [
Extension(
"pyroomacoustics.libroom",
[os.path.join(libroom_src_dir, f) for f in ["libroom.cpp", "rir_builder.cpp"]],
[os.path.join(libroom_src_dir, f) for f in ["libroom.cpp"]],
depends=libroom_files,
include_dirs=[
".",
Expand Down

0 comments on commit b1052c4

Please sign in to comment.