<?xml version="1.0" encoding="UTF-8"?><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: Python and real time graphical analysis</title>
	<atom:link href="http://www.sharms.org/blog/2009/11/24/python-and-real-time-graphical-analysis/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sharms.org/blog/2009/11/24/python-and-real-time-graphical-analysis/</link>
	<description>Technology, Linux, Life</description>
	<lastBuildDate>Mon, 08 Mar 2010 00:16:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: sharms</title>
		<link>http://www.sharms.org/blog/2009/11/24/python-and-real-time-graphical-analysis/comment-page-1/#comment-6107</link>
		<dc:creator>sharms</dc:creator>
		<pubDate>Wed, 25 Nov 2009 14:28:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.sharms.org/blog/?p=650#comment-6107</guid>
		<description>Spider is correct, these are just tests, in real life I use the output of a bunch of these types of calculations.

I compiled it with &#039;gcc -g -Wall&#039; which appears to use -O0, as when I recompiled with O1 my time passed is 0ms.</description>
		<content:encoded><![CDATA[<p>Spider is correct, these are just tests, in real life I use the output of a bunch of these types of calculations.</p>
<p>I compiled it with &#8216;gcc -g -Wall&#8217; which appears to use -O0, as when I recompiled with O1 my time passed is 0ms.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Spider</title>
		<link>http://www.sharms.org/blog/2009/11/24/python-and-real-time-graphical-analysis/comment-page-1/#comment-6106</link>
		<dc:creator>Spider</dc:creator>
		<pubDate>Wed, 25 Nov 2009 10:29:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.sharms.org/blog/?p=650#comment-6106</guid>
		<description>@Ronan:  Most probably yes.   But my guess would be that in &quot;reality&quot; it&#039;d be used to create a difference average/difference-map between the two.  However, since this testcase just doesn&#039;t actually do anything with the counts, it would end up being void.</description>
		<content:encoded><![CDATA[<p>@Ronan:  Most probably yes.   But my guess would be that in &#8220;reality&#8221; it&#8217;d be used to create a difference average/difference-map between the two.  However, since this testcase just doesn&#8217;t actually do anything with the counts, it would end up being void.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Holly</title>
		<link>http://www.sharms.org/blog/2009/11/24/python-and-real-time-graphical-analysis/comment-page-1/#comment-6105</link>
		<dc:creator>Holly</dc:creator>
		<pubDate>Wed, 25 Nov 2009 09:53:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.sharms.org/blog/?p=650#comment-6105</guid>
		<description>Maybe I&#039;m missing something, but why have you got
screen1[x][y] * screen2[x][y] in the loops.  The result doesn&#039;t appear to be used for anything.</description>
		<content:encoded><![CDATA[<p>Maybe I&#8217;m missing something, but why have you got<br />
screen1[x][y] * screen2[x][y] in the loops.  The result doesn&#8217;t appear to be used for anything.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ronan</title>
		<link>http://www.sharms.org/blog/2009/11/24/python-and-real-time-graphical-analysis/comment-page-1/#comment-6104</link>
		<dc:creator>Ronan</dc:creator>
		<pubDate>Wed, 25 Nov 2009 09:41:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.sharms.org/blog/?p=650#comment-6104</guid>
		<description>Do you realise that your compare_array() C function will be optimized into a noop by gcc if you use -O1 or above ?</description>
		<content:encoded><![CDATA[<p>Do you realise that your compare_array() C function will be optimized into a noop by gcc if you use -O1 or above ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: oliver</title>
		<link>http://www.sharms.org/blog/2009/11/24/python-and-real-time-graphical-analysis/comment-page-1/#comment-6103</link>
		<dc:creator>oliver</dc:creator>
		<pubDate>Wed, 25 Nov 2009 09:26:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.sharms.org/blog/?p=650#comment-6103</guid>
		<description>Would also recommend numpy, or opencv for more complicated image analysis.</description>
		<content:encoded><![CDATA[<p>Would also recommend numpy, or opencv for more complicated image analysis.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sharms</title>
		<link>http://www.sharms.org/blog/2009/11/24/python-and-real-time-graphical-analysis/comment-page-1/#comment-6102</link>
		<dc:creator>sharms</dc:creator>
		<pubDate>Wed, 25 Nov 2009 04:19:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.sharms.org/blog/?p=650#comment-6102</guid>
		<description>Ulrik - that is fantastic, I will stick with numpy.  Thanks for saving me a lot of time and ignorance</description>
		<content:encoded><![CDATA[<p>Ulrik &#8211; that is fantastic, I will stick with numpy.  Thanks for saving me a lot of time and ignorance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Doe</title>
		<link>http://www.sharms.org/blog/2009/11/24/python-and-real-time-graphical-analysis/comment-page-1/#comment-6100</link>
		<dc:creator>John Doe</dc:creator>
		<pubDate>Wed, 25 Nov 2009 02:35:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.sharms.org/blog/?p=650#comment-6100</guid>
		<description>Ulrik: I&#039;ve tried with itertools.izip (and normal zip) before posting the code and it was a lot slower. I forgot about the _abs trick but it worked well (-100ms).

def compareArrays(screen1, screen2):
    _abs = abs
    for x in xrange(0, 1920):
        s2x = screen2[x]
        for y, e in enumerate(screen1[x]):
            diff = _abs(e - s2x[y])
            combo = e * s2x[y]</description>
		<content:encoded><![CDATA[<p>Ulrik: I&#8217;ve tried with itertools.izip (and normal zip) before posting the code and it was a lot slower. I forgot about the _abs trick but it worked well (-100ms).</p>
<p>def compareArrays(screen1, screen2):<br />
    _abs = abs<br />
    for x in xrange(0, 1920):<br />
        s2x = screen2[x]<br />
        for y, e in enumerate(screen1[x]):<br />
            diff = _abs(e &#8211; s2x[y])<br />
            combo = e * s2x[y]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ulrik</title>
		<link>http://www.sharms.org/blog/2009/11/24/python-and-real-time-graphical-analysis/comment-page-1/#comment-6099</link>
		<dc:creator>Ulrik</dc:creator>
		<pubDate>Wed, 25 Nov 2009 01:57:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.sharms.org/blog/?p=650#comment-6099</guid>
		<description>John Doe -- if you want to speed up pure-python loops, here are some things you can try: Loop by value, not by index.

for x, y in itertools.izip(screen1, screen2): diff = _abs(x - y); combo = x *y

tip nr 2:

for function calls inside loops (avoid these, but we have abs above), rebind the function to a local variable for the loop. So just before the for loop we define _abs = abs.</description>
		<content:encoded><![CDATA[<p>John Doe &#8212; if you want to speed up pure-python loops, here are some things you can try: Loop by value, not by index.</p>
<p>for x, y in itertools.izip(screen1, screen2): diff = _abs(x &#8211; y); combo = x *y</p>
<p>tip nr 2:</p>
<p>for function calls inside loops (avoid these, but we have abs above), rebind the function to a local variable for the loop. So just before the for loop we define _abs = abs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Doe</title>
		<link>http://www.sharms.org/blog/2009/11/24/python-and-real-time-graphical-analysis/comment-page-1/#comment-6098</link>
		<dc:creator>John Doe</dc:creator>
		<pubDate>Wed, 25 Nov 2009 01:53:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.sharms.org/blog/?p=650#comment-6098</guid>
		<description>100ms more!

def compareArrays(screen1, screen2):
    for x in xrange(0, 1920):
        s2x = screen2[x]
        for y, e in enumerate(screen1[x]):
            diff = abs(e - s2x[y])
            combo = e * s2x[y]</description>
		<content:encoded><![CDATA[<p>100ms more!</p>
<p>def compareArrays(screen1, screen2):<br />
    for x in xrange(0, 1920):<br />
        s2x = screen2[x]<br />
        for y, e in enumerate(screen1[x]):<br />
            diff = abs(e &#8211; s2x[y])<br />
            combo = e * s2x[y]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ulrik</title>
		<link>http://www.sharms.org/blog/2009/11/24/python-and-real-time-graphical-analysis/comment-page-1/#comment-6097</link>
		<dc:creator>Ulrik</dc:creator>
		<pubDate>Wed, 25 Nov 2009 01:38:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.sharms.org/blog/?p=650#comment-6097</guid>
		<description>Numpy -- written in C so that you don&#039;t have to.</description>
		<content:encoded><![CDATA[<p>Numpy &#8212; written in C so that you don&#8217;t have to.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic page generated in 0.282 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-03-10 04:21:56 -->
