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
import tftb
import numpy as np
signal = np.zeros(13)
wvd = tftb.processing.WignerVilleDistribution(signal)
wvd.run()
and gives:
Traceback (most recent call last):
File "", line 3, in
File "/Users/[...]/opt/anaconda3/envs/tftb/lib/python3.8/site-packages/tftb/processing/cohen.py", line 165, in run
self.tfr[tausec, icol] = self.signal[icol + tausec, 0] *
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
but this doesn't
import tftb
import numpy as np
signal = np.zeros(12)
wvd = tftb.processing.WignerVilleDistribution(signal)
wvd.run()
Is there are reason for that?
The text was updated successfully, but these errors were encountered:
chapochn
changed the title
WignerVillerDistriubtion crashed signal lenghts
WignerVillerDistriubtion crashes for different signal lenghts
Feb 26, 2021
Dealing with the same issue. I believe it is due to the logic in the if statement ported from Matlab.
Please correct me if I'm wrong, but it seems pytftb ravels() the input signal. If so, then indexing into the second dimension is a leftover from Matlab where the input array has shape [xrow, xcol]. When calculating the auto-WVD xcol will be 1 in Matlab, and for pytftb it will always be one (technically it is squeezed out). So we can fully drop the second indexing.
I believe the logic of the if statement also needs a check. It is a copy of the Matlab logic which introduces the classic/annoying off-by-one error since Matlab indexes start from one. After changing the logic as follows:
Change from this: if (icol <= self.signal.shape[0] - tausec) and (icol >= tausec + 1)
To this: if (icol <= self.signal.shape[0] - tausec - 1) and (icol >= tausec)
I avoid any boundary issues.
Lastly (sorry if adding too much here...) we are missing a factor of 1/2 inside the loop:
Hello,
This crashes:
and gives:
Traceback (most recent call last):
File "", line 3, in
File "/Users/[...]/opt/anaconda3/envs/tftb/lib/python3.8/site-packages/tftb/processing/cohen.py", line 165, in run
self.tfr[tausec, icol] = self.signal[icol + tausec, 0] *
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
but this doesn't
Is there are reason for that?
The text was updated successfully, but these errors were encountered: