This commit is contained in:
Sebastien Bourdeauducq 2020-08-11 14:59:52 +08:00
parent 48ff6bac8e
commit 69c5d0282d
3 changed files with 6 additions and 6 deletions

2
dmi.py
View File

@ -23,7 +23,7 @@ def main():
gui.update_beat_spectrum(spectrum, peak_freq, locked)
induction.set(tuning)
stabilizer = Stabilizer(block_size, (1088.1e6 - freq_base)/freq_sample, stabilizer_cb)
stabilizer = Stabilizer(freq_sample, block_size, 1088.1e6 - freq_base, stabilizer_cb)
position_tracker = PositionTracker(int(0.1*freq_sample/block_size))
sdr = SoapySDR.Device()

View File

@ -55,7 +55,7 @@ class MainWindow(pg.GraphicsLayoutWidget):
if peak_freq is None:
self.text_ref.setText("REF: NO SIGNAL")
else:
self.text_ref.setText("REF: {:.3f}MHz".format((self.freq_base + self.freq_sample*peak_freq)/1e6))
self.text_ref.setText("REF: {:.3f}MHz".format((self.freq_base + peak_freq)/1e6))
if locked:
self.text_locked.setText("REF LASER LOCKED", color="00FF00")
else:

View File

@ -106,8 +106,8 @@ class InductionHeater:
class Stabilizer:
def __init__(self, block_size, freq_target, cb):
self.freqs = np.fft.fftfreq(block_size)
def __init__(self, freq_sample, block_size, freq_target, cb):
self.freqs = np.fft.fftfreq(block_size, d=1/freq_sample)
self.freq_target = freq_target
self.cb = cb
@ -116,8 +116,8 @@ class Stabilizer:
self.wiggle_direction = 1
self.amp_threshold = 80.0
self.k = 50.0
self.tolerance = 0.010
self.k = 50.0e-6
self.tolerance = 10e3
self.lock_counter_threshold = 60
self.unlock_counter_threshold = 600
self.wiggle = 0.1