From: W. Trevor King Date: Thu, 8 Jan 2009 15:49:07 +0000 (-0500) Subject: Improved plotVerbose behaviour in wiggleForInterferenceMin() X-Git-Tag: 0.2~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6f16294350d737ad9466dc47e224e7a05055bdba;p=pypiezo.git Improved plotVerbose behaviour in wiggleForInterferenceMin() --- diff --git a/z_piezo_utils.py b/z_piezo_utils.py index 122098b..f80017f 100644 --- a/z_piezo_utils.py +++ b/z_piezo_utils.py @@ -88,9 +88,10 @@ def moveToPosOrDef(zpiezo, pos, defl, step, return_data=False) : return zpiezo.curVals() -def wiggleForInterferenceMin(zpiezo, wig_amp=20000, wig_freq=100) : +def wiggleForInterferenceMin(zpiezo, wig_amp=20000, wig_freq=100, + plotVerbose=True) : "Output sin to measure interference" - if not PYLAB_INTERACTIVE_VERBOSE : + if PYLAB_INTERACTIVE_VERBOSE or plotVerbose: from pylab import figure, plot, title, hold, ion, ioff, draw, axes npoints = 1000 scanfreq = wig_freq*npoints @@ -98,25 +99,28 @@ def wiggleForInterferenceMin(zpiezo, wig_amp=20000, wig_freq=100) : for i in range(npoints) : out[i] = int(sin(4*pi*i/npoints)*wig_amp+32000) # 4 for 2 periods - figure(BASE_FIG_NUM+1) - a = axes() + if PYLAB_INTERACTIVE_VERBOSE or plotVerbose: + figure(BASE_FIG_NUM+1) + a = axes() + title('wiggle for interference') + hold(False) + p = plot(out, out, 'b.-') if LOG_DATA : log = data_logger.data_log(LOG_DIR, noclobber_logsubdir=False, log_name="wiggle") - title('wiggle for interference') - hold(False) - p = plot(out, out, 'b.-') c = curses_check_for_keypress.check_for_keypress(test_mode=False) while c.input() == None : data = zpiezo.ramp(out, scanfreq) - p[0].set_ydata(data["Deflection input"]) dmin = data["Deflection input"].min() dmax = data["Deflection input"].max() - a.set_ylim([dmin,dmax]) + if PYLAB_INTERACTIVE_VERBOSE or plotVerbose: + p[0].set_ydata(data["Deflection input"]) + a.set_ylim([dmin,dmax]) + draw() if LOG_DATA : log.write_dict_of_arrays(data) - draw() - hold(True) + if PYLAB_INTERACTIVE_VERBOSE or plotVerbose: + hold(True) def getSurfPosData(zpiezo, maxDefl, textVerbose=False, plotVerbose=False) : "Measure the distance to the surface"