FRB Hosts
Module related to host galaxies of FRBs Warning: Might get chopped up into pieces sommeday
- frb.galaxies.hosts.chance_coincidence(rmag, r_i)[source]
Calculate the chance probability of a galaxy to an FRB
- Taken from Bloom et al. 2002
https://ui.adsabs.harvard.edu/abs/2002AJ….123.1111B/abstract
..todo.. Expand to allow for other filters
- frb.galaxies.hosts.chance_dx(rmag)[source]
Returns the angular separation for a secure association (1%) as in https://ui.adsabs.harvard.edu/abs/2014MNRAS.437.1495T/abstract
- Parameters:
rmag (float) – r-band magnitude
- Returns:
Angular offset in arcsec
- Return type:
Quantity
- frb.galaxies.hosts.random_separation(catalog, wcs, npix, trim=<Quantity 1. arcmin>, ntrial=100)[source]
Find random offsets to
- frb.galaxies.hosts.get_R(R_frb, R_0=0.2, R_h=0.25)[source]
Calculates Radius of localisation region in arcsecond Based on Bloom et al 2002 and Eftekhari et al 2017
- frb.galaxies.hosts.read_r_mags(data_table_path)[source]
Reads data used in Driver et al (2016). https://iopscience.iop.org/article/10.3847/0004-637X/827/2/108
- Parameters:
data_table_path (string) – Path to the fits file with data
- Returns:
r band magnitudes array: magnitude bin array: cosmic variance
- Return type:
array
- frb.galaxies.hosts.prob_eb17(R_frb, m, R_0=0.2, R_h=0.25, ret_numgal=False)[source]
Calculates chance association probability of a galaxy to an FRB Taken from:
- Parameters:
R_frb (float) – The 1 sigma localization radius of the FRB in arcsec
m (float) – r band magnitude of the galaxy
R_0 (float) – Radial angular separation between the FRB position and a presumed host
R_h (float) – Galaxy half light radius
ret_numgal (bool) – to return the number of galaxies along with the chance coincidence probability
- Returns:
Probability of chance coincidence
- Return type:
- frb.galaxies.hosts.load_host_tbl(hosts_file: str = None, host_tbl: DataFrame = None)[source]
Generate a simple host table from a CSV, usually the public file
- frb.galaxies.hosts.load_Mr_pdf(pdf_file: str = None)[source]
Load the PDF for Mr for Host galaxies
Generated by M. Bhardwaj from ~20 localized FRBs
Overview
This module provides specialized functionality for FRB host galaxies, extending the basic FRBGalaxy class with additional methods specific to confirmed host associations and enhanced analysis capabilities.
Note
This module builds upon frb.galaxies.frbgalaxy and provides host-specific analysis tools and database interfaces.
Classes
FRBHost
Host Analysis Functions
Association Analysis
Database Integration
Population Analysis
Literature Compilation
Host-Specific Properties
The FRBHost class includes additional attributes:
- Association Metadata
Discovery paper reference
Association method (statistical, spectroscopic confirmation)
Confidence level or probability
Alternative host candidates
- Enhanced Measurements
Compiled literature photometry
Multiple redshift estimates with references
Morphological measurements from different studies
Environmental context (group/cluster membership)
- Analysis Results
SED fitting results from multiple codes
Spectral line analysis summaries
Host-normalized offset measurements
Population comparison statistics
Examples
Creating FRBHost objects:
from frb.galaxies.hosts import FRBHost
from frb.frb import FRB
# Create FRB object
frb = FRB.by_name('FRB180924')
# Create host object with enhanced functionality
host = FRBHost(ra=349.24, dec=-40.9, frb=frb)
# Set confirmed host status
host.association_prob = 0.99
host.discovery_ref = '2019Sci...365..565B'
Loading from host database:
from frb.galaxies.hosts import load_host_database
# Load complete host database
host_db = load_host_database()
# Access specific host
frb180924_host = host_db['FRB180924']
print(f"Host redshift: {frb180924_host.z:.4f}")
print(f"Stellar mass: {frb180924_host.derived['Mstar']:.2e} Msun")
Association probability calculation:
from frb.galaxies.hosts import calc_association_prob
# Calculate association probability for candidate
prob = calc_association_prob(
offset_arcsec=1.2,
galaxy_mag=23.1,
field_density=1500, # galaxies per sq arcmin to this depth
survey_depth=25.0
)
print(f"Association probability: {prob:.3f}")
Host population analysis:
from frb.galaxies.hosts import host_mass_function
import matplotlib.pyplot as plt
# Calculate host stellar mass function
masses, phi, phi_err = host_mass_function(
completeness_limit=1e9, # Msun
volume_correction=True
)
# Plot comparison with field galaxies
plt.errorbar(masses, phi, yerr=phi_err, label='FRB hosts')
plt.xlabel('Stellar Mass [Msun]')
plt.ylabel('Φ [Mpc^-3 dex^-1]')
plt.yscale('log')
plt.legend()
Literature compilation:
from frb.galaxies.hosts import compile_literature_data
# Compile all literature data for specific host
lit_data = compile_literature_data('FRB121102')
print("Literature photometry:")
for paper, data in lit_data['photometry'].items():
print(f" {paper}: {len(data)} measurements")
print("\\nRedshift measurements:")
for z_entry in lit_data['redshifts']:
print(f" z = {z_entry['z']:.4f} ± {z_entry['z_err']:.4f} ({z_entry['ref']})")
Candidate ranking:
from frb.galaxies.hosts import host_candidate_ranking
from astropy.coordinates import SkyCoord
from astropy import units as u
# Define FRB position and error
frb_coord = SkyCoord(ra=82.998, dec=33.148, unit='deg')
frb_error = 0.1 * u.arcsec # localization uncertainty
# List of galaxy candidates with positions and magnitudes
candidates = [
{'coord': SkyCoord(ra=82.999, dec=33.149, unit='deg'), 'mag': 22.1},
{'coord': SkyCoord(ra=83.001, dec=33.146, unit='deg'), 'mag': 23.8},
{'coord': SkyCoord(ra=82.995, dec=33.151, unit='deg'), 'mag': 24.2}
]
# Rank by association probability
ranked_candidates = host_candidate_ranking(
frb_coord, frb_error, candidates,
field_density=2000,
magnitude_limit=25.0
)
print("Ranked host candidates:")
for i, candidate in enumerate(ranked_candidates):
print(f" {i+1}. P = {candidate['prob']:.3f}, "
f"offset = {candidate['offset']:.2f}\", "
f"mag = {candidate['mag']:.1f}")
Cross-matching with surveys:
from frb.galaxies.hosts import cross_match_catalogs
# Cross-match host position with major surveys
matches = cross_match_catalogs(
host.coord,
radius=2.0 * u.arcsec,
surveys=['DES', 'Pan-STARRS', 'WISE', 'GALEX']
)
print("Survey matches:")
for survey, data in matches.items():
if len(data) > 0:
print(f" {survey}: {len(data)} sources")
print(f" Closest: {data[0]['separation']:.2f}\" ")
Statistical analysis:
from frb.galaxies.hosts import offset_distribution_analysis
import numpy as np
# Analyze offset distribution for all confirmed hosts
analysis_results = offset_distribution_analysis(
normalize_by_size=True, # Normalize by galaxy effective radius
compare_to_light=True, # Compare with surface brightness profiles
bootstrap_errors=True
)
print(f"Median normalized offset: {analysis_results['median_norm']:.2f} R_e")
print(f"Fraction within 1 R_e: {analysis_results['frac_1Re']:.2f}")
print(f"KS test vs exponential profile: p = {analysis_results['ks_pvalue']:.3f}")