def bpm_3d_spheres(size, units, lam = .5, u0 = None, points = None, dn_inner = 0.0, rad_inner = 0., dn_outer = 0.05, rad_outer = 2.5, return_scattering = False, use_fresnel_approx = False ): """ simulates the propagation of monochromativ wave of wavelength lam with initial conditions u0 along z in a media filled with coated spheres at positions points and inner radius r1 and dn1 and outer radius r2/ dn2 size - the dimension of the image to be calulcated in pixels (Nx,Ny,Nz) units - the unit lengths of each dimensions in microns lam - the wavelength u0 - the initial field distribution, if u0 = None an incident plane wave is assumed points - a list of coordinates [[x1,y1,z1],...] in real unit interval [0...dx*nx] where spheres are placed. """ dn_g = create_dn_buffer(size,units,points = points, dn_inner = dn_inner, rad_inner = rad_inner, dn_outer = dn_outer, rad_outer = rad_outer) return bpm_3d(size = size,units = units,lam = lam, u0 = u0,dn = dn_g, return_scattering= return_scattering, use_fresnel_approx = use_fresnel_approx)
def bpm_3d_spheres(size, units, lam=.5, u0=None, points=None, dn_inner=0.0, rad_inner=0., dn_outer=0.05, rad_outer=2.5, return_scattering=False, use_fresnel_approx=False): """ simulates the propagation of monochromativ wave of wavelength lam with initial conditions u0 along z in a media filled with coated spheres at positions points and inner radius r1 and dn1 and outer radius r2/ dn2 size - the dimension of the image to be calulcated in pixels (Nx,Ny,Nz) units - the unit lengths of each dimensions in microns lam - the wavelength u0 - the initial field distribution, if u0 = None an incident plane wave is assumed points - a list of coordinates [[x1,y1,z1],...] in real unit interval [0...dx*nx] where spheres are placed. """ dn_g = create_dn_buffer(size, units, points=points, dn_inner=dn_inner, rad_inner=rad_inner, dn_outer=dn_outer, rad_outer=rad_outer) return bpm_3d(size=size, units=units, lam=lam, u0=u0, dn=dn_g, return_scattering=return_scattering, use_fresnel_approx=use_fresnel_approx)
dz = 1.*Lz/(Nz-1) lam = .5 x = dx*arange(Nx) y = dx*arange(Nx) z = dz*arange(Nz) X0,Y0 = meshgrid(x,y,indexing="ij") _xgrid = (X0%a)-.5*a _ygrid = (Y0%a)-.5*a R = sqrt(_xgrid**2+_ygrid**2) u0 = (jn(1,4*R)+2.e-10)/4./(1.e-10+R)+0.j u0 = u0.astype(complex64) # u0 = exp(-20*(_xgrid**2+_ygrid**2)) # u0 *= exp(-1.5*(R0/dx/Nx*3.)**2) u, dn = bpm_3d((Nx,Nx,Nz), (dx,dx,dz), lam = lam ,u0 = u0, use_fresnel_approx = False) overlaps = array([overlap(abs(u[0,...])**2,abs(u[i,...])**2) for i in range(Nz)])
dz = 1. * Lz / (Nz - 1) lam = .5 x = dx * arange(Nx) y = dx * arange(Nx) z = dz * arange(Nz) X0, Y0 = meshgrid(x, y, indexing="ij") _xgrid = (X0 % a) - .5 * a _ygrid = (Y0 % a) - .5 * a R = sqrt(_xgrid**2 + _ygrid**2) u0 = (jn(1, 4 * R) + 2.e-10) / 4. / (1.e-10 + R) + 0.j u0 = u0.astype(complex64) # u0 = exp(-20*(_xgrid**2+_ygrid**2)) # u0 *= exp(-1.5*(R0/dx/Nx*3.)**2) u, dn = bpm_3d((Nx, Nx, Nz), (dx, dx, dz), lam=lam, u0=u0, use_fresnel_approx=False) overlaps = array( [overlap(abs(u[0, ...])**2, abs(u[i, ...])**2) for i in range(Nz)])