You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{
"name": "ValueError",
"message": "Either fft_norm_2 (denominator) has to be 'none' or both fft_norms must be the same, but they are none and rms.",
"stack": "---------------------------------------------------------------------------ValueErrorTraceback (mostrecentcalllast)
CellIn[4], line42signal=pf.signals.exponential_sweep_time(44100, (50, 2e4))
3signal.fft_norm='rms'---->41/signalFile~/anaconda3/envs/electroacoustics/lib/python3.11/site-packages/pyfar/classes/audio.py:519, inFrequencyData.__rtruediv__(self, data)
518def__rtruediv__(self, data):
-->519returndivide((data, self), 'freq')
File~/anaconda3/envs/electroacoustics/lib/python3.11/site-packages/pyfar/classes/audio.py:1049, individe(data, domain)
1008defdivide(data: tuple, domain='freq'):
1009 \"\"\"Dividepyfaraudioobjects, arraylikes, andscalars.
10101011Pyfaraudioobjectsare: :py:func:`Signal`, :py:func:`TimeData`, and
(...)
1047*Othercombinationsraiseanerror.
1048 \"\"\"->1049return_arithmetic(data, domain, _divide)
File~/anaconda3/envs/electroacoustics/lib/python3.11/site-packages/pyfar/classes/audio.py:1271, in_arithmetic(data, domain, operation, **kwargs)
1267division=Trueifoperation==_divideelseFalse1268matmul=Trueifoperation==_matrix_multiplicationelseFalse1269sampling_rate, n_samples, fft_norm, times, frequencies, audio_type, \\
1270cshape= \\
->1271_assert_match_for_arithmetic(data, domain, division, matmul)
1273# apply arithmetic operation1274result=_get_arithmetic_data(data[0], domain, cshape, matmul, audio_type)
File~/anaconda3/envs/electroacoustics/lib/python3.11/site-packages/pyfar/classes/audio.py:1370, in_assert_match_for_arithmetic(data, domain, division, matmul)
1365n_samples=d.n_samples1366# if a signal comes first (n==0) its fft_norm is taken1367# directly. If a signal does not come first, (n>0, e.g.1368# 1/signal), the fft norm is matched1369fft_norm=d.fft_normifn==0else \\
->1370_match_fft_norm(fft_norm, d.fft_norm, division)
1371elifisinstance(d, TimeData):
1372ifdomain!= \"time\":
File~/anaconda3/envs/electroacoustics/lib/python3.11/site-packages/pyfar/classes/audio.py:1579, in_match_fft_norm(fft_norm_1, fft_norm_2, division)
1576fft_norm_result='none'1578else:
->1579raiseValueError((\"Eitherfft_norm_2 (denominator) hastobe \"
1580 \"'none'orbothfft_normsmustbethesame, but \"
1581f\"theyare {fft_norm_1} and {fft_norm_2}.\"))
1583returnfft_norm_resultValueError: Eitherfft_norm_2 (denominator) hastobe'none'orbothfft_normsmustbethesame, buttheyarenoneandrms."
}
The text was updated successfully, but these errors were encountered:
That's an interesting issue. Seems like it is due to the fact that internally 1 is "cast" to a Signal with "none" normalisation.
In any case I'd recommend using the regularised spectrum inversion for the example you provided (if the example you provided is not an irrelevant toy example)
General
Description
Hi,
When using an fft normalization other than
none
, inverting the signal with the division operator1 / signal
throws the error:Inverting with
signal**-1
works fine.What I Did
The text was updated successfully, but these errors were encountered: