Built-in field models

class midas.models.PiecewiseLinearField(field_name, axis, axis_name)

Models a chosen field as a piecewise-linear 1D profile.

Parameters:
  • field_name (str) – The name of the field to be modelled.

  • axis (ndarray) – Coordinate values specifying the locations of the basis functions which make up the 1D profile. The number of free parameters of the field model will be equal to the size of axis. The coordinate values must be given in strictly ascending order.

  • axis_name (str) – The name of the coordinate over which the 1D profile is defined.

class midas.models.FieldModel

An abstract base-class for field models.

abstractmethod get_values(parameters, field)

Get the values of the field at a set of given coordinates.

Parameters:
  • parameters (dict[str, ndarray]) – The parameter values requested via the ParameterVector objects stored in the parameters instance attribute. These values are given as a dictionary mapping the parameter names (specified by the name attribute of the ParameterVector objects) to the parameter values as 1D arrays.

  • field (FieldRequest) – A FieldRequest specifying the coordinates at which the modelled field values should be calculated.

Returns:

The modelled field values as a 1D array.

Return type:

ndarray

abstractmethod get_values_and_jacobian(parameters, field)

Get the values of the field at a set of given coordinates, and the Jacobian of those fields values with respect to the given parameters values.

Parameters:
  • parameters (dict[str, ndarray]) – The parameter values requested via the ParameterVector objects stored in the parameters instance attribute. These values are given as a dictionary mapping the parameter names (specified by the name attribute of the ParameterVector objects) to the parameter values as 1D arrays.

  • field (FieldRequest) – A FieldRequest specifying the coordinates at which the modelled field values should be calculated.

Returns:

The field values as a 1D array, followed by the Jacobians of the field values with respect to the given parameter values.

The Jacobians must be returned as a dictionary mapping the parameter names to the corresponding Jacobians as 2D arrays.

Return type:

tuple[ndarray, dict[str, ndarray]]