The (Great) GalSBI
Create realistic galaxy catalogs and astronomical images based on the GalSBI model. The GalSBI model is described in Fischbacher et al. (2024) and the package is described in Fischbacher et al. (2024).
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, 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"]
Currently, the following models are available:
Fischbacher+24
: constrained in Fischbacher et al. (2024).Moser+24
: constrained in Moser et al. (2024).
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 asimage
, but also runsSExtractor
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 argumentconfig_file
. The predefined configuration files can be found in thesrc/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 paper Fischbacher et al. (2024) for using the GalSBI model and the code release paper Fischbacher et al. (2024) for using the package. 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 is currently maintained by Silvan Fischbacher.
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.
Contents:
- Installation
- Tutorial overview
- Getting Started
- Emulate image simulation
- Simulating an astronomical image
- Perform source extraction
- Saving Galaxy Spectra
- Customize configuration
- Run in parallel
- How to use ucat
- Catalog Column Descriptions
- Filters in GalSBI
- Phenomenologial GalSBI: Overview of the model
- SPS GalSBI: Overview of the model
- FAQs
- Which papers should I cite when using galsbi?
- Can I use the emulator with any version of libraries (e.g. tensorflow, jax)?
- I run the code for the first time and it is taking a long time and printing a lot of messages. Is this normal?
- I get an error when I run the code for the first time during the compilation of PyCosmo. What should I do?
- galsbi package
- galsbi
- Contributing to galsbi
- Credits
- History
Feedback
If you have any suggestions or questions about galsbi feel free to email me at silvanf@phys.ethz.ch.
If you encounter any errors or problems with galsbi, please let me know!