From bf375142e009aaaa7a517b67e5842d493ae0206a Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Sun, 2 Jan 2022 18:22:04 -0500 Subject: redo lockin via SCPI_PROPERTY --- qolab/hardware/lockin/srs_sr865a.py | 135 +++++++++++------------------------- 1 file changed, 40 insertions(+), 95 deletions(-) (limited to 'qolab/hardware/lockin') diff --git a/qolab/hardware/lockin/srs_sr865a.py b/qolab/hardware/lockin/srs_sr865a.py index 3d3ebfc..727c54e 100644 --- a/qolab/hardware/lockin/srs_sr865a.py +++ b/qolab/hardware/lockin/srs_sr865a.py @@ -1,5 +1,11 @@ from qolab.hardware.basic import BasicInstrument from qolab.hardware.lockin import LockinSCPI +from qolab.hardware.scpi import SCPI_PROPERTY +from enum import IntEnum, EnumMeta + +class TimeBaseOption(IntEnum): + AUTO=0 + INT=1 class SRS_SR865A(LockinSCPI): """ SRS SR865A lockin """ @@ -9,101 +15,40 @@ class SRS_SR865A(LockinSCPI): self.resource.read_termination='\n' self.deviceProperties.extend(['TimeBaseMode']) - @BasicInstrument.tsdb_append - def getFreqInt(self): - qstr = f'FreqInt?' - rstr = self.query(qstr) - return(float(rstr)) - - @BasicInstrument.tsdb_append - def setFreqInt(self, freq): - cstr = f'FreqInt {freq}' - rstr = self.write(cstr) - - # this one has only getter - @BasicInstrument.tsdb_append - def getFreqExt(self): - qstr = f'FreqExt?' - rstr = self.query(qstr) - return(float(rstr)) - - @BasicInstrument.tsdb_append - def getHarm(self): - qstr = f'Harm?' - rstr = self.query(qstr) - return(int(rstr)) - - @BasicInstrument.tsdb_append - def setHarm(self, harm): - cstr = f'Harm {harm}' - rstr = self.write(cstr) - - @BasicInstrument.tsdb_append - def getSinAmpl(self): - qstr = f'SLVL?' - rstr = self.query(qstr) - return(float(rstr)) - - @BasicInstrument.tsdb_append - def setSinAmpl(self, ampl): - cstr = f'SLVL {ampl}' - rstr = self.write(cstr) - - @BasicInstrument.tsdb_append - def getSinOffset(self): - qstr = f'SOFF?' - rstr = self.query(qstr) - return(float(rstr)) - - @BasicInstrument.tsdb_append - def setSinOffset(self, offset): - cstr = f'SOFF {offset}' - rstr = self.write(cstr) - - @BasicInstrument.tsdb_append - def getSensetivity(self): - return(int(self.query(f'SCAL?'))) - - @BasicInstrument.tsdb_append - def setSensetivity(self, val): - rstr = self.write(f'SCAL {val}') - - @BasicInstrument.tsdb_append - def getTimeConstan(self): - return(int(self.query(f'OFLT?'))) - - @BasicInstrument.tsdb_append - def setTimeConstan(self, val): - rstr = self.write(f'OFLT {val}') - - @BasicInstrument.tsdb_append - def getFilterSlope(self): - return(int(self.query(f'OFSL?'))) - - @BasicInstrument.tsdb_append - def setFilterSlope(self, val): - rstr = self.write(f'OFSL {val}') - - # this one has only getter - @BasicInstrument.tsdb_append - def getEquivalentFileterBW(self): - return(float(self.query(f'ENBW?'))) - - @BasicInstrument.tsdb_append - def getTimeBaseMode(self): - return(int(self.query(f'TBMODE?'))) - - @BasicInstrument.tsdb_append - def setTimeBaseMode(self, val): - rstr = self.write(f'TBMODE {val}') - - @BasicInstrument.tsdb_append - def getRefPhase(self): - return(float(self.query(f'PHAS?'))) - - @BasicInstrument.tsdb_append - def setRefPhase(self, val): - rstr = self.write(f'PHAS {val}') + FreqInt = SCPI_PROPERTY(scpi_prfx='FreqInt', ptype=float, doc='Internal LO frequency') + FreqExt = SCPI_PROPERTY(scpi_prfx='FreqExt', ptype=float, doc='External LO frequency', no_setter=True) + Harm = SCPI_PROPERTY(scpi_prfx='Harm', ptype=float, doc='Harmonic of the LO') + SinAmpl = SCPI_PROPERTY(scpi_prfx='SLVL', ptype=float, doc='Modulation amplitude') + SinOffset = SCPI_PROPERTY(scpi_prfx='SOFF', ptype=float, doc='Modulation offset') + EquivalentNoiseBW = SCPI_PROPERTY(scpi_prfx='ENBW', ptype=float, doc='Equivalent Noise BandWidth (it is not 3dB BW, see the manual)', no_setter=True) + TimeBaseMode = SCPI_PROPERTY(scpi_prfx='TBMODE', ptype=int, doc='10 MHz reference mode: 0 - Auto, 1 - Internal') + RefPhase = SCPI_PROPERTY(scpi_prfx='PHAS', ptype=float, doc='LO/reference phase') + + Sensitivity = SCPI_PROPERTY(scpi_prfx='SCAL', ptype=int, doc=""" + Sensitivity: + 0: 1 V (uA), 6: 10 mV (nA), ... 27: 1 nV (fA) + 1: 500 mV (nA), 7: 5 mV (nA), + 2: 200 mV (nA), 8: 2 mV (nA), + 3: 100 mV (nA), 9: 1 mV (nA), + 4: 50 mV (nA), 10: 500 uV (pA), + 5: 20 mV (nA), 11: 200 uV (pA), + """) + TimeConstan = SCPI_PROPERTY(scpi_prfx='OFLT', ptype=int, doc=""" + Time constant: + 0: 1 uS, 6: 1 mS, ..... , 21: 30 kS + 1: 3 uS, 7: 3 mS, + 2: 10 uS, 8: 10 mS, + 3: 30 uS, 9: 30 mS, + 4: 100 uS, 10: 100 mS, + 5: 300 uS, 11: 300 mS, + """) + FilterSlope = SCPI_PROPERTY(scpi_prfx='OFSL', ptype=int, doc=""" + Output Filter slope: + 0: 6dB/Oct + 1: 12dB/Oct + 2: 18dB/Oct + 3: 24dB/Oct + """) if __name__ == '__main__': import pyvisa -- cgit v1.2.3