firecrown.updatable.Updatable

class firecrown.updatable.Updatable[source]

Bases: ABC

Abstract class Updatable is the base class for Updatable objects in Firecrown.

Any class in Firecrown that supports updating from a ParamsMap should inherit. Such classes are expected to change state only in through their implementation of _update (including any other private methods used to implement _update). Other functions should not change the data of Updatable objects.

Public Methods:

__init__()

Updatable initialization.

__setattr__(key, value)

Set the attribute named key to the supplied value.

set_internal_parameter(key, value)

Assure this InternalParameter has not already been set, and then set it.

set_sampler_parameter(key, value)

Assure this SamplerParameter has not already been set, and then set it.

update(params)

Update self by calling the abstract _update() method.

reset()

Reset self by calling the abstract _reset() method, and mark as reset.

required_parameters()

Return a RequiredParameters object containing the information for all parameters defined in the implementing class, any additional parameter

get_derived_parameters()

Returns a collection of derived parameters once per iteration of the statistical analysis.

Private Methods:

_update(params)

Abstract method to be implemented by all concrete classes to update self.

_reset()

Abstract method to be implemented by all concrete classes to update self.

_required_parameters()

Return a RequiredParameters object containing the information for this Updatable.

_get_derived_parameters()

Abstract method to be implemented by all concrete classes to return their derived parameters.


__setattr__(key, value)[source]

Set the attribute named key to the supplied value.

Note that there is special handling for two types: SamplerParameter and InternalParameter

Parameters
  • key (str) –

  • value (Any) –

Return type

None

abstract _get_derived_parameters()[source]

Abstract method to be implemented by all concrete classes to return their derived parameters.

Concrete classes must override this. If no derived parameters are required derived classes must simply return super()._get_derived_parameters().

Return type

DerivedParameterCollection

abstract _required_parameters()[source]

Return a RequiredParameters object containing the information for this Updatable. This method must be overridden by concrete classes.

The base class implementation returns a list with all SamplerParameter objects properties.

Return type

RequiredParameters

abstract _reset()[source]

Abstract method to be implemented by all concrete classes to update self.

Concrete classes must override this, resetting themselves.

The base class implementation does nothing.

Return type

None

abstract _update(params)[source]

Abstract method to be implemented by all concrete classes to update self.

Concrete classes must override this, updating themselves from the given ParamsMap. If the supplied ParamsMap is lacking a required parameter, an implementation should raise a TypeError.

The base class implementation does nothing.

Parameters

params (ParamsMap) – a new set of parameter values

Return type

None

final get_derived_parameters()[source]

Returns a collection of derived parameters once per iteration of the statistical analysis. First call returns the DerivedParameterCollection, further calls return None.

Return type

Optional[DerivedParameterCollection]

final required_parameters()[source]

Return a RequiredParameters object containing the information for all parameters defined in the implementing class, any additional parameter

Return type

RequiredParameters

final reset()[source]

Reset self by calling the abstract _reset() method, and mark as reset.

set_internal_parameter(key, value)[source]

Assure this InternalParameter has not already been set, and then set it.

Parameters
Return type

None

set_sampler_parameter(key, value)[source]

Assure this SamplerParameter has not already been set, and then set it.

Parameters
Return type

None

final update(params)[source]

Update self by calling the abstract _update() method.

Parameters

params (ParamsMap) – new parameter values