[SciPy-User] Low pass filter

Kaan AKŞİT kunguz at gmail.com
Thu Sep 17 11:19:22 EDT 2009


May be butterworth is not the correct way to make it. Can it be like that?

17 Eylül 2009 17:17 tarihinde Kaan AKŞİT <kunguz at gmail.com> yazdı:

> Thanks Ivo, The problem is after filtering I got the same signal. I wanted
> to clear the frequencies higher then 5 Hz. My code is similar to yours but
> the output doesn't seem logical:
>
> #!/usr/bin/python
> # -*- coding: utf-8 -*-
> import time, array, datetime
> import matplotlib
> import matplotlib.pyplot as plt
> from scipy import *
> from scipy.signal import butter, lfilter
>
> input = 0
> timing = []
> voltage  = []
> values = []
>
> input = 0
> infile = open('measurements/' + "data.csv", "r")
> for line in infile.readlines():
>     values = line.split(',')
>     voltage.insert(input,float(values[0]))
>     timing.insert(input,float(values[1]))
>     input = input + 1
> plt.xlabel('Time steps')
> plt.ylabel('Voltage')
> plt.title('Measurments from Oscilloscope')
> plt.grid(True)
> plt.plot(voltage,timing)
> [b,a]=butter(2,5)
> voltagelowp=lfilter(b,a,voltage)
> plt.plot(voltagelowp,timing)
> plt.show()
> plt.close()
>
> 2009/9/17 Ivo Maljevic <ivo.maljevic at gmail.com>
>
> Does the following:
>>
>> plt.plot(timing, voltage)
>> plt.show()
>>
>> work before filtering? (Suggestion, you may want to put time on x-axis,
>> see the line above)
>>
>> I just wrote a small test program, and it works:
>>
>>
>> #!/usr/bin/python
>>
>> # import
>> import pylab as plt
>> from scipy import *
>> from scipy.signal import butter, lfilter
>>
>> t=linspace(0,1,100)
>> v=sin(2*pi*t)
>>
>> (b,a)=butter(2,5,btype='low')
>> v=lfilter(b,a,v)
>> plt.plot(t,v)
>> plt.show()
>>
>>
>> 2009/9/17 Kaan AKŞİT <kunguz at gmail.com>
>>
>>>  Hi all,
>>>
>>> This is my first time that I use Scipy. I have two arrays both of them
>>> one dimensional. One of them is filled with voltage values and one of them
>>> is filled with time values. I want to apply low pass filter to clear the
>>> noise from the data. Can you please help me? I already wrote something but
>>> it is not working:
>>>
>>> (b,a)=butter(2,5,btype='low')
>>> voltage=lfilter(b,a,voltage)
>>> plt.plot(voltage,timing)
>>>
>>> Best regards,
>>> Kaan
>>>
>>> _______________________________________________
>>> SciPy-User mailing list
>>> SciPy-User at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>>
>>>
>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20090917/136b6494/attachment.html>


More information about the SciPy-User mailing list