<commit_before>import sys
#import matplotlib.pyplot as plt
import numpy as np

from pysim.simulation import Sim
from pysim.cythonsystem import Sys

from collections import OrderedDict

class MySys(Sys):
    def __init__(self):
        self.add_state("x", "dx", 2)

    def do_step(self,time):
        print("x {}".format(self.statedict['x']))
        self.derdict['dx'][0] = self.statedict['x'][1]
        self.derdict['dx'][1] = 1.0



def main():
    """Test that the elapsed time is returned from the simulation"""
    sys = MySys()
    sim = Sim()

    sim.add_cython_system(sys,"Cython1")
    sim.simulate(20, 0.1)
    print("ending")


if __name__ == "__main__":
    sys.exit(int(main() or 0))<commit_msg>implementing prototype storage functionality<commit_after>import sys

import numpy as np

from pysim.simulation import Sim
from pysim.cythonsystem import Sys

from collections import OrderedDict

class VanDerPol(Sys):
    def __init__(self):
        self.add_state("x", "dx", 2)
        self.a = 1.0
        self.b = 1.0
        self.statedict['x'][0] = 1
        self.statedict['x'][1] = 0
        self.stores = {'x':[]}

    def do_step(self,time):
        a = self.a
        b = self.b
        x = self.statedict['x'][0]
        y = self.statedict['x'][1]

        self.derdict['dx'][0] = a*x*(b-y*y)-y
        self.derdict['dx'][1] = x

    def do_storestep(self,time):
        self.stores['x'].append(self.statedict['x'].copy())


def main():
    """Test that the elapsed time is returned from the simulation"""
    sys = VanDerPol()
    sim = Sim()

    sim.add_cython_system(sys,"Cython1")
    sim.simulate(20, 0.1)
    print("ending")
    res = np.array(sys.stores["x"])
    print(res)

    import matplotlib.pyplot as plt
    plt.plot(res[:,0])
    plt.plot(res[:,1])
    plt.show()

if __name__ == "__main__":
    sys.exit(int(main() or 0))
{'fraction_non_alphanumeric': 0.15851692638366469, 'fraction_numerical': 0.017732401934443847, 'mean_word_length': 2.9035639412997902, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1994044', 'n_tokens_mistral': 690, 'n_tokens_neox': 668, 'n_words': 153}