diff --git a/karabo/simulation/sky_model.py b/karabo/simulation/sky_model.py index 1ab63a59..eab285e1 100644 --- a/karabo/simulation/sky_model.py +++ b/karabo/simulation/sky_model.py @@ -368,7 +368,7 @@ def extract_names_and_freqs( for col in cols: col_name = col.name if not isinstance(col_name, str): - raise RuntimeError( + raise TypeError( f"`col_name` should be of type `str`, but is {type(col_name)=}" ) match = pattern.match(string=col_name) diff --git a/karabo/test/test_data.py b/karabo/test/test_data.py deleted file mode 100644 index 0d527e14..00000000 --- a/karabo/test/test_data.py +++ /dev/null @@ -1,19 +0,0 @@ -from karabo.data.external_data import GLEAMSurveyDownloadObject -from karabo.simulation.sky_model import SkyModel, SkyPrefixMapping - - -def test_download_gleam(): - survey = GLEAMSurveyDownloadObject() - survey.get() - - -def test_download_gleam_and_make_sky_model(): - sky = SkyModel.get_GLEAM_Sky(min_freq=72e6, max_freq=80e6) - sample_prefix_mapping = SkyPrefixMapping([], [], []) - number_of_sky_attributes = len(sample_prefix_mapping.__dict__) - - assert sky.num_sources > 0 - - # -1 since we do not return the source ID - assert sky.to_np_array().shape == (sky.num_sources, number_of_sky_attributes - 1) - assert sky.source_ids["dim_0"].shape[0] == sky.shape[0] # checking source-ids diff --git a/karabo/test/test_skymodel.py b/karabo/test/test_skymodel.py index 88d7315f..f884c1d8 100644 --- a/karabo/test/test_skymodel.py +++ b/karabo/test/test_skymodel.py @@ -23,6 +23,7 @@ MIGHTEESurveyDownloadObject, ) from karabo.simulation.sky_model import ( + KaraboSkyModelError, Polarisation, SkyModel, SkyPrefixMapping, @@ -37,6 +38,26 @@ def gleam() -> SkyModel: return SkyModel.get_GLEAM_Sky(min_freq=72e6, max_freq=80e6) +def test_download_gleam_and_make_sky_model(): + sky = SkyModel.get_GLEAM_Sky(min_freq=72e6, max_freq=80e6) + sample_prefix_mapping = SkyPrefixMapping([], [], []) + number_of_sky_attributes = len(sample_prefix_mapping.__dict__) + + assert sky.num_sources > 0 + + # -1 since we do not return the source ID + assert sky.to_np_array().shape == (sky.num_sources, number_of_sky_attributes - 1) + assert sky.source_ids["dim_0"].shape[0] == sky.shape[0] # checking source-ids + + +def test_mightee(): + _ = SkyModel.get_MIGHTEE_Sky() + with pytest.raises(KaraboSkyModelError): + _ = SkyModel.get_MIGHTEE_Sky(min_freq=3e11) + _ = SkyModel.get_MIGHTEE_Sky(max_freq=3e11) + _ = SkyModel.get_MIGHTEE_Sky(min_freq=1.3e9, max_freq=1.4e9) + + def test_filter_sky_model(gleam: SkyModel): phase_center = [250, -80] # ra,dec filtered_sky = gleam.filter_by_radius(0, 0.55, phase_center[0], phase_center[1])