[Pybrainsim-activity] SF.net SVN: pybrainsim:[6] trunk/src/Head.py
Status: Planning
Brought to you by:
rgoj
|
From: <rg...@us...> - 2009-07-17 12:23:37
|
Revision: 6
http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=6&view=rev
Author: rgoj
Date: 2009-07-17 12:23:35 +0000 (Fri, 17 Jul 2009)
Log Message:
-----------
* Adding a list of generator positions
* Each generator is added at position [0, 0, 0]
* A new method for running the head model, now only assigning the output of the generators to the registration sites (code moved here from runSimulation)
* Head.runHeadModel is run within Head.runSimulation
* A small correction to the comments to addRecordingSite
Modified Paths:
--------------
trunk/src/Head.py
Modified: trunk/src/Head.py
===================================================================
--- trunk/src/Head.py 2009-07-17 11:54:57 UTC (rev 5)
+++ trunk/src/Head.py 2009-07-17 12:23:35 UTC (rev 6)
@@ -28,6 +28,7 @@
def __init__(self):
self.samplingFrequency = 128;
self.generatorList = []
+ self.generatorSiteList = []
self.registrationSiteList = []
def setSamplingFrequency(self, samplingFrequency):
@@ -35,16 +36,27 @@
def addGenerator(self, generator):
self.generatorList.append(generator)
+ self.generatorSiteList.append([0, 0, 0])
def addRegistrationSite(self, position):
# We should be checking whether the position is within the boundaries of the brain, which need to be defined somewhere somehow.
# The class must somehow provide a means to accessing the size of the brain, the available positions, etc.
- # One interesting thing to do would be to implement a method returning a position for a name of a given brain region...
+ # One interesting thing to do would be to implement a method returning a position for a name of a given brain/scalp region...
self.registrationSiteList.append(position)
+ def runHeadModel(self, generatorOutput, recording):
+ # 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]
+
+ return recording
+
+
def runSimulation(self, duration=1):
"""Queries all generators and connections, sends the generators' output to the head model and then to the specified registration sites"""
-
+
# Preparing a variable to hold the recording for all registration sites
recording = []
for i in range(len(self.registrationSiteList)):
@@ -59,11 +71,7 @@
for timePoint in range(duration * self.samplingFrequency):
for i in range(len(self.generatorList)):
generatorOutput[i] = (self.generatorList[i]).runGenerator()
+
+ recording = self.runHeadModel(generatorOutput, recording)
- # Filling all registration sites with the generators' output
- for i in range(len(self.registrationSiteList)):
- recording[i].append(0)
- for klupek in range(len(self.generatorList)):
- recording[i][timePoint] += generatorOutput[klupek]
-
return recording
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|