diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2022-05-31 16:52:21 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2022-05-31 16:52:21 -0400 |
commit | 266c7085e8c0b14feaf250e326db2d47d900d04f (patch) | |
tree | 0f1788276b37035c5e8822b6c7ba0fb89f41b98a /qolab/hardware | |
parent | ba2b3ed0c8faff18905dd7191eea24653fdf8667 (diff) | |
download | qolab-266c7085e8c0b14feaf250e326db2d47d900d04f.tar.gz qolab-266c7085e8c0b14feaf250e326db2d47d900d04f.zip |
added hope free tuning to home build generator
Diffstat (limited to 'qolab/hardware')
-rw-r--r-- | qolab/hardware/rf_generator/qol_lmx2487.py | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/qolab/hardware/rf_generator/qol_lmx2487.py b/qolab/hardware/rf_generator/qol_lmx2487.py index c81b71b..e8214a9 100644 --- a/qolab/hardware/rf_generator/qol_lmx2487.py +++ b/qolab/hardware/rf_generator/qol_lmx2487.py @@ -19,6 +19,8 @@ class QOL_LMX2487(RFGenerator): self.log = [] self.logCapacity = 10 self._FreqFixed = None + self.hopeFreeFreqJump = 100e3 # we break laser lock if Freq change is larger + self.hopeFree = True if setToDefaults: self.sendSerialCmd("set_lmx2487_board_to_default_state()") @@ -47,9 +49,29 @@ class QOL_LMX2487(RFGenerator): @BasicInstrument.tsdb_append def setFreqFixed(self,freq): - self._FreqFixed = freq - cmd_str=f'setFreq({freq:.2f})' - self.sendSerialCmd(cmd_str) + """ + Will do incremental hope free tuning to desired frequency, + if self.hopeFree is True. + RF generator itself is fine, but our laser looses lock without it. + """ + + finished = False + while not finished: + frNow = self.getFreqFixed() + dF = freq-frNow + if dF >= 0: + dFSign = 1 + else: + dFSign = -1 + dF = abs(dF) + if dF <= self.hopeFreeFreqJump or not self.hopeFree: + fr = freq + finished = True + else: + fr = frNow + dFSign * self.hopeFreeFreqJump + self._FreqFixed = fr + cmd_str=f'setFreq({fr:.2f})' + self.sendSerialCmd(cmd_str) @BasicInstrument.tsdb_append def getFreqFixed(self): |