<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Micropore</title>
	<atom:link href="http://micropore.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://micropore.wordpress.com</link>
	<description></description>
	<lastBuildDate>Mon, 16 Jan 2012 20:51:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='micropore.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/45dcdf616c862501e3cb5708d9de6940?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Micropore</title>
		<link>http://micropore.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://micropore.wordpress.com/osd.xml" title="Micropore" />
	<atom:link rel='hub' href='http://micropore.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Debian Wheezy repository</title>
		<link>http://micropore.wordpress.com/2012/01/16/debian-wheezy-repository/</link>
		<comments>http://micropore.wordpress.com/2012/01/16/debian-wheezy-repository/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 20:50:00 +0000</pubDate>
		<dc:creator>micropore</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[broadcom wireless]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nvidia graphics]]></category>

		<guid isPermaLink="false">http://micropore.wordpress.com/?p=1128</guid>
		<description><![CDATA[This is the repository of the Debian testing, wheezy. It is still in the testing branch and will be stable by end of 2012. I have installed that recently. ################################################################################## deb ftp://ftp.debian.org/debian wheezy main contrib non-free deb-src ftp://ftp.debian.org/debian wheezy main contrib non-free deb http://ftp.debian.org/debian wheezy-proposed-updates main contrib non-free #deb http://security.debian.org/debian-security Wheezy/updates main deb http://security.debian.org/ wheezy/updates [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=micropore.wordpress.com&amp;blog=10457582&amp;post=1128&amp;subd=micropore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is the repository of the <a href="http://en.wikipedia.org/wiki/Debian">Debian</a> testing, wheezy. It is still in the testing branch and will be stable by end of 2012. I have installed that recently. ################################################################################## deb ftp://ftp.debian.org/debian wheezy main contrib non-free deb-src ftp://ftp.debian.org/debian wheezy main contrib non-free deb http://ftp.debian.org/debian wheezy-proposed-updates main contrib non-free #deb http://security.debian.org/debian-security Wheezy/updates main deb http://security.debian.org/ wheezy/updates main contrib non-free deb http://www.debian-multimedia.org wheezy main non-free deb http://download.skype.com/linux/repos/debian/ stable non-free  ################################################################################## <strong></strong></p>
<h4><strong>The procedure:</strong></h4>
<p>Basically I have changed the source file (/etc/apt/sources.list), then run <strong>apt-get update</strong>, and then <strong>apt-get dist-upgrade</strong>.  It updated the list, and downloaded all the new packages. After that, the old packages were removed and started to install the new ones.</p>
<p><strong>Problems:</strong> Since I have Debian on a MacBookPro, there are basically two issues that I had to solve manually. They are related to NVidia graphics card and Broadcom wireless card. I have installed them using the <a href="http://wiki.debian.org/ModuleAssistant">module-assistant</a> as explained <a href="http://wiki.debian.org/MacBookPro">here</a>. At some point during upgrade, it crashed complaining a dependency conflict (libgstreamer, if I remember correctly). I removed some packages using <strong>dpkg -r</strong> to solve the problem. Then, the upgrade was completed and I got a message about errors during the upgrade. It was basically Nvidia problem, as I expected. I following the instruction and run the module assistant.</p>
<p>That was it. Now, it runs Debian 7 (Wheezy), with an updated kernel (3.1). As far as I have experienced the system so far, it is rather stable.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/micropore.wordpress.com/1128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/micropore.wordpress.com/1128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/micropore.wordpress.com/1128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/micropore.wordpress.com/1128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/micropore.wordpress.com/1128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/micropore.wordpress.com/1128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/micropore.wordpress.com/1128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/micropore.wordpress.com/1128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/micropore.wordpress.com/1128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/micropore.wordpress.com/1128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/micropore.wordpress.com/1128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/micropore.wordpress.com/1128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/micropore.wordpress.com/1128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/micropore.wordpress.com/1128/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=micropore.wordpress.com&amp;blog=10457582&amp;post=1128&amp;subd=micropore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://micropore.wordpress.com/2012/01/16/debian-wheezy-repository/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b428711303ff41f7be01cacadf8c5fff?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">micropore</media:title>
		</media:content>
	</item>
		<item>
		<title>Solar battery chargers</title>
		<link>http://micropore.wordpress.com/2012/01/09/solar-battery-chargers/</link>
		<comments>http://micropore.wordpress.com/2012/01/09/solar-battery-chargers/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 07:38:56 +0000</pubDate>
		<dc:creator>micropore</dc:creator>
				<category><![CDATA[life]]></category>
		<category><![CDATA[Physics]]></category>
		<category><![CDATA[solar]]></category>

		<guid isPermaLink="false">http://micropore.wordpress.com/?p=1141</guid>
		<description><![CDATA[Recently, there are quite a lot of solar battery chargers. Such instruments like the one in the following image are able, in theory, to recharge mobile devices, ipods, etc when they are charged, and charge themselves using the sun light. In this particular example, the company provides the following specifications for the instrument: it has [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=micropore.wordpress.com&amp;blog=10457582&amp;post=1141&amp;subd=micropore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently, there are quite a lot of solar battery chargers. <a href="http://www.alibaba.com/product-gs/324862784/3500mah_solar_battery_charger_for_PSP.html">Such instruments</a> like the one in the following image are able, in theory, to recharge mobile devices, ipods, etc when they are charged, and charge themselves using the sun light.</p>
<p><a href="http://micropore.files.wordpress.com/2012/01/3500mah.jpg"><img class="aligncenter size-full wp-image-1142" title="3500mAh solar battery charger" src="http://micropore.files.wordpress.com/2012/01/3500mah.jpg?w=500" alt=""   /></a></p>
<p>In this particular example, the company provides the following specifications for the instrument: it has a charge capacity of 3.5 Ah (<a href="http://en.wikipedia.org/wiki/Ampere">Ampere</a>  hour) at a potential difference of 3.7 <a href="http://en.wikipedia.org/wiki/Volt">Volts</a>. That means it contains 12.95 Watt h energy when it is fully charged. Just for comparison, a small auto battery has like 40 A.h at a potential difference of 12 V.  That means the energy stored in the device is like 2% of the energy stored in an auto battery, so it is quite a bit actually.</p>
<p>Needless to say, you can charge it via AC adapter or USB cable of your laptop and use it to charge your mobile phone when required. The life cycle according to the webpage is 500. Indeed, the typical <a href="http://en.wikipedia.org/wiki/Lithium-ion_polymer_battery">Lithium-ion polymer batteries</a> have a life cycle of 1000 or more. Perhaps due to irregular solar charging rather than the standard net charging, the life cycle will be shorter as expressed in the webpage.</p>
<p><strong>C</strong><strong>an it really charge itself via solar radiation?</strong> I try to simply evaluate how much solar energy it can absorb, according to the data given in the webpage. <a href="http://en.wikipedia.org/wiki/Solar_constant">The solar constant</a>, the energy that the unit area on the top of the earth atmosphere receives in a second is about S = 1400 Watt per square meter. On tropical latitudes, the received energy on the ground is larger than 1000 W/m<sup>2</sup>. On middle latitudes like central Europe, and in a summer day, S = 800 W/m<sup>2</sup>. In winter, it is usually about 500 to 600 W/m<sup>2</sup> in a sunny day. When it is overcast and very dark, it drops to values comparable to 1W/m<sup>2</sup>.</p>
<p>Now let us calculate how long it takes to collect <strong>12.95 Wh</strong> energy from the received solar radiation on an average day. The collecting area, according to webpage, is 11.5 x 6.0 cm<sup>2 </sup>, and the efficiency is 17%. If I take S = 300 W/m<sup>2</sup> for a relatively bright day, then the rate of collecting energy is</p>
<p>Area  x  Solar constant  x  efficiency = 69 cm<sup>2 </sup>x 300 W/m<sup>2</sup> x 0.17 = 0.35 Watt.</p>
<p><strong>Therefore to collect 12.95 Wh, i.e. <span style="color:#0000ff;">to recharge the battery via sun light</span>,  one has to keep the instrument in sunshine for <span style="color:#ff0000;">37 hours</span>. </strong>In <strong>tropical regions</strong>, this time can be a factor 2 or 3 shorter.<strong><br />
</strong></p>
<p>This simple calculation shows that if you have such an instrument, you should be <strong>patient</strong> to get it charged using its own solar panel. In practice, the charging time can be longer because of the cloudy sky, and a decline of the efficiency with aging.  <strong></strong></p>
<p><strong>Do you save money if you buy it?</strong></p>
<p><strong>Perhaps not, specially if you live in high latitudes. </strong>The instrument can, in theory, work for 500 cycles of 12.95 Wh. That amounts to 6.5 kWh during its lifetime. <a href="http://en.wikipedia.org/wiki/Electricity_pricing">The electricity price</a> in expensive cases is like half a dollar per kWh. That means you collect in total like 3.2 US dollar while the instrument costs like <a href="http://www.amazon.com/s/ref=nb_sb_noss/182-9323086-6786229?url=search-alias%3Daps&amp;field-keywords=solar+battery+charger+3500+mAh&amp;x=0&amp;y=0">40+ dollars</a>. This particular device is more a (big) spare battery than a solar charger.</p>
<p><strong>There are</strong> <strong>better options</strong>. Consider a similar instrument with an area of 2-3 times larger. That efficiently reduce the recharging time. In addition, I guess the systems with rechargeable AA batteries have the ability to live longer: you can exchange those batteries when they are dead. The solar panels usually work much longer (like 10+ years).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/micropore.wordpress.com/1141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/micropore.wordpress.com/1141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/micropore.wordpress.com/1141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/micropore.wordpress.com/1141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/micropore.wordpress.com/1141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/micropore.wordpress.com/1141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/micropore.wordpress.com/1141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/micropore.wordpress.com/1141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/micropore.wordpress.com/1141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/micropore.wordpress.com/1141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/micropore.wordpress.com/1141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/micropore.wordpress.com/1141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/micropore.wordpress.com/1141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/micropore.wordpress.com/1141/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=micropore.wordpress.com&amp;blog=10457582&amp;post=1141&amp;subd=micropore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://micropore.wordpress.com/2012/01/09/solar-battery-chargers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b428711303ff41f7be01cacadf8c5fff?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">micropore</media:title>
		</media:content>

		<media:content url="http://micropore.files.wordpress.com/2012/01/3500mah.jpg" medium="image">
			<media:title type="html">3500mAh solar battery charger</media:title>
		</media:content>
	</item>
		<item>
		<title>M13 in Hercules</title>
		<link>http://micropore.wordpress.com/2012/01/04/m13-in-hercules/</link>
		<comments>http://micropore.wordpress.com/2012/01/04/m13-in-hercules/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 20:46:23 +0000</pubDate>
		<dc:creator>micropore</dc:creator>
				<category><![CDATA[Astronomy]]></category>
		<category><![CDATA[Astrophotography]]></category>
		<category><![CDATA[constellations]]></category>

		<guid isPermaLink="false">http://micropore.wordpress.com/?p=1076</guid>
		<description><![CDATA[M13 globular cluster in Hercules constellation is one of the favorite night sky objects for observers in northern hemisphere. This photo, captured on July 06, 2009. It is a composite photo of 23 exposures (8 seconds each). As usual, I used a Canon EOS 400D camera without tracking. The reduction and processing was done using [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=micropore.wordpress.com&amp;blog=10457582&amp;post=1076&amp;subd=micropore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://micropore.files.wordpress.com/2011/10/m13_06july09.jpg"><img class="aligncenter size-full wp-image-1077" title="m13_06july09" src="http://micropore.files.wordpress.com/2011/10/m13_06july09.jpg?w=500&#038;h=341" alt="" width="500" height="341" /></a></p>
<p>M13 <a href="http://en.wikipedia.org/wiki/Globular_cluster">globular cluster</a> in Hercules constellation is one of the favorite night sky objects for observers in northern hemisphere. This photo, captured on July 06, 2009. It is a composite photo of 23 exposures (8 seconds each). As usual, I used a Canon EOS 400D camera without tracking. The reduction and processing was done using Iris.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/micropore.wordpress.com/1076/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/micropore.wordpress.com/1076/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/micropore.wordpress.com/1076/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/micropore.wordpress.com/1076/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/micropore.wordpress.com/1076/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/micropore.wordpress.com/1076/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/micropore.wordpress.com/1076/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/micropore.wordpress.com/1076/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/micropore.wordpress.com/1076/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/micropore.wordpress.com/1076/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/micropore.wordpress.com/1076/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/micropore.wordpress.com/1076/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/micropore.wordpress.com/1076/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/micropore.wordpress.com/1076/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=micropore.wordpress.com&amp;blog=10457582&amp;post=1076&amp;subd=micropore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://micropore.wordpress.com/2012/01/04/m13-in-hercules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b428711303ff41f7be01cacadf8c5fff?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">micropore</media:title>
		</media:content>

		<media:content url="http://micropore.files.wordpress.com/2011/10/m13_06july09.jpg" medium="image">
			<media:title type="html">m13_06july09</media:title>
		</media:content>
	</item>
		<item>
		<title>Pymc: Bayesian fit for Python</title>
		<link>http://micropore.wordpress.com/2011/12/05/pymc-bayesian-fit-fpr-python/</link>
		<comments>http://micropore.wordpress.com/2011/12/05/pymc-bayesian-fit-fpr-python/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 21:45:14 +0000</pubDate>
		<dc:creator>micropore</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Bayesian fit]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[math]]></category>

		<guid isPermaLink="false">http://micropore.wordpress.com/?p=1103</guid>
		<description><![CDATA[Using a Bayesian fit is totally different from a  least-squared fit. Doing it is also more complicated.  In a chi-squared fit, we minimize a merit function. In a Bayesian fit, we have a set of priors, and a set of observations. To fit a model to those observations, we calculate a likelihood function. Unlike a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=micropore.wordpress.com&amp;blog=10457582&amp;post=1103&amp;subd=micropore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Using a <a href="http://en.wikipedia.org/wiki/Bayes_estimator">Bayesian fit</a> is totally different from a  <a href="http://en.wikipedia.org/wiki/Least_squares">least-squared fit</a>. Doing it is also more complicated.  In a chi-squared fit, we minimize a merit function. In a Bayesian fit, we have a set of <a href="http://en.wikipedia.org/wiki/Prior_probability">priors,</a> and a set of observations. To fit a model to those observations, we calculate a likelihood function. Unlike a least-squared problem, here basically each variable has a distribution. and we find the peak of distribution as the solution for unknown parameters. It is way better to read a review or something like this nice paper:</p>
<p><a href="http://adsabs.harvard.edu/abs/1992ApJ...398..146G">http://adsabs.harvard.edu/abs/1992ApJ&#8230;398..146G</a></p>
<p>Well, now that we know what is it, how can we do simplest things with that: i.e., fitting a straight line to some data points? <a href="http://code.google.com/p/pymc/">Pymc</a> made it easy. It is a python package which contains three different solvers for Bayesian statistics including a <a href="http://en.wikipedia.org/wiki/Markov_chain_Monte_Carlo">Markov chain Monte Carlo</a> (MCMC) estimator.</p>
<p>You can not only use it to do simple fitting stuff like<a href="http://healthyalgorithms.wordpress.com/tag/pymc/"> this</a>, but also do more complicated things.  However, I try to show some simple examples of its usage and comparison to a traditional fit in a separate post. Basically I compare fitting a parabola using chi-square and Bayesian method.</p>
<p>save the following in a file (I call it test.py):</p>
<p><span style="color:#800000;"># A quadratic fit</span><br />
<span style="color:#800000;">#&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span><br />
<span style="color:#0000ff;">import numpy, pymc</span></p>
<p><span style="color:#800000;"># create some test data</span><br />
<span style="color:#0000ff;">x = numpy.arange(100) * 0.3</span><br />
<span style="color:#0000ff;">f = 0.1 * x**2 &#8211; 2.6 * x &#8211; 1.5</span><br />
<span style="color:#0000ff;">numpy.random.seed(76523654)</span><br />
<span style="color:#0000ff;">noise = numpy.random.normal(size=100) * .1     </span><span style="color:#800000;"># create some Gaussian noise</span><br />
<span style="color:#0000ff;">f = f + noise</span>                               <span style="color:#800000;"> # add noise to the data</span></p>
<p><span style="color:#0000ff;">z = numpy.polyfit(x, f, 2)</span>   <span style="color:#800000;"># the traditional chi-square fit</span><br />
<span style="color:#0000ff;">print &#8216;The chi-square result: &#8216;,  z</span></p>
<p><span style="color:#800000;">#priors</span><br />
<span style="color:#0000ff;">sig = pymc.Uniform(&#8216;sig&#8217;, 0.0, 100.0, value=1.)</span></p>
<p><span style="color:#0000ff;">a = pymc.Uniform(&#8216;a&#8217;, -10.0, 10.0, value= 0.0)</span><br />
<span style="color:#0000ff;">b = pymc.Uniform(&#8216;b&#8217;, -10.0, 10.0, value= 0.0)</span><br />
<span style="color:#0000ff;">c = pymc.Uniform(&#8216;c&#8217;, -10.0, 10.0, value= 0.0)</span></p>
<p><span style="color:#800000;">#model</span><br />
<span style="color:#0000ff;">@pymc.deterministic(plot=False)</span><br />
<span style="color:#0000ff;">def mod_quadratic(x=x, a=a, b=b, c=c):</span><br />
<span style="color:#0000ff;">      return a*x**2 + b*x + c</span></p>
<p><span style="color:#800000;">#likelihood</span><br />
<span style="color:#0000ff;">y = pymc.Normal(&#8216;y&#8217;, mu=mod_quadratic, tau=1.0/sig**2, value=f, observed=True)</span><br />
<span style="color:#800000;">#&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></p>
<p>Now, go to command line and run the following (or alternatively put them in a file):</p>
<p><span style="color:#0000ff;">import pymc, test</span>              <span style="color:#800000;"># load the model file</span><br />
<span style="color:#0000ff;">R = pymc.MCMC(test) </span>   <span style="color:#800000;">#  build the model</span><br />
<span style="color:#0000ff;">R.sample(10000) </span>             <span style="color:#800000;"># populate and run it</span><br />
<span style="color:#0000ff;">print &#8216;a   &#8216;, R.a.value </span>       <span style="color:#800000;"># print outputs</span><br />
<span style="color:#0000ff;">print &#8216;b    &#8216;, R.b.value</span><br />
<span style="color:#0000ff;">print &#8216;c    &#8216;, R.c.value</span><br />
The output looks like this:</p>
<p>The chi-square result: [ 0.0999244  -2.59879643 -1.49278601]<br />
Sampling: 100% [00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000] Iterations: 10000<br />
a    0.0981867109293<br />
b     -2.54514077442<br />
c     -1.77016283024</p>
<p>The correct results are a=0.1, b=2.6, and c=1.5. Both methods gave satisfactory results. Indeed, if you increase number of iterations from 10000 to one million, the answer will be like this:</p>
<p>Sampling: 100% [000000000000000000000000000000000000000000000000000000000000000000000000000000000000000] Iterations: 1000000<br />
a    0.0997945467529<br />
b     -2.59731835923<br />
c     -1.47308938314</p>
<p>As you see, the results are more accurate compared to the former case.</p>
<p>If you like to have more information, you can use the following command:</p>
<p><span style="color:#0000ff;">print &#8216;a   &#8216;, R.a.stats()</span></p>
<p><span style="color:#0000ff;"><span style="color:#000000;">a    {&#8217;95% HPD interval&#8217;: array([ 0.09956635,  0.10027448]), &#8216;n&#8217;: 1000000, &#8216;quantiles&#8217;: {2.5: 0.099545071298350371, 25: 0.099805050609863097, 50: 0.099919386231275664, 75: 0.10003496316945379, 97.5: 0.10025986774435611}, &#8216;standard deviation&#8217;: 0.0050467522199834905, &#8216;mc error&#8217;: 0.0003721035009025152, &#8216;mean&#8217;: 0.099548164235412406}</span></span></p>
<p>Recall that in  a Bayesian fit, each variable has a distribution. The following plot shows the data points as well as the two Bayesian fits.</p>
<p><a href="http://micropore.files.wordpress.com/2011/12/fit.png"><img class="aligncenter size-full wp-image-1120" title="fit" src="http://micropore.files.wordpress.com/2011/12/fit.png?w=500&#038;h=376" alt="" width="500" height="376" /></a></p>
<p>To compare it with a least-square fit, I repeated the experiment with a sample data which has more noise. The resulting fits are compared in the following panel.</p>
<p><a href="http://micropore.files.wordpress.com/2011/12/fit2.png"><img class="aligncenter size-full wp-image-1122" title="fit2" src="http://micropore.files.wordpress.com/2011/12/fit2.png?w=500&#038;h=376" alt="" width="500" height="376" /></a></p>
<p>There are much more you can learn from the examples of Pymc. I hope in a future post, I can explain other types of fit, like a weighted-least-square fit or a bisector fit.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/micropore.wordpress.com/1103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/micropore.wordpress.com/1103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/micropore.wordpress.com/1103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/micropore.wordpress.com/1103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/micropore.wordpress.com/1103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/micropore.wordpress.com/1103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/micropore.wordpress.com/1103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/micropore.wordpress.com/1103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/micropore.wordpress.com/1103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/micropore.wordpress.com/1103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/micropore.wordpress.com/1103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/micropore.wordpress.com/1103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/micropore.wordpress.com/1103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/micropore.wordpress.com/1103/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=micropore.wordpress.com&amp;blog=10457582&amp;post=1103&amp;subd=micropore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://micropore.wordpress.com/2011/12/05/pymc-bayesian-fit-fpr-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b428711303ff41f7be01cacadf8c5fff?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">micropore</media:title>
		</media:content>

		<media:content url="http://micropore.files.wordpress.com/2011/12/fit.png" medium="image">
			<media:title type="html">fit</media:title>
		</media:content>

		<media:content url="http://micropore.files.wordpress.com/2011/12/fit2.png" medium="image">
			<media:title type="html">fit2</media:title>
		</media:content>
	</item>
		<item>
		<title>Sirius and M41</title>
		<link>http://micropore.wordpress.com/2011/11/25/sirius-and-m41/</link>
		<comments>http://micropore.wordpress.com/2011/11/25/sirius-and-m41/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 07:58:10 +0000</pubDate>
		<dc:creator>micropore</dc:creator>
				<category><![CDATA[Astronomy]]></category>
		<category><![CDATA[Astrophotography]]></category>
		<category><![CDATA[Photo]]></category>
		<category><![CDATA[constellations]]></category>

		<guid isPermaLink="false">http://micropore.wordpress.com/?p=1060</guid>
		<description><![CDATA[Following  older posts on astrophotography  where I have shown Lyra and Andromeda, here I present Canis Major, the constellation of the brightest star in the sky, Sirius. The M41 open cluster is seen clearly in the image. It has 90 seconds of total exposure time, a focal length of 30mm, and opening of f/4.0. I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=micropore.wordpress.com&amp;blog=10457582&amp;post=1060&amp;subd=micropore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://micropore.files.wordpress.com/2011/09/canismajor_05april11.jpg"><img class="aligncenter size-full wp-image-1061" title="canismajor_05april11" src="http://micropore.files.wordpress.com/2011/09/canismajor_05april11.jpg?w=500&#038;h=303" alt="" width="500" height="303" /></a></p>
<p>Following  older posts on astrophotography  where I have shown <a href="http://micropore.wordpress.com/2010/09/18/lyra/">Lyra</a> and <a href="http://micropore.wordpress.com/2011/11/11/andromeda-and-triangulum-galaxies/">Andromeda</a>, here I present <a href="http://en.wikipedia.org/wiki/Canis_Major">Canis Major</a>, the constellation of the brightest star in the sky, Sirius. The M41 open cluster is seen clearly in the image. It has 90 seconds of total exposure time, a focal length of 30mm, and opening of f/4.0. I used <a href="http://www.astrosurf.com/buil/us/iris/iris.htm">Iris</a> to calibrate and merge the raw images. The original  image has a resolution of about 8 times better.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/micropore.wordpress.com/1060/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/micropore.wordpress.com/1060/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/micropore.wordpress.com/1060/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/micropore.wordpress.com/1060/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/micropore.wordpress.com/1060/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/micropore.wordpress.com/1060/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/micropore.wordpress.com/1060/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/micropore.wordpress.com/1060/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/micropore.wordpress.com/1060/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/micropore.wordpress.com/1060/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/micropore.wordpress.com/1060/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/micropore.wordpress.com/1060/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/micropore.wordpress.com/1060/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/micropore.wordpress.com/1060/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=micropore.wordpress.com&amp;blog=10457582&amp;post=1060&amp;subd=micropore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://micropore.wordpress.com/2011/11/25/sirius-and-m41/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b428711303ff41f7be01cacadf8c5fff?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">micropore</media:title>
		</media:content>

		<media:content url="http://micropore.files.wordpress.com/2011/09/canismajor_05april11.jpg" medium="image">
			<media:title type="html">canismajor_05april11</media:title>
		</media:content>
	</item>
	</channel>
</rss>
