[Pybrainsim-activity] SF.net SVN: pybrainsim:[136] trunk/src/PyBrainSim.py
Status: Planning
Brought to you by:
rgoj
From: <rg...@us...> - 2009-09-14 00:50:56
|
Revision: 136 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=136&view=rev Author: rgoj Date: 2009-09-14 00:50:41 +0000 (Mon, 14 Sep 2009) Log Message: ----------- * Simulations that presented their output via stdandard output, now print to the output log window. * Removed simulation progress information from the neural mass simulation, because somehow it just won't get displayed in the log window... Modified Paths: -------------- trunk/src/PyBrainSim.py Modified: trunk/src/PyBrainSim.py =================================================================== --- trunk/src/PyBrainSim.py 2009-09-14 00:48:51 UTC (rev 135) +++ trunk/src/PyBrainSim.py 2009-09-14 00:50:41 UTC (rev 136) @@ -49,9 +49,10 @@ class PyBrainSimGUI(wx.App): def OnInit(self): - self.res = xrc.XmlResource("PyBrainSimGUI.xrc") + self.res1 = xrc.XmlResource("PyBrainSimGUI1.xrc") + self.res2 = xrc.XmlResource("PyBrainSimGUI2.xrc") - self.frame = self.res.LoadFrame(None, "menuFrame") + self.frame = self.res1.LoadFrame(None, "menuFrame") self.frame.Bind(wx.EVT_BUTTON, self.menuButton1, id=xrc.XRCID("menuButton1")) self.frame.Bind(wx.EVT_BUTTON, self.menuButton2, id=xrc.XRCID("menuButton2")) self.frame.Bind(wx.EVT_BUTTON, self.menuButton3, id=xrc.XRCID("menuButton3")) @@ -62,6 +63,10 @@ self.frame.Bind(wx.EVT_BUTTON, self.menuButton8, id=xrc.XRCID("menuButton8")) self.frame.Bind(wx.EVT_BUTTON, self.menuButtonQuit, id=xrc.XRCID("menuButtonQuit")) self.frame.Show() + + self.logWindow = self.res2.LoadFrame(None, "outputWindow") + self.log = xrc.XRCCTRL(self.logWindow, "outputLog") + return True def menuButton1(self, control): @@ -75,8 +80,9 @@ exampleConnection = ConnectionDummy('Con', exampleHead, exampleStimulus, exampleGenerator) exampleExperiment = Experiment(exampleHead.getSamplingFrequency(), 1.0, exampleHead.runSimulation( 1.0 )) - print("\nSimulations resulted in the following recording:") - print(exampleExperiment.getRecording()) + output = str(exampleExperiment.getRecording()) + self.log.SetValue(output) + self.logWindow.Show() def menuButton2(self, control): exampleHead = Head() @@ -90,8 +96,9 @@ exampleConnection = Connection('Con', exampleHead, exampleStimulus, exampleGenerator) exampleExperiment = Experiment(exampleHead.getSamplingFrequency(), 1.0, exampleHead.runSimulation( 1.0 )) - print("\nSimulations resulted in the following recording:") - print exampleExperiment.getRecording() + output = str(exampleExperiment.getRecording()) + self.log.SetValue(output) + self.logWindow.Show() def menuButton3(self, control): exampleHead = Head() @@ -113,8 +120,9 @@ exampleConnection2 = Connection('Con2', exampleHead, exampleStimulus2, exampleGenerator2) exampleExperiment.setRecording(exampleHead.runSimulation(exampleExperiment.getDuration())) - print("\nSimulations resulted in the following recording:") - print exampleExperiment.getRecording() + output = str(exampleExperiment.getRecording()) + self.log.SetValue(output) + self.logWindow.Show() def menuButton4(self, control): exampleHead = Head() @@ -126,14 +134,11 @@ exampleExperiment.setStimulusTimes([[0.3, 1.75, 2.16, 3.87, 4.31, 5.183, 6.34, 7.13]]) exampleStimulus = Stimulus('Stim', exampleHead) - print exampleExperiment.getStimulusTimes()[0] exampleStimulus.setStimulusTimes(exampleExperiment.getStimulusTimes()[0]) exampleGenerator = GeneratorSine('Gen', exampleHead) exampleConnection = Connection('Con', exampleHead, exampleStimulus, exampleGenerator) exampleExperiment.setRecording(exampleHead.runSimulation(exampleExperiment.getDuration())) - print("\nSimulations resulted in the following recording:") - print exampleExperiment.getRecording() exampleExperiment.plotRecording() def menuButton5(self, control): @@ -230,7 +235,6 @@ cC3=0.25*cC1 cC4=0.25*cC1 noise = noiseObject.getNoise(t) - #print("Time: " + str(t) + " Noise: " + str(noise)) return [y[1], cA*ca*( sigmoidFunction(y[2] - y[4]) ) - 2*ca*y[1] - ca**2*y[0], y[3], cA*ca*( noise + cC2*sigmoidFunction(cC1*y[0]) ) - 2*ca*y[3] - ca**2*y[2], y[5], cB*cb*( cC4*sigmoidFunction(cC3*y[0]) @@ -251,7 +255,7 @@ r = [] recording = [ [], [], [], [], [], [] ] parameter = [ 68, 128, 135, 270, 675, 1350 ] - + # Differential equation integration for i in range(len(parameter)): # Preparing the integration @@ -259,7 +263,6 @@ r[i].set_initial_value(y0, t0) r[i].set_f_params( someNoise, parameter[i] ) # Integrating - print("Performing simulation " + str(i+1) + "/" + str(len(parameter))) while r[i].successful() and r[i].t < timeSpan: r[i].integrate(r[i].t+dtime) recording[i].append(r[i].y[2] - r[i].y[4]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |