galsbi package

Subpackages

Submodules

galsbi.citations module

galsbi.citations.cite_abc_posterior(name)[source]

Prints the citation for the model with the given name.

Parameters:

name – model name for which to print the citation

galsbi.citations.cite_code_release(mode)[source]

Prints the citation for the code release.

Parameters:

mode – mode of the model

galsbi.citations.cite_galsbi_release()[source]

Prints the citation for the galsbi release.

galsbi.galsbi module

class galsbi.galsbi.GalSBI(name)[source]

Bases: object

This class is the main interface to the model. It provides methods to generate mock galaxy catalogs and to cite the model.

cite()[source]

Prints all the papers that should be cited when using the configuration specified

generate_catalog(mode='intrinsic', config_file=None, model_index=0, file_name='GalSBI_sim', **kwargs)[source]

Generates a mock galaxy catalog using the model and configuration specified. The parameter model_index is used to select a specific set of model parameters from the ABC posterior. If a list of model parameters is provided, catalogs are generated for each set of parameters. The saved catalogs and images are named according to the file_name and model_index.

Names of the files

Intrinsic ucat galaxy catalog: f”{file_name}_{index}_{band}_ucat.gal.cat” Intrinsic ucat star catalog: f”{file_name}_{index}_{band}_ucat.star.cat” Output catalog: f”{file_name}_{index}_{band}_se.cat” Output image: f”{file_name}_{index}_{band}_image.fits” Segmentation map: f”{file_name}_{index}_{band}_se_seg.h5” Background map: f”{file_name}_{index}_{band}_se_bkg.h5”

param mode:

mode to use for generating the catalog, either “intrinsic”, “emu”, “image”, “image+SE”, “config_file”

param config_file:

dictionary or path to a configuration file to use for generating the catalog (only used if mode=”config_file”)

param model_index:

index of the model parameters to use for generating the catalog

param catalog_name:

filename of the catalog and images to generate

param kwargs:

additional keyword arguments to pass to the workflow (overwrites the values from the model parameters and config file)

load_catalogs(output_format='rec', model_index=0, combine=False)[source]

Loads the catalogs generated by the model.

Parameters:
  • output_format – format of the output, either “rec”, “df” or “fits”

  • model_index – index of the model parameters to use for loading the catalogs

  • combine – if True, combines the catalogs from all bands into a single catalog

Returns:

catalogs in the specified format

load_images(model_index=0)[source]

Loads the images generated by the model. This include the actual image, the segmentation map and the background map.

param model_index: index of the model parameters to use for loading the images return: images as numpy arrays

galsbi.load module

galsbi.load.load_abc_posterior(name)[source]

Loads the ABC posterior for the given model.

Parameters:

name – name of the model

Returns:

ABC posterior as a structured numpy array

galsbi.load.load_config(name, mode, config_file=None)[source]

Loads the correct configuration for the given model and mode. If mode is “config_file”, the configuration is loaded from the given file. Otherwise, the configuration is loaded based on the model name and mode.

Parameters:
  • name – name of the model

  • mode – mode for which to load the configuration (either “intrinsic”, “emu”, “image”, “config_file”)

  • config_file – path to a configuration file to use

Returns:

module name of the configuration to use

galsbi.models module

Module contents

class galsbi.GalSBI(name)[source]

Bases: object

This class is the main interface to the model. It provides methods to generate mock galaxy catalogs and to cite the model.

cite()[source]

Prints all the papers that should be cited when using the configuration specified

generate_catalog(mode='intrinsic', config_file=None, model_index=0, file_name='GalSBI_sim', **kwargs)[source]

Generates a mock galaxy catalog using the model and configuration specified. The parameter model_index is used to select a specific set of model parameters from the ABC posterior. If a list of model parameters is provided, catalogs are generated for each set of parameters. The saved catalogs and images are named according to the file_name and model_index.

Names of the files

Intrinsic ucat galaxy catalog: f”{file_name}_{index}_{band}_ucat.gal.cat” Intrinsic ucat star catalog: f”{file_name}_{index}_{band}_ucat.star.cat” Output catalog: f”{file_name}_{index}_{band}_se.cat” Output image: f”{file_name}_{index}_{band}_image.fits” Segmentation map: f”{file_name}_{index}_{band}_se_seg.h5” Background map: f”{file_name}_{index}_{band}_se_bkg.h5”

param mode:

mode to use for generating the catalog, either “intrinsic”, “emu”, “image”, “image+SE”, “config_file”

param config_file:

dictionary or path to a configuration file to use for generating the catalog (only used if mode=”config_file”)

param model_index:

index of the model parameters to use for generating the catalog

param catalog_name:

filename of the catalog and images to generate

param kwargs:

additional keyword arguments to pass to the workflow (overwrites the values from the model parameters and config file)

load_catalogs(output_format='rec', model_index=0, combine=False)[source]

Loads the catalogs generated by the model.

Parameters:
  • output_format – format of the output, either “rec”, “df” or “fits”

  • model_index – index of the model parameters to use for loading the catalogs

  • combine – if True, combines the catalogs from all bands into a single catalog

Returns:

catalogs in the specified format

load_images(model_index=0)[source]

Loads the images generated by the model. This include the actual image, the segmentation map and the background map.

param model_index: index of the model parameters to use for loading the images return: images as numpy arrays