예제 #1
0
    def test_lx_mie_values(self):
        # Check values reported in Kitzmann & Heng 2017
        Qexts = _mie_multi_x.get_Qext(10 - 10j, [0.001, 0.1, 1, 100, 1000, 2e4, 1e6])
        expected = [6.0020755e-5, 3.2039088e-2, 2.53299308, 2.07112433, 2.02426046, 2.00361474, 2.00021914]
        self.assertTrue(np.allclose(Qexts, expected))

        Qexts = _mie_multi_x.get_Qext(1.5 - 1j, [1e2, 1e4])
        expected = [2.09750176, 2.00436771]
        self.assertTrue(np.allclose(Qexts, expected))

        Qexts = _mie_multi_x.get_Qext(1.33 - 1e-5j, [1e2, 1e4])
        expected = [2.10132071, 2.00408893]
        self.assertTrue(np.allclose(Qexts, expected))

        Qexts = _mie_multi_x.get_Qext(0.75, [10, 1e3, 1e4])
        expected = [2.23226484, 1.99790818, 2.00125518]
        self.assertTrue(np.allclose(Qexts, expected))
예제 #2
0
 def integrand(y):
     r = r_mean * np.exp(np.sqrt(2) * sigma * y)
     x = 2*np.pi*r/wavelength
     if x < 1e-6: Qext = 0
     elif x > 1e4:
         # Optimization needed, or else code takes forever
         Qext = 2
     else:
         Qext = _mie_multi_x.get_Qext(ri, [x])[0]                    
     return np.exp(-y**2) * np.sqrt(np.pi) * r_mean**2 * np.exp(2*np.sqrt(2)*sigma*y) * Qext
예제 #3
0
    def test_real_refractive_index(self):
        radius = 1e-6
        m = 2.1
        wavelengths = np.load("platon/data/wavelengths.npy")
        xs = 2*np.pi*radius/wavelengths
        Qext = _mie_multi_x.get_Qext(m, xs)
        simple_Qext = np.array([self.simple_Qext(m, x) for x in xs])

        #Make sure fiducial Qext calculation agrees with simple version
        #plt.plot(xs, Qext)
        #plt.plot(xs, simple_Qext)
        #plt.show()
        self.assertTrue(np.allclose(Qext, simple_Qext))
예제 #4
0
    def test_complex_refractive_index(self):
        radius = 1e-6
        m = 1.33 - 0.1j
        wavelengths = np.load("platon/data/wavelengths.npy")
        xs = 2*np.pi*radius/wavelengths
        Qext = _mie_multi_x.get_Qext(m, xs)
        simple_Qext = np.array([self.simple_Qext(m, x) for x in xs])

        lx_mie_Qext = np.loadtxt("tests/testing_data/lx_mie_output.dat", unpack=True)[4]

        #Make sure our simple calculation agrees with LX-MIE
        self.assertTrue(np.allclose(simple_Qext, lx_mie_Qext))

        #Make sure fiducial Qext calculation agrees with simple version
        self.assertTrue(np.allclose(Qext, simple_Qext))