diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2019-06-17 19:20:50 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2019-06-17 19:20:50 +0200 |
commit | bde01fae55eba2d0fd3af9bd10c22336ce0352f3 (patch) | |
tree | 548c7a049c098c79d68760c1cd8f7990a8c12c58 /src/phys.py | |
parent | 30a8d019417f59ce825ccdf44b16e0a51bdda3f2 (diff) |
Shitty Poincare sphere (to be improved later)
Diffstat (limited to 'src/phys.py')
-rw-r--r-- | src/phys.py | 14 |
1 files changed, 7 insertions, 7 deletions
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): |