diff options
Diffstat (limited to 'qolab/hardware/rf_generator')
-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): |