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.

Example:

    $ python example_google.py

Classes

monitor

Source code in flowdyn/monitors.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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)

Functions

append(it, time, value)

add it, time, value to monitor

Parameters:

Name Type Description Default
it
required
time
required
value
required

Returns:

Source code in flowdyn/monitors.py
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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()

get monitor name

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