mtnlion.deprecated_engine module

Equation solver.

class mtnlion.deprecated_engine.Mountain(mesh: numpy.ndarray, time_mesh: numpy.ndarray, boundaries: Union[numpy.ndarray, List[float]], **kwargs)[source]

Bases: object

Container for holding n-variable n-dimensional data in space and time.

filter(index: List, func: Callable = <function Mountain.<lambda>>) → Dict[str, numpy.ndarray][source]

Filter through dictionary to collect sections of the contained ndarrays.

Parameters
  • index – subset of arrays to collect

  • func – function to call on every variable in data

Returns

dictionary of reduced arrays

filter_space(index: List, func: Callable = <function Mountain.<lambda>>) → mtnlion.deprecated_engine.Mountain[source]

Filter the Mountain for a subset of space indices.

For example::

solution.filter_time([slice(0,5), 4]) # for 2D space solution.filter_time([0, 3, 5]) solution.filter_time(slice(step=-1))

will return the solutions from in space where x=[0, 5] and y=5, and x=[0, 3, 5], even reverse the first dimension respectively. :param index: indices or slices of space to retrieve :param func: function to call on every variable in data :return: space filtered Mountain

filter_time(index: List, func: Callable = <function Mountain.<lambda>>) → mtnlion.deprecated_engine.Mountain[source]

Filter the Mountain for a subset of time indices.

For example::

solution.filter_time(slice(0,5)) solution.filter_time([0, 3, 5]) solution.filter_time(slice(step=-1)) solution.filter_time(numpy.where(solution.time_mesh == time) # time could be [1, 2, 3] seconds

will return the solutions from time index [0, 4], [0, 3, 5], reverse time, and fetch specific times respectively. :param index: indices or slices of time to retrieve :param func: function to call on every variable in data :return: time filtered Mountain

classmethod from_dict(data: Dict[str, numpy.ndarray]) → mtnlion.deprecated_engine.Mountain[source]

Convert dictionary to SolutionData.

Parameters

data – dictionary of formatted data

Returns

consolidated simulation data

to_dict() → Dict[str, numpy.ndarray][source]

Retrieve dictionary of Mountain to serialize.

Returns

data dictionary

mtnlion.deprecated_engine.fetch_params(filename: str) → Union[Dict[str, Dict[str, float]], None, munch.DefaultMunch][source]

TODO: read template from config file.

mtnlion.deprecated_engine.find_ind(data: numpy.ndarray, value: Union[List[int], List[float]]) → numpy.ndarray[source]

Find the indices of the values given in the data.

Parameters
  • data – data to find indices in

  • value – values to find indices with

Returns

indices of value in data

mtnlion.deprecated_engine.find_ind_near(data: numpy.ndarray, value: Union[List[int], List[float]]) → numpy.ndarray[source]

Find the indices of the closest values given in the data.

Parameters
  • data – data to find indices in

  • value – values to find indices with

Returns

indices of value in data

mtnlion.deprecated_engine.rmse(estimated: numpy.ndarray, true: numpy.ndarray) → Optional[numpy.ndarray][source]

Calculate the root-mean-squared error between two arrays.

Parameters
  • estimated – estimated solution

  • true – ‘true’ solution

Returns

root-mean-squared error