getdist.paramnames
- class getdist.paramnames.ParamInfo(line=None, name='', label='', comment='', derived=False, renames=None, number=None)[source]
Parameter information object.
- Variables:
name – the parameter name tag (no spacing or punctuation)
label – latex label (without enclosing $)
comment – any descriptive comment describing the parameter
isDerived – True if a derived parameter, False otherwise (e.g. for MCMC parameters)
- class getdist.paramnames.ParamList(fileName=None, setParamNameFile=None, default=0, names=None, labels=None)[source]
Holds an orders list of
ParamInfo
objects describing a set of parameters.- Variables:
names – list of
ParamInfo
objects- Parameters:
fileName – name of .paramnames file to load from
setParamNameFile – override specific parameter names’ labels using another file
default – set to int>0 to automatically generate that number of default names and labels (param1, p_{1}, etc.)
names – a list of name strings to use
- addDerived(name, **kwargs)[source]
adds a new parameter
- Parameters:
name – name tag for the new parameter
kwargs – other arguments for constructing the new
ParamInfo
- numberOfName(name)[source]
Gets the parameter number of the given parameter name
- Parameters:
name – parameter name tag
- Returns:
index of the parameter, or -1 if not found
- parWithName(name, error=False, renames=None)[source]
Gets the
ParamInfo
object for the parameter with the given name- Parameters:
name – name of the parameter
error – if True raise an error if parameter not found, otherwise return None
renames – a dictionary that is used to provide optional name mappings to the stored names
- parsWithNames(names, error=False, renames=None)[source]
gets the list of
ParamInfo
instances for given list of name strings. Also expands any names that are globs into list with matching parameter names- Parameters:
names – list of name strings
error – if True, raise an error if any name not found, otherwise returns None items. Can be a list of length len(names)
renames – optional dictionary giving mappings of parameter names
- class getdist.paramnames.ParamNames(fileName=None, setParamNameFile=None, default=0, names=None, labels=None)[source]
Holds an orders list of
ParamInfo
objects describing a set of parameters, inheriting fromParamList
.Can be constructed programmatically, and also loaded and saved to a .paramnames files, which is a plain text file giving the names and optional label and comment for each parameter, in order.
- Variables:
names – list of
ParamInfo
objects describing each parameterfilenameLoadedFrom – if loaded from file, the file name
- Parameters:
fileName – name of .paramnames file to load from
setParamNameFile – override specific parameter names’ labels using another file
default – set to int>0 to automatically generate that number of default names and labels (param1, p_{1}, etc.)
names – a list of name strings to use
- getdist.paramnames.makeList(roots)[source]
Checks if the given parameter is a list. If not, Creates a list with the parameter as an item in it.
- Parameters:
roots – The parameter to check
- Returns:
A list containing the parameter.
- getdist.paramnames.mergeRenames(*dicts, **kwargs)[source]
Joins several dicts of renames.
If keep_names_1st=True (default: False), keeps empty entries when possible in order to preserve the parameter names of the first input dictionary.
Returns a merged dictionary of renames, whose keys are chosen from the left-most input.