Commit 7caaa6e7 authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Throw error if device is off

parent abe68804
......@@ -11,12 +11,16 @@ class CamrasHpibDevice(HpibDevice):
@property
def frequency(self):
"""Returns the frequency (in Hz) of the receiver"""
"""Returns the frequency (in Hz) of the device. Throws a RuntimeError if no response"""
freq_str = self.query("freq?")
if len(freq_str)==0:
raise RuntimeError("Camras device at address {} is not responding".format(self._hpib_address))
return int(float(self.query("freq?")))
@frequency.setter
def frequency(self, freq):
"""Set the receiver to the specified frequency. Throws a RuntimeError if failed"""
"""Set the device to the specified frequency. Throws a RuntimeError if failed"""
print("setting frequency to", freq)
self.command("freq {:d} Hz".format(int(freq)))
new_freq = self.frequency
if new_freq != 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