<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Dear Christoph</span></div><div>I think the calculation of median values in Numpy is not optimal. I don't know if there are other libraries that do better?</div><div>On my machine I get these results:</div><div> </div><div>>>> data = numpy.random.rand(5000,5000)<br>>>> t0=time.time();print numpy.ma.median(data);print time.time()-t0<br>0.499845739822<br>15.1949999332<br>>>> t0=time.time();print numpy.median(data);print time.time()-t0<br>0.499845739822<br>4.32100009918<br>>>> t0=time.time();print aspylib.astro.get_median(data);print time.time()-t0<br>[ 0.49984574]<br>0.90499997139<br>>>><br></div><div>The median calculation in Aspylib is using C code from Nicolas Devillard (can be found here: <a href="http://ndevilla.free.fr/median/index.html" rel="nofollow"
 target="_blank"><font color="#2862c5">http://ndevilla.free.fr/median/index.html</font></a>) interfaced with ctypes.</div><div>It could be easily re-used for other, more official packages. I think the code also finds quantiles efficiently.</div><div>Kind regards</div><div>Jerome Caron<br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> <div style="margin: 5px 0px; padding: 0px; border: 1px solid rgb(204, 204, 204); height: 0px; line-height: 0; font-size: 0px;" class="hr" contentEditable="false" readonly="true"></div>  <b><span style="font-weight: bold;">De :</span></b> Christoph Deil <deil.christoph@googlemail.com><br> <b><span style="font-weight: bold;">À :</span></b> "astropy@scipy.org list" <astropy@scipy.org> <br> <b><span style="font-weight:
 bold;">Envoyé le :</span></b> Mardi 15 janvier 2013 8h42<br> <b><span style="font-weight: bold;">Objet :</span></b> [AstroPy] Missing some statistical method for your astronomy analyses in Python?<br> </font> </div> <br><div id="yiv304964796"><div><span style="color: rgb(34, 34, 34); font-family: Arial, Helvetica, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);">Dear all, </span><br style="color: rgb(34, 34, 34); font-family: Arial, Helvetica, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);"><br><span style="background-color: rgb(255, 255, 255);"><font color="#222222" face="Arial, Helvetica, sans-serif"><span style="font-size: 13px;">we would like to know which statistical methods you want to use for you astronomy work with Python that are not readily available e.g. in scipy or one of the existing scientific Python packages like e.g. </span></font></span><span style="color: rgb(34, 34, 34);
 font-family: Arial, Helvetica, sans-serif; font-size: 13px;">statsmodels, </span><span style="color: rgb(34, 34, 34); font-family: Arial, Helvetica, sans-serif; font-size: 13px;">scikit-learn, astroML, </span><span style="color: rgb(34, 34, 34); font-family: Arial, Helvetica, sans-serif; font-size: 13px;">…</span><div><font color="#222222" face="Arial, Helvetica, sans-serif"><span style="font-size: 13px;"><br></span></font></div><div><font color="#222222" face="Arial, Helvetica, sans-serif"><span style="font-size: 13px;">Please visit the wiki page for what has already been suggested, then reply to this email or make an addition to the </span></font><a style="margin: 0px; padding: 0px; border: 0px currentColor; color: rgb(102, 17, 204); font-family: Arial, Helvetica, sans-serif; font-size: 13px; text-decoration: none; vertical-align: baseline; cursor: pointer; background-color: rgb(255, 255, 255);"
 href="https://github.com/astropy/astropy/wiki/What-methods-do-we-want-in-astropy.stats?" rel="nofollow" target="_blank">https://github.com/astropy/astropy/wiki/What-methods-do-we-want-in-astropy.stats?</a><span style="color: rgb(34, 34, 34); font-family: Arial, Helvetica, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);">  wiki page directly.</span></div><div><br></div><div><font color="#222222" face="Arial, Helvetica, sans-serif"><span style="font-size: 13px;">The plan is to add these methods either to astropy.stats or, if they are not astronomy-specific, to one of the existing scientific Python packages.</span></font></div><div><br></div><div>Christoph</div><div><br></div><div><font color="#222222" face="Arial, Helvetica, sans-serif"><span style="font-size: 13px;">PS: This discussion started as a thread on astropy-dev ( </span></font><a
 href="https://groups.google.com/d/topic/astropy-dev/Zwgafam171E/discussion" rel="nofollow" target="_blank">https://groups.google.com/d/topic/astropy-dev/Zwgafam171E/discussion</a> ), but it was suggested to also ask here.</div></div></div><br>_______________________________________________<br>AstroPy mailing list<br><a href="mailto:AstroPy@scipy.org" ymailto="mailto:AstroPy@scipy.org">AstroPy@scipy.org</a><br><a href="http://mail.scipy.org/mailman/listinfo/astropy" target="_blank">http://mail.scipy.org/mailman/listinfo/astropy</a><br><br><br> </div> </div>  </div></body></html>