diff --git a/pydynamo/core/plot_system.py b/pydynamo/core/plot_system.py index 8786ecd6acbafe88b23d0299762aabd74ffd8cb3..253b37111bf8e3c7f8832fd96475888cc80b276e 100644 --- a/pydynamo/core/plot_system.py +++ b/pydynamo/core/plot_system.py @@ -3,6 +3,7 @@ from pyvis.network import Network import numpy as np def plot_system(s, v_names=None, rescale=False, com=True, filter_no=None, scales=None, colors=None, title='', linestyle='-'): + assert 'time' in dir(s), "Aucune simulation n'a été lancée pour le système !" if not v_names: v_names = s.get_vars() if isinstance(v_names, str): @@ -53,7 +54,8 @@ def show_pyvis(s, init_val=True, notebook=False, options=None, highlight=None, c return Gq -def plot_tabhl(s, name): +def plot_non_linearity(s, name): + assert 'time' in dir(s), "No simulation yet! Please run the system." x, y, ylabel, xlabel, title = s.get_tabhl_args(name) if x is not None and y is not None: plt.plot(x, y) @@ -62,6 +64,7 @@ def plot_tabhl(s, name): plt.title(title) def compare_systems(s1, s2, v_names, scales=None, rescale=False, *args, **kwargs): + assert 'time' in dir(s1) and 'time' in dir(s2), "No simulation yet! Please run the system." # remove tables v_names = [v for v in v_names if not isinstance(getattr(s1,v), list)] if not scales and rescale: diff --git a/pydynamo/core/system.py b/pydynamo/core/system.py index 2565b5802477ec1ffa8e41e4e29c5c65f2240d70..1db96216775a0838499ae6cdff0c1c1ca58576d9 100644 --- a/pydynamo/core/system.py +++ b/pydynamo/core/system.py @@ -124,7 +124,7 @@ class System: argop = self.eqs['update'][name]['args']['fun']['tabhl']['val'].strip() argop = re.sub('^\(|\)$', '',re.sub('\.[jk]', '', argop)).strip() xlabel = argop + ('\n'+ self.get_comment(argname) if argop==argname else '') - return x, f(x), ylabel, xlabel, f'tabhl_{name}' + return x, f(x), ylabel, xlabel, f"{name} non-linear function" def iter_all_eqs(self): return chain(*self.eqs.values())