getdist.paramnames

class getdist.paramnames.ParamInfo(line=None, name='', label='', comment='', derived=False, 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
list()[source]

Gets a list of parameter name strings

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={})[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={})[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
  • renames – optional dictionary giving mappings of parameter names
saveAsText(filename)[source]

Saves to a plain text .paramnames file

Parameters:filename – filename to save to
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 from ParamList.

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 parameter
  • filenameLoadedFrom – 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
loadFromFile(fileName)[source]

loads from fileName, a plain text .paramnames file