f = consts.c / (lam * consts.giga)
    th = 1 - 300. / consts.C2K(temp)
    eps0 = 77.66 - 103.3 * th
    eps1 = 0.0671 * eps0
    gamma1 = 20.20 + 146.4 * th + 316 * th * th
    eps2 = 3.52 + 7.52 * th
    gamma2 = 39.8 * gamma1
    epsM = (eps0 - eps1) / (1 - 1.0j * (f / gamma1)) + (eps1 - eps2) / (
            1 - 1.0j * (f / gamma2)) + eps2
    return np.sqrt(epsM)

temps = np.linspace(-10, 40)
fig, (ax1, ax2) = plt.subplots(2, 1)

for lam,color in zip([0.03, 0.05, 0.1], ['r', 'g', 'b']):
    eps_ray = scattering.refractive_index('water', lam, temps)
    eps_liebe = liebe('water', lam, temps)

    ax1.plot(temps, eps_ray.real, color + '-', label='%.2f' % lam)
    ax1.plot(temps, eps_liebe.real, color + '--', label='%.2f' % lam)
    ax1.set_title('Real part of index of refraction')
    ax1.set_xlabel(u'Temperature (\N{DEGREE SIGN}C)')
    ax1.grid(True)

    ax2.plot(temps, eps_ray.imag, color + '-', label='%.2f' % lam)
    ax2.plot(temps, eps_liebe.imag, color + '--', label='%.2f' % lam)
    ax2.set_title('Imaginary part of index of refraction')
    ax2.set_xlabel(u'Temperature (\N{DEGREE SIGN}C)')
    ax2.grid(True)

plt.tight_layout()
예제 #2
0
import numpy as N
import matplotlib.pyplot as P
import scattering, dsd

d = N.linspace(0.01, 2.0, 200).reshape(200,1)
l = N.linspace(0.01, 25.0, 100).reshape(1,100)
mp = dsd.mp_from_lwc(d*10.0, l)
sband = 10.0

s_ray = scattering.scatterer(sband, 10.0, 'water', diameters = d)
s_ray.set_scattering_model('rayleigh')
s_ray_ref = 10.0 * N.log10(s_ray.get_reflectivity(mp))
s_ray_atten = s_ray.get_attenuation(mp) * (10.0 * N.log10(N.e))
m = scattering.refractive_index('water', sband, 10.0)
Kw = (m**2 - 1)/(m**2 + 2)
lam = dsd.mp_slope_3rd(l)
s_ray_atten_mp = ((2/3.) * (N.pi**5 * N.abs(Kw)**2 / (sband**4) * 720./lam**7
    * dsd.mp_N0) + 6 * N.pi / (1e6 * sband) * N.imag(Kw) * l).squeeze()

d = d.squeeze()
l = l.squeeze()

f = P.figure()

ax = f.add_subplot(1,2,2)
ax.semilogy(l, s_ray_atten_mp, 'b--')
ax.semilogy(l, s_ray_atten, 'b-')
ax.set_xlabel('LWC (g/kg)')
ax.set_ylabel('Attenuation')
ax.set_title('Comparison of Attenuation')
ax.grid()
예제 #3
0
import numpy as np
from scattering import tmatrix, mie, rayleigh, rayleigh_gans
from scattering import refractive_index

lam = .1 #meters
ds = np.array([.001])#meters
m = refractive_index('water', lam)

fmat,bmat,qs = tmatrix(m, ds, lam * 10.0, 'sphere')
print 'T-matrix'
print qs
print fmat
print bmat

fmat,bmat,qs = mie(m, ds, lam * 10.0, 'sphere')
print '\nMie'
print qs
print fmat
print bmat

fmat,bmat,qs = rayleigh(m, ds, lam * 10.0, 'sphere')
print '\nRayleigh'
print qs
print fmat
print bmat

fmat,bmat,qs = rayleigh_gans(m, ds, lam * 10.0, 'sphere')
print '\nRayleigh-Gans'
print qs
print fmat
print bmat