Parameter#

class Parameter#

Bases: FieldQuantity

Represent a physical material parameter, e.g. the exchange stiffness.

__init__(impl)#

Initialize a python Parameter from a C++ Parameter instance.

Parameters should only have to be initialized within the mumax⁺ module and not by the end user.

property is_uniform: bool#

Return True if a Parameter instance is uniform, otherwise False.

See also

uniform_value

property is_dynamic: bool#

Return True if a Parameter instance has time dependent terms.

property uniform_value: float#

Return the uniform value of the Parameter instance if it exists.

See also

is_uniform

add_time_term(term, mask=None)#

Add a time-dependent term.

If mask is None, then the value of the time-dependent term will be the same for every grid cell and the final parameter value will be:

  • uniform_value + term(t)

  • cell_value + term(t)

where t is a time value in seconds. If mask is not None, then the value of the time-dependent term will be multiplied by the mask values and the parameter instance will be estimated as:

  • uniform_value + term(t) * mask

  • cell_value + term(t) * cell_mask_value

Parameter can have multiple time-dependent terms. All their values will be weighted by their mask values and summed, prior to being added to the static parameter value.

Parameters:
  • term (callable) – Time-dependent function that will be added to the static parameter values. Possible signatures are (float)→float and (float)→tuple(float).

  • mask (ndarray or callable, optional) – A numpy array, or a callable function taking coordinates x, y and z as arguments, defining how the magnitude of the time-dependent function should be weighted depending on the cell coordinates. For example, it can be an array of 0s and 1s. The number of components of the Parameter instance and the shape of mask should conform.

remove_time_terms()#

Remove all time dependent terms.

set(value)#

Set the parameter value.

Use a single float to set a uniform scalar parameter or a tuple of three floats for a uniform vector parameter.

To set the values of an inhomogeneous parameter, use a numpy array or a function which returns the parameter value as a function of the position, i.e.

(x: float, y: float, z: float) → float or
(x: float, y: float, z: float) → sequence[float] of size 3.

To assign time-dependant terms using this method use either a single-argument function, i.e. (float t) → float or (t: float) → sequence[float] of size 3; or a tuple of size two consisting of a time-dependent term as its first entry and the mask of the function as its second entry, i.e. ((float t) → float, numpy.ndarray) or ((float t) → [float], numpy.ndarray).

Parameters:

value (float, tuple of floats, numpy array, or callable) – The new value for the parameter.

set_in_region(region_idx, value)#

Set a uniform, static value in a specified region.