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()
omega0_p = .5 ######## END Param ############## ####### 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) ) \ + lg.LG_xy( l=0, p=p, xx=xx, yy=yy, omega0=.85*2/sqrt(l) ) # normalize lg; we only want the phase information lg /= abs(lg) #imshow (angle(lg)); show() ####### END Create LG order propagate = Propagate(vmin=0., vmax=100.) F = Field(N, side_length, wavelength) F.gaussian_aperture(gaussian_size) #F.lens(f) F.value[:] *= lg #propagate(F, z=2*f, dz=.5*cm) for z in r_[0:(2 * f):(.1 * f)]: Fcopy = F.copy() Fcopy.lens_forvard(f, z) propagate.imshow((Fcopy.value * Fcopy.value.conj()).real) raw_input()
#imshow (x,y,angle(lg)) ####### END Create LG order propagate = Propagate() F = Field(N, side_length, wavelength) F.gaussian_aperture(gaussian_size) 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
""".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()
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 F.forvard(z4)