def test_dessin(): s = Systeme.exemple_bistable() fig, ax = plt.subplots() s.dessin(ax) p, l1, l2, *_ = ax.get_children() assert isinstance(l1, Line2D) assert isinstance(l2, Line2D) assert isinstance(p, PathCollection)
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2019 perrollaz <perrollaz@vincent-MacBookPro> # # Distributed under terms of the MIT license. """ Exemple d'utilisation du module. Cas avec boite invariante. """ import sys sys.path.append("..") import matplotlib.pyplot as plt from hjb.cartographie import Valeur from hjb.systeme import Systeme import hjb.affichage as aff s = Systeme(a=1, b=2, c=2, d=1, M=1, alpha=0.4, beta=0.4, bx=1, by=1) v = Valeur.from_dl(sys=s, T=50, dl=0.02) v.resolution() fc = aff.affichage_contour(v, im=10, num=21) plt.show()
def s(): s = Systeme(a=1, b=1, c=1, d=1, bx=1, by=1, alpha=1, beta=1, M=1) return s
def test_exemple(): s1 = Systeme.exemple_simple() assert not s1.verifications() s2 = Systeme.exemple_bistable() assert s2.verifications()
def test_coexistence(): f2 = Systeme(a=1, b=2, c=2, d=1, bx=1, by=1, alpha=1, beta=1, M=2) x, y = f2.etat_coexistence() assert (x == 1 / 3) and (y == 1 / 3)
def test_verification(s1): assert not s1.verifications() f2 = Systeme(a=1, b=2, c=2, d=1, bx=1, by=1, alpha=1, beta=1, M=2) assert f2.verifications()
def test_bistabilitite(s1): assert not s1._regime_bistable() f2 = Systeme(a=1, b=2, c=2, d=1, bx=1, by=1, alpha=1, beta=1, M=2) assert f2._regime_bistable()
def test_parametres_valides(s1): assert s1._parametres_positifs() f2 = Systeme(a=-1, b=1, c=1, d=1, bx=1, by=1, alpha=1, beta=1, M=2) assert not f2._parametres_positifs()
def s1(): return Systeme(a=1, b=1, c=1, d=1, bx=1, by=1, alpha=1, beta=1, M=2)
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2019 perrollaz <perrollaz@vincent-MacBookPro> # # Distributed under terms of the MIT license. """ Exemple d'utilisation du module. Cas "intéressant" pas de boite invariante. """ import sys sys.path.append("..") import matplotlib.pyplot as plt from hjb.cartographie import Valeur from hjb.systeme import Systeme import hjb.affichage as aff s = Systeme(a=1, b=2, c=2, d=1, M=1, alpha=6 / 8, beta=5 / 8, bx=1, by=1) v = Valeur.from_dl(sys=s, T=50, dl=0.02) v.resolution() fc = aff.affichage_contour(v, im=10, num=21) plt.show()