def __init__(self, name, lock_in_freq, cycles, num_frames, settings=None): self._handle = LibHeLIC() self._name = name self._lock_in_freq = lock_in_freq self._cycles = cycles try: self._handle.Open(0, sys=self._name) except Exception as e: print(e) raise RuntimeError('Unable to open camera') _register(self.close) self.settings = { 'CamMode': 0, 'SensNFrames': num_frames, 'SensNavM2': int(cycles / 2), 'SensTqp': int(round((70e6 / (8 * self._lock_in_freq)) - 30)), #from Helicam C3 Manual Pg No - Update it 'SensDeltaExp': 0, 'BSEnable': 1, 'DdsGain': 2, 'TrigFreeExtN': 0, 'InvEncCnt': 0, } if settings is not None: self.settings.update({k: settings[k] for k in self.good_keys}) self._update_settings()
def __init__(self, host, port=1998, timeout=0.1): self._host = host self._port = port self._conn = _socket.create_connection((self._host, self._port), timeout=timeout) self.sleep_time = 0.01 _sleep(self.sleep_time) self._conn.recv(1024) _register(self.close)
def __init__(self, dlc_address,motor_address, *args, **kwargs): self._dlc_host = dlc_address self.dlc = DLCpro(NetworkConnection(dlc_address)).__enter__() self.set_power_stabilization(False) if motor_address is not None: self.motor = DLMotor(motor_address,home=True) else: self.motor = fakeMotor() self.sleep_time = 1.0 _register(self.close)
def __init__(self, addr, timeout=1.0): if isinstance(addr, _Serial): self._conn = addr else: self._conn = _serial_for_url(url=addr, timeout=timeout) _register(self.close) self._conn.write(b"0in") resp = self._conn.readline().decode('utf-8').strip() self._serial_num = resp[5:13] self.home() self.open = True
def __init__(self, port: str, timeout: float = 1.0, offset_wavelength: float = 0, offset_frequency: float = 0, motor: int = 2, home: bool = True, hysteresis_curve=None, enforce_limits: bool = True): # def __init__(self,port:str,timeout:float=1.0,motor:int=2,home:bool=True,hysteresis_curve=None,enforce_limits:bool=True,wavemeter_addr=None): self._port = _Serial(port=port, timeout=timeout) self.saved_positions = [] self._direction = None self._address = 1 self._motor = 2 self.wavelength_offset = offset_wavelength self.frequency_offset = offset_frequency self.enforce_limits = enforce_limits # self.wavemeter_addr = socket.create_connection((wavemeter_addr,1998),timeout=1.0) if hysteresis_curve is None: self._hysteresis_curve = self._load_hysteresis_curve( self.HYSTERESIS_CURVE, header=True) else: self._hysteresis_curve = self._load_hysteresis_curve( hysteresis_curve) self._pos_max = max(max(self._hysteresis_curve['up']), max(self._hysteresis_curve['down'])).position self._pos_min = min(min(self._hysteresis_curve['up']), min(self._hysteresis_curve['down'])).position if home: self.home_motor() # self.cycle_position('down') # self.cycle_position('up') # self.cycle_position('down') # self.cycle_position('up') _register(self.close)
from os import popen import sys try: l = getTerminalSize()[0] except: l = 0 sys.stdout.write( "\r" + " " * l + '\r\x1b[0;29m* {0}\x1b[0;29m'.format(str(x))) sys.stdout.flush() _updating = True def finishUpdate(**kwargs): global _verbo, _updating if _verbo: if not checkIsSublime(): print '' _updating = False def _output_exit(): global _updating if _verbo: if not checkIsSublime(): if _updating: finishUpdate() _updating = False _register(_output_exit)