diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-09 21:20:52 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-09 21:20:52 -0500 |
commit | 13892e556d475cf34ae4e2424d45ff93580dca26 (patch) | |
tree | fee53fd6663c326994bc8817da7a88caa9b9eccb /qolab | |
parent | 5cda6142ddd092f8d7ea9da25ab4794108eb30cb (diff) | |
download | qolab-13892e556d475cf34ae4e2424d45ff93580dca26.tar.gz qolab-13892e556d475cf34ae4e2424d45ff93580dca26.zip |
simplified rf generator
Diffstat (limited to 'qolab')
-rw-r--r-- | qolab/hardware/rf_generator/__init__.py | 13 | ||||
-rw-r--r-- | qolab/hardware/rf_generator/agilent_e8257d.py | 12 |
2 files changed, 17 insertions, 8 deletions
diff --git a/qolab/hardware/rf_generator/__init__.py b/qolab/hardware/rf_generator/__init__.py index 15a366e..726dbb0 100644 --- a/qolab/hardware/rf_generator/__init__.py +++ b/qolab/hardware/rf_generator/__init__.py @@ -1,8 +1,14 @@ from qolab.hardware.scpi import SCPIinstr +from qolab.hardware.basic import BasicInstrument -class RFGenerator: - # Minimal set of methods to be implemented. - pass +class RFGenerator(BasicInstrument): + # Minimal set of methods to be implemented by a RFGenerator + def __init__(self): + BasicInstrument.__init__(self) + self.config['Device type']='RFGenerator' + self.config['Device model'] = 'Generic RF generator Without Hardware interface' + self.config['FnamePrefix'] = 'rfgen' + self.deviceProperties = ['FreqFixed', ] class RFGeneratorSCPI(SCPIinstr, RFGenerator): """ @@ -13,6 +19,7 @@ class RFGeneratorSCPI(SCPIinstr, RFGenerator): def __init__(self, resource): SCPIinstr.__init__(self, resource) RFGenerator.__init__(self) + 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 eef3c7a..c98f0f1 100644 --- a/qolab/hardware/rf_generator/agilent_e8257d.py +++ b/qolab/hardware/rf_generator/agilent_e8257d.py @@ -8,15 +8,17 @@ class AgilentE8257D(RFGeneratorSCPI): def __init__(self, resource): super().__init__(resource) self.resource.read_termination='\n' + self.config['Device model'] = 'Agilent E8257D' + self.deviceProperties.extend(['SweepCentralFreq', 'SweepSpan', ]) """ Note: Fixed frequency and Center frequency (of sweep) are different in this model """ - def getFreq(self): + def getFreqFixed(self): qstr = f':FREQuency:Fixed?' rstr = self.query(qstr) return( float(rstr) ) - def setFreq(self, freq): + def setFreqFixed(self, freq): cstr = f':FREQuency:FIXED {freq}Hz' self.write(cstr) @@ -51,7 +53,7 @@ if __name__ == '__main__': 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()}') + print('------ Header start -------------') + print(str.join('\n', rfgen.getHeader())) + print('------ Header ends -------------') |