# Path: plugin.py
# class Plugin:
#     def __init__(self):
#         self.documents = Documents(self)
#         try: self.name
#         except: self.name = self.__class__.__name__.lower()
#         try: self.description
#         except: self.description = 'This plugin has no description.'
#         if self.__class__ is Plugin:
#             raise NotImplementedError
# 
#     @property
#     def user(self):
#         return app.current_user
# 
#     def process(self, request):
#         pass
# 
#     def unload(self):
#         pass


from numpy import *
from scipy.integrate import odeint
from plugin import Plugin
        return True


'''    
    def plot_data(self):
        for i in range(self.data_all.shape[0]):
            plt.plot(self.t_range, self.data_all[i, :], label='y' + str(i))

        if self.unstable is not None:
            plt.axvline(x=self.unstable, linewidth=3, color='r')
        plt.show()
    



def main():
    str_eqs ="""dy0dt = -10*y[0] + 10*y[1]
    dy1dt = 28*y[0] - y[1]-y[0]*y[2]
    dy2dt = -8/3 * y[2] + y[0] * y[1]"""
    str_init = """y0 = 10
    y1 = 5
    y2 = 1.01"""

    #str_eqs = """dy0dt = 3.8 * y[0] * (1 - y[0])"""
    #str_init = """y0= 0.5"""

    sim = bio_simulation(str_eqs, str_init)
    sim.run_sim()
    #print(repr(list(map(list, sim.data_all))))
    sim.plot_data()

# Path: plugin.py
# class Plugin:
#     def __init__(self):
#         self.documents = Documents(self)
#         try: self.name
#         except: self.name = self.__class__.__name__.lower()
#         try: self.description
#         except: self.description = 'This plugin has no description.'
#         if self.__class__ is Plugin:
#             raise NotImplementedError
# 
#     @property
#     def user(self):
#         return app.current_user
# 
#     def process(self, request):
#         pass
# 
#     def unload(self):
#         pass


# Path: plugins/simulation.py
from numpy import *
from scipy.integrate import odeint
from plugin import Plugin

        return True


'''    
    def plot_data(self):
        for i in range(self.data_all.shape[0]):
            plt.plot(self.t_range, self.data_all[i, :], label='y' + str(i))

        if self.unstable is not None:
            plt.axvline(x=self.unstable, linewidth=3, color='r')
        plt.show()
    



def main():
    str_eqs ="""dy0dt = -10*y[0] + 10*y[1]
    dy1dt = 28*y[0] - y[1]-y[0]*y[2]
    dy2dt = -8/3 * y[2] + y[0] * y[1]"""
    str_init = """y0 = 10
    y1 = 5
    y2 = 1.01"""

    #str_eqs = """dy0dt = 3.8 * y[0] * (1 - y[0])"""
    #str_init = """y0= 0.5"""

    sim = bio_simulation(str_eqs, str_init)
    sim.run_sim()
    #print(repr(list(map(list, sim.data_all))))
    sim.plot_data()

if __name__ in ("plugins.simulation", '__main__'):