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
Relax arithmetic rules in case only one audio object is involved #606
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing! How about testing if its really working, to make sure it will work in future as well.
I did a quick check locally, and everything works. I'll add it if we decide to change the behaviour - I added a todo in the PR description to make sure we dont forget. Just didn't want to do too much work that might be discarded :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest not to change the behaviour of _match_fft_norm
instead jsut call it if we have more then 1 Audio object
pyfar/classes/audio.py
Outdated
found_audio_data = False | ||
for n, d in enumerate(data): | ||
n_audio_objects = 0 | ||
for d in enumerate(data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for d in enumerate(data): | |
for _, d in enumerate(data): |
otherwise sth breaks
pyfar/classes/audio.py
Outdated
fft_norm = _match_fft_norm( | ||
fft_norm, d.fft_norm, division, n_audio_objects) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fft_norm = _match_fft_norm( | |
fft_norm, d.fft_norm, division, n_audio_objects) | |
fft_norm = d.fft_norm if n_audio_objects < 2 else \ | |
_match_fft_norm(fft_norm, d.fft_norm, division) |
I would not change the behaviour of _match_fft_norm, instead i would just call it, if we have more then 1 audio object.
pyfar/classes/audio.py
Outdated
@@ -1501,7 +1503,7 @@ def _matrix_multiplication(a, b, axes, audio_type): | |||
return np.matmul(a, b, axes=axes) | |||
|
|||
|
|||
def _match_fft_norm(fft_norm_1, fft_norm_2, division=False): | |||
def _match_fft_norm(fft_norm_1, fft_norm_2, division=False, n_audio_objects=2): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def _match_fft_norm(fft_norm_1, fft_norm_2, division=False, n_audio_objects=2): | |
def _match_fft_norm(fft_norm_1, fft_norm_2, division=False): |
then there would be no need to change the behaviour here.
@ahms5 implemented your changes as suggested. Now I'm waiting for the weekly before changing any tests |
ee53ccd
to
3cd328a
Compare
Which issue(s) are closed by this pull request?
Closes #587
Changes proposed in this pull request:
For discussion
I discovered that we had a test that explicitly does not allow
1/signal
if the FFT norm is not'none'
. I did not remove this test yet. Do we want to stay hard?