API#

evstats.evs#

evstats.evs.evs_hypersurface_pdf(mf=None, V=33510.321)#

Calculate extreme value probability density function for the dark matter halo population on a spatial hypersurface (fixed redshift).

Parameters:
  • mf (mass function, from hmf package (default: hmf.MassFunction()))

  • V (volume in Mpc^3 (default: a sphere with radius 20 Mpc))

Return type:

phi

evstats.evs.evs_bin_pdf(mf=None, zmin=0.0, zmax=0.1, dz=0.01, mmin=12, mmax=18, dm=0.01, fsky=1.0)#

Calculate EVS in redshift and mass bin

Parameters:
  • mf (mass function, from hmf package (default: hmf.MassFunction()))

  • zmin (z minimum)

  • zmax (z maximum)

  • dz (delta z)

  • mmin (mass minimum (log10 (M_{sol}) ))

  • mmax (mass maximum (log10 (M_{sol}) ))

  • dm (delta m (dex))

  • fsky (fraction of sky)

Returns:

  • phi (probability density function)

  • ln10m_range (corresponding mass values for PDF (log10 (M_{sol}) ))

evstats.evs.apply_fsky(N, f, F, fsky)#

Scale the whole-sky EVS terms to a sky fraction, giving the EVS PDF.

Parameters:
  • N (number of haloes over the whole sky)

  • f (dN/dlog10m over the whole sky)

  • F (number of haloes below each mass over the whole sky)

  • fsky (fraction of sky)

Returns:

phi

Return type:

probability density function

evstats.stats#

evstats.stats.compute_conf_ints(pdf, x, y=None, lims=[0.001349898, 0.0227501319, 0.15865525, 0.5, 0.8413447, 0.97724986, 0.998650102])#

Compute confidence intervals for a given pdf

Parameters:
  • pdf (array) – probability density function evaluated at x

  • x (array) – x coordinates

  • y (array, optional) – monotonic function of x, evaluated at x. If given the intervals are returned in these coordinates instead, e.g. the flux at each stellar mass. The cdf is always integrated over x, so no Jacobian is needed; quantiles are preserved under a monotonic transform.

  • lims (array) – confidence intervals to compute

Returns:

CI – confidence intervals

Return type:

array

evstats.stats.eddington_bias(m, m_err, mf=None)#

Calculate masses corrected for eddington bias.

ln M_corrected = ln M_observed + 0.5 * epsilon * sigma_ln_M**2

where epsilon is the slope of the halo mass function.

Parameters:
  • m (array) – object masses in log base 10

  • m_err (array) – object mass errors in log base 10

  • mf (hmf.MassFunction, optional) – mass function (default: hmf.MassFunction())

Returns:

  • array – corrected masses

  • array – slope of the halo mass function, epsilon

evstats.stellar#

evstats.stellar.log10_fs_pdf(v, method='lognormal')#

PDF of v = log10(f_s), for the f_s distributions truncated to 0 < f_s <= 1.

Parameters:
  • v (array) – log10 stellar fraction, uniformly spaced and <= 0

  • method (str) – parametric form of f_s pdf, one of ‘lognormal’, ‘normal’, ‘uniform’ or ‘exponential’

Returns:

normalised pdf of v

Return type:

array

evstats.stellar.apply_fs_distribution(pdf, _x, method='lognormal', f_b=0.16, vmin=-8.0)#

Combine an EVS distribution with an f_s distribution to give the stellar mass PDF.

The stellar mass is the product M_star = f_b * f_s * M_halo, which in log space is a sum, so the PDF is the convolution of the halo EVS PDF with the PDF of log10(f_s), shifted by the baryon fraction.

Parameters:
  • pdf (array) – probability density function on x

  • _x (array) – log10 halo mass coordinates of pdf, uniformly spaced

  • method (str) – parametric form of f_s pdf, see log10_fs_pdf

  • f_b (float) – additional normalisation constant to apply (e.g. baryon fraction)

  • vmin (float) – lower limit on log10(f_s) to include in the convolution

Returns:

pdf – stellar mass pdf, on the same coordinates _x

Return type:

array

evstats.stellar.halo_dependent_fs(halom, lo_halo_mass=13.5, hi_halo_mass=14.0, f_b=0.16)#

Apply Andreon+10 fits: https://ui.adsabs.harvard.edu/abs/2010MNRAS.407..263A/abstract

evstats.stellar.apply_halo_dependent_fs(pdf, log10m, lo_halo_mass=13.5, hi_halo_mass=14.0, N=1000, f_b=0.16)#

Stellar mass PDF with halo_dependent_fs stellar fractions, by Monte Carlo sampling of the halo EVS PDF.