def setStageSpeed(self, value): """Value be 0 - 1""" if value > 1 or value < 0: raise FEIValueError( f'setStageSpeed value must be between 0 and 1. Input: {value}') self.tom.Stage.Speed = value
def getApertureSize(self, aperture): if aperture == 'C1': return self.tom.Illumination.C1ApertureSize * 1e3 elif aperture == 'C2': return self.tom.Illumination.C2ApertureSize * 1e3 else: raise FEIValueError("aperture must be specified as 'C1' or 'C2'.")
def setFunctionMode(self, value): """{1:'LM',2:'Mi',3:'SA',4:'Mh',5:'LAD',6:'D'}""" if isinstance(value, str): try: value = FUNCTION_MODES.index(value) except ValueError: raise FEIValueError(f'Unrecognized function mode: {value}') self.FunctionMode_value = value
def setBeamTilt(self, x, y): """rotation center in FEI.""" bt = self.tom.Illumination.BeamAlignmentTilt if x is not None: if abs(x) > 1: raise FEIValueError( f'BeamTilt x must be a floating number between -1 an 1. Input: x={x}' ) bt.X = x if y is not None: if abs(y) > 1: raise FEIValueError( f'BeamTilt y must be a floating number between -1 an 1. Input: y={y}' ) bt.Y = y self.tom.Illumination.BeamAlignmentTilt = bt
def setImageShift1(self, x, y): is1 = self.tom.Projection.ImageShift if abs(x) > 1 or abs(y) > 1: raise FEIValueError( f'ImageShift1 x/y must be a floating number between -1 an 1. Input: x={x}, y={y}' ) if x is not None: is1.X = x if y is not None: is1.Y = y self.tom.Projection.ImageShift = is1
def setBeamAlignShift(self, x, y): """Align Shift.""" bs = self.tom.Illumination.BeamAlignShift if abs(x) > 1 or abs(y) > 1: raise FEIValueError( f'BeamAlignShift x/y must be a floating number between -1 an 1. Input: x={x}, y={y}' ) if x is not None: bs.X = x if y is not None: bs.Y = y self.tom.Illumination.BeamAlignShift = bs
def setGunTilt(self, x, y): gt = self.tecnai.Gun.Tilt if abs(x) > 1 or abs(y) > 1: raise FEIValueError( f'GunTilt x/y must be a floating number between -1 an 1. Input: x={x}, y={y}' ) if x is not None: gt.X = x if y is not None: gt.Y = y self.tecnai.Gun.Tilt = gt
def setGunShift(self, x, y): """x y can only be float numbers between -1 and 1.""" gs = self.tem.GUN.Shift if abs(x) > 1 or abs(y) > 1: raise FEIValueError( f'GunShift x/y must be a floating number between -1 an 1. Input: x={x}, y={y}' ) if x is not None: gs.X = x if y is not None: gs.Y = y self.tem.GUN.Shift = gs
def setStagePosition(self, x=None, y=None, z=None, a=None, b=None, wait=True, speed=1): """x, y, z in the system are in unit of meters, angles in radians.""" pos = self.stage.Position axis = 0 if speed > 1 or speed < 0: raise FEIValueError( f'setStageSpeed value must be between 0 and 1. Input: {speed}') self.tom.Stage.Speed = speed goniospeed = self.tom.Stage.Speed if x is not None: pos.X = x * 1e-6 axis += 1 if y is not None: pos.Y = y * 1e-6 axis += 2 if z is not None: pos.Z = z * 1e-6 axis += 4 if a is not None: pos.A = a / 180 * pi axis += 8 if b is not None: pos.B = b / 180 * pi axis += 16 if speed == 1: self.stage.Goto(pos, axis) else: if x is not None: self.stage.GotoWithSpeed(pos, 1, goniospeed) if y is not None: self.stage.GotoWithSpeed(pos, 2, goniospeed) if z is not None: self.stage.GotoWithSpeed(pos, 4, goniospeed) if a is not None: self.stage.GotoWithSpeed(pos, 8, goniospeed) if b is not None: self.stage.GotoWithSpeed(pos, 16, goniospeed)