Commit ffce98a7 authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Make checking of frequency optional

parent e6bcc19f
...@@ -10,8 +10,9 @@ class CamrasHpibDevice(object): ...@@ -10,8 +10,9 @@ class CamrasHpibDevice(object):
command_thread = None command_thread = None
def __init__(self, address): def __init__(self, address, check_frequency=True):
self.hpib_address = address self.hpib_address = address
self._check_frequency = check_frequency
if not CamrasHpibDevice.command_thread: if not CamrasHpibDevice.command_thread:
serial_port = serial.Serial("/dev/ttyUSB0") serial_port = serial.Serial("/dev/ttyUSB0")
...@@ -54,7 +55,7 @@ class CamrasHpibDevice(object): ...@@ -54,7 +55,7 @@ class CamrasHpibDevice(object):
CamrasHpibDevice.command_thread.protocol.command("freq {:d} Hz".format(int(freq)), CamrasHpibDevice.command_thread.protocol.command("freq {:d} Hz".format(int(freq)),
address=self.hpib_address) address=self.hpib_address)
new_freq = self.frequency new_freq = self.frequency
if new_freq.to(u.Hz).value != int(freq): if self._check_frequency and new_freq.to(u.Hz).value != int(freq):
raise RuntimeError("Setting frequency failed: tried to set to {}, it is now {}".format( raise RuntimeError("Setting frequency failed: tried to set to {}, it is now {}".format(
freq, new_freq)) freq, new_freq))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment