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 origing 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.
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 GFRB
This will display the code in a monospaced font and preserve the formatting. You can also specify the programming language after the opening backticks to enable syntax highlighting. For example, to highlight Python code, use python
:
GFRB.mock_realization()
Input parameters of mock_realization()
routine:
zbins
: the redshift values separating the bins (number of bins = len(zbins) - 1)zgal
: the redshift at which each mock galaxy lies for each bin (applicable and useful only whenspace_dist='delta'
)Nsample
: number of mock galaxies per mock galaxy realization and per redshift binweight
: weight function to be used in the sampling distribution function (current options: 'SFR', 'mass', 'uniform')save
: flag for storing the figuremfunc_ref
: Which stellar mass function to be implemented in the calculation (current options: 'Leja', 'Schechter')mfunc_slope
: slope coefficient for artificially changing the stellar mass-function slope (default: 0, i.e., no modification of the stellar mass function)mfunc_Mstar0
: stellar-mass coefficient below which the stellar mass slope changes artificially (only if mfunc_slope!=0)sfr_ref
: Which SFR-Mstar-z probability density to be used [current options: 'Speagle', 'Leja']mode
: which mode of the sfr-Mstar parametric formula to be considered (available: 'ridge', 'mean', 'nn') ('nn' corresponds to the probability density offered by the trained normalizing flow of Leja+2022; it also needsposterior=True
)posterior
: If True, then sampling of the posterior in the SFR-Mstar-z is activated,plot_cdf_ridge
: Flag to activate plotting of the cdf curved computed usingmode='ridge'
, i.e., no posterior, for comparison purposescompleteness_handling
:if mode='nn'
, then it determines the prescribed sfr-mass relationship below m_completeness (current options: 'sharma-like', 'hybrid', 'cutoff')sigma_norm
: it controls the spread in the sfr-mass below m_completeness (only ifcompleteness-handling='hybrid'
)n_realizations
: how many different samples from the posterior are to be generated per redshift bintransparency
: 'alpha' for each line in the plotdata_source
: FRB host galaxy sample (current options: 'Sharma_only', 'Sharma_full')ks_test
: If True, the Kolmogorov-smirnoff test is carried outsfr_sampling
: flag to sample sfr value for each mock generated galaxy (used to obtain color)space_dist
: Distribution of mock galaxies in space (current options: 'uniform-vol', 'delta', 'uniform-z'). The 'uniform' mode is outdated.z_min
: odd parameter (set toNone
). It will be removed in the futurez_max
: odd parameter (set toNone
). It will be removed in the futurep_dens_params
: various parameters used to sample the PDF in logm-logsfr-z,p_prob_arr
: PDF in logm-logsfr-z space (Leja et al. 2022)p_z_arr
: redshift array in logm-logsfr-z grid spacep_logm_arr
: logM array in logm-logsfr-z grid spacep_logsfr_arr
: logsfr array in logm-logsfr-z grid spaceml_sampling
: If mass-to-light ratio is to be sampled. (current options: 'gaussian', 'prescribed', 'advanced'. The advanced is the one described in Loudas et al. 2025)prescribed_ml_func
: Prescribed lambda function to compute M/L for given sfr, sfr_mode, it is used only ifml_sampling='prescribed'
density_sfr_color
: prob. density in sfr-color plane provided M/L sampling is activatedsfr_grid
: sfr array (in log form) for sfr-color grid resolution provided M/L sampling is activatedcolor_gr_grid
: color g-r array for sfr-color grid resolution provided M/L sampling is activatedKr_correction
: flag to activate and implement Kr-correctionplot_M_L
: flag to plot the mass-to-light distribution and other related quantitiesstore_output
: flag to store all samples into an h5 data file
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.