Пример #1
0
 def is_power_conserved_TE(self, index1, index2, angle):
     reflected_power = sm.reflected_power_TE(index1, index2, angle)
     transmitted_power = sm.transmitted_power_TE(index1, index2, angle)
     total_power = reflected_power + transmitted_power
     if np.isclose(total_power, 1.0):
         return True
     else:
         print(total_power)
         return False
Пример #2
0
 def test_scattering_matrix_calculation_singlethickness_complex(self):
     index_air = sm.single_index_function(1.0)
     index_complex = sm.single_index_function(1.5 - 2.0j)
     structure = sm.LayerList()
     structure.append(sm.SingleLayer(index_air, 1.0 * sm.Units.um))
     structure.append(sm.SingleLayer(index_complex, 1.0 * sm.Units.um))
     calculate_powers = sm.scattering_matrix_calculation(
         structure, 1.0 * sm.Units.um)
     calc_transmission = calculate_powers[0]
     calc_reflection = calculate_powers[1]
     expected_transmission = (
         sm.transmitted_power_TE(1.0, 1.5 - 2.0j, 0.0) * np.exp(
             (-4.0 * np.pi) * 2))
     expected_reflection = sm.reflected_power_TE(1.0, 1.5 - 2.0j, 0.0)
     ratio_t = calc_transmission / expected_transmission
     ratio_r = calc_reflection / expected_reflection
     sum_t_r = calc_transmission + calc_reflection
     npt.assert_array_almost_equal(ratio_t, np.array([1.0]), decimal=5)
     npt.assert_array_almost_equal(ratio_r, np.array([1.0]), decimal=5)
     self.assertTrue((sum_t_r < 1.0).all())
Пример #3
0
 def test_scattering_matrix_calculation_singleinterface_complex(self):
     index_air = sm.single_index_function(1.0)
     index_complex = sm.single_index_function(1.5 - 2.0j)
     structure = sm.LayerList()
     structure.append(sm.SingleLayer(index_air, 1.0 * sm.Units.um))
     structure.append(sm.SingleLayer(index_complex, 0.0 * sm.Units.um))
     calculate_powers = sm.scattering_matrix_calculation(
         structure, 1.0 * sm.Units.um)
     calc_transmission = calculate_powers[0]
     calc_reflection = calculate_powers[1]
     calc_absorption = calculate_powers[2]
     expected_transmission = sm.transmitted_power_TE(1.0, 1.5 - 2.0j, 0.0)
     expected_reflection = sm.reflected_power_TE(1.0, 1.5 - 2.0j, 0.0)
     ratio_t = calc_transmission / expected_transmission
     ratio_r = calc_reflection / expected_reflection
     npt.assert_array_almost_equal(ratio_t, np.array([1.0]), decimal=5)
     npt.assert_array_almost_equal(ratio_r, np.array([1.0]), decimal=5)
     npt.assert_array_almost_equal(calc_absorption,
                                   np.array([0.0]),
                                   decimal=5)