[Pybrainsim-activity] SF.net SVN: pybrainsim:[102] trunk/src
Status: Planning
Brought to you by:
rgoj
From: <rg...@us...> - 2009-08-13 11:55:42
|
Revision: 102 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=102&view=rev Author: rgoj Date: 2009-08-13 11:55:33 +0000 (Thu, 13 Aug 2009) Log Message: ----------- * Adding a checkPosition function in the HeadModel * Using the new function in the PyBrainSim scripts * Correcting comments Modified Paths: -------------- trunk/src/Head.py trunk/src/HeadModel.py Modified: trunk/src/Head.py =================================================================== --- trunk/src/Head.py 2009-08-13 09:14:46 UTC (rev 101) +++ trunk/src/Head.py 2009-08-13 11:55:33 UTC (rev 102) @@ -40,21 +40,22 @@ def getSamplingFrequency(self): return self.samplingFrequency - def addGenerator(self, generator): + def addGenerator(self, generator, position = [0,0,0]): + if self.headModel.checkPosition(position): + self.generatorSiteList.append(position) + else: + print("Wrong position of generator!") self.generatorList.append(generator) - self.generatorSiteList.append([0, 0, 0]) + self.generatorSiteList.append(position) def addConnection(self, connection): self.connectionList.append(connection) 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/scalp region... - self.registrationSiteList.append(position) + if self.headModel.checkPosition(position): + self.registrationSiteList.append(position) + else: + print("Wrong position of registration site!") def setHeadModel(self, headModel): self.headModel = headModel Modified: trunk/src/HeadModel.py =================================================================== --- trunk/src/HeadModel.py 2009-08-13 09:14:46 UTC (rev 101) +++ trunk/src/HeadModel.py 2009-08-13 11:55:33 UTC (rev 102) @@ -26,14 +26,16 @@ class HeadModel: def __init__(self, head): head.setHeadModel(self) + + def checkPosition(self,position): + return position == [0,0,0] def runHeadModel(self, generatorOutput, recording): # Filling all registration sites with the generators' output for i in range(len(recording)): recording[i].append(0) for j in range(len(generatorOutput)): - # The Stimulus class may return a string variable, we can't add - # it to the recording, so we need to look out for it. + # Rejecting generator output that isn't a number if isinstance(generatorOutput[j], str): recording[i][-1] += 0 else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |