[Pybrainsim-activity] SF.net SVN: pybrainsim:[27] trunk/src/GeneratorStimulusPhaseReset.py
Status: Planning
Brought to you by:
rgoj
From: <rg...@us...> - 2009-07-29 14:43:39
|
Revision: 27 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=27&view=rev Author: rgoj Date: 2009-07-29 14:43:30 +0000 (Wed, 29 Jul 2009) Log Message: ----------- * adding a phase reset stimuli generator Added Paths: ----------- trunk/src/GeneratorStimulusPhaseReset.py Added: trunk/src/GeneratorStimulusPhaseReset.py =================================================================== --- trunk/src/GeneratorStimulusPhaseReset.py (rev 0) +++ trunk/src/GeneratorStimulusPhaseReset.py 2009-07-29 14:43:30 UTC (rev 27) @@ -0,0 +1,49 @@ +# PyBrainSim +# Copyright 2009 Roman Goj +# +# This file is part of PyBrainSim. +# +# PyBrainSim is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# PyBrainSim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with PyBrainSim. If not, see <http://www.gnu.org/licenses/>. + +__metaclass__ = type # New style classes. Is this necessary? + +""" +""" + +from DummyGenerator import DummyGenerator + +class PhaseResetStimulusGenerator(DummyGenerator): + def __init__(self): + self.activation = 0 + self.connectedGeneratorPhase = 0 + self.stimulusTimes = [] + self.currentStimulus = 0 + + def setStimulusTimes(self, stimulusTimes): + self.stimulusTimes = stimulusTimes + + def receiveInput(self, input): + self.connectedGeneratorPhase = input + print("Received input: " + str(self.connectedGeneratorPhase)) + + def runGenerator(self, time): + if self.currentStimulus < len(self.stimulusTimes): + if self.stimulusTimes[self.currentStimulus] < time: + print("Stimulus now: BEEEEEEEP! ... Time is: " + str(time) + ", Stimulus list is: " + str(self.stimulusTimes) + " Connected generator phase should have been: " + str(self.connectedGeneratorPhase)) + self.activation = -self.connectedGeneratorPhase + self.currentStimulus += 1 + else: + self.activation = 0 + + return 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |