def main(return_final=False):
    N = r_[2**21, 2]  # Number of pixels (different resolution for demo)
    DX = 60 * mm  # physical size in the important direction
    wavelength = 780 * nm  # Wavelength
    gaussian_size = 1.0 / sqrt(
        2) * mm  # 1/e Intensity width of beam; (note, it's not the 1/e^2)
    L_propagate = 25 * mm  # distance from initial lens to 2D-MOT

    # grating parameters
    grating_period = mm / 900
    grating_lambda = 1200 * nm  # for the blazed grating

    ######## END Param ##############

    side_length = DX * r_[1, N[1] / float(N[0])]  # physical size

    ####### Create grating
    G = grating.phase.Blazed(grating_period / m, wavelength / m,
                             grating_lambda / m)
    ####### END Create grating

    propagate = Propagate1D(N, side_length, window_size=511)

    #####  With the knife edge between the SLM (at SLM focus) relay:1,lens:1.
    #####  In this case, we relay the knife edge to the MOT and not the SLM plane.
    F = Field(N, side_length / m, wavelength / m)  # beginning field
    F.gaussian_aperture(gaussian_size / m, 1e300)

    G.apply(F)

    if return_final:
        F.forvard(L_propagate / m)
        plot((F.value * F.value.conj()).real[:, N[1] / 2])
        return F
    else:
        propagate(F, L_propagate / m, L_propagate / m / 75.)

    print 'press enter to exit'
    raw_input()
예제 #2
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()
예제 #3
0
####### Create LG order
dx = (2 / (N - 1.))
x = y = 3 * r_[-1:(1 + dx):dx]
[xx, yy] = meshgrid(x, y)

lg = lg.LG_xy(l=l, p=0, xx=xx, yy=yy, omega0=2 / sqrt(l))
# normalize lg; we only want the phase information
lg /= abs(lg)
#imshow (x,y,arg(lg))
####### END Create LG order

propagate = Propagate()

F = Field(N, side_length, wavelength)
F.gaussian_aperture(gaussian_size)
F.axicon(axicon_angle, axicon_n1)
#F4 = propagate(13.*cm, step_size,               F3,0,0,4);
F.forvard(7.5 * cm)
F.axicon(axicon_angle, axicon_n1)

print 'moving towards slm'
#F.forvard(40*cm)
propagate(F, z=40. * cm, dz=10 * cm)

print 'applying slm'
F.value[:] *= lg
propagate(F, z=50. * cm, dz=2 * cm)
print 'press enter to exit'
raw_input()
예제 #4
0
lg = lg.LG_xy(l=l, p=0, xx=xx, yy=yy, omega0=2 / sqrt(l))
# normalize lg; we only want the phase information
lg /= abs(lg)
#imshow (x,y,arg(lg))
####### END Create LG order

propagate = Propagate()

if False:
    #####  Just the hollow beam relayed.
    F = Field(N, side_length, wavelength)  # beginning field
    F.gaussian_aperture(gaussian_size)
    F.value[:] *= lg  # SLM LG phase
    F.lens(fslm)  # 'SLM' lens
    F.forvard(fslmR)
    F.lens(fslmR)  # relay:1 lens:1
    F.forvard(2 * fslmR)
    F.lens(fslmR)  # relay:1 lens:2
    F.forvard(fslmR + fslm)  # MOT (1st pass)

    imshow((F.value * F.value.conj()).real)
    print 'press enter to continue'
    raw_input()

    F.forvard(fr1)
    F.lens(fr1, )  # relay:2 lens:1
    F.forvard(fr1 + fr2)
    F.lens(fr2, )  # relay:2 lens:2
    F.forvard(2 * fr2)
    F.lens(fr2, )  # relay:2 lens:3
예제 #5
0
"""
LightPipes for Python Optical Toolbox
"""

import common
from lightpipes import Field
from pylab import *


phi = 178 * (pi/180.)


F = Field(256, 512*15e-6, 780e-9)
F.gaussian_aperture(.75e-3) 
F.axicon(phi, 1.5,   0e-6, 0)
F.forvard(25e-2)

imshow( abs(F.value)**2 )
show()

F.axicon(phi, 1.5,   0e-6, 0)
F.forvard(100e-2)

imshow( abs(F.value)**2 )
show()


#F.lens(-20e-2)
#F.forvard(3e-2)
#    gsplot F7.F.*conj(F7.F);
예제 #6
0
  """.format(*choices)
  choice = raw_input()
  if choice not in ['0','1','2','3']:
    break
  choice = int(choice)


  F = Field(N,size,wavelength)
  F.circular_aperture(R)
  if choice == 3:
    F.lens(f)
  else:
    k = choice
    F.zernike(nZ[k],mZ[k],RZ[k],AZ[k])

  F.forvard(z1)
  F1 = F.copy()
  F1.value[:] *= Rplate
  F.value[:] *= (1 - Rplate)

  F.interpolate(size,N,D,D1)
  F.value[:] += F1.value
  Int = (F.value * F.value.conj()).real

  if im:
    im.set_array(Int)
  else:
    im = imshow(Int)
  title( choices[choice] )
  draw()
예제 #7
0
Pf = P / sum(F.value * F.value.conj())  # power per grid cell [ W ]
Ef = sqrt(Pf / grid_dx**2)  # sqrt(I) [ sqrt(W/m^2) ]
Ef /= sqrt(mW / cm**2)  # put Ef in units [ sqrt(mW/cm^2) ]
F.value[:] *= Ef  # put F in units of sqrt(I)

print 'writing SLM phase...'
F.lens(f)  # apply lens (physical lens)
Fb = F.copy()  # store the undeflected beam
Fb.value[:] *= sqrt(0.2)  # undeflected light
F.value[:] *= lg  # apply lg phase
grating.phase.perfect(F, 32, 0)  # apply a perfect grating phase.
F.value[:] *= sqrt(0.8)  # deflection efficiency of SLM
F.value[:] += Fb.value  # mix the beams back together.
print 'finished writing SLM phase.'

F.forvard(lf * f)

# traverse a piece of glass and interfere primary beam with 1st internally
# reflected+transmitted beam.
Fr = F.copy()
Fr.interpolate(side_length, N, dx0)
Fr.value[:] *= exp(1j * dphi)  # add phase delay to secondary beam
Fr.value[:] *= (r * r * (1 - r))  # reflection, reflection, transmission
F.value[:] *= (1 - r)  # transmission
F.value[:] += Fr.value  # mix the beams back together.

xlabel('x (mm)')
ylabel('y (mm)')
propagate(F, z=(1 - lf) * f + 2 * cm, dz=.5 * cm)
cb = colorbar()
cb.set_label('I [mW/cm^2]')
예제 #8
0
size = 30 * mm
R = 5 * mm
N = 250
z1 = 50 * cm
z2 = 40 * cm
z3 = 40 * cm
z4 = 100 * cm
RBS = 0.3
nz = 3
mz = 1
Rz = 0.005
Az = 25

F1 = Field(N, size, wavelength)
F1.circular_aperture(R)
F1.forvard(z1)

F2 = F1.copy()

F1 *= RBS
F2 *= 1 - RBS
F1.forvard(2 * z2)
F2.forvard(z3)
F1
F2.zernike(nz, mz, Rz, Az)
F1
F2.forvard(z3)
F1 *= RBS
F2 *= 1 - RBS

F = F1 + F2
예제 #9
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()