From 5c4f541669a5528f1c315df781f63981aadde08e Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 16 Aug 2020 17:45:28 +0800 Subject: [PATCH] fix position math --- gui_impl.py | 2 +- noptica.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gui_impl.py b/gui_impl.py index 757faba..a3ed216 100644 --- a/gui_impl.py +++ b/gui_impl.py @@ -72,7 +72,7 @@ class MainWindow(pg.GraphicsLayoutWidget): def update_position(self, position): self.position_history = np.roll(self.position_history, -1) - self.position_history[-1] = position*632.816/2 + self.position_history[-1] = position*632.816/(4.0*np.pi) self.position.clear() self.position.plot(self.position_history) diff --git a/noptica.py b/noptica.py index c13296e..474fa97 100644 --- a/noptica.py +++ b/noptica.py @@ -184,9 +184,8 @@ class PositionTracker: self.last_position = 0.0 def input(self, ref, meas): - demod = np.conjugate(ref)*meas - phase = np.angle(demod) - position = continuous_unwrap(self.last_phase, self.last_position, phase)/(2.0*np.pi) + phase = np.angle(meas*ref.conj()) + position = continuous_unwrap(self.last_phase, self.last_position, phase) self.last_phase = phase[-1] self.last_position = position[-1] return position