1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- import numpy as np
- import scattnlay
- import matplotlib.pylab as plt
- n1 = 1.335
- nm = 1.333
- radius = 0.3
- extent = 2.0
- distance = 0.5
- resolution = 20.0
- twopi = 2*np.pi*nm
- x = np.array([radius*twopi], dtype = np.float64)
- m = np.array([n1/nm], dtype = np.complex128)
- nptsx = int(extent*resolution)
- nptsy = int(extent*resolution)
- scanx = np.linspace(-extent/2, extent/2, nptsx, endpoint=True)*twopi
- scany = np.linspace(-extent/2, extent/2, nptsy, endpoint=True)*twopi
- coordX, coordY = np.meshgrid(scanx, scany)
- coordX.resize(nptsx*nptsy)
- coordY.resize(nptsx*nptsy)
- coordZ = np.ones(nptsx*nptsy, dtype=np.float64)*distance*twopi
- terms, E, H = scattnlay.fieldnlay(x, m, coordX, coordY, coordZ)
- Ex = E[:,0].reshape(nptsx, nptsy)
- Ex /= np.exp(2j*np.pi*distance*nm)
- ax = plt.subplot(111)
- mapper = plt.imshow(np.angle(Ex))
- plt.colorbar(mapper, ax=ax, label="phase [rad]")
- plt.title("phase retardation introduced by a dielectric sphere")
- plt.show()
|