- # plot time series
- common._pylab.subplot(311)
- common._pylab.hold(False)
- common._pylab.plot(deflection_bits, 'r.')
- common._pylab.title("free oscillation")
-
- # plot histogram distribution and gaussian fit
- common._pylab.subplot(312)
- common._pylab.hold(False)
- n, bins, patches = \
- common._pylab.hist(deflection_bits, bins=30,
- normed=1, align='center')
- gaus = numpy.zeros((len(bins),), dtype=numpy.float)
- mean = deflection_bits.mean()
- std = deflection_bits.std()
- pi = numpy.pi
- exp = numpy.exp
- for i in range(len(bins)) :
- gaus[i] = (2*pi)**(-.5)/std * exp(-0.5*((bins[i]-mean)/std)**2)
- common._pylab.hold(True)
- common._pylab.plot(bins, gaus, 'r-');
- common._pylab.hold(False)
-
- # plot FFTed data
- axes = common._pylab.subplot(313)
+ if deflection_bits != None:
+ # plot time series
+ common._pylab.subplot(311)
+ common._pylab.hold(False)
+ common._pylab.plot(deflection_bits, 'r.')
+ common._pylab.title("free oscillation")
+
+ # plot histogram distribution and gaussian fit
+ common._pylab.subplot(312)
+ common._pylab.hold(False)
+ n, bins, patches = \
+ common._pylab.hist(deflection_bits, bins=30,
+ normed=1, align='center')
+ gaus = numpy.zeros((len(bins),), dtype=numpy.float)
+ mean = deflection_bits.mean()
+ std = deflection_bits.std()
+ pi = numpy.pi
+ exp = numpy.exp
+ for i in range(len(bins)) :
+ gaus[i] = (2*pi)**(-.5)/std * exp(-0.5*((bins[i]-mean)/std)**2)
+ common._pylab.hold(True)
+ common._pylab.plot(bins, gaus, 'r-');
+ common._pylab.hold(False)
+
+ # plot FFTed data
+ axes = common._pylab.subplot(313)
+ else:
+ # use a nice big subplot just for the FFTed data
+ axes = common._pylab.subplot(111)