lib.parameter.Parameter

class lib.parameter.Parameter(name, value=None, fixed=None, prior=None, ref=None, proposal=None, latex=None)

Bases: lib.utils.BaseClass

Class that represents a parameter.

name

Parameter name.

Type

ParamName

value

Default value for parameter.

Type

float

fixed

Whether parameter is fixed.

Type

bool

prior

Prior distribution.

Type

Prior

ref

Reference distribution. This is supposed to represent the expected posterior for this parameter.

Type

Prior

proposal

Proposal uncertainty.

Type

float

latex

Latex for parameter.

Type

string, default=None

Initialize Parameter.

Parameters
  • name (tuple, list, string, ParamName, Parameter) – If Parameter, update self attributes. Else, arguments to initialize parameter name, see ParamName.

  • value (float, default=False) – Default value for parameter.

  • fixed (bool, default=None) – Whether parameter is fixed. If None, defaults to True if prior or ref is not None, else False.

  • prior (Prior, dict, default=None) – Prior distribution for parameter, arguments for Prior.

  • ref (Prior, dict, default=None) – Reference distribution for parameter, arguments for Prior. This is supposed to represent the expected posterior for this parameter. If None, defaults to prior.

  • proposal (float, default=None) – Proposal uncertainty for parameter. If None, defaults to scale (or half of limiting range) of ref.

  • latex (string, default=None) – Latex for parameter.

Methods

add_suffix

Add suffix to parameter:

copy

Return shallow copy of self.

deepcopy

from_state

Instantiate and initalize class with state dictionary.

get_label

If latex is specified (i.e.

is_mpi_broadcast

is_mpi_gathered

is_mpi_root

is_mpi_scattered

load

Load class in numpy binary format from disk.

load_auto

If different formats are possible, this method should between them based on file name extension.

log_critical

log_debug

log_error

log_info

log_warning

save

Save class to disk.

save_auto

If different formats are possible, this method should between them based on file name extension.

update

Update parameter attributes with new arguments kwargs.

Attributes

limits

Parameter limits.

logger

mpiattrs

MPI attributes

mpicomm

mpiroot

mpistate

varied

Whether parameter is varied (i.e.

add_suffix(suffix)

Add suffix to parameter:

copy()

Return shallow copy of self.

classmethod from_state(state, mpiroot=0, mpicomm=None)

Instantiate and initalize class with state dictionary.

get_label()

If latex is specified (i.e. not None), return latex surrounded by ‘$’ signs, else None.

property limits

Parameter limits.

classmethod load(filename, mpiroot=0, mpicomm=None)

Load class in numpy binary format from disk. If the loaded state contains __class__ and that exists in cls._registry, return instance of cls._registry[__class__] (instead of cls).

load_auto(*args, **kwargs)

If different formats are possible, this method should between them based on file name extension.

property mpiattrs

MPI attributes

save(filename)

Save class to disk.

save_auto(*args, **kwargs)

If different formats are possible, this method should between them based on file name extension.

update(**kwargs)

Update parameter attributes with new arguments kwargs.

property varied

Whether parameter is varied (i.e. not fixed).