From bde01fae55eba2d0fd3af9bd10c22336ce0352f3 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Mon, 17 Jun 2019 19:20:50 +0200 Subject: Shitty Poincare sphere (to be improved later) --- src/phys.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/phys.py') diff --git a/src/phys.py b/src/phys.py index 8065d14..7bf20e6 100644 --- a/src/phys.py +++ b/src/phys.py @@ -73,6 +73,12 @@ class Polarizer: self.t2 = 0 self.enable = True + def matrix(self): + A = np.sqrt(np.array([[self.t1, 0], [0, self.t2]])) # FIXME: half-assed again + M = np.array([[1, 0], [0, np.exp(1j * self.phase_retardation),]]) + return np.matmul(R(-self.angle - self.delta), + np.matmul(np.matmul(M, A), R(self.angle + self.delta))) + def mul(self, state): # unpolarized light if state is None: @@ -81,13 +87,7 @@ class Polarizer: np.array([[1], [0]])) * np.sqrt(self.t1) else: return None - - # FIXME: half-assed again - A = np.sqrt(np.array([[self.t1, 0], [0, self.t2]])) - M = np.array([[1, 0], [0, np.exp(1j * self.phase_retardation),]]) - MR = np.matmul(R(-self.angle - self.delta), \ - np.matmul(np.matmul(M, A), R(self.angle + self.delta))) - return np.dot(MR, state) + return np.dot(self.matrix(), state) class System: def __init__(self): -- cgit