diff --git a/script/local.py b/script/local.py index 57c466fa..7c075773 100644 --- a/script/local.py +++ b/script/local.py @@ -134,59 +134,6 @@ def release_keithleys(): KeiSample.release() KeiReference.release() -def init_keithley_ca(dwell): - """ - prepare keithleys for gpib polling: - passive, bus triggered, dwell time - - dwell = dwell time in seconds (0.1 - 20.0) - """ - caput(KEI_SAMPLE + "READSCAN.SCAN", 0) - caput(KEI_SAMPLE + "TTYPE", 2) - caput(KEI_REF + "READSCAN.SCAN", 0) - caput(KEI_REF + "TTYPE", 2) - nplc = 5. - navg = dwell / 0.1 - if navg > 100: - nplc *= 2 - navg /= 2 - navg = min(navg, 100) - nplc = min(nplc, 10.) - caput(KEI_SAMPLE + "NPLC", nplc) - caput(KEI_REF + "NPLC", nplc) - caput(KEI_SAMPLE + "NAVG", navg) - caput(KEI_REF + "NAVG", navg) - -def read_keithley_ca(): - """ - trigger keithleys, wait until done, and read the result into EPICS. - the value can then be read by pshell from the channel. - """ - dwell1 = caget(KEI_SAMPLE + "TOTTIME") / 1000. - dwell2 = caget(KEI_REF + "TOTTIME") / 1000. - dwell = max(dwell1, dwell2) - caput(KEI_SAMPLE + "DOINIT", 1) - caput(KEI_REF + "DOINIT", 1) - caput(KEI_SAMPLE + "DOTRIGGER", 1) - caput(KEI_REF + "DOTRIGGER", 1) - time.sleep(dwell) - caput(KEI_SAMPLE + "DOFETCH", 1) - caput(KEI_REF + "DOFETCH", 1) - -def free_keithley_ca(): - """ - switch keithleys to free run. - 0.1 s polling and dwell time - """ - caput(KEI_SAMPLE + "NPLC", 5.) - caput(KEI_REF + "NPLC", 5.) - caput(KEI_SAMPLE + "NAVG", 1) - caput(KEI_REF + "NAVG", 1) - caput(KEI_SAMPLE + "READSCAN.SCAN", 9) - caput(KEI_REF + "READSCAN.SCAN", 9) - caput(KEI_SAMPLE + "TTYPE", 0) - caput(KEI_REF + "TTYPE", 0) - diag_channels = [] diag_channels.append(Scienta.channelBegin) #diag_channels.append(ChannelDouble("ChannelBegin", "X03DA-SCIENTA:cam1:CHANNEL_BEGIN_RBV")) diag_channels.append(Scienta.channelEnd) #diag_channels.append(ChannelDouble("ChannelEnd", "X03DA-SCIENTA:cam1:CHANNEL_END_RBV")) @@ -326,12 +273,6 @@ def wait_beam(): time.sleep(0.1) print "Beam ok" -def before_scan(): - dwell = Scienta.getStepTime().read() - dwell = min(dwell, 20.0) - dwell = max(dwell, 0.1) - prepare_keithleys(dwell) - def before_readout(): sample_scienta = False for dev in ["Scienta.spectrum","EnergyDistribution", "AngleDistribution", "Scienta.dataMatrix"]: @@ -365,7 +306,10 @@ def after_scan(): release_keithleys() def set_adc_averaging(): - pass + dwell = Scienta.getStepTime().read() + dwell = min(dwell, 20.0) + dwell = max(dwell, 0.1) + prepare_keithleys(dwell) #value = Scienta.getStepTime().read() * 10.0 #averaging count in 100ms #SampleCurrentAveraging.write(value) #RefCurrentAveraging.write(value) diff --git a/script/test/ManipulatorScanKei.py b/script/test/ManipulatorScanKei.py index 9109692e..ece1e614 100644 --- a/script/test/ManipulatorScanKei.py +++ b/script/test/ManipulatorScanKei.py @@ -19,7 +19,6 @@ ENDSCAN = True adjust_sensors() set_adc_averaging() -before_scan() set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1}) try: