diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-02 17:15:03 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-02 17:15:03 -0500 |
commit | 508db69a6b0a16d26cbccd2a1a1840310687d8e7 (patch) | |
tree | ed996c1a92a41b8a7ff93ab64b655a6d28dfce03 /qolab/hardware/rf_generator/agilent_e8257d.py | |
parent | 3c6c11f0c25e3d25422a4671f84d8b8d12d15ad6 (diff) | |
download | qolab-508db69a6b0a16d26cbccd2a1a1840310687d8e7.tar.gz qolab-508db69a6b0a16d26cbccd2a1a1840310687d8e7.zip |
added files required for agilent_e8257d generator
Diffstat (limited to 'qolab/hardware/rf_generator/agilent_e8257d.py')
-rw-r--r-- | qolab/hardware/rf_generator/agilent_e8257d.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/qolab/hardware/rf_generator/agilent_e8257d.py b/qolab/hardware/rf_generator/agilent_e8257d.py new file mode 100644 index 0000000..eef3c7a --- /dev/null +++ b/qolab/hardware/rf_generator/agilent_e8257d.py @@ -0,0 +1,57 @@ +from qolab.hardware.rf_generator import RFGeneratorSCPI +from qolab.data.trace import Trace +import re +import numpy as np + +class AgilentE8257D(RFGeneratorSCPI): + """ Agilent E8257D RF generator """ + def __init__(self, resource): + super().__init__(resource) + self.resource.read_termination='\n' + + """ Note: Fixed frequency and Center frequency (of sweep) are different in this model """ + + def getFreq(self): + qstr = f':FREQuency:Fixed?' + rstr = self.query(qstr) + return( float(rstr) ) + + def setFreq(self, freq): + cstr = f':FREQuency:FIXED {freq}Hz' + self.write(cstr) + + def getSweepCentralFreq(self): + qstr = f':FREQuency:CENTer?' + rstr = self.query(qstr) + return( float(rstr) ) + + def setSweepCentralFreq(self, cfreq): + cstr = f':FREQuency:CENTer {cfreq}Hz' + self.write(cstr) + + def getSweepSpan(self): + qstr = f':FREQuency:SPAN?' + rstr = self.query(qstr) + return( float(rstr) ) + + def setSweepSpan(self, span): + cstr = f':FREQuency:SPAN {span}Hz' + self.write(cstr) + + def setSweep(self, cfreq=None, span=None): + if cfreq is not None: + self.setSweepCentralFreq(cfreq) + if cfreq is not None: + self.setSweepSpan(span) + +if __name__ == '__main__': + import pyvisa + print("testing") + rm = pyvisa.ResourceManager() + print(rm.list_resources()) + instr=rm.open_resource('TCPIP::192.168.0.114::INSTR') + rfgen = AgilentE8257D(instr) + print(f'Fixed frequency: {rfgen.getFreq()}') + print(f'Sweep Central frequency: {rfgen.getSweepCentralFreq()}') + print(f'Sweep Span: {rfgen.getSweepSpan()}') + |