def runSampleEnvironmentScan(sampleEvnGroup): # Gets the sample environment settings evnSetting = sampleEnvironments[sampleEvnGroup['target']] controller = evnSetting['controller'] preset = evnSetting[sampleEvnGroup['setting']]['preset'] waitTime = evnSetting[sampleEvnGroup['setting']]['wait'] # Drive drivable controller deviceController = sics.getDeviceController(controller) if (deviceController == None): log('Driving controller ' + controller + ' to set point ' + str(preset)) driverPath = WorkspaceUtils.getFolder(PYTHON_DRIVERS_PATH).getFullPath().toString() driverPath = driverPath.replace('/', '.')[1:] exec('from ' + driverPath + ' import ' + controller) exec(controller + '.drive(preset)') else: log('Driving controller ' + controller + ' to set point ' + str(preset)) sics.drive(controller, preset) # Stabilisation log('Stabilising the controller for ' + str(waitTime) + ' sec') sleep(waitTime) # Recurrsively run (for effectiveness we reverse the configuration on every second run) if sampleEvnGroup['setting'] % 2 == 1: runQuokkaScan(sampleEvnGroup['contents'], True, controller + '=' + str(preset)) else: runQuokkaScan(sampleEvnGroup['contents'], False, controller + '=' + str(preset))
def drive_Ei(): sics.execute('tasub outofplane 0') slog('fix s1, s2, a1 and a2') sics.execute('s1 fixed 1') sics.execute('s2 fixed 1') sics.execute('a1 fixed 1') sics.execute('a2 fixed 1') sics.drive('sgl', 0) sics.drive('sgu', 0) sics.execute('sgl fixed 1') sics.execute('sgu fixed 1') slog('drive Ei ' + str(Ei.value)) sics.execute('tasub update') time.sleep(1) try: sics.drive('ei', Ei.value) except: pass time.sleep(1) while str(sics.getDeviceController('ei').getStatus()) == 'RUNNING': time.sleep(0.5) m2.value = sicsext.getStableValue('m2').getFloatData() m1.value = m2.value / 2 scan.value = str(math.ceil((m1.value - 2) * 1000) / 1000) + ', 0.1, 41, \'timer\', 1' sics.execute('tasub update') slog('unfix sgu, sgl, s1, s2, a1 and a2') sics.execute('s2 fixed -1') sics.execute('s1 fixed -1') sics.execute('a1 fixed -1') sics.execute('a2 fixed -1') sics.execute('sgl fixed -1') sics.execute('sgu fixed -1')
def drive_a1a2_0(): if ei_old != Ei.value : slog('drive Ei ' + str(Ei.value)) sics.execute('tasub update') time.sleep(1) try: sics.drive('ei', Ei.value) except: pass time.sleep(1) while str(sics.getDeviceController('ei').getStatus()) == 'RUNNING': time.sleep(0.5) slog('drive a1 0 a2 0') sics.multiDrive({'a1' : 0, 'a2' : 0})
from gumpy.nexus.fitting import Fitting, GAUSSIAN_FITTING from gumpy.commons import sics # Script control setup area # script info __script__.title = 'Run En Scan' __script__.version = '' previous_file = 'auto_7_align_a1a2.py' next_file = 'auto_9_finished.py' # Use below example to create parameters. # The type can be string, int, float, bool, file. pact = Act('', 'Calibration Finished') G1 = Group('Scan En') sics.getDeviceController('ei').getValue(True) sics.getDeviceController('en').getValue(True) ei = Par('float', sics.getValue('ei').getFloatData()) en = Par('float', sics.getValue('en').getFloatData()) scan = Par('string', '0, 0.25, 17, \'timer\', 1') act2 = Act('scan_en()', 'Scan on en') def scan_en(): aname = 'en' try: if DEBUGGING : aname = 'dummy_motor' except: pass axis_name.value = aname sicsext.call_back = __load_experiment_data__ slog('s2 fixed 1')