### 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
from raypier.tracer import RayTraceModel
from raypier.sources import ConfocalRayFieldSource
from raypier.lenses import PlanoConvexLens
from raypier.fields import EFieldPlane
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])
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.
%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")
Enjoy the spherical aberations.
probe.direction = 0,0,1
probe.height=0.05
%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")