tensiometer.cosmosis_interface

File with tools to interface Cosmosis chains with GetDist.

tensiometer.cosmosis_interface.MCSamplesFromCosmosis(chain_root, param_label_dict=None, name_tag=None, settings=None)[source]

Function to import Cosmosis chains in GetDist.

Parameters:
  • chain_root – the name and path to the chain or the path to the folder that contains it.
  • param_label_dict – dictionary with the mapping between parameter names and parameter labels, since Cosmosis does not save the labels in the chain.
  • name_tag – a string with the name tag for the chain.
  • settings – dictionary of analysis settings to override defaults
Returns:

The MCSamples instance

tensiometer.cosmosis_interface.get_cosmosis_info(file)[source]

Parse a file to get all the information about a Cosmosis run.

Parameters:file – path and name of the file to parse.
Returns:a list of strings with the cosmosis parameters for the run.
tensiometer.cosmosis_interface.get_maximum_likelihood(chain_root, param_label_dict)[source]

Import the maximum likelihood file for a Cosmosis run, if present.

Parameters:
  • chain_root – name of the chain file or the folder that contains it.
  • param_label_dict – dictionary with the mapping between the parameter names and the labels.
Returns:

BestFit the best fit object.

tensiometer.cosmosis_interface.get_name_tag(info)[source]

Get the name tag for a chain given the a list of strings containing the cosmosis run parameter informations.

Parameters:info – a list of strings with the cosmosis parameters for the run.
Returns:a string with the name tag if any, otherwise returns none.
tensiometer.cosmosis_interface.get_param_labels(info, param_names, param_label_dict)[source]

Get the labels for the parameter names of a Cosmosis run.

Parameters:
  • info – a list of strings with the cosmosis parameters for the run.
  • param_names – a list of strings with the parameter names.
  • param_label_dict – a dictionary with the mapping between names and labels.
Returns:

a list of strings with the parameter labels.

tensiometer.cosmosis_interface.get_param_names(info)[source]

Get the parameter names for a Cosmosis run.

Parameters:info – a list of strings with the cosmosis parameters for the run.
Returns:a list of strings with the parameter names.
tensiometer.cosmosis_interface.get_ranges(info, param_names)[source]

Get the ranges for the parameters from the info file.

Parameters:
  • info – a list of strings with the cosmosis parameters for the run.
  • param_names – a list with the parameter names.
Returns:

a dictionary with the parameter ranges.

tensiometer.cosmosis_interface.get_sampler_type(info)[source]

Get the sampler type for a chain given the a list of strings containing the cosmosis run parameter informations. To process the sampler type the function defines internally a dictionary with the mapping from sampler name to sampler type.

Parameters:info – a list of strings with the cosmosis parameters for the run.
Returns:a string with the sampler type if any, otherwise returns none.
tensiometer.cosmosis_interface.polish_samples(chain)[source]

Remove fixed parameters and samples with some parameter that is Nan from the input chain.

Parameters:chainMCSamples the input chain.
Returns:MCSamples the polished chain.