This commit is contained in:
75
script/cpy/TestJProxy.py
Normal file
75
script/cpy/TestJProxy.py
Normal file
@@ -0,0 +1,75 @@
|
||||
from jep import jproxy
|
||||
import random
|
||||
|
||||
|
||||
class MyWritable(Writable):
|
||||
def write(self, value):
|
||||
print ("Write: ",value)
|
||||
|
||||
class MyReadable(Readable):
|
||||
def read(self):
|
||||
return random.random()
|
||||
|
||||
class MyReadableArray(ReadableArray):
|
||||
def read(self):
|
||||
ret = []
|
||||
for i in range (self.getSize()):
|
||||
ret.append(random.random())
|
||||
return ret
|
||||
|
||||
def getSize(self):
|
||||
return 20
|
||||
|
||||
class MyReadableCalibratedArray(ReadableCalibratedArray):
|
||||
def read(self):
|
||||
return rw1.read()
|
||||
|
||||
def getSize(self):
|
||||
return rw1.getSize()
|
||||
|
||||
def getCalibration(self):
|
||||
return ArrayCalibration(5,1000)
|
||||
|
||||
class MyReadableMatrix(ReadableMatrix):
|
||||
def read(self):
|
||||
ret = []
|
||||
for i in range (self.getHeight()):
|
||||
ret.append([random.random()] * self.getWidth())
|
||||
return to_array(ret, 'd')
|
||||
|
||||
def getWidth(self):
|
||||
return 80
|
||||
|
||||
def getHeight(self):
|
||||
return 40
|
||||
|
||||
|
||||
class MyReadableCalibratedMatrix(ReadableCalibratedMatrix):
|
||||
def read(self):
|
||||
return ri1.read()
|
||||
|
||||
def getWidth(self):
|
||||
return ri1.getWidth()
|
||||
|
||||
def getHeight(self):
|
||||
return ri1.getHeight()
|
||||
|
||||
def getCalibration(self):
|
||||
return MatrixCalibration(2,4,100,200)
|
||||
|
||||
|
||||
#plot([1,2,3])
|
||||
|
||||
ws1 = MyWritable("ws1")
|
||||
rs1 = MyReadable("rs1")
|
||||
rw1 = MyReadableArray("rw1")
|
||||
ri1 = MyReadableMatrix("ri1")
|
||||
ac1 = MyReadableCalibratedArray("ac1")
|
||||
mc1 = MyReadableCalibratedMatrix("mc1")
|
||||
|
||||
|
||||
|
||||
t=lscan(ws1, (rs1, rw1, ri1, ac1, mc1), 0, 5, 5)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user