fix wiggle

This commit is contained in:
Sebastien Bourdeauducq 2020-08-12 13:06:46 +08:00
parent ec700a111b
commit 9ec7c5e794
1 changed files with 2 additions and 2 deletions

View File

@ -138,7 +138,7 @@ class Stabilizer:
else:
freq = None
tuning = 0.0
max_tuning_abs = 0.5 - self.wiggle
max_tuning_abs = 0.5 - self.wiggle_amplitude - 1e-9
tuning = max(min(tuning, max_tuning_abs), -max_tuning_abs)
if success:
@ -152,7 +152,7 @@ class Stabilizer:
self.unlock_counter += 1
if not success and (self.unlock_counter > self.unlock_counter_threshold):
print("wiggle")
self.wiggle = self.wiggle_amplitude*2.0*(np.random.random() - 0.5)
self.wiggle = self.wiggle_amplitude*np.random.uniform(-1.0, 1.0)
self.unlock_counter = 0
self.cb(spectrum, freq, self.locked(), tuning + self.wiggle)