<commit_before>from Reaction import *


class Simulator:
	def __init__(self,crn):
		self.crn = crn
		self.simulationData = dict()
		self.crn.prepare()

		for chemical_name in self.crn.concentrations:
			self.simulationData[chemical_name] = []

	def addInSimulationData(self,concentrations):
		for chemical_name in concentrations:
			self.simulationData[chemical_name].append(concentrations[chemical_name])

	def simulate(self,timeSteps):
		print self.crn.concentrations
		self.addInSimulationData(self.crn.concentrations)
		for i in range(timeSteps):
			reaction = self.crn.getFastestReaction()
			if reaction != None:
				self.crn.doReaction(reaction)
			self.addInSimulationData(self.crn.concentrations)
			print self.crn.concentrations

		#for chemical_name in self.simulationData:
		#	print chemical_name,'-> ',self.simulationData[chemical_name]<commit_msg>Add plot method<commit_after>from Reaction import *
import matplotlib.pyplot as plt


class Simulator:
	def __init__(self,crn):
		self.crn = crn
		self.simulationData = dict()
		self.crn.prepare()

		for chemical_name in self.crn.concentrations:
			self.simulationData[chemical_name] = []

	def addInSimulationData(self,concentrations):
		for chemical_name in concentrations:
			self.simulationData[chemical_name].append(concentrations[chemical_name])

	def simulate(self,timeSteps):
		#print self.crn.concentrations
		self.addInSimulationData(self.crn.concentrations)
		for i in range(timeSteps):
			reaction = self.crn.getFastestReaction()
			if reaction != None:
				self.crn.doReaction(reaction)
			self.addInSimulationData(self.crn.concentrations)
			#print self.crn.concentrations

	def plot(self,listOfChemicals):
		for chemical in listOfChemicals:
			plt.plot(self.simulationData[chemical],label=chemical)
		plt.ylabel('Concentration')
		plt.xlabel('Time (unit time)')
		plt.legend()
		plt.show()

{'fraction_non_alphanumeric': 0.1045016077170418, 'fraction_numerical': 0.0, 'mean_word_length': 5.3720136518771335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '168915', 'n_tokens_mistral': 733, 'n_tokens_neox': 625, 'n_words': 109}