Commit 2e4b9483 authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Add wrapper for camras devices

parent 680a8df7
import hpib
from hpib import HpibDevice
class CamrasHpibDevice(HpibDevice):
"""Wrapper around HPIB commands"""
def __init__(self, address):
self._port = hpib.PrologixGpibUsb()
super(CamrasHpibDevice, self).__init__(address, self._port)
self.__frequency = 0
def frequency(self):
"""Returns the frequency (in Hz) of the receiver"""
return int(float(self.query("freq?")))
def frequency(self, freq):
"""Set the receiver to the specified frequency. Throws a RuntimeError if failed"""
self.command("freq {:d} Hz".format(int(freq)))
new_freq = self.frequency
if new_freq != freq:
raise RuntimeError("Setting frequency failed: tried to set to {}, it is now {}".format(
freq, new_freq))
class Receiver(CamrasHpibDevice):
"""Wrapper around HPIB commands for the Rohde & Schwartz receiver"""
def __init__(self):
super(Receiver, self).__init__(1)
class LO(CamrasHpibDevice):
"""Wrapper around HPIB commands for the local oscillator"""
def __init__(self):
super(LO, self).__init__(28)
class SignalGenerator(CamrasHpibDevice):
"""Wrapper around HPIB commands for the signal generator"""
def __init__(self):
super(SignalGenerator, self).__init__(14)
Supports Markdown
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