cosmosis_interface
File with tools to interface Cosmosis chains with GetDist.
- tensiometer.interfaces.cosmosis_interface.MCSamplesFromCosmosis(chain_root, chain_min_root=None, param_name_dict=None, 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.
chain_min_root – (optional) name of the file containing the explicit best fit.
param_name_dict – (optional) a dictionary with the mapping between cosmosis names and reasonable parameter names.
param_label_dict – (optional) dictionary with the mapping between parameter names and parameter labels, since Cosmosis does not save the labels in the chain.
name_tag – (optional) a string with the name tag for the chain.
settings – (optional) dictionary of analysis settings to override getdist defaults
- Returns:
The
MCSamples
instance
- tensiometer.interfaces.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.interfaces.cosmosis_interface.get_maximum_likelihood(dummy, max_posterior, chain_min_root, param_name_dict, param_label_dict)[source]
Import the maximum likelihood file for a Cosmosis run, if present.
- Parameters:
dummy – dummy argument for interfacing, not used in practice
chain_min_root – name of the minimum file or the folder that contains it.
param_name_dict – a dictionary with the mapping between cosmosis names and reasonable names.
param_label_dict – dictionary with the mapping between the parameter names and the labels.
- Returns:
BestFit
the best fit object.
- tensiometer.interfaces.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.interfaces.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.interfaces.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.interfaces.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.interfaces.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.