def positioner_move_slow(x_pos, y_pos): try: move_mode = ctl.MoveMode.CL_ABSOLUTE ctl.SetProperty_i32(d_handle, 1, ctl.PropertyKey.MOVE_MODE, move_mode) ctl.SetProperty_i32(d_handle, 2, ctl.PropertyKey.MOVE_MODE, move_mode) ctl.SetProperty_i64(d_handle, 1, ctl.PropertyKey.MOVE_VELOCITY, 10000000) # Set move acceleration [in pm/s2]. ctl.SetProperty_i64(d_handle, 1, ctl.PropertyKey.MOVE_ACCELERATION, 10000000) ctl.Move(d_handle, 1, x_pos, 0) ctl.SetProperty_i64(d_handle, 2, ctl.PropertyKey.MOVE_VELOCITY, 10000000) # Set move acceleration [in pm/s2]. ctl.SetProperty_i64(d_handle, 2, ctl.PropertyKey.MOVE_ACCELERATION, 10000000) ctl.Move(d_handle, 2, y_pos, 0) except ctl.Error as e: print( "MCS2 {}: {}, error: {} (0x{:04X}) in line: {}. Press return to exit." .format(e.func, ctl.GetResultInfo(e.code), ctl.ErrorCode(e.code).name, e.code, (sys.exc_info()[-1].tb_lineno))) except Exception as ex: print("Unexpected error: {}, {} in line: {}".format( ex, type(ex), (sys.exc_info()[-1].tb_lineno)))
def initialize(self): try: buffer = ctl.FindDevices("") if len(buffer) == 0: print("MCS2 no devices found.") sys.exit(1) locators = buffer.split("\n") for locator in locators: print("MCS2 available devices: {}".format(locator)) except: print("MCS2 failed to find devices. Exit.") input() sys.exit(1) try: # Open the first MCS2 device from the list global d_handle d_handle = ctl.Open(locators[0]) print("MCS2 opened {}.".format(locators[0])) # Get the proper initial position. self.getXYZPosition() for ch in range(2): move_mode = ctl.MoveMode.CL_ABSOLUTE self.findReference() except ctl.Error as e: # Passing an error code to "GetResultInfo" returns a human readable string # specifying the error. print("MCS2 {}: {}, error: {} (0x{:04X}) in line: {}.".format(e.func, ctl.GetResultInfo(e.code), ctl.ErrorCode(e.code).name, e.code, (sys.exc_info()[-1].tb_lineno))) except Exception as ex: print("Unexpected error: {}, {} in line: {}".format(ex, type(ex), (sys.exc_info()[-1].tb_lineno))) raise
type = ctl.GetProperty_i32(d_handle, 1, ctl.PropertyKey.CHANNEL_TYPE) if type == ctl.ChannelModuleType.STICK_SLIP_PIEZO_DRIVER: ctl.SetProperty_i32(d_handle, 1, ctl.PropertyKey.MAX_CL_FREQUENCY, 6000) ctl.SetProperty_i32(d_handle, 1, ctl.PropertyKey.HOLD_TIME, 1000) elif type == ctl.ChannelModuleType.MAGNETIC_DRIVER: # Enable the amplifier (and start the phasing sequence). ctl.SetProperty_i32(d_handle, 1, ctl.PropertyKey.AMPLIFIER_ENABLED, ctl.ENABLED) except ctl.Error as e: # Passing an error code to "GetResultInfo" returns a human readable string # specifying the error. print( "MCS2 {}: {}, error: {} (0x{:04X}) in line: {}. Press return to exit.". format(e.func, ctl.GetResultInfo(e.code), ctl.ErrorCode(e.code).name, e.code, (sys.exc_info()[-1].tb_lineno))) except Exception as ex: print("Unexpected error: {}, {} in line: {}".format( ex, type(ex), (sys.exc_info()[-1].tb_lineno))) raise ## ---------------------- SMARACT MCS2 ----------------------------- class measurement: def initialise_SA(startFreq, stopFreq, bW_Res, coupling_Type, sweep): try: