In [1]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import miepython as mp
Since the backscattering efficiency is $|2S_1(-180^\circ)/x|^2$, it is easy to see that that backscattering should be the best comparison. For example, the asymmetry factor for this test case only has three significant digits and the scattering efficiency only has two!
A typical test result looks like this:
MIEV0 Test Case 12: Refractive index: real 1.500 imag -1.000E+00, Mie size parameter = 0.055
NUMANG = 7 angles symmetric about 90 degrees
Angle Cosine S-sub-1 S-sub-2 Intensity Deg of Polzn
0.00 1.000000 7.67526E-05 8.34388E-05 7.67526E-05 8.34388E-05 1.28530E-08 0.0000
( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000)
30.00 0.866025 7.67433E-05 8.34349E-05 6.64695E-05 7.22517E-05 1.12447E-08 -0.1428
( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000)
60.00 0.500000 7.67179E-05 8.34245E-05 3.83825E-05 4.16969E-05 8.02857E-09 -0.5999
( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000)
90.00 0.000000 7.66833E-05 8.34101E-05 3.13207E-08 -2.03740E-08 6.41879E-09 -1.0000
( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000)
120.00 -0.500000 7.66486E-05 8.33958E-05 -3.83008E-05 -4.17132E-05 8.01841E-09 -0.6001
( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000)
150.00 -0.866025 7.66233E-05 8.33853E-05 -6.63499E-05 -7.22189E-05 1.12210E-08 -0.1429
( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000)
180.00 -1.000000 7.66140E-05 8.33814E-05 -7.66140E-05 -8.33814E-05 1.28222E-08 0.0000
( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000)
Angle S-sub-1 T-sub-1 T-sub-2
0.00 7.67526E-05 8.34388E-05 3.13207E-08 -2.03740E-08 7.67213E-05 8.34592E-05
( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000)
180.00 7.66140E-05 8.33814E-05 3.13207E-08 -2.03740E-08 7.66453E-05 8.33611E-05
( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000)
Efficiency factors for Asymmetry
Extinction Scattering Absorption Factor
0.101491 0.000011 0.101480 0.000491
( 1.000000) ( 1.000000) ( 1.000000) ( 1.000000)
In [2]:
print(" miepython Wiscombe")
print(" X m.real m.imag Qback Qback ratio")
m=complex(1.55, 0.0)
x = 2*3.1415926535*0.525/0.6328
ref = 2.92534
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.4f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
m=complex(0.0, -1000.0)
x=0.099
ref = (4.77373E-07*4.77373E-07 + 1.45416E-03*1.45416E-03)/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.2f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=0.101
ref = (5.37209E-07*5.37209E-07 + 1.54399E-03*1.54399E-03)/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.2f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=100
ref = (4.35251E+01*4.35251E+01 + 2.45587E+01*2.45587E+01)/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.2f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=10000
ref = abs(2.91013E+03-4.06585E+03*1j)**2/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.2f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
print()
In [3]:
print(" miepython Wiscombe")
print(" X m.real m.imag Qback Qback ratio")
m=complex(0.75, 0.0)
x=0.099
ref = (1.81756E-08*1.81756E-08 + 1.64810E-04*1.64810E-04)/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.4f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=0.101
ref = (2.04875E-08*2.04875E-08 + 1.74965E-04*1.74965E-04)/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.4f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=10.0
ref = (1.07857E+00*1.07857E+00 + 3.60881E-02*3.60881E-02)/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.4f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=1000.0
ref = (1.70578E+01*1.70578E+01 + 4.84251E+02* 4.84251E+02)/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.4f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
print()
In [4]:
print(" miepython Wiscombe")
print(" X m.real m.imag Qback Qback ratio")
m=complex(1.5, 0)
x=10
ref = abs(4.322E+00 + 4.868E+00*1j)**2/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.5f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=100
ref = abs(4.077E+01 + 5.175E+01*1j)**2/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.5f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=1000
ref = abs(5.652E+02 + 1.502E+03*1j)**2/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.5f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
print()
In [5]:
print(" old")
print(" miepython Wiscombe")
print(" X m.real m.imag Qback Qback ratio")
m=complex(1.33, -0.00001)
x=1
ref = (2.24362E-02*2.24362E-02 + 1.43711E-01*1.43711E-01)/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.5f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=100
ref = (5.65921E+01*5.65921E+01 + 4.65097E+01*4.65097E+01)/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.5f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=10000
ref = abs(-1.82119E+02 -9.51912E+02*1j)**2/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.5f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
print()
In [6]:
print(" miepython Wiscombe")
print(" X m.real m.imag Qback Qback ratio")
m=complex(1.5, -1.0)
x=0.055
ref = abs(7.66140E-05 + 8.33814E-05*1j)**2/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.4f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=0.056
ref = (8.08721E-05*8.08721E-05 + 8.80098E-05*8.80098E-05)/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.4f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=1.0
ref = (3.48844E-01*3.48844E-01 + 1.46829E-01*1.46829E-01)/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.4f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=100.0
ref = (2.02936E+01*2.02936E+01 + 4.38444E+00*4.38444E+00)/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.4f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=10000
ref = abs(-2.18472E+02 -2.06461E+03*1j)**2/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.4f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
print()
In [7]:
print(" miepython Wiscombe")
print(" X m.real m.imag Qback Qback ratio")
m=complex(10, -10.0)
x=1
ref = abs(4.48546E-01 + 7.91237E-01*1j)**2/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.4f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=100
ref = abs(-4.14538E+01 -1.82181E+01*1j)**2/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.4f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
x=10000
ref = abs(2.25248E+03 -3.92447E+03*1j)**2/x/x*4
qext, qsca, qback, g = mp.mie(m,x)
print("%9.3f % 8.4f % 8.4f % 8e % 8e %8.5f" % (x,m.real,m.imag,qback,ref,qback/ref))
In [8]:
x = np.logspace(1, 5, 20) # also in microns
kappa=1
m = 1.5 - kappa*1j
R = abs(m-1)**2/abs(m+1)**2
Qbig = R * np.ones_like(x)
qext, qsca, qback, g = mp.mie(m,x)
plt.semilogx(x, qback, '+')
plt.semilogx(x, Qbig, ':')
plt.text(x[-1],Qbig[-1],"$\kappa$=%.3f" % kappa,va="bottom",ha='right')
kappa=0.001
m = 1.5 - kappa*1j
R = abs(m-1)**2/abs(m+1)**2
Qbig = R * np.ones_like(x)
qext, qsca, qback, g = mp.mie(m,x)
plt.semilogx(x, qback, '+')
plt.semilogx(x, Qbig, ':')
plt.text(x[-1],Qbig[-1],"$\kappa$=%.3f" % kappa,va="bottom",ha='right')
plt.ylim(0,0.2)
plt.title("Backscattering Efficiency for m=1.5 - i $\kappa$")
plt.xlabel("Size Parameter")
plt.ylabel("$Q_{back}$")
plt.grid()