def test_create_nk_from_csv_expected_nk_eV(self): dir_path = os.path.dirname(os.path.realpath(__file__)) filename_full = os.path.join(dir_path,"TestCSVFile_comma_eV.csv") index_function = sm.create_nk_from_csv(filename_full, independent_unit_str="eV", lines_to_skip = 1) ratio = index_function(1.23984*sm.Units.um)/(2.0+0.4j) self.assertAlmostEqual(ratio,1.0,places=5)
def test_create_nk_from_csv_expected_nk_eV_upperbound(self): dir_path = os.path.dirname(os.path.realpath(__file__)) filename_full = os.path.join(dir_path,"TestCSVFile_comma_eV.csv") index_function = sm.create_nk_from_csv(filename_full, independent_unit_str="eV", lines_to_skip = 1) ratio =index_function(sm.convert_photon_unit("eV","wl",6.0))/(2.0+0.0j) self.assertAlmostEqual(ratio,1.0,places=5)
def test_create_nk_from_csv_expected_nk_lowerbound(self): dir_path = os.path.dirname(os.path.realpath(__file__)) filename_full = os.path.join(dir_path,"TestCSVFile_comma.csv") index_function = sm.create_nk_from_csv(filename_full, dependent_col=np.array([2,3]), independent_unit_str="um", lines_to_skip = 1) ratio = index_function(0.1*sm.Units.um)/(2.0+0.0j) self.assertAlmostEqual(ratio,1.0,places=5)
def test_create_nk_from_csv_expected_nk_nm_er_ei(self): dir_path = os.path.dirname(os.path.realpath(__file__)) filename_full = os.path.join(dir_path,"TestCSVFile_tab.csv") index_function = sm.create_nk_from_csv(filename_full, delimiter="\t", dependent_col=np.array([2,3]), dependent_unit_str="er_ei", lines_to_skip = 2) ratio = index_function(1.3*sm.Units.um)/(1.010947736+0.1483756228j) self.assertAlmostEqual(ratio,1.0,places=5)