The Luminosity Function Fit Module

class atelier.lumfunfit.LuminosityFunctionFit(lum_range, redsh_range, cosmology, surveys, emcee_nwalkers=50, emcee_steps=1000)

Class that carries out maximum likelihood fits to a luminosity function model using MCMC (emcee).

lum_range

Luminosity range for the luminosity function fit (2-element list).

Type:

list(float, float)

redsh_range

Redshift range for the luminosity function fit (2-element list).

Type:

list(float, float)

cosmology

Cosmology object

Type:

astropy.cosmology.Cosmology

surveys

List of survey objects used in to fit the luminosity function model to.

Type:

list(survey.Survey)

emcee_sampler

Emcee Ensemble sampler object. This attribute cannot be initialized but is internally populated during the .run_mcmc or .run_mcmc_multiprocess methods.

Type:

emcee.EnsembleSampler

emcee_nwalker

Number of walkers for the emcee sampler.

Type:

int (default = 50)

emcee_steps

Number of steps for the emcee sampler.

Type:

int (default = 1000)

log_prior(theta, parameters)

Logarithmic prior function for luminosity function maximum likelihood estimation (MLE).

Parameters:
  • theta (list of parameter values) – parameter vector

  • parameters (dict(atelier.lumfun.Parameter)) – Dictionary of parameters used in MLE. The Parameter.bounds attribute is used to keep the fit within the pre-defined parameter boundaries (bounds).

Returns:

Logarithmic prior

Return type:

float

log_probability(theta, lumfun=None, use_prior=True, int_mode='romberg')

Logarithmic probability for luminosity function maximum likelihood estimation (MLE).

The logarithmic probability implemented here goes back to the definition of Marshall+1983 Equation 3.

ADS reference: https://ui.adsabs.harvard.edu/abs/1983ApJ…269…35M/abstract

Parameters:
Returns:

Logarithmic probability

Return type:

float

negative_log_likelihood(theta, lumfun)

Return the negative logarithmic likelihood for a set of parameters ‘theta’ and a luminosity function model ‘lumfun’ using the default logarithmic likelihood definition.

Parameters:
Returns:

Negative logarithmic likelihood

Return type:

float

run_mcmc(lumfun, initial_guess=None, nwalkers=None, steps=None, int_mode='romberg')

Run the emcee MCMC EnsembleSampler to fit the luminosity function model to the survey data using maximum likelihood estimation.

Parameters:
  • lumfun (atelier.lumfun.LuminosityFunction (or children classes)) – Luminosity function model

  • initial_guess (list(float) (default = None)) – Initial guess of the free parameters (ordered as in the luminosity function model.

  • nwalkers (int (default = None)) – Number of walkers for the emcee sampler overriding ( not overwriting) the class attribute emcee_nwalkers.

  • steps (int (default = None)) – Number of steps for the emcee sampler overriding ( not overwriting) the class attribute emcee_nwalkers.

Returns:

None

run_mcmc_multiprocess(lumfun, initial_guess=None, nwalkers=None, steps=None, processes=None, int_mode='romberg')

Run the emcee MCMC EnsembleSampler to fit the luminosity function model to the survey data using maximum likelihood estimation in multiprocessing mode.

Parameters:
  • lumfun (atelier.lumfun.LuminosityFunction (or children classes)) – Luminosity function model

  • initial_guess (list(float) (default = None)) – Initial guess of the free parameters (ordered as in the luminosity function model.

  • nwalkers (int (default = None)) – Number of walkers for the emcee sampler overriding ( not overwriting) the class attribute emcee_nwalkers.

  • steps (int (default = None)) – Number of steps for the emcee sampler overriding ( not overwriting) the class attribute emcee_nwalkers.

  • processes (int (default = None)) – Number of processes for multiprocessing. The default value of ‘None’ will use the maximum number determinded by the multiprocessing package.

Returns:

atelier.lumfunfit.log_prior(theta, parameters)
Logarithmic prior function for luminosity function maximum likelihood

estimation (MLE) using emcee in multiprocessing mode.

Parameters:
  • theta (list of parameter values) – parameter vector

  • parameters (dict(atelier.lumfun.Parameter)) – Dictionary of parameters used in MLE. The Parameter.bounds attribute is used to keep the fit within the pre-defined parameter boundaries (bounds).

Returns:

Logarithmic prior

Return type:

float

atelier.lumfunfit.log_probability(theta, lumfun=None, lum_range=None, redsh_range=None, surveys=None, dVdzdO=None, log_prior=None, use_prior=True, int_mode='romberg')

Logarithmic probability for luminosity function maximum likelihood estimation (MLE) using emcee in multiprocessing mode.

The logarithmic probability implemented here goes back to the definition of Marshall+1983 Equation 3.

ADS reference: https://ui.adsabs.harvard.edu/abs/1983ApJ…269…35M/abstract

Parameters:
  • theta (list of parameter values) – parameter vector

  • lumfun (atelier.lumfun.LuminosityFunction (or children classes)) – Luminosity function model

  • lum_range (tuple) – Luminosity range

  • redsh_range (tuple) – Redshift range

  • surveys (list(atelier.survey.Survey)) – List of surveys

  • dVdzdO (function) – Differential comoving solid volume element

  • log_prior – Functiond describing the logarithmic prior

  • use_prior (bool) – Boolean to indicate whether the logarithmic prior function will be used or strictly flat priors for all parameters will be adopted.

Returns:

Logarithmic probability

Return type:

float