Params

The module contains a Parameter class to be used with the Model class.

class params.Parameters(params=None, **kwargs)

A parameter class that handles names, values and bounds.

Parameters:
  • params (dict of dict) – A dictionary of parameter names, each being associated with a namedtuple containing the ‘value’, the ‘bounds’, the ‘fixed’, and the ‘error’ attributes.
  • kwargs (keywords) – Additional keywords argument to set parameter names, values (and possibly bounds and fixed attributes). Can override params too.
listToParams(pList, errList=None)

Use the given list to convert a list of parameters to a dictionary similar to the current one.

loadParams(fileName)

Load parameters from a file in JSON format.

paramList

Accessor for parameter list.

set(name, **kwargs)

Set a parameter entry with given attributes in ‘kwargs’.

Parameters:
  • name (str) – Parameter name to be updated.
  • kwargs (dict of float, tuple or namedtuple) –

    Parameters to be updates with the associated attributes. The call should be of the form:

    >>> params.set('amplitude', value=1.2, fixed=True)
    >>> params.set('width', value=2.3, bounds=(0., np.inf))
    
update(**kwargs)

Update the parameters.

writeParams(fileName)

Write parameters to given file in JSON format.

params.pTuple(value=1, bounds=(-inf, inf), fixed=False, error=0.0)

Helper function to create a namedtuple with default values.