<?xml version="1.0" encoding="windows-1252"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Signal Filtering with Python</title>
	<atom:link href="http://www.SWHarden.com/blog/2009-01-21-signal-filtering-with-python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.SWHarden.com/blog/2009-01-21-signal-filtering-with-python/</link>
	<description>A collection of thoughts in technological degradation</description>
	<lastBuildDate>Wed, 08 Feb 2012 09:12:28 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Anonymous</title>
		<link>http://www.SWHarden.com/blog/2009-01-21-signal-filtering-with-python/comment-page-1/#comment-16801</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Wed, 07 Sep 2011 16:43:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.SWHarden.com/blog/?p=657#comment-16801</guid>
		<description>Thanks for the code snippet.  I&#039;ve got a few suggestions for you, though: 
1) When I use the line &quot;bp=fft[:]&quot;, modifying bp still alters fft.  I&#039;ve used &quot;bp = fft.copy()&quot; instead.
2) When zeroing out FFT terms, you need to make the zeros symmetric around the mid-point of the FFT spectrum.  The inverse FFT will have a non-negligible imaginary component if the frequency spectrum isn&#039;t symmetric, even though the input data is strictly real.
3) To zero out fft coefficients, it&#039;s easier to write bp[10:-10] = 0
4) To normalize the data, add the line bp *= real(fft.dot(fft))/real(bp.dot(bp)).  fft.dot(fft) gives the total power in the signal, so this redistributes the power in the stop band more or less equally to the pass band.
5) It&#039;s perhaps better to change the variable name &#039;fft&#039; to something else so that it doesn&#039;t conflict with numpy.fft.fft.  If you&#039;re working in iPython, numpy.fft.fft is automagically imported into the global namespace, so trying to use the fft function after running your script could cause a few headaches.</description>
		<content:encoded><![CDATA[<p>Thanks for the code snippet.  I&#8217;ve got a few suggestions for you, though:<br />
1) When I use the line &#8220;bp=fft[:]&#8220;, modifying bp still alters fft.  I&#8217;ve used &#8220;bp = fft.copy()&#8221; instead.<br />
2) When zeroing out FFT terms, you need to make the zeros symmetric around the mid-point of the FFT spectrum.  The inverse FFT will have a non-negligible imaginary component if the frequency spectrum isn&#8217;t symmetric, even though the input data is strictly real.<br />
3) To zero out fft coefficients, it&#8217;s easier to write bp[10:-10] = 0<br />
4) To normalize the data, add the line bp *= real(fft.dot(fft))/real(bp.dot(bp)).  fft.dot(fft) gives the total power in the signal, so this redistributes the power in the stop band more or less equally to the pass band.<br />
5) It&#8217;s perhaps better to change the variable name &#8216;fft&#8217; to something else so that it doesn&#8217;t conflict with numpy.fft.fft.  If you&#8217;re working in iPython, numpy.fft.fft is automagically imported into the global namespace, so trying to use the fft function after running your script could cause a few headaches.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken</title>
		<link>http://www.SWHarden.com/blog/2009-01-21-signal-filtering-with-python/comment-page-1/#comment-16373</link>
		<dc:creator>Ken</dc:creator>
		<pubDate>Thu, 21 Jul 2011 21:17:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.SWHarden.com/blog/?p=657#comment-16373</guid>
		<description>Be careful with this method of &quot;filtering.&quot;  This kind of direct manipulation of the spectrum results in time-aliasing when you take the inverse FFT.  The result is not truly the original signal with its high frequencies filtered out, because the time-aliasing leaves the signal littered with artifacts.

The easiest way to do it properly would be to do a lowpass filter in the time-domain.  

You can do a similar filter in the frequency domain (sort of like you&#039;re doing), but the time-domain data and a filter impulse response needs to be properly zero-padded before you FFT them to avoid circular convolution (which results in time-aliasing).</description>
		<content:encoded><![CDATA[<p>Be careful with this method of &#8220;filtering.&#8221;  This kind of direct manipulation of the spectrum results in time-aliasing when you take the inverse FFT.  The result is not truly the original signal with its high frequencies filtered out, because the time-aliasing leaves the signal littered with artifacts.</p>
<p>The easiest way to do it properly would be to do a lowpass filter in the time-domain.  </p>
<p>You can do a similar filter in the frequency domain (sort of like you&#8217;re doing), but the time-domain data and a filter impulse response needs to be properly zero-padded before you FFT them to avoid circular convolution (which results in time-aliasing).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danny</title>
		<link>http://www.SWHarden.com/blog/2009-01-21-signal-filtering-with-python/comment-page-1/#comment-11535</link>
		<dc:creator>Danny</dc:creator>
		<pubDate>Mon, 22 Nov 2010 15:13:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.SWHarden.com/blog/?p=657#comment-11535</guid>
		<description>Thanks for the article, sure it&#039;ll come in handy cleaning some of my (very noisy) data.</description>
		<content:encoded><![CDATA[<p>Thanks for the article, sure it&#8217;ll come in handy cleaning some of my (very noisy) data.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kamil</title>
		<link>http://www.SWHarden.com/blog/2009-01-21-signal-filtering-with-python/comment-page-1/#comment-10388</link>
		<dc:creator>Kamil</dc:creator>
		<pubDate>Thu, 19 Aug 2010 22:13:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.SWHarden.com/blog/?p=657#comment-10388</guid>
		<description>Thank you, great article!</description>
		<content:encoded><![CDATA[<p>Thank you, great article!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jphn</title>
		<link>http://www.SWHarden.com/blog/2009-01-21-signal-filtering-with-python/comment-page-1/#comment-9700</link>
		<dc:creator>Jphn</dc:creator>
		<pubDate>Mon, 17 May 2010 11:39:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.SWHarden.com/blog/?p=657#comment-9700</guid>
		<description>&quot;This python file requires that test.wav (~700kb) (an actual ECG recording of my heartbeat) be saved in the same folder.&quot;
=&gt; false

Thanks for the code!</description>
		<content:encoded><![CDATA[<p>&#8220;This python file requires that test.wav (~700kb) (an actual ECG recording of my heartbeat) be saved in the same folder.&#8221;<br />
=&gt; false</p>
<p>Thanks for the code!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

