import ch.psi.pshell.device.ArrayCalibration as ArrayCalibration
import ch.psi.pshell.device.MatrixCalibration as MatrixCalibration

class Scalar(Readable):
    def read(self):
        return 1.0

class Array(ReadableArray):
    def read(self):
        return range(self.getSize())
        
    def getSize(self):
        return 10

class Matrix(ReadableMatrix):
    def read(self):
        return [range(self.getWidth()),] * self.getHeight()
        
    def getWidth(self):
        return 20

    def getHeight(self):
        return 5

class ArrayCalibrated(Array, Readable.ReadableCalibratedArray):
    def getCalibration(self):
        return ArrayCalibration(5,1000)
        
class ArrayCalibrated1d(Array, Readable.ReadableCalibratedArray):
    def getCalibration(self):
        return ArrayCalibration(5,1000)

class MatrixCalibrated(Matrix, Readable.ReadableCalibratedMatrix):
    def getCalibration(self):
        return MatrixCalibration(2,4,100,200)

scalar = Scalar()
array = Array()
matrix = Matrix()
arrayCalibrated = ArrayCalibrated()
arrayCalibrated1d = ArrayCalibrated1d()
matrixCalibrated = MatrixCalibrated()


set_preference(Preference.PLOT_TYPES, {arrayCalibrated1d:1})


a= lscan(out, [scalar, array, arrayCalibrated, arrayCalibrated1d, matrix, matrixCalibrated], 0, 40, 200)                 