firecrown.connector.cosmosis.likelihood

CosmoSIS Likelihood Connector.

This module provides the class FirecrownLikelihood, and the hook functions for this module to be a CosmoSIS likelihood module.

Note that the class FirecrownLikelihood does not inherit from firecrown’s likelihood abstract base class; it the implementation of a CosmoSIS module, not a specific likelihood.

Classes

FirecrownLikelihood

CosmoSIS likelihood module for calculating a Firecrown likelihood.

Functions

extract_section(sample, section)

Extract all the parameters from the name datablock section into a dictionary.

calculate_firecrown_params(sampling_sections, ...)

Calculate the ParamsMap for this sample.

form_error_message(sampling_sections, exc)

Form the error message that will be used to report a missing parameter.

setup(config)

Setup hook for a CosmoSIS module.

execute(sample, instance)

Execute hook for a CosmoSIS module.

cleanup(_)

Cleanup hook for a CosmoSIS module. This one has nothing to do.

Module Contents

firecrown.connector.cosmosis.likelihood.extract_section(sample, section)[source]

Extract all the parameters from the name datablock section into a dictionary.

Parameters:
  • sample (cosmosis.datablock) – the CosmoSiS datablock to query

  • section (str) – the name of the section desired

Returns:

a dictionary of the parameters in the section

Return type:

firecrown.likelihood.likelihood.NamedParameters

class firecrown.connector.cosmosis.likelihood.FirecrownLikelihood(config)[source]

CosmoSIS likelihood module for calculating a Firecrown likelihood.

In this simplest implementation, we have only a single module. This module is responsible for calling CCL to perform theory calculations, based on the output of CAMB, and also for calculating the data likelihood based on this theory.

Parameters:

config (cosmosis.datablock)

firecrown_module_name = 'module_options'
sampling_sections: list[str]
likelihood: firecrown.likelihood.likelihood.Likelihood
map
execute(sample)[source]

This is the method called for each sample generated by the sampler.

Parameters:

sample (cosmosis.datablock) – the sample generated by the sampler

Returns:

0

Return type:

int

special_gauss_family_handling(sample)[source]

Special handling for the GaussFamily likelihood.

We need to save concatenated data vector and inverse covariance to enable support for the CosmoSIS Fisher sampler. This can only work for likelihoods that have these quantities. Currently, this is only GaussFamily.

Parameters:

sample (cosmosis.datablock) – the sample generated by the sampler

Returns:

None

Return type:

None

handle_twopoint_statistic(sample, stat)[source]

Handle the TwoPoint statistic for the GaussFamily likelihood.

This puts the theory and data vectors in the data block.

Parameters:
Return type:

None

update_likelihood_and_tools(firecrown_params)[source]

Update the likelihood and tools with the new parameters.

Parameters:

firecrown_params (firecrown.parameters.ParamsMap) – the new parameters

Returns:

None

Return type:

None

firecrown.connector.cosmosis.likelihood.calculate_firecrown_params(sampling_sections, firecrown_module_name, sample)[source]

Calculate the ParamsMap for this sample.

Parameters:
  • sample (cosmosis.datablock) – the sample generated by the sampler

  • sampling_sections (list[str])

  • firecrown_module_name (str)

Returns:

a ParamsMap with the firecrown parameters

Return type:

firecrown.parameters.ParamsMap

firecrown.connector.cosmosis.likelihood.form_error_message(sampling_sections, exc)[source]

Form the error message that will be used to report a missing parameter.

This error message will also include when that parameter should have been supplied by the sampler.

Parameters:
Returns:

the error message

Return type:

str

firecrown.connector.cosmosis.likelihood.setup(config)[source]

Setup hook for a CosmoSIS module.

The returned object will be passed to the CosmoSIS execute hook.

Parameters:

config (cosmosis.datablock) – the datablock the configuration

Returns:

an instance of class FirecrownLikelihood

Return type:

FirecrownLikelihood

firecrown.connector.cosmosis.likelihood.execute(sample, instance)[source]

Execute hook for a CosmoSIS module.

Return 0 on success. The parameter sample represents the current MCMC sample; instance is the FirecrownLikelihood object created by setup.

Parameters:
  • sample (cosmosis.datablock) – the sample generated by the sampler

  • instance (FirecrownLikelihood) – the FirecrownLikelihood object

Returns:

the status of the call to the module’s execute function

Return type:

int

firecrown.connector.cosmosis.likelihood.cleanup(_)[source]

Cleanup hook for a CosmoSIS module. This one has nothing to do.

Returns:

0

Return type:

int