line_ingredients.c File Reference

Documented line_ingredients module. More...

#include "header.h"
Include dependency graph for line_ingredients.c:

Functions

struct LineLine_alloc_init (struct Cosmology *Cx, long line_type, size_t npoints_interp, double M_min, long mode_mf)
 Allocate the memory and initialize the the line structure. More...
 
int Line_free (struct Line *Lx)
 Free the line structure. More...
 
int Line_evaluate (struct Line *Lx, double *zz, double *res)
 Allocate the memory and initialize the the line structure. More...
 
double mult_func (double sigma, long mode_mf)
 Compute the multiplicity function needed to compute the halo mass function Three models are implemented: Press-Schechter, Sheth-Tormen and Tinker see Pillepich et al arxiv: 0811.4176 for the expressions. More...
 
double mass_func (struct Cosmology *Cx, double M, double z, long mode_mf)
 Compute the halo mass function for Press-Schechter, Sheth-Tormen and Tinker models see Pillepich et al arxiv: 0811.4176 for the expressions. More...
 
double mass_func_sims (struct Cosmology *Cx, double M, double z, long mode_mf)
 Read in the measured mass function of Hidden-valey sims and build an interpolator for HMF(M) for a fixed redshift. More...
 
void halo_bias (struct Cosmology *Cx, double M, double z, long mode_mf, double *bias_arr)
 computes the halo biases for three mass functions, press-schecter, Sheth-Tormen, and Tinker mass functions More...
 
void logSFR_Behroozi_read (double *z_arr, double *logM_arr, double *log10SFR)
 Read in the file for the star formation rate byy Behroozi et al 2013. More...
 
int logSFR_alloc_init ()
 Allocate memory and initialize the 2d interpolator for the star formation rate of Behroozi et al 2013 as a function of halo mass and redshift. More...
 
int SFR_Behroozi_free ()
 Free the memory allocated to the interpolators of star formation rate by Behroozi et al 2013. More...
 
double logSFR_Behroozi (double logM, double z)
 Evaluate the SFR interpolator object for a given value of mass and redshift. More...
 
double luminosity (double M, double z, long mode_lum)
 Compute the line specific luminosity in unit of solar luminosity For CO ladder, I am using the fits in Table 4 of Kamenetzky et al. More...
 
int mass_moment1_integ (unsigned nd, const double *x, void *p, unsigned fdim, double *fvalue)
 The integrand function passed to hcubature integrator to compute the first moment of line luminosity. More...
 
double mass_moment1 (struct Cosmology *Cx, double z, double M_min, long mode_mf, long mode_lum)
 Compute the first luminosity moment. More...
 
int mass_moment2_integ (unsigned nd, const double *x, void *p, unsigned fdim, double *fvalue)
 The integrand function passed to hcubature integrator to compute the second moment of line luminosity. More...
 
double mass_moment2 (struct Cosmology *Cx, double z, double M_min, long mode_mf, long mode_lum)
 Compute the second luminosity moment. More...
 
int bias_lum_weighted_integ (unsigned nd, const double *x, void *p, unsigned fdim, double *fvalue)
 The integrand function passed to hcubature integrator to compute the un-normalized luminosity-weighted line bias. More...
 
void bias_lum_weighted (struct Cosmology *Cx, double z, double M_min, long mode_mf, long mode_lum, double *result)
 Compute the luminosity-weighted linear and quadratic line biases. More...
 
double p_sig_shot_integrand (double x, void *par)
 The integrand function passed to qags integrator to compute the scatter in shot ala Keating 2016. More...
 
double p_sig_shot (double scatter)
 Compute the scatter in shot noise due to scatter in luminosity-halo mass relation, assume log-normal scatter ala Keating Note that we set f_duty =1 unlike other LIM paper (ex. More...
 
double p_sig_Tbar_integrand (double x, void *par)
 The integrand function passed to qags integrator to compute the scatter in Tbar ala Keating 2016. More...
 
double p_sig_Tbar (double scatter)
 Compute the scatter in Tbar due to scatter in luminosity-halo mass relation, assume log-normal scatter ala Keating Note that we set f_duty =1 unlike other LIM paper (ex. More...
 
void line_bias (struct Line *Lx, double z, double *result)
 Compute the linear and quadratic line biases, accounting ffor the normalization w.r.t. More...
 
double mean_intens (struct Cosmology *Cx, size_t line_id, double z)
 Compute the line mean intensity in unit of erg Mpc^-2 Sr^-1. More...
 
double Tbar_line (struct Cosmology *Cx, size_t line_id, double z)
 Compute the mean brightness temprature of CO in unit of microK, compared with Pullen et al and Lidz et al 2011. More...
 

Detailed Description

Documented line_ingredients module.

This module includes functions that are needed for computing the line clustering and shot contributions.

Azadeh Moradinezhad Dizgah, November 4th 2021

In summary, the following functions can be called from other modules:

  1. Line_alloc_init() allocate memory and initizlized the line structure which contains 4 interpolators for first and second mass moments and linear and quadratic line biases.
  2. Line_free() frees the memory allocated to line structure
  3. Line_evaluate() evaluates the interpolators initialized in Line_alloc_init()
  4. mult_func() computes the multiplicity function needed for computing the halo mass function
  5. mass_func() computes the halo mass finction. Three options are available, Press-Schecter, Sheth-Tormen, Tinker
  6. mass_func_sims() reads in the measured mass function on Hidden-Valley simulations by Farnik, and convert it to compare with the theoretical predictions
  7. halo_bias() computes the halo biases assuming the above theoretical predictions of the halo mass function
  8. logSFR_Behroozi_read() reeds in the data file of Behroozi 2013 for SFR(M,z)
  9. logSFR_alloc_init() allocates memory for 2d interpolator of logSFR(M,z)
  10. SFR_behroozi_free() frees the memory allocated to logSFR interpolator
  11. logSFR_Behroozi() evaluates the logSFR_Behroozi interpolator
  12. luminosity() computes the line luminosity
  13. mass_moment1() computes the first mass moment
  14. mass_moment2() computes the first mass moment
  15. bias_lum_weighted() computes the luminosity-weighetd line bias
  16. p_sig_shot() computes the coefficient accounting for the scatter in L(M) in shot noise
  17. p_sig_Tbar() computes the coefficient accounting for the scatter in L(M) in mean brightness temprature
  18. mean_intens() compues the mean intensity of the line
  19. Tbar_line() compues the mean brightness temprature of the line

Function Documentation

◆ bias_lum_weighted()

void bias_lum_weighted ( struct Cosmology Cx,
double  z,
double  M_min,
long  mode_mf,
long  mode_lum,
double *  result 
)

Compute the luminosity-weighted linear and quadratic line biases.

The normalization of first mass moment is not included yet. The function bias_lum_weighted_integ() is the integrand and bias_lum_weighted() computes the bias

Parameters
CxInput: pointer to cosmology structure
zInput: redshift
M_minInput: minimum halo mass
mode_mfInput: model of halo mass function to consider, PSC, ST, TR
mode_lumInpute: which luminosity model, basically which line considered
resultInput: an output array of linear and quadratic line biases
Returns
un-normalized line bias

In units of solar mass;

In units of solar mass

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bias_lum_weighted_integ()

int bias_lum_weighted_integ ( unsigned  nd,
const double *  x,
void *  p,
unsigned  fdim,
double *  fvalue 
)

The integrand function passed to hcubature integrator to compute the un-normalized luminosity-weighted line bias.

Parameters
ndInput: Dimensionality of the domain of integration
xInput: integration variable
pInput: integration parmaeters
fdimInput: Dimensionality of the integrand function
fvalueInput: Array of values of the integrand of dimension fdim return the error status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ halo_bias()

void halo_bias ( struct Cosmology Cx,
double  M,
double  z,
long  mode_mf,
double *  bias_arr 
)

computes the halo biases for three mass functions, press-schecter, Sheth-Tormen, and Tinker mass functions

Parameters
CxInput: Cosmology structure
MInput: halo mass
zInput: redshift
mode_mfInput: switch for setting the model of mass function, can be set to PSC, ST, TR
bias_arrOutput: the output array containning linear and quadratic local-in-matter halo biases, and quadratic and cubic tidal biases
Returns
void

Note that for PSC and ST mass functions, same form of the biases can be assumed, with different coefficents. See astro-ph/0006319

Assuming spherical collapse

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Line_alloc_init()

struct Line * Line_alloc_init ( struct Cosmology Cx,
long  line_type,
size_t  npoints_interp,
double  M_min,
long  mode_mf 
)

Allocate the memory and initialize the the line structure.

This structure contains interpolators for computing the luminosity-weighted mass moments and line biases For a given line defined with "line_type" variable, this function first computes the above four quantities for a wide range of redshifts. Next it iniialized 4 interpolators for these quantities, and store them in line structure.

Parameters
CxInput: Cosmology structure
line_typeInpute: name of the line to compute. It can be set to CII, CO10, CO21, CO32, CO43, CO54, CO65
npoints_interpInput: number of interpolation points
M_minInput: minimum halo mass for mass integrals
mode_mfInpute: theoretical model of halo mass function to use. It can be set to sheth-Tormen (ST), Tinker (TR) or Press-Schecter (PSC)
Returns
the total clustering line power spectrum, including the 1- and 2-halo term

CII

Here is the call graph for this function:
Here is the caller graph for this function:

◆ line_bias()

void line_bias ( struct Line Lx,
double  z,
double *  result 
)

Compute the linear and quadratic line biases, accounting ffor the normalization w.r.t.

the first mass moment

Parameters
LxInput: Pointer to line structure
zInput: Redshift
resultInput: a pointer to an array containing the results of b1_line and b2_line
Returns
void
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Line_evaluate()

int Line_evaluate ( struct Line Lx,
double *  zz,
double *  res 
)

Allocate the memory and initialize the the line structure.

This structure contains interpolators for computing the luminosity-weighted mass moments and line biases For a given line defined with "line_type" variable, this function first computes the above four quantities for a wide range of redshifts. Next it iniialized 4 interpolators for these quantities, and store them in line structure.

Parameters
LxInput: Pointer to the line structure
zzInput: this is an array with 4 elements to determine which of the 4 interpolators should be evaluated.
  • If any of the elements are set to DO_NOT_EVALUATE, the quantitiy corresponding to that index is not computed. O
  • If any of the elements is set to z, the corresponding quantity would be evaluated at that redshift
resOutput: an array containing the results. The number of elements of this array depends on how the zz array is set.
Returns
the error status
Here is the caller graph for this function:

◆ Line_free()

int Line_free ( struct Line Lx)

Free the line structure.

Parameters
LxInput: Pointer to line structure
Returns
the error status
Here is the caller graph for this function:

◆ logSFR_alloc_init()

int logSFR_alloc_init ( )

Allocate memory and initialize the 2d interpolator for the star formation rate of Behroozi et al 2013 as a function of halo mass and redshift.

Returns
the error status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ logSFR_Behroozi()

double logSFR_Behroozi ( double  logM,
double  z 
)

Evaluate the SFR interpolator object for a given value of mass and redshift.

Parameters
logMInput: log10 of halo mass
zInput: redshift
Returns
log10SFR
Here is the caller graph for this function:

◆ logSFR_Behroozi_read()

void logSFR_Behroozi_read ( double *  z_arr,
double *  logM_arr,
double *  log10SFR 
)

Read in the file for the star formation rate byy Behroozi et al 2013.

Parameters
z_arrOutput: pointer to an array of redshifts read from the file
logM_arrOutput: pointer to an array of halo masses read from the file
log10SFROutput: pointer to an array of SFR read from the file
Returns
void
Here is the call graph for this function:
Here is the caller graph for this function:

◆ luminosity()

double luminosity ( double  M,
double  z,
long  mode_lum 
)

Compute the line specific luminosity in unit of solar luminosity For CO ladder, I am using the fits in Table 4 of Kamenetzky et al.

arXiv:1508.05102, while for CII we use Silva et al arXiv:1410.4808

Parameters
MInput: halo mass
zInput: redshift
mode_lumInpute: which luminosity model, basically which line considered
Returns
line luminosity

a = 1.37 Charilli

b = -1.74

in unit of K km/s pc^2

in unit of L_sun

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mass_func()

double mass_func ( struct Cosmology Cx,
double  M,
double  z,
long  mode_mf 
)

Compute the halo mass function for Press-Schechter, Sheth-Tormen and Tinker models see Pillepich et al arxiv: 0811.4176 for the expressions.

Parameters
CxInput: Cosmology structure
MInput: Halo mass function
zInput: redshift
mode_mfInput: switch for setting the model of mass function, can be set to PSC, ST, TR
Returns
the halo mass function in unit of halos per Mpc^3 per solar mass, compared at z=0 with Murray etal https://arxiv.org/abs/1306.5140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mass_func_sims()

double mass_func_sims ( struct Cosmology Cx,
double  M,
double  z,
long  mode_mf 
)

Read in the measured mass function of Hidden-valey sims and build an interpolator for HMF(M) for a fixed redshift.

Parameters
CxInput: Cosmology structure
MInput: halo mass
zInput: redshift
mode_mfInput: switch for setting the model of mass function, can be set to PSC, ST, TR
Returns
the interpolated measured halo mass function
M in unit of M_sun and HMF in unit of #-of-halos/Mpc^3/M_sun

not to be used at z other than 2. This function is for testing purposes only. We test the theoretical predictions at z=2 if ST MF or measured MF are used.

Here is the call graph for this function:

◆ mass_moment1()

double mass_moment1 ( struct Cosmology Cx,
double  z,
double  M_min,
long  mode_mf,
long  mode_lum 
)

Compute the first luminosity moment.

Parameters
CxInput: pointer to cosmology structure
zInput: redshift
M_minInput: minimum halo mass
mode_mfInput: model of halo mass function to consider, PSC, ST, TR
mode_lumInpute: which luminosity model, basically which line considered
Returns
the first mass moment
in unit of M_sun/Mpc^3

In units of solar mass;

In units of solar mass

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mass_moment1_integ()

int mass_moment1_integ ( unsigned  nd,
const double *  x,
void *  p,
unsigned  fdim,
double *  fvalue 
)

The integrand function passed to hcubature integrator to compute the first moment of line luminosity.

Parameters
ndInput: Dimensionality of the domain of integration
xInput: integration variable
pInput: integration parmaeters
fdimInput: Dimensionality of the integrand function
fvalueInput: Array of values of the integrand of dimension fdim return the error status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mass_moment2()

double mass_moment2 ( struct Cosmology Cx,
double  z,
double  M_min,
long  mode_mf,
long  mode_lum 
)

Compute the second luminosity moment.

Parameters
CxInput: pointer to cosmology structure
zInput: redshift
M_minInput: minimum halo mass
mode_mfInput: model of halo mass function to consider, PSC, ST, TR
mode_lumInpute: which luminosity model, basically which line considered
Returns
the second lum moment
in unit of M_sun/Mpc^3

In units of solar mass;

In units of solar mass

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mass_moment2_integ()

int mass_moment2_integ ( unsigned  nd,
const double *  x,
void *  p,
unsigned  fdim,
double *  fvalue 
)

The integrand function passed to hcubature integrator to compute the second moment of line luminosity.

Parameters
ndInput: Dimensionality of the domain of integration
xInput: integration variable
pInput: integration parmaeters
fdimInput: Dimensionality of the integrand function
fvalueInput: Array of values of the integrand of dimension fdim return the error status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mean_intens()

double mean_intens ( struct Cosmology Cx,
size_t  line_id,
double  z 
)

Compute the line mean intensity in unit of erg Mpc^-2 Sr^-1.

Parameters
CxInput: Pointer to cosmology structure
line_idInpute: id of line of interest, an integer value
zInput: Redshift
Returns
the line mean intensity

Note: nu_J is the rest-frame emission frequency related to the observed frequency as nu_obs = nu_J/(1+z_J) For a CO transition from J-> J-1, the rest-frame frequency is nu_J = J nu_CO where nu_Co = 115 GHz.

in unit of erg/s

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mult_func()

double mult_func ( double  sigma,
long  mode_mf 
)

Compute the multiplicity function needed to compute the halo mass function Three models are implemented: Press-Schechter, Sheth-Tormen and Tinker see Pillepich et al arxiv: 0811.4176 for the expressions.

Parameters
sigmaInput: variance of matter fluctuations
mode_mfInput: switch for setting the model of mass function, can be set to PSC, ST, TR
Returns
the multiplicity function

In Barkana & Loeb Rev a = 0.75

Here is the caller graph for this function:

◆ p_sig_shot()

double p_sig_shot ( double  scatter)

Compute the scatter in shot noise due to scatter in luminosity-halo mass relation, assume log-normal scatter ala Keating Note that we set f_duty =1 unlike other LIM paper (ex.

Lidz et al 2011).

Parameters
scatterInput: variance of the log-scatter
Returns
the scatter coeff of shot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ p_sig_shot_integrand()

double p_sig_shot_integrand ( double  x,
void *  par 
)

The integrand function passed to qags integrator to compute the scatter in shot ala Keating 2016.

Parameters
xInput: integration variable
parInput: integration parmaeters
Returns
value of the integrand
Here is the caller graph for this function:

◆ p_sig_Tbar()

double p_sig_Tbar ( double  scatter)

Compute the scatter in Tbar due to scatter in luminosity-halo mass relation, assume log-normal scatter ala Keating Note that we set f_duty =1 unlike other LIM paper (ex.

Lidz et al 2011).

Parameters
scatterInput: variance of the log-scatter
Returns
the scatter coeff of Tbar
Here is the call graph for this function:
Here is the caller graph for this function:

◆ p_sig_Tbar_integrand()

double p_sig_Tbar_integrand ( double  x,
void *  par 
)

The integrand function passed to qags integrator to compute the scatter in Tbar ala Keating 2016.

Parameters
xInput: integration variable
parInput: integration parmaeters
Returns
value of the integrand
Here is the caller graph for this function:

◆ SFR_Behroozi_free()

int SFR_Behroozi_free ( )

Free the memory allocated to the interpolators of star formation rate by Behroozi et al 2013.

Returns
the error status
Here is the caller graph for this function:

◆ Tbar_line()

double Tbar_line ( struct Cosmology Cx,
size_t  line_id,
double  z 
)

Compute the mean brightness temprature of CO in unit of microK, compared with Pullen et al and Lidz et al 2011.

Parameters
CxInput: Pointer to cosmology structure
line_idInpute: id of line of interest, an integer value
zInput: Redshift
Returns
the line mean temprature assuming Rayleigh-Jeans limit

Boltzmann constant in unit of erg K^-1

factor of 10^6 is the conversion factor from K to microK

Here is the call graph for this function:
Here is the caller graph for this function: