Nebular Emission Line Analysis
Methods related to nebular line analysis, e.g. dust extinction, SFR
- frb.galaxies.nebular.calc_dust_extinct(neb_lines, method)[source]
Estimate the Visual extinction A_V based on input nebular emission lines
Uses the Gordon 2024
- frb.galaxies.nebular.calc_logOH(neb_lines, method)[source]
Estimate the oxygen abundance based on the input nebular emission line fluxes For now based on the O3N2 calibration from https://ui.adsabs.harvard.edu/abs/2018AJ….155…82H/abstract
- frb.galaxies.nebular.calc_lum(neb_lines, line, z, cosmo, AV=None)[source]
Calculate the line luminosity (and error) from input nebular line emission
Error is -999.*erg/s if input line flux has negative error
- Parameters:
- Returns:
Luminosity, sig(Luminosity)
- Return type:
Quantity, Quantity
- frb.galaxies.nebular.calc_SFR(neb_lines, method, z, cosmo, AV=None, curve='MW')[source]
Calculate the SFR from input nebular line emission
- Parameters:
neb_lines (dict) – Observed line fluxes
method (str) – Method for deriving the SFR Ha – Use the Halpha line flux
z (float) – Emission redshift – for Luminosity distance
cosmo (astropy.cosmology.FLRW) – Cosmology
AV (float, optional) – Visual extinction, if supplied will apply
curve (str) – Name of the extinction curve. Only used if A_V is supplied
- Returns:
SFR with units of Msun/yr
- Return type:
Quantity
- frb.galaxies.nebular.get_ebv(coords, definition='SandF', region=<Quantity 5. deg>, get_ext_table=False)[source]
Get the E(B-V) value and statistic from the Milky way dust extinction within the query region around the input coordinate
- Parameters:
coords (Astropy SkyCoord) – Input celestial coordinates
definition (str, optional) – Can be either “SFD” or “SandF”. They stand for the definitions of E(B-V) according to either Schlegel et al. 1998 (ApJ 500, 525) or Schlafly and Finkbeiner 2011 (ApJ 737, 103) respectively
region (Astropy Angle (Quantity), optional) – Angular radius around the input coordinate where the query is run to obtain statistics. Must be between 2 deg and 37.5 deg. Default value: 5 deg.
get_stats – bool, optional If true, also returns a dict with the statistics of E(B-V) within the query region.
get_ext_table – bool, optional If true, also returns the table with A/E(B-V) ratios for multiple filters.
- Returns:
Dict with E(B-V) at refPixelValue, meanValue, std, minValue and maxValue in the query region. All values are in mags.
- Return type:
Overview
This module provides functions for analyzing nebular emission lines in galaxy spectra, including line flux measurements, extinction corrections, and star formation rate calculations from emission line diagnostics.
Functions
Line Analysis Functions
- frb.galaxies.nebular.calc_lum(neb_lines, line, z, cosmo, AV=None)[source]
Calculate the line luminosity (and error) from input nebular line emission
Error is -999.*erg/s if input line flux has negative error
- Parameters:
- Returns:
Luminosity, sig(Luminosity)
- Return type:
Quantity, Quantity
Calculate emission line luminosity with optional dust extinction correction.
This function converts observed line fluxes to intrinsic luminosities, applying distance corrections and optionally correcting for dust extinction using the Balmer decrement or other extinction indicators.
Star Formation Rate Functions
Extinction and Reddening
- frb.galaxies.nebular.get_ebv(coords, definition='SandF', region=<Quantity 5. deg>, get_ext_table=False)[source]
Get the E(B-V) value and statistic from the Milky way dust extinction within the query region around the input coordinate
- Parameters:
coords (Astropy SkyCoord) – Input celestial coordinates
definition (str, optional) – Can be either “SFD” or “SandF”. They stand for the definitions of E(B-V) according to either Schlegel et al. 1998 (ApJ 500, 525) or Schlafly and Finkbeiner 2011 (ApJ 737, 103) respectively
region (Astropy Angle (Quantity), optional) – Angular radius around the input coordinate where the query is run to obtain statistics. Must be between 2 deg and 37.5 deg. Default value: 5 deg.
get_stats – bool, optional If true, also returns a dict with the statistics of E(B-V) within the query region.
get_ext_table – bool, optional If true, also returns the table with A/E(B-V) ratios for multiple filters.
- Returns:
Dict with E(B-V) at refPixelValue, meanValue, std, minValue and maxValue in the query region. All values are in mags.
- Return type:
Get Galactic extinction E(B-V) for given coordinates.
Queries dust maps to obtain Milky Way foreground extinction values using Schlegel, Finkbeiner & Davis (1998) or other dust maps.
Diagnostic Functions
Physical Properties
Constants and Calibrations
The module includes various physical constants and calibration factors:
- Recombination Constants
Case B recombination coefficients
Temperature and density dependent line ratios
Intrinsic Balmer line ratios
- Extinction Laws
Cardelli, Clayton & Mathis (1989) extinction curve
Calzetti et al. (2000) starburst attenuation law
Fitzpatrick (1999) Milky Way extinction
- SFR Calibrations
Kennicutt (1998) Hα-SFR relation
Modern IMF-corrected calibrations
Metallicity-dependent corrections
Examples
Basic line analysis:
from frb.galaxies import nebular
from frb.galaxies.frbgalaxy import FRBGalaxy
# Assuming galaxy object with emission line measurements
galaxy = FRBGalaxy(ra=180.0, dec=45.0, frb=frb_object)
# Set emission line fluxes (in units of erg/s/cm^2)
galaxy.neb_lines['Ha_flux'] = 5.2e-16
galaxy.neb_lines['Ha_flux_err'] = 0.3e-16
galaxy.neb_lines['Hb_flux'] = 1.1e-16
galaxy.neb_lines['OIII_5007_flux'] = 2.8e-16
# Calculate luminosity
ha_lum = nebular.calc_lum(galaxy, 'Ha')
print(f"Hα luminosity: {ha_lum:.2e} erg/s")
Star formation rate calculation:
# Calculate extinction from Balmer decrement
extinction = nebular.calc_extinction(
galaxy.neb_lines['Ha_flux'],
galaxy.neb_lines['Hb_flux']
)
print(f"A_V = {extinction:.2f} mag")
# Calculate extinction-corrected SFR
sfr = nebular.sfr_ha(ha_lum, extinction=extinction)
print(f"Star formation rate: {sfr:.2f} Msun/yr")
BPT classification:
# Calculate line ratios for BPT diagram
line_ratios = {
'NII_Ha': galaxy.neb_lines['NII_6583_flux'] / galaxy.neb_lines['Ha_flux'],
'OIII_Hb': galaxy.neb_lines['OIII_5007_flux'] / galaxy.neb_lines['Hb_flux'],
'SII_Ha': galaxy.neb_lines['SII_6717_flux'] / galaxy.neb_lines['Ha_flux'],
'OI_Ha': galaxy.neb_lines['OI_6300_flux'] / galaxy.neb_lines['Ha_flux']
}
# Classify source type
classification = nebular.bpt_classification(line_ratios)
print(f"BPT classification: {classification}")
Metallicity analysis:
# Calculate metallicity using N2 method
n2_ratio = galaxy.neb_lines['NII_6583_flux'] / galaxy.neb_lines['Ha_flux']
metallicity_n2 = nebular.metallicity_diagnostics(n2_ratio, method='N2')
# Convert to 12 + log(O/H) scale
oh_abundance = 8.69 + metallicity_n2
print(f"12 + log(O/H) = {oh_abundance:.2f}")
Electron density measurement:
# Calculate electron density from [SII] doublet
sii_ratio = (galaxy.neb_lines['SII_6717_flux'] /
galaxy.neb_lines['SII_6731_flux'])
n_e = nebular.electron_density(sii_ratio)
print(f"Electron density: {n_e:.1f} cm^-3")
Galactic extinction correction:
from astropy.coordinates import SkyCoord
# Get Galactic extinction
coord = SkyCoord(ra=180.0*u.deg, dec=45.0*u.deg)
ebv_gal = nebular.get_ebv(coord)
# Apply foreground correction to observed fluxes
extinction_corr = 10**(0.4 * 2.5 * ebv_gal) # Hα extinction
intrinsic_flux = galaxy.neb_lines['Ha_flux'] * extinction_corr
print(f"Galactic E(B-V): {ebv_gal:.3f}")
print(f"Corrected Hα flux: {intrinsic_flux:.2e} erg/s/cm^2")