fN Classes



There are two classes designed for \(f(N)\) calculations. While the authors have reservations on the validity of \(f(N)\) as a description of the IGM, it still offers good value for a number of calculations.


The FNModel Class may take several forms as described below.

Type Description Reference
Hspline Hermite spline which is constrained to monotonically decrease Prochaska+14
Gamma Power-law + exponential Inoue+14


Here are some examples of instantiation:

from pyigm.fN.fnmodel import FNModel
fN_P14 = FNModel('Hspline', zmnx=(2.,5.))
fN_I14 = FNModel('Gamma')

And the default model is currently the P14 formulation:

fN_default = FNModel.default_model()


Variable Type Description
zmnx tuple min/max redshift for using this model to evaluate f(N)



Calculate \(\ell(X)\), the incidence of absorption per absorption path length \(dX\) in a given interval of column density:

\[\ell(X) = \int_{N_{\rm min}}^{N_{\rm max}} f(N,X) \, dN\]

Easily evaluated with:

lX = fN_default.calculate_lox(z, Nmin, Nmax)


Calculate the effective optical depth to Lyman limit photons

\[\tau_{\rm eff}^{\rm LL}(z_{912},z_\mathrm{q}) = \int_{z_{912}}^{z_q} \int_0^\infty f(N_{\rm HI},z) \, [1 - \exp[-N_{\rm HI} \sigma_{\rm ph}(z')]] \, dN_{\rm HI} dz'\]

Easily evaluated over across a redshift interval:

from pyigm.fN import tau_eff as pyteff
zval,teff_LL = pyteff.lyman_limit(fN_default, 0.5, 2.45)


Evaluate the mean free path to ionizing photons at a given redshift:

mfp = fN_default.mfp(z)

rho HI

Evaluate the mass density in HI atoms at a specific redshift, integrating over a \(N_{\rm HI}\) interval:

\[\rho_{\rm HI} = \frac{m_p H_0}{c} \int_{N_{\rm min}}^{N_{\rm max}} f(N_{\rm HI},X) \, N_{\rm HI} \, dN_{\rm HI}\]

As such:

rho_HI = fN_default.calculate_rhoHI(z, (Nmin, Nmax))

Most useful for DLA calculations.

fN Constraint

The FNConstraint class organizes constraints on \(f(N)\). It is likely to be used mostly to read in existing data:

pyigm_path = imp.find_module('pyigm')[1]
fn_file = pyigm_path+'/data/fN/fN_constraints_z2.5_vanilla.fits'
fN_cs = FNConstraint.from_fitsfile(fn_file)

Mock Forest

One may generate mock spectra of the Lya forest with the mockforest module. One inputs a wavelength array, source redshift, and FNModel and the mock spectrum is generated:

mock_spec, HI_comps, _ = pyigm.mockforest.mk_mock(wave, zem, fN_model)

Measured teff

The estimated teff values from observational studies are encoded in the lyman_alpha_obs() method. These draw upon the Kirkman+07, Kirkman+05 and Becker+13 studies. Here is an example call:

from pyigm.fN import tau_eff as pyteff
teff = pyteff.lyman_alpha_obs(1.)
# Array
teff = pyteff.lyman_alpha_obs(np.linspace(1.,4.,100))

A float or ndarray is returned depending on the type of input. The code raises an error if the input redshift exceeds zmax which is currently set to 4.9.