Fix gaussian normalization in vibration_analyze.plot (no need for binwidth).
authorW. Trevor King <wking@drexel.edu>
Tue, 27 Mar 2012 16:25:15 +0000 (12:25 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 27 Mar 2012 16:25:15 +0000 (12:25 -0400)
calibcant/vibration_analyze.py

index 1b8fec256e9ec6d2cc295fb341482e491e68e5df..312c04ba093f4e5251c40e7da8019e8bfd5014e3 100644 (file)
@@ -520,10 +520,9 @@ def plot(deflection=None, freq_axis=None, power=None, A=None, B=None,
         std = deflection.std()
         pi = _numpy.pi
         exp = _numpy.exp
-        gauss = _numpy.sqrt(2*pi)/std * exp(-0.5*((bins-mean)/std)**2)
+        gauss = exp(-0.5*((bins-mean)/std)**2) / (_numpy.sqrt(2*pi) * std)
         # Matplotlib's normed histogram uses bin heights of n/(len(x)*dbin)
-        dbin = bins[1]-bins[0]
-        hist_axes.plot(bins, gauss/dbin, 'r-')
+        hist_axes.plot(bins, gauss, 'r-')
         hist_axes.autoscale(tight=True)
     if power is not None:
         freq_axes.hold(True)