diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-26 19:59:55 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-26 19:59:55 -0500 |
commit | 5449c6ae1fea9f925798f3a25cba12bd13946291 (patch) | |
tree | 8862f43d1b86b2ad3098a1f9fee08507300dad0c /qolab/hardware | |
parent | 07243e32a4737bb00fea4affec16da6d522fa76c (diff) | |
download | qolab-5449c6ae1fea9f925798f3a25cba12bd13946291.tar.gz qolab-5449c6ae1fea9f925798f3a25cba12bd13946291.zip |
rf generator log to tsdb
Diffstat (limited to 'qolab/hardware')
-rw-r--r-- | qolab/hardware/rf_generator/__init__.py | 8 | ||||
-rw-r--r-- | qolab/hardware/rf_generator/agilent_e8257d.py | 34 |
2 files changed, 36 insertions, 6 deletions
diff --git a/qolab/hardware/rf_generator/__init__.py b/qolab/hardware/rf_generator/__init__.py index 726dbb0..3064c54 100644 --- a/qolab/hardware/rf_generator/__init__.py +++ b/qolab/hardware/rf_generator/__init__.py @@ -3,8 +3,8 @@ from qolab.hardware.basic import BasicInstrument class RFGenerator(BasicInstrument): # Minimal set of methods to be implemented by a RFGenerator - def __init__(self): - BasicInstrument.__init__(self) + def __init__(self, *args, **kwds): + BasicInstrument.__init__(self, *args, **kwds) self.config['Device type']='RFGenerator' self.config['Device model'] = 'Generic RF generator Without Hardware interface' self.config['FnamePrefix'] = 'rfgen' @@ -16,9 +16,9 @@ class RFGeneratorSCPI(SCPIinstr, RFGenerator): rm = pyvisa.ResourceManager() RFGeneratorSCPI(rm.open_resource('TCPIP::192.168.0.2::INSTR')) """ - def __init__(self, resource): + def __init__(self, resource, *args, **kwds): SCPIinstr.__init__(self, resource) - RFGenerator.__init__(self) + RFGenerator.__init__(self, *args, **kwds) self.config['DeviceId'] = str.strip(self.idn) from .agilent_e8257d import AgilentE8257D diff --git a/qolab/hardware/rf_generator/agilent_e8257d.py b/qolab/hardware/rf_generator/agilent_e8257d.py index e765d85..98e3baa 100644 --- a/qolab/hardware/rf_generator/agilent_e8257d.py +++ b/qolab/hardware/rf_generator/agilent_e8257d.py @@ -1,3 +1,4 @@ +from qolab.hardware.basic import BasicInstrument from qolab.hardware.rf_generator import RFGeneratorSCPI from qolab.data.trace import Trace import re @@ -5,8 +6,8 @@ import numpy as np class AgilentE8257D(RFGeneratorSCPI): """ Agilent E8257D RF generator """ - def __init__(self, resource): - super().__init__(resource) + def __init__(self, resource, *args, **kwds): + super().__init__(resource, *args, **kwds) self.resource.read_termination='\n' self.config['Device model'] = 'Agilent E8257D' self.deviceProperties.extend([ @@ -25,102 +26,131 @@ class AgilentE8257D(RFGeneratorSCPI): """ Note: Fixed frequency and Center frequency (of sweep) are different in this model """ + @BasicInstrument.tsdb_append def getFreqFixed(self): qstr = f':FREQuency:Fixed?' rstr = self.query(qstr) return( float(rstr) ) + @BasicInstrument.tsdb_append def setFreqFixed(self, freq): cstr = f':FREQuency:FIXED {freq}Hz' self.write(cstr) + @BasicInstrument.tsdb_append def getSweepCentralFreq(self): qstr = f':FREQuency:CENTer?' rstr = self.query(qstr) return( float(rstr) ) + @BasicInstrument.tsdb_append def setSweepCentralFreq(self, cfreq): cstr = f':FREQuency:CENTer {cfreq}Hz' self.write(cstr) + @BasicInstrument.tsdb_append def getSweepSpan(self): qstr = f':FREQuency:SPAN?' rstr = self.query(qstr) return( float(rstr) ) + @BasicInstrument.tsdb_append def setSweepSpan(self, span): cstr = f':FREQuency:SPAN {span}Hz' self.write(cstr) + @BasicInstrument.tsdb_append def setSweep(self, cfreq=None, span=None): if cfreq is not None: self.setSweepCentralFreq(cfreq) if cfreq is not None: self.setSweepSpan(span) + @BasicInstrument.tsdb_append def getModulationState(self): return(int(self.query(f':MODulation:STATe?'))) + @BasicInstrument.tsdb_append def setModulationState(self, val): rstr = self.write(f':MODulation:STATe {val}') + @BasicInstrument.tsdb_append def getRFPowerState(self): return(int(self.query(f':OUTPut:STATe?'))) + @BasicInstrument.tsdb_append def setRFPowerState(self, val): rstr = self.write(f':OUTPut:STATe {val}') + @BasicInstrument.tsdb_append def getRFAmplitude(self): return(float(self.query(f':POWer:AMPLitude?'))) + @BasicInstrument.tsdb_append def setRFAmplitude(self, val): rstr = self.write(f':POWer:AMPLitude {val}') + @BasicInstrument.tsdb_append def getFM1ModulationDepth(self): return(float(self.query(f':FM1:Deviation?'))) + @BasicInstrument.tsdb_append def setFM1ModulationDepth(self, val): rstr = self.write(f':FM1:Deviation {val}') + @BasicInstrument.tsdb_append def getFM2ModulationDepth(self): return(float(self.query(f':FM2:Deviation?'))) + @BasicInstrument.tsdb_append def setFM2ModulationDepth(self, val): rstr = self.write(f':FM2:Deviation {val}') + @BasicInstrument.tsdb_append def getFM1Source(self): return(str(self.query(f':FM1:Source?'))) + @BasicInstrument.tsdb_append def setFM1Source(self, val): rstr = self.write(f':FM1:Source {val}') + @BasicInstrument.tsdb_append def getFM2Source(self): return(str(self.query(f':FM2:Source?'))) + @BasicInstrument.tsdb_append def setFM2Source(self, val): rstr = self.write(f':FM2:Source {val}') + @BasicInstrument.tsdb_append def getFM1State(self): return(int(self.query(f':FM1:State?'))) + @BasicInstrument.tsdb_append def setFM1State(self, val): rstr = self.write(f':FM1:State {val}') + @BasicInstrument.tsdb_append def getFM2State(self): return(int(self.query(f':FM2:State?'))) + @BasicInstrument.tsdb_append def setFM2State(self, val): rstr = self.write(f':FM2:State {val}') + @BasicInstrument.tsdb_append def getFrequencyMode(self): return(str(self.query(f':Frequency:Mode?'))) + @BasicInstrument.tsdb_append def setFrequencyMode(self, val): rstr = self.write(f':Frequency:Mode {val}') + @BasicInstrument.tsdb_append def startFrequencySweep(self): self.setFrequencyMode('Sweep') + @BasicInstrument.tsdb_append def stopFrequencySweep(self): self.setFrequencyMode('FIXED') |