LCAV / pyroomacoustics

Pyroomacoustics is a package for audio signal processing for indoor applications. It was developed as a fast prototyping platform for beamforming algorithms in indoor scenarios.
https://pyroomacoustics.readthedocs.io
MIT License
1.33k stars 417 forks source link

Colatitude calculation fix #329

Closed fabiodimarco closed 5 months ago

fabiodimarco commented 6 months ago

Description

This update fixed the colatitude calculation. A missing parenthesis was added, and the associated tests were adjusted accordingly.

Code Change

Previous Code:

colatitude = np.arctan2(
    ((x_vals - x2) ** 2 + (y_vals - y2) ** 2) ** 1 / 2, (z_vals - z2)
)

Updated Code:

colatitude = np.arctan2(
    ((x_vals - x2) ** 2 + (y_vals - y2) ** 2) ** (1 / 2), (z_vals - z2)
)

Implications

The absence of parenthesis around 1 / 2 led to miscalculations of the colatitude angle. This is particularly relevant in simulations involving Cardioid or Hypercardioid microphones or in case of directional sources.

fakufaku commented 5 months ago

Thanks for finding this bug, this is a nasty one! This has been merged into master as part of #332