Esempio n. 1
0
plane.rectangle_e(center=[126,551], xlen=20, ylen=8,   value=1)


metal = PolarDPlane(plane.shape, a=(1.757*10**16)**2, b=0, c=3.0786*10**14, d=1, dt=plane.dt()).set_factor()
metal.rectangle(center=[151,351], xlen=70, ylen=710, value=1)
metal.rectangle(center=[151,351], xlen=70, ylen=8,   value=0)
metal.rectangle(center=[126,251], xlen=20, ylen=8,   value=0)
metal.rectangle(center=[126,451], xlen=20, ylen=8,   value=0)
metal.rectangle(center=[126,151], xlen=20, ylen=8,   value=0)
metal.rectangle(center=[126,551], xlen=20, ylen=8,   value=0)

dt = plane.dt()
freq = plane.frequency()

for t in range(0,7000):
    stdout.write("\b\b\b\b%d"%t)
    plane.t = t

    plane.teinc.update(cos(2*pi*freq*t*dt)*gaussian(t*dt, 800*dt, 150*dt))#.plot_e("result/grating-slit/teinc/teinc-%.4d.png"%t)

    plane.update_dfield().update_dtfsf()
    metal.update(plane)
    plane.update_efield(metal).update_epbc()

    plane.update_bfield().update_btfsf()
    plane.update_hfield().update_hpbc()

    plane.imshow_hz("result/grating-slit/hz/grating-slit-%.4d.png"%t)
    plane.save()

Esempio n. 2
0
pylab.subplot(2,2,1)
pylab.plot(t,timedomain)
pylab.xlim(0, n*dt)

pylab.subplot(2,2,3)
pylab.plot(f,freqdomain)
pylab.xlim(-n/2,n/2)


n = numpy.float(2**18)

dt = 1./1024

t = numpy.arange(n)*dt
timedomain = [cos(2*pi*5*i)*gaussian(i, 100, 0.25) for i in t]

f, freqdomain = fft(t, timedomain, dt)

if DEBUG:
  for item in zip(f,freqdomain.round()):
    print item

pylab.subplot(2,2,2)
pylab.plot(t,timedomain)
pylab.xlim(99, 101)

pylab.subplot(2,2,4)
pylab.plot(f,freqdomain)
pylab.xlim(-10,10)