Welcome to the GALFRB repository!
Artist’s impression of CSIRO’s Australian SKA Pathfinder (ASKAP) radio telescope finding a fast radio burst and determining its precise location. The KECK, VLT and Gemini South optical telescopes joined ASKAP with follow-up observations to image the host galaxy. Credit: CSIRO/Dr Andrew Howells
GALFRB is a project aiming to unveiling the origin of Fast Radio Bursts (FRBs) by modeling their hosts' properties. With improved localization precision a considerable amount of FRBs are now associated with host galaxies. Their stellar mass
This repository contains flexible modules for generating joint distributions of the properties of mock galaxies to compare with FRB hosts and provide stringent constraints on their origin. Not limited to FRBs, this code can be also applied to studies of any kind of transient, extragalactic phenomena (e.g., gamma-ray bursts), so long as their host galaxies are identified.
The main paper of this project can be found here: Unveiling the origin of fast radio bursts by modeling the stellar mass and star formation distributions of their host galaxies.
GALFRB constructs mock galaxy populations using:
- Stellar mass function (Leja / Schechter variants)
- SFR–M⋆–z relations (ridge / mean / neural network posterior)
- Color–SFR probabilistic mapping
- Mass-to-light modeling with redshift dependence
To get started with GALFRB, follow these steps:
- Clone the repository:
git clone https://github.com/loudasnick/GALFRB.git - Navigate to GALFRB directory:
cd GALFRB/ - Create a new conda environment devoted to executing GALFRB:
conda create -n GALFRB_evn python==3.8.19 ipykernel - Activate conda env:
conda activate GALFRB_evn - Install required libraries:
pip install -r requirements.txt - Install GALFRB:
pip install -e . - Download SDSS+WISE galaxy catalog (used in modeling the probability density in color-sfr plane):
python download_sdss_wise_data.py - Run the tutorial found in
examples/to verify the correct installation of the package
- Clone the repository:
git clone https://github.com/loudasnick/GALFRB.git - Navigate to GALFRB directory:
cd GALFRB/ - Install necessary python version
pyenv install 3.8.18 - Create a virtual environment devoted to executing GALFRB:
pyenv virtualenv 3.8.18 GalFRB - Activate virtual env:
pyenv activate GalFRB - Install required libraries:
pyenv exec pip install -r requirements.txt - Install GALFRB:
pyenv exec pip install -e . - Download SDSS+WISE galaxy catalog (used in modeling the probability density in color-sfr plane):
python download_sdss_wise_data.py - Run the tutorial found in
examples/to verify the correct installation of the package
You are all set!
# load the main modules of GALFRB
from galfrb import generator as GFRBSubsequently call the mock_realization module with the desired input parameters
GFRB.mock_realization()Input parameters of mock_realization() routine:
zbins: redshift-bin edges (number of bins = len(zbins) - 1)zgal: representative redshift(s) for each bin. Forspace_dist='delta'or'delta_at_zright', this specifies the redshift where galaxies are placedNsample: number of mock galaxies generated per realization and per redshift binweight: weighting scheme used in the sampling distribution ('SFR','mass','uniform')save: flag to save generated figuresmfunc_ref: stellar mass-function prescription ('Leja','Schechter')mfunc_slope: artificial modification applied to the low-mass slope of the stellar mass functionmfunc_mstar0: stellar-mass threshold below which the modified slope is appliedsfr_ref: star-forming main-sequence prescription ('Speagle','Leja')mode: mode of the SFR--stellar-mass relation ('ridge','mean','nn')'nn'uses the normalizing-flow posterior model of Leja et al. (2022)
posterior: ifTrue, samples realizations from the posterior distributionplot_cdf_ridge: ifTrue, also plots the ridge-line CDF for comparisoncompleteness_handling: treatment of the SFR--mass relation below the completeness limit whenmode='nn'- available options:
'hybrid','cutoff','sharma-like'
- available options:
sigma_norm: controls the SFR scatter below the completeness limit (relevant for'hybrid')n_realizations: number of posterior realizations generated per redshift bintransparency: transparency (alpha) value used for posterior realizations in plotsdata_source: FRB host-galaxy sample used for comparison ('Sharma_only','Sharma_full')ks_test: ifTrue, performs a Kolmogorov--Smirnov test between mock galaxies and FRB hostssfr_sampling: ifTrue, samples SFR values for each mock galaxy (required for color and mass-to-light calculations)space_dist: spatial/redshift distribution of mock galaxies- available options:
'delta': all galaxies placed atzgal'delta_at_zright': galaxies placed at the upper redshift edge [in that casezgal==zbins[1:]]'uniform-z': galaxies uniformly distributed in redshift'uniform-vol': galaxies uniformly distributed in comoving volume
- available options:
nz_bins: number of sub-redshift bins used whenspace_distis not delta-function basedz_min: lower redshift limits for each bin (dummy variable--ignore)z_max: upper redshift limits for each bin (dummy variable--ignore)p_dens_params: dictionary containing parameters defining the posterior PDF grid in(logM, logSFR, z)spacep_prob_arr: posterior probability-density array in(logM, logSFR, z)spacep_z_arr: redshift grid corresponding top_prob_arrp_logm_arr: stellar-mass grid corresponding top_prob_arrp_logsfr_arr: SFR grid corresponding top_prob_arrml_sampling: mass-to-light ratio prescription- available options:
'prescribed''advanced'
- available options:
prescribed_ml_func: user-defined lambda/function used to compute mass-to-light ratios whenml_sampling='prescribed'bimodal_gr: activates a bimodal rest-frame(g-r)color distribution (ml_sampling='advanced'only)all_red: forces all galaxies to belong to the red population (ml_sampling='advanced'only)all_blue: forces all galaxies to belong to the blue population (ml_sampling='advanced'only)density_sfr_color: probability density in SFR--color space used for color samplingsfr_grid: logarithmic SFR grid corresponding todensity_sfr_colorcolor_gr_grid: rest-frame(g-r)color grid corresponding todensity_sfr_colorKr_correction: activates K-correction calculationsplot_diagnostics: generates diagnostic plots for SFRs, colors, K-corrections, and mass-to-light ratiosstore_output: ifTrue, stores all generated samples and metadata in an HDF5 output file
An example call can be found at examples/mock_population.ipynb
To access and manipulate the output files, you can refer to the jupyter-notebook examples/data_postprocessing.ipynb. This notebook provides a tutorial on how to work with the stored output data. It includes instructions on accessing the files and performing various calculations with the data. Make sure to follow the steps outlined in the notebook to effectively utilize the stored data.
We welcome contributions from the community!
This project is licensed under the MIT License.