Skip to main content

Package to easily generate catalogs from the model

Project description

The (Great) GalSBI

MIT license PyPI pyversions PyPI version pipeline coverage coverage report

DOI image image image

Docs Source Code

Create realistic galaxy catalogs and astronomical images based on the GalSBI model. The GalSBI phenomenological model is described in Fischbacher et al. (2024), while the stellar population synthesis-based model GalSBI-SPS in Tortorelli et al. (2025). The Python package is described in Fischbacher et al. (2024).

Motivation

Next-generation galaxy surveys will test cosmology with unprecedented precision. To fully realize the potential of these surveys, forward modeling of galaxy populations offers a promising path - enabling accurate redshift estimation, shape measurement calibration, selection effect modeling, and deeper insights into galaxy properties.

GalSBI is a parametric galaxy population model constrained by observational data using simulation-based inference (SBI). The galsbi Python package provides a flexible framework for generating realistic galaxy catalogs and rendering them into astronomical images via UFig.

Installation

The package can be installed via pip:

pip install galsbi

or using uv:

uv pip install galsbi

Usage

To generate a catalog of galaxies with their intrinsic properties from the phenomenological model, you can use the following code snippet:

from galsbi import GalSBI

model = GalSBI(name="Fischbacher+24") # define which model to use
model(mode="intrinsic") # generating catalogs with intrinsic galaxy properties
cats = model.load_catalogs() # load the generated catalogs

intrinsic_i_band_cat = cats["ucat galaxies i"]

To generate a catalog of galaxies with their intrinsic properties from the stellar population synthesis-based model GalSBI-SPS, you can use the following code snippet:

from galsbi import GalSBI

model = GalSBI("Tortorelli+25")
model(mode="intrinsic")
cats = model.load_catalogs()

intrinsic_i_band_cat = cats["ucat galaxies i"]

More examples and detailed documentation can be found in the documentation. Note: The first time you run galsbi, additional data files will be downloaded automatically and cached locally. The initial run may also take longer due to PyCosmo compilation. If you encounter any issues, see the FAQ.

Currently, the following models are available:

There are different modes available to generate catalogs:

  • intrinsic: generates a catalog with intrinsic galaxy properties for HSC grizy bands.
  • emulator: generates a catalog with intrinsic galaxy properties for HSC grizy bands and a catalog with measured galaxy properties for each band using an emulator trained on HSC deep fields.
  • image: generates a catalog with intrinsic galaxy properties for HSC grizy bands and a simulated image for each band. The image has background noise and PSF size similar to HSC deep fields.
  • image+SE: same as image, but also runs SExtractor on the images to generate catalogs with measured galaxy properties for each band.
  • config_file: runs the model following a custom configuration file. The path to the configuration file can be passed as an argument config_file. The predefined configuration files can be found in the src/galsbi/configs directory and can be used as a starting point for custom configurations.

The loaded catalogs are stored in a dictionary with the following keys:

  • ucat galaxies <band>: intrinsic galaxy catalog for the given band.
  • ucat stars <band>: intrinsic star catalog for the given band.
  • sextractor <band>: catalog with measured galaxy properties for the given band (if a measured catalog is generated)
  • sed: catalog with SEDs of the galaxies (in case the SEDs are saved, see Saving Galaxy Spectra).
  • restframe_wavelength_in_A: the restframe wavelength in Angstroms for the SEDs (if the SEDs are saved).

By default, the catalogs are loaded as structured NumPy arrays. Setting output_format to df loads them as pandas DataFrames, while output_format="fits" loads them as FITS catalogs. An overview of the columns in the catalogs can be found in the Catalog Column Descriptions.

If an image is generated, one can also load the images, segmentation and background maps using model.load_images(). This returns a dictionary with the following keys:

  • image <band>: the simulated image for the given band.
  • segmentation <band>: the segmentation map for the given band.
  • background <band>: the background map for the given band.

More details on the usage of the package can be found in the documentation.

Citation

If you use GalSBI in your work, please cite the science papers Fischbacher et al. (2024), Tortorelli et al. (2025), the ProMage magnitude emulator paper Tortorelli et al. (2025b), and the code release paper Fischbacher et al. (2024). If you are using specific models or parametrizations, please also cite the corresponding papers. If you are not sure which papers to cite, use the following with your model instance:

model.cite()

Credits

This package was developed by the Cosmology group at ETH Zurich and updated by the ACAI group at LMU Munich. The package is currently maintained by Silvan Fischbacher and Luca Tortorelli.

Contributions

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

Please see the Contributing to galsbi documentation for more information on how to contribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

galsbi-0.3.0.tar.gz (29.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

galsbi-0.3.0-py2.py3-none-any.whl (126.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file galsbi-0.3.0.tar.gz.

File metadata

  • Download URL: galsbi-0.3.0.tar.gz
  • Upload date:
  • Size: 29.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for galsbi-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ed7e92c5fae50d86ffca156a17aca19358575d95486b7f3b81ef562970284836
MD5 a7c50edda83f1bcf96e789d0dfe1e686
BLAKE2b-256 883511dee7523214e07228ea9cb0881237a2550b263fa4009f41d75bfe8ad0ea

See more details on using hashes here.

File details

Details for the file galsbi-0.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: galsbi-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 126.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for galsbi-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bc06b80267b13314bbc2a08c2f4fc3333c2fc4f1ea3400ec0ed050411153d59b
MD5 758c938b34a97508e6334f761781ca47
BLAKE2b-256 21a6259edc179691ab8a31930e3ebc9f7b25192aa5a354fde6eb3cd78b440410

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page