123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- 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.ones((1, 1), dtype = np.float64)
- x[0, 0] = radius*twopi
- m = np.ones((1, 1), dtype = np.complex128)
- m[0, 0] = n1/nm
- nptsx = extent*resolution
- nptsy = 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
- coord = np.vstack((coordX, coordY, coordZ)).transpose()
- terms, E, H = scattnlay.fieldnlay(x, m, coord)
- Ex = E[:,:,0].reshape(nptsx, nptsy)
- Ex /= np.exp(1j*2*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()
|