0
|
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')
|