Crop vib_analyze pylab Lorentzian fitline when it goes off-axis.
authorW. Trevor King <wking@drexel.edu>
Wed, 26 Nov 2008 21:05:08 +0000 (16:05 -0500)
committerW. Trevor King <wking@drexel.edu>
Wed, 26 Nov 2008 21:05:08 +0000 (16:05 -0500)
calibcant/vib_analyze.py

index 33a829b70bf4b559fec896c1b920710aed1e6dcf..8bd92747c98f267e8374757c11a9ab2849e29685 100755 (executable)
@@ -278,13 +278,16 @@ def vib_plot(deflection_bits, freq_axis, power, A, B, C,
         common._pylab.hold(False)
 
         # plot FFTed data
-        common._pylab.subplot(313)
+        axes = common._pylab.subplot(313)
         common._pylab.semilogy(freq_axis, power, 'r.-')
         fitdata = C / ((A**2-freq_axis**2)**2 + (B*freq_axis)**2)
+        xmin,xmax = axes.get_xbound()
+        ymin,ymax = axes.get_ybound()
         common._pylab.hold(True)
         common._pylab.plot(freq_axis, fitdata, 'b-');
         common._pylab.hold(False)
-        
+        axes.axis([xmin,xmax,ymin,ymax])
+
         common._flush_plot()
     if (plotVerbose or config.GNUPLOT_VERBOSE): # TODO: cleanup and test
         # write all the ft data now