diff options
Diffstat (limited to 'src/ui.py')
-rw-r--r-- | src/ui.py | 38 |
1 files changed, 21 insertions, 17 deletions
@@ -32,38 +32,42 @@ def update(): for i, pol in enumerate(system.elements): row = GUI.table.rows[i] - # update all the diagrams row.ellipse.state = system.states[i] row.ellipse.ellipse = system.ellipses[i] row.ellipse.is_used = system.elements[i].enable row.ellipse.repaint() - - text = "%s at %f°" \ - % (pol.type, (pol.angle + pol.delta) * 180 / np.pi) - row.info_angle.setText(text) state = system.states[i] + V = system.Vs[i] ellipse = system.ellipses[i] if state is None: - I = 1 - row.info_jones.setText("Unpolarized") + I = system.input_intensity + + for label in row.jones: + label.setText("-") + row.stokes[0].setText("%g" % I) + for label in row.stokes[1:]: + label.setText("0") else: I = np.abs(state[0] * state[0].conjugate() \ + state[1] * state[1].conjugate()) if state is None: continue - - A, B = state - text = "I = %f\n" % I - text += "%f ∠ %+f°\n%f ∠ %+f°\n" % \ - (np.abs(A), 180 / np.pi * np.angle(A), \ - np.abs(B), 180 / np.pi * np.angle(B)) - text += "α = %f°\nφ = %+f°" % \ - (180 / np.pi * ellipse.alpha, 180 / np.pi * ellipse.theta) - text = text.replace("-", "- ").replace("+", "+ ") - row.info_jones.setText(text) + + polar = [(np.abs(z), np.angle(z) * 180 / np.pi) for z in state] + for i, (a, b) in enumerate(polar): + row.jones[2 * i].setText("%g" % a) + row.jones[2 * i + 1].setText("%g°" % b) + + delta = polar[1][1] - polar[0][1] + row.jones[4].setText("%g°" % delta) + + for i, x in enumerate(phys.jones_to_stokes(state)): + row.stokes[i].setText("%g" % x) + row.stokes[4].setText("%g°" % (ellipse.alpha * 180 / np.pi)) + row.stokes[5].setText("%g°" % (ellipse.theta * 180 / np.pi)) GUI.widok.intensity = I GUI.widok.repaint() |