]> git.donarmstrong.com Git - neurodebian.git/commitdiff
Fix div by zero prob.
authorMichael Hanke <michael.hanke@gmail.com>
Mon, 16 May 2011 16:13:24 +0000 (12:13 -0400)
committerMichael Hanke <michael.hanke@gmail.com>
Mon, 16 May 2011 16:13:24 +0000 (12:13 -0400)
survey/makestats

index 7b229b1e900febb3ff03c36dff119250958db69f..09b0c9415b20fe6d7f39a554c2c836dc841cfa7d 100755 (executable)
@@ -187,7 +187,10 @@ def mkpic_os_per_env(db, destdir):
             stats[os_family_rev[os]] += counts[os]
         total_count = np.sum(stats.values())
         for osf in stats:
-            stats[osf] = float(stats[osf]) / total_count
+            if not total_count:
+                stats[osf] = 0
+            else:
+                stats[osf] = float(stats[osf]) / total_count
         env_stats[env] = stats
     # make stacked barplot
     pl.figure(figsize=(6.4, 4.8))