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
Complex normalization #567
Conversation
…gals implement tests
I'm wondering about the meaning of the |
Maybe |
pyfar/classes/audio.py
Outdated
if self._complex and fft_norm in ["rms", "power"]: | ||
raise ValueError((f"'{fft_norm}' normalization is not valid " | ||
if self._complex and fft_norm in ["rms", "power", "psd"]: | ||
raise ValueError((f"'{fft_norm} normalization is not valid " |
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.
Lets maybe give a full list of non-valid norms. Otherwise one might change the norm to get the same error again:
'The rms, power, and psd FFT normalizations are not valid for complex signals'
pyfar/classes/audio.py
Outdated
# check fft norm if complex flag was set | ||
if self._complex: | ||
if self.fft_norm in ["rms", "power", "psd"]: | ||
raise ValueError((f"'{self.fft_norm}' normalization is not " |
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.
See above
@@ -957,7 +962,7 @@ def fft_norm(self, value): | |||
raise ValueError(("Invalid FFT normalization. Has to be " | |||
f"{', '.join(self._VALID_FFT_NORMS)}, but found " | |||
f"'{value}'")) | |||
if self._complex and value in ["rms", "power"]: | |||
if self._complex and value in ["rms", "power", "psd"]: |
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.
See above
pyfar/dsp/dsp.py
Outdated
@@ -2261,6 +2261,10 @@ def normalize(signal, reference_method='max', domain='time', | |||
raise ValueError(( | |||
f"domain is '{domain}' and signal is type '{signal.__class__}'" | |||
" but must be of type 'Signal' or 'FrequencyData'.")) | |||
if isinstance(signal, (pyfar.TimeData, pyfar.Signal)): | |||
if signal.complex and reference_method in ['energy', 'power', 'rms']: | |||
raise ValueError(f'{reference_method} is not implemented for ' |
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.
Lets maybe give a full list of non-valid methods. Otherwise one might change the norm to get the same error again:
'The energy, power, and rms reference methods are not implemented for complex signals'
implement more detailed value error messages
Which issue(s) are closed by this pull request?
Changes proposed in this pull request: