def test_getting_galsim_catalog(): """Returns the galsim catalog""" cosmos_catalog = CosmosCatalog.from_file(COSMOS_CATALOG_PATHS) galsim_catalog = cosmos_catalog.get_galsim_catalog() # assert that the merged and galsim catalog have same length assert len(galsim_catalog) == len(cosmos_catalog.table), "error reading catalog with cuts" return galsim_catalog
def test_incompatible_catalogs(): stamp_size = 24.0 batch_size = 8 cpus = 1 add_noise = True catalog = CatsimCatalog.from_file(CATALOG_PATH) sampling_function = DefaultSampling(stamp_size=stamp_size) with pytest.raises(ValueError): # Wrong generator draw_generator = CosmosGenerator( # noqa: F841 catalog, sampling_function, get_surveys("Rubin"), stamp_size=stamp_size, batch_size=batch_size, cpus=cpus, add_noise=add_noise, ) with pytest.raises(ValueError): # Missing filter draw_generator = CatsimGenerator( # noqa: F841 catalog, sampling_function, get_surveys("HST"), stamp_size=stamp_size, batch_size=batch_size, cpus=cpus, add_noise=add_noise, ) catalog = CosmosCatalog.from_file(COSMOS_CATALOG_PATHS, exclusion_level="none") with pytest.raises(ValueError): draw_generator = CatsimGenerator( # noqa: F841 catalog, sampling_function, get_surveys("Rubin"), stamp_size=stamp_size, batch_size=batch_size, cpus=cpus, add_noise=add_noise, )
def test_cosmos_ext_galaxies(): stamp_size = 24.0 batch_size = 2 catalog = CosmosCatalog.from_file(COSMOS_EXT_CATALOG_PATHS, exclusion_level="none") sampling_function = DefaultSampling(stamp_size=stamp_size) HST = get_surveys("HST") draw_generator = CosmosGenerator( catalog, sampling_function, HST, batch_size=batch_size, stamp_size=stamp_size, cpus=1, add_noise="all", verbose=True, ) _ = next(draw_generator)
def test_cosmos_galaxies_parametric(): stamp_size = 24.0 batch_size = 2 catalog = CosmosCatalog.from_file(COSMOS_CATALOG_PATHS) sampling_function = DefaultSampling(stamp_size=stamp_size) HST = get_surveys("HST") draw_generator = CosmosGenerator( catalog, sampling_function, HST, batch_size=batch_size, stamp_size=stamp_size, cpus=1, add_noise="all", verbose=True, gal_type="parametric", ) _ = next(draw_generator)
def test_verbose(): """Testing the verbose option""" CatsimCatalog.from_file(CATALOG_PATH, verbose=True) CosmosCatalog.from_file(COSMOS_CATALOG_PATHS, verbose=True, exclusion_level="none")
def test_getting_galsim_catalog_without_cuts(): """Returns the galsim catalog""" cosmos_catalog = CosmosCatalog.from_file(COSMOS_CATALOG_PATHS, exclusion_level="none") galsim_catalog = cosmos_catalog.get_galsim_catalog() return galsim_catalog
def test_reading_cosmos_catalog_without_cuts(): """Returns the cosmos catalog""" cosmos_catalog = CosmosCatalog.from_file(COSMOS_CATALOG_PATHS, exclusion_level="none") return cosmos_catalog
def test_reading_cosmos_catalog(): """Returns the cosmos catalog""" cosmos_catalog = CosmosCatalog.from_file(COSMOS_CATALOG_PATHS) return cosmos_catalog