[Pybrainsim-activity] SF.net SVN: pybrainsim:[78] trunk/src/GeneratorSine.py
Status: Planning
Brought to you by:
rgoj
From: <rg...@us...> - 2009-08-03 18:36:27
|
Revision: 78 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=78&view=rev Author: rgoj Date: 2009-08-03 18:36:14 +0000 (Mon, 03 Aug 2009) Log Message: ----------- * Corrected mistake: __init__ must be also called with the head argument * Corrected mistake: the phase of the sine is now correctly calculated Modified Paths: -------------- trunk/src/GeneratorSine.py Modified: trunk/src/GeneratorSine.py =================================================================== --- trunk/src/GeneratorSine.py 2009-08-03 18:14:42 UTC (rev 77) +++ trunk/src/GeneratorSine.py 2009-08-03 18:36:14 UTC (rev 78) @@ -27,8 +27,8 @@ from Generator import Generator class GeneratorSine(Generator): - def __init__(self, name, frequency = 2, phaseShift = 0): - Generator.__init__(self, name) + def __init__(self, name, head, frequency = 2, phaseShift = 0): + Generator.__init__(self, name, head) self.frequency = frequency self.phaseShift = phaseShift @@ -39,6 +39,12 @@ self.activation += input def runGenerator(self, time): - self.phase = (2 * math.pi * self.frequency * time + 2 * math.pi * self.phaseShift) % (2 * math.pi / self.frequency) / (2 * math.pi) - print("Phase is now: " + str(self.phase)) - return math.sin(self.phase * 2 * math.pi) +# self.phase = (2 * math.pi * self.frequency * time + 2 * math.pi * self.phaseShift) \ +# % (2 * math.pi / self.frequency) / (2 * math.pi) + self.phase = ((2 * math.pi * self.frequency * time + 2 * math.pi * self.phaseShift) \ + % (2 * math.pi)) / (2 * math.pi) +# self.activation += math.sin(self.phase * 2 * math.pi) + self.activation = math.sin(self.phase * 2 * math.pi) + print("Output is now: " + str(self.activation)) + + return self.activation This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |