Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colatitude calculation fix #329

Merged

Conversation

fabiodimarco
Copy link
Contributor

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.

Added missing parenthesis and adjusted the tests
@fabiodimarco fabiodimarco changed the title Colatitude Calculation Fix Colatitude calculation fix Nov 16, 2023
@fakufaku fakufaku changed the base branch from master to bugfix/angle_function November 25, 2023 14:46
@fakufaku fakufaku merged commit e78867f into LCAV:bugfix/angle_function Nov 25, 2023
fakufaku added a commit that referenced this pull request Nov 25, 2023
* Fixes a bug in the angle_function for azimuth/colatitude computation (initial PR #329)

---------

Co-authored-by: Fabio Di Marco <[email protected]>
@fakufaku
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants