Parameter

class ionworkspipeline.Parameter(name, initial_value=None, bounds=None, prior=None, normalize=None, check_bounds=None, check_initial_value=None)

Parameter object for use in data fits, stores the initial value and bounds

Inherits from pybamm.InputParameter for compatibility with PyBaMM models.

Parameters

namestr

The name of the parameter.

initial_valuefloat or int, optional

The initial value to be assigned to the parameter. If not provided and bounds are given, will be set to the mean of finite bounds. Defaults to 1 if no bounds are given.

boundstuple, optional

A tuple defining the lower and upper bounds for the parameter. Defaults to (-np.inf, np.inf).

normalizebool, optional

Whether to normalize the parameter by its initial value. Defaults to True.

Extends: pybamm.expression_tree.input_parameter.InputParameter

property bounds

Returns the corrected parameter bounds

create_copy()

Overwrite create_copy so that the fitting scale is incorporated

evaluate(*args, **kwargs)

Returns the scaled value of the parameter

get_bounds()

Returns the unmodified bounds

get_initial_value()

Returns the unmodified initial value

property initial_value

Returns the corrected initial value

property is_transformed

Returns whether the parameter represents a transformed variable.

Returns

bool

True if the parameter is a transformed variable (e.g., “Log10(Diffusion Coefficient)”) False if the parameter is in its original form (e.g., “Diffusion Coefficient”)

Examples

>>> param = Parameter("Diffusion Coefficient", 1e-9, (1e-10, 1e-8))
>>> param.is_transformed  # Returns False
>>> transformed_param = Log10(param)
>>> transformed_param.is_transformed  # Returns True
property normalized_bounds

Returns the normalized bounds

property normalized_initial_value

Returns the normalized initial value

property prior

Returns the prior

set_bounds(value, check_initial_value=True, check_bounds=True)

Sets the parameter bounds

set_fitting_scale()

Sets the fitting scale for the parameter

Parameters

normalizebool, optional

Whether to normalize the parameter by its initial value. Defaults to True.

set_prior(prior)

Sets the prior for the parameter

to_dict(name)

Convert the parameter to a dictionary for fitting.

This method is used by the DataFit class to process parameters for fitting. For a basic Parameter object, it simply returns a dictionary with one entry mapping the given name to this parameter object.

Parameters

namestr

The name to use for the parameter in the model. This may be different from the parameter’s internal name.

Returns

dict

A dictionary with a single entry mapping the given name to this parameter.