Exemple #1
0
m = 1
nm = 1e-9 * m
mm = 1e-3 * m
cm = 1e-2 * m

wavelength = 550 * nm
size = 5 * mm
N = 150
R = 0.12 * mm
x = 0.5 * mm
y = 0.25 * mm
z = 5 * cm

F = Field(N, size, wavelength)
F2 = F.copy()
F3 = F.copy()
F.circular_aperture(R, -x, -y)
F2.circular_aperture(R, x, -y)
F3.circular_aperture(R, 0, y)
F.value[:] = F.value + F2.value + F3.value
del F2, F3

for l in xrange(1, 11):
    F.forvard(z)
    subplot(2, 5, l)
    imshow(abs(F.value)**2)
    xticks([]), yticks([])
    title('z={z} cm'.format(z=(l * z / cm)))

show()
Exemple #2
0
from lightpipes import Field
from pylab import *

m = 1
nm = 1e-9 * m
mm = 1e-3 * m
cm = 1e-2 * m

wavelength = 550 * nm
size = 5 * mm
N = 300
R = 0.12 * mm
d = 0.5 * mm
z = 5 * cm

F = Field(N, size, wavelength)
F2 = F.copy()
F.circular_aperture(R, d, 0)
F2.circular_aperture(R, -d, 0)
F.value[:] = F.value + F2.value
del F2

for l in xrange(1, 11):
    F.forvard(z)
    subplot(2, 5, l)
    imshow(abs(F.value)**2)
    xticks([]), yticks([])
    title('z={z} cm'.format(z=(l * z / cm)))

show()
Exemple #3
0
#!/usr/bin/env python
"""
LightPipes for Python Optical Toolbox
Calculates the Fraunhofer diffraction of a round hole.
"""

import common
from lightpipes import Field
from pylab import *

m = 1
nm = 1e-9 * m
mm = 1e-3 * m
cm = 1e-2 * m

wavelength = 1000 * nm
size = 10 * cm
N = 150
R = 10 * mm
z = 1000 * m
f1 = 200 * m
f2 = -200 * m

F = Field(N, size, wavelength)
F.circular_aperture(R)
F.lens(f1)
F.lens_forvard(f2, z)

imshow(abs(F.value)**2)  # plot intensity
show()
Exemple #4
0

x = y = grid_dx * r_[-255.5:256:1.]
[xx, yy] = meshgrid(x,y)
torus_phase = tlens(xx,yy,R0,f_torus,wavelength) + phase_ring(xx,yy,R1,w1)

propagate = Propagate()

#print 'press enter to continue'
#propagate.imshow( torus_phase )
#raw_input()

# propagate the field from the SLM and take a look
F = Field( N, side_length, wavelength)     # initial field
F.gaussian_aperture(w)                     # gaussian input
F.circular_aperture(side_length/2.)        # Iris in front of SLM
F.value[:] *= exp(1j * torus_phase )       # apply SLM phase
F.forvard(f_torus)
propagate(F, z=f_torus, dz=f_torus/25.)

print 'press enter to show final phase...'
raw_input()
propagate.imshow( angle(F.value) )

print 'press enter to show final intensity...'
raw_input()
propagate.imshow( (F.value * F.value.conj()).real )

print 'press enter to exit'
raw_input()