The Jones Calculus: Examples

Scott Prahl

March 2020

Basic tests and visualization options for the pypolar.jones module.

This module and many optics texts (including Fowles) define angles based on the reciever point-of-view. This means that the electric field is viewed against the direction of propagation or on looking into the source. Complete details of the conventions used can be found in this Jupyter notebook on Conventions

[1]:
import numpy as np
import matplotlib.pyplot as plt

import pypolar.jones as jones
import pypolar.visualization as vis

# printing 1e-16 as zero
np.set_printoptions(suppress=True)

Optical isolator

56be04dff2434d39a80f643cc9aa0bc2

The path through the system is (b) linear polarizer at lab angle 0°, (C) QWP at 45°, (D) mirror , (E) QWP from the opposite side so -45°, linear polarizer at 0°

[2]:
B = jones.op_linear_polarizer(0)
C = jones.op_quarter_wave_plate(np.pi/4)
D = jones.op_mirror()
E = jones.op_quarter_wave_plate(-np.pi/4)
F = jones.op_linear_polarizer(0)

We can find the operator for these elements by multiplying all the matrices together. This is done using the @ operator (since python 3.5).

He we find the overall polarization operator for the five polarization elements is the zero matrix! Therefore any incident polarization state will be zeroed out — exactly what is needed for an optical isolator.

[3]:
F @ E @ D @ C @ B
[3]:
array([[0.+0.j, 0.+0.j],
       [0.+0.j, 0.+0.j]])

It is worth emphasizing that @ is required. The usual * operator only multiplies elements together and therefore ends up with the wrong result!

[4]:
F * E * D * C * B
[4]:
array([[0.5+0.j, 0. +0.j],
       [0. +0.j, 0. +0.j]])

Compare C @ D with D * C and it is clear that the two methods give completely different results.

[5]:
print(C @ D)
print()
print(C * D)
[[ 0.70710678+0.j          0.        -0.70710678j]
 [ 0.        +0.70710678j -0.70710678+0.j        ]]

[[ 0.70710678+0.j  0.        +0.j]
 [ 0.        +0.j -0.70710678+0.j]]

Visualization on Poincaré Sphere

Start with an arbitrary elliptical polarization state and see how by the second pass the polarization state is always linearly polarized at 90°.

[6]:
fig = plt.figure(figsize=(8, 8))
ax = fig.add_subplot(111, projection='3d')
vis.draw_empty_sphere(ax)

# J1 = jones.field_elliptical(np.random.random()*np.pi,np.random.random()*2*np.pi)

J1 = jones.field_elliptical(np.pi/6,np.pi/6)

J2 = B @ J1
J3 = C @ J2
J4 = D @ J3
J5 = E @ J4

vis.draw_jones_poincare(J1, ax, label='  start', color='red')
vis.draw_jones_poincare(J2, ax, label='  post Polarizer', color='blue')
vis.draw_jones_poincare(J3, ax, label='  post QWP', color='blue')
vis.draw_jones_poincare(J4, ax, label='  post mirror', color='blue')
vis.draw_jones_poincare(J5, ax, label='  post QWP', color='blue')

vis.join_jones_poincare(J1, J2, ax, color='blue', lw=2, linestyle=':')
vis.join_jones_poincare(J2, J3, ax, color='blue', lw=2, linestyle=':')
vis.join_jones_poincare(J3, J4, ax, color='blue', lw=2, linestyle=':')
vis.join_jones_poincare(J4, J5, ax, color='blue', lw=2, linestyle=':')

plt.show()

_images/05-Jones-Examples_12_0.png
[7]:
?vis
Type:        module
String form: <module 'pypolar.visualization' from '/Users/prahl/Documents/Code/git/pypolar/pypolar/visualization.py'>
File:        ~/Documents/Code/git/pypolar/pypolar/visualization.py
Docstring:
A set of basic routines for visualizing polarization.

Functions for drawing the polarization ellipse (sectional pattern)::

   draw_jones_ellipse(J)
   draw_stokes_ellipse(S)

Functions for drawing 2D and 3D representations::

    draw_jones_field(J)
    draw_stokes_field(S)

Functions for drawing an animated 2D and 3D representations::

   draw_jones_animated(J)
   draw_stokes_animated(S)

Functions for drawing a Poincaré representation::
   draw_empty_sphere()
   draw_jones_poincare(J)
   draw_stokes_poincare(S)
   join_jones_poincare(J)
   join_stokes_poincare(S)

Example: Poincaré sphere plot of a Jones vector::

    J = pypolar.jones.field_linear(np.pi/6)
    pypolar.visualization.draw_jones_poincare(J)

Example: Poincaré sphere plot of two Stokes vectors::

    S1 = pypolar.mueller.stokes_left_circular()
    S2 = pypolar.mueller.stokes_linear(np.radians(15))

    fig = plt.figure(figsize=(8, 8))
    ax = fig.add_subplot(111, projection='3d')
    pypolar.visualization.draw_empty_sphere(ax)
    pypolar.visualization.draw_stokes_poincare(S1, ax, label='  S1')
    pypolar.visualization.draw_stokes_poincare(S2, ax, label='  S2')
    pypolar.visualization.join_stokes_poincare(S1, S2, ax, lw=2, ls=':', color='orange')

[ ]: