For one of my DSP projects, I decided to use python to perform signal processing. While I am new to python, I understand that it is a very powerful and versatile language. For my processing, I opted to use Scipy's signal library to perform the signal processing, where I designed an analog, Butterworth lowpass filter. When it was time to apply the filter, using the "signal.lfilter" command, I received the following error:
"Traceback (most recent call last):
File "C:\Users\bessi\Desktop\crying.py", line 39, in <module>
f = signal.lfilter(b, a, data, axis = 0)
File "C:\Users\bessi\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\signal\signaltools.py", line 1397, in lfilter
return sigtools._linear_filter(b, a, x, axis)
ValueError: selected axis is out of range"
The lines of code associated with the design and application of the filter, are as follows, with the first line, being the line that creates the lowpass filter, while the second line, with the lfilter command, is where the error occurs (line 39)
b, a = signal.butter(4, 21980, 'low', analog = True, output='ba')
f = signal.lfilter(b, a, data)
(Data is the input, sampled signal. )
This value error has been confusing me all evening, as it is saying that my axis parameter is invalid. What confuses me even more, is the fact that the axis input argument for the function has a default value of '-1' which I did not originally tamper with. I tried to adjust the axis value, and even tried to hardcode values, however, this same error keeps showing up. Hoping someone can offer some advice/assistance.
The links for the lfilter command: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.lfilter.html#scipy.signal.lfilter
Link for the scipy filter creation: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html#scipy.signal.butter