From 9ec7c5e794ff8005bf987ccb663ff19a508f6b76 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 12 Aug 2020 13:06:46 +0800 Subject: [PATCH] fix wiggle --- noptica.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/noptica.py b/noptica.py index 8da101e..9a5dc97 100644 --- a/noptica.py +++ b/noptica.py @@ -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)