22 lines
596 B
Python
Executable File
22 lines
596 B
Python
Executable File
class Waveform(ReadonlyRegisterBase, ReadonlyRegisterArray):
|
|
def doRead(self):
|
|
time.sleep(0.001)
|
|
#self.val = to_array(self.calc(), 'd')
|
|
return self.calc()
|
|
|
|
def getSize(self):
|
|
return len(self.take(-1)) #only reads if cache is None
|
|
|
|
class SinusoidWaveform(Waveform):
|
|
def calc(self):
|
|
ret = []
|
|
x = random.random()
|
|
for i in range (20):
|
|
ret.append(math.sin(x))
|
|
x = x + 0.1
|
|
return ret
|
|
|
|
add_device(SinusoidWaveform("wf1"), True)
|
|
|
|
r3 = lscan(out, (wf1,), 0.0,1.0, 4, 0.01)
|