In [1]:
### Because We're running from the Examples folder and raytrace is not installed
import sys
sys.path.append('..')

from matplotlib import pyplot as pp
import numpy as np
In [3]:
from raypier.tracer import RayTraceModel
from raypier.sources import ConfocalRayFieldSource
from raypier.lenses import PlanoConvexLens
from raypier.fields import EFieldPlane
In [5]:
lens = PlanoConvexLens(centre=(0,0,20),
                      direction=(0,0,1),
                      diameter=25,
                      curvature=100,
                      n_inside=1.6)

src = ConfocalRayFieldSource(centre=(0,0,0),
                            direction=(0,0,1),
                            angle=5.0,
                            angle_step=0.5,
                            E_vector=(1,0,0),
                            working_dict=100.0,
                            display='wires')

probe = EFieldPlane(source=src,
                   width=0.05,
                   height=1.0,
                   size=100,
                   centre=(0,0,77.4),
                   direction=(0,1,0))

model = RayTraceModel(optics=[lens],
                     sources=[src],
                     probes=[probe])
Made input rays.
trace
SET MTIME
Field calculation took: 0.23153188778087497 s
In [6]:
model.ipython_view(800,600)

The probe-plane is in the 3D view but it's rather small (only 50 microns wide) and obscured by the rays, so you can't see it unless you zoom in a lot.

In [7]:
%matplotlib notebook

pwr = (probe.E_field.real**2 + probe.E_field.imag**2).sum(axis=-1)
pp.imshow(pwr)
pp.title("Optical Intensity")
pp.xlabel("Radial position")
pp.ylabel("Axis position")
Out[7]:
Text(0, 0.5, 'Axis position')

Enjoy the spherical aberations.

In [8]:
probe.direction = 0,0,1
probe.height=0.05
Field calculation took: 0.2280168430879712 s
Field calculation took: 0.19471929827705026 s
In [9]:
%matplotlib notebook

pwr = (probe.E_field.real**2 + probe.E_field.imag**2).sum(axis=-1)
pp.imshow(pwr)
pp.title("Optical Intensity")
pp.xlabel("Radial position")
pp.ylabel("Axis position")
Out[9]:
Text(0, 0.5, 'Axis position')