<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><style>
<!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:Arial;
layout-grid-mode:line;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.E-mailStijl17
{mso-style-type:personal-compose;
font-family:Arial;
color:windowtext;}
@page Section1
{size:595.3pt 841.9pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang="NL" link="blue" vlink="purple">
<div class="Section1">
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt">Hi!<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">Sorry, a bit short on time so I decided to e-mail you the bug I came across.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">The built-in sum function is not correctly summing all columns in my array. I noticed by coincidence and verified this in excel.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">My matrix is 64x64.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">(I am using spyder 2.3.0, and python 2.7.6 32bits on Windows)<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">sum(summedim)<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">Out[37]:
<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">array([ 148, 123, 130, 207, 293, 290, 401, 638, 928,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"> 1221, 1597, 2162, 3030, 4331, 6271, 8892, 11805, 14248,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"> 15602, 16510, 18550, 22730, 27386, 29778, 29970, 32941, 43589,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"> 59399,
<span style="background:yellow">6365, 9188, 5404, 1503, 785, 3809, 6611, 5109</span>,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"> 62835, 50904, 39940, 33964, 32919, 34305, 35697, 35820, 32936,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"> 26407, 17595, 9770, 5008, 2895, 1872, 1142, 628, 476,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"> 541, 627, 763, 908, 862, 518, 150, 6, 0, 0], dtype=uint16)<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt;background:yellow">sum(sum(summedim))<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt;background:yellow">Out[38]: 821432<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt;background:yellow"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">np.sum(summedim)<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">Out[39]: 1345720
<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">The last output is correct, the marked outputs are incorrect. I don’t know why the function does not work properly for just a few columns.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">Though this is consistently the case in all 64x64 array’s I was analysing<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">I am glad I noticed and now started using the np.sum function, but it might aid other users if this bug is fixed.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">Happy holidays!<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">Kind regards,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt">Renske<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:
10.0pt"><o:p> </o:p></span></font></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;color:navy"><img width="192" height="77" id="_x0000_i1025" src="cid:image002.jpg@01D14233.A5913FA0"><o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><b><font size="2" color="navy" face="Calibri"><span style="font-size:10.0pt;font-family:Calibri;color:navy;font-weight:bold">ir. Renske Hoeben<br>
<br>
</span></font></b><font color="navy" face="Calibri"><span style="font-family:Calibri;
color:navy">Klinisch Fysicus in opleiding<br>
<br>
</span></font><font size="1" color="navy" face="Calibri"><span style="font-size:9.0pt;
font-family:Calibri;color:navy">Afd. Klinische Fysica en Instrumentatie<br>
Postbus 2500 <br>
3430 EM Nieuwegein <o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Calibri"><span style="font-size:
9.0pt;font-family:Calibri;color:navy">M 06 5274 1217<br>
T 030 609 3070 (secretariaat)<br>
E r.hoeben@antoniusziekenhuis.nl <o:p></o:p></span></font></p>
</div>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
</body>
</html>