From: Michael Hanke Date: Mon, 16 May 2011 16:13:24 +0000 (-0400) Subject: Fix div by zero prob. X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=eb3674f0d0e4663e8970604f88828e3f240bd88b;p=neurodebian.git Fix div by zero prob. --- diff --git a/survey/makestats b/survey/makestats index 7b229b1..09b0c94 100755 --- a/survey/makestats +++ b/survey/makestats @@ -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))