comparison nodes/sine.py @ 0:45b12307c695

Initial revision
author drewp
date Wed, 03 Jul 2002 09:37:57 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:45b12307c695
1 """node that generates a sine wave"""
2
3
4 class SineGenerator(Node):
5 def op(self, input, output, stateaccess):
6
7 # input and output have names
8 output.sin = stateaccess.magnitude * math.sin(stateaccess.phase+input.time)
9
10 """
11 # dict-style access for names with spaces
12 output['sin'] = input['ti me']
13 # underscore magic for accessing names with spaces-- the port object makes
14 # this work
15 output.sin=input.ti_me
16
17 input.time = input.money
18 """
19
20 def getports(self):
21 return OutputPort('sin'), InputPort('time'), InputPort('money')