Skip to content

flowdyn.monitors

module monitors

This module implements generic monotoring of iterative integration. Specific implementation is done in flowdyn.integration. A monitor directive is passed to *.solve integration as a dictionary with its own parameters. A monitor class is returned with 'output' key.

Examples:

$ python example_google.py

Classes

monitor

Source code in flowdyn/monitors.py
class monitor():
    """ """
    def __init__(self, name):
        self._name = name
        self.reset()

    def name(self):
        """get monitor name"""
        return self._name

    def reset(self):
        self._it = []
        self._time = []
        self._value = []

    def append(self, it, time, value):
        """add it, time, value to monitor

        Args:
          it: 
          time: 
          value: 

        Returns:

        """
        self._it.append(it)
        self._time.append(time)
        self._value.append(value)

    def lastratio(self):
        return self._value[-1]/self._value[0]

    def plot_it(self, ax=plt, **kwargs):
        ax.plot(self._it, self._value, **kwargs)

    def plot_time(self, ax=plt, **kwargs):
        ax.plot(self._time, self._value, **kwargs)

    def semilogplot_it(self, ax=plt, **kwargs):
        ax.semilogy(self._it, self._value, **kwargs)

    def semilogplot_time(self, ax=plt, **kwargs):
        ax.semilogy(self._time, self._value, **kwargs)

Methods

append(self, it, time, value)

add it, time, value to monitor

Parameters:

Name Type Description Default
it required
time required
value required
Source code in flowdyn/monitors.py
def append(self, it, time, value):
    """add it, time, value to monitor

    Args:
      it: 
      time: 
      value: 

    Returns:

    """
    self._it.append(it)
    self._time.append(time)
    self._value.append(value)
name(self)

get monitor name

Source code in flowdyn/monitors.py
def name(self):
    """get monitor name"""
    return self._name