Reputation: 3
I'm trying to find the peaks of and EMG signal which i converted into the frequency domain with the use of FFT. My problem is that when I try to use the command Find_peaks from the scipy.signal libraries it gives me a warning of ValueError: x
must be a 1D array. could someone please point me in the right path because I am having a hard time of understanding how I could find the peaks of my signal in the frequency domain, should I convert it back to the time domain or should I find a way to compress the array. (P.S. I am still a newbie, all the help is much appreciated).This is what I was able to code
Upvotes: 0
Views: 629
Reputation: 2409
The results of scipy's FFT is a multi-dimensional array that includes complex-number results of the transform, represented as a 2-element vector. The find_peaks
call can only accept a 1D array. You may need to either convert these to a scalar (perhaps take the absolute value of the tuples), or you can use a peak detector that operates in more domains. Check out this related question for some options.
If you convert to 1D, peakutil is a package that may help you (though it doesn't appear to be dramatically more powerful than find_peaks
for your needs).
For more details, you can also see some of the answers to the questions here, a related question.
Upvotes: 1