[Pybrainsim-activity] SF.net SVN: pybrainsim:[69] trunk/src/Head.py
Status: Planning
Brought to you by:
rgoj
From: <rg...@us...> - 2009-08-03 17:04:16
|
Revision: 69 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=69&view=rev Author: rgoj Date: 2009-08-03 17:04:08 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Correcting mistake: If the stimulus returns a word as it's activation, this should not be counted into the general activation * Using Numeric.arange to provide the range of time points * Time points now begin at 1/samplingFrequency and the last point is the end time specified when invoking runSimulation Modified Paths: -------------- trunk/src/Head.py Modified: trunk/src/Head.py =================================================================== --- trunk/src/Head.py 2009-08-03 17:00:55 UTC (rev 68) +++ trunk/src/Head.py 2009-08-03 17:04:08 UTC (rev 69) @@ -15,6 +15,7 @@ # PyBrainSim. If not, see <http://www.gnu.org/licenses/>. from __future__ import division +from Numeric import arange __metaclass__ = type # New style classes. Is this necessary? """ @@ -57,8 +58,13 @@ # Filling all registration sites with the generators' output for i in range(len(recording)): recording[i].append(0) - for klupek in range(len(self.generatorList)): - recording[i][-1] += generatorOutput[klupek] + for j in range(len(self.generatorList)): + # The Stimulus class may return a string variable, we can't add + # it to the recording, so we need to look out for it. + if isinstance(generatorOutput[j], str): + recording[i][-1] += 0 + else: + recording[i][-1] += generatorOutput[j] return recording @@ -79,12 +85,14 @@ # Querying all generators and sending generator output through # connections - for timePoint in range(duration * self.samplingFrequency): - print("HEAD, time: " + str(timePoint/self.samplingFrequency)) + timeStep = 1/self.samplingFrequency + timeRange = list(arange(timeStep, duration + timeStep, timeStep)) + for timePoint in timeRange: + print("HEAD, time: " + str(timePoint)) # Recording the output of each generator for i in range(len(self.generatorList)): - generatorOutput[i] = (self.generatorList[i]).runGenerator(timePoint/self.samplingFrequency) + generatorOutput[i] = (self.generatorList[i]).runGenerator(timePoint) # Sending the output of generators through connections for i in range(len(self.connectionList)): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |