def test_add_empty_surface_to_full_table(self, input_tables, position): rt = opt_rad.RadiometryTable(tables=(input_tables[0])) surf = opt_surf.SpectralSurface() rt.add_surface(surf, "new_surf", position) colname = utils.real_colname("name", rt.table.colnames) assert rt.table[colname][position] == "new_surf" assert "new_surf" in rt.surfaces assert isinstance(rt.surfaces["new_surf"], opt_surf.SpectralSurface)
def test_returns_source_spectrum_for_full_path(self, input_tables): rt = opt_rad.RadiometryTable(tables=input_tables) row_list = np.arange(len(rt.table)) etendue = (996*u.m**2) * (0.004*u.arcsec)**2 comb_emission = rad_utils.combine_emissions(rt.table, rt.surfaces, row_indexes=row_list, etendue=etendue) assert isinstance(comb_emission, SourceSpectrum)
def test_returns_spectral_element_containing_everything( self, input_tables): rt = opt_rad.RadiometryTable(tables=(input_tables)) row_list = np.arange(len(rt.table)) comb_throughput = rad_utils.combine_throughputs(rt.table, rt.surfaces, rows_indexes=row_list) assert isinstance(comb_throughput, SpectralElement)
def test_return_spectral_element_for_only_2_rows(self, input_tables): rt = opt_rad.RadiometryTable(input_tables) thru = rt.get_throughput(start=1, end=3) assert isinstance(thru, SpectralElement) if float(synphot_version()) < 0.2: assert thru.model.n_submodels() == 2 else: assert thru.model.n_submodels == 2
def test_return_spectral_element_for_only_2_rows(self, input_tables): rt = opt_rad.RadiometryTable(input_tables) etendue = (996 * u.m**2) * (0.004 * u.arcsec)**2 emiss = rt.get_emission(etendue=etendue, start=1, end=3) assert isinstance(emiss, SourceSpectrum) if float(synphot_version()) < 0.2: assert emiss.model.n_submodels() == 9 else: assert emiss.model.n_submodels == 7
def test_return_spectral_element_from_get_throughput(self, input_tables): rt = opt_rad.RadiometryTable(input_tables) thru = rt.get_throughput() assert isinstance(thru, SpectralElement)
def test_add_empty_surface_to_empty_table(self): rt = opt_rad.RadiometryTable() surf = opt_surf.SpectralSurface() with pytest.raises(ValueError): rt.add_surface(surf, "new_surf", 0)
def test_all_surfaces_where_added_to_dict_surface(self, input_tables): rad_table = opt_rad.RadiometryTable() rad_table.add_surface_list(input_tables) names = rad_table.table["name"] assert np.all(name in rad_table.surface for name in names)
def test_combine_list_of_filename(self, input_tables): rad_table = opt_rad.RadiometryTable() rad_table.add_surface_list(input_tables) assert len(rad_table.table) == 19
def test_combine_two_tables_from_filename(self, input_tables): rad_table = opt_rad.RadiometryTable() rad_table.add_surface_list([input_tables[0], input_tables[1]]) assert len(rad_table.table) == 6
def test_append_single_table_from_filename(self, input_tables): rad_table = opt_rad.RadiometryTable() rad_table.add_surface_list(input_tables[0]) assert len(rad_table.table) == 5
def test_initialises_with_list_of_tables(self, input_tables): rt = opt_rad.RadiometryTable(input_tables) assert isinstance(rt, opt_rad.RadiometryTable) assert len(rt.table) == 19
def test_initialises_with_single_table(self, input_tables): rt = opt_rad.RadiometryTable([input_tables[0]]) assert isinstance(rt, opt_rad.RadiometryTable) assert len(rt.table) == 5
def test_initialises_with_no_input(self): rt = opt_rad.RadiometryTable() assert isinstance(rt, opt_rad.RadiometryTable) assert rt.table is None
def test_return_none_for_empty_radimetry_table(self): rt = opt_rad.RadiometryTable() emiss = rt.get_throughput() assert emiss is None
def test_return_spectral_element_from_get_throughput(self, input_tables): rt = opt_rad.RadiometryTable(input_tables) etendue = 996*u.m**2 * (0.004*u.arcsec)**2 emiss = rt.get_emission(etendue=etendue) assert isinstance(emiss, SourceSpectrum)