class CamtoolValue(Readable):
    def __init__(self, channel, alias = None):        
        self.channel=channel
        set_device_alias(self, channel if (alias is None) else alias)
        
    def read(self):
        return  camtool.getValue(self.channel)

class CamtoolArray(ReadableArray):
    def __init__(self, channel, alias = None):              
        self.channel=channel
        set_device_alias(self, channel if (alias is None) else alias)
        
    def read(self):
        return  camtool.getValue(self.channel)        

    def getSize(self):
        return len(camtool.getValue(self.channel))



class CamtoolImage(ReadableMatrix):
    def __init__(self, alias = None):             
        set_device_alias(self, camtool.getCurrentCamera() + " image" if (alias is None) else alias)
        
    def read(self):
        return camtool.getData().matrix

    def getWidth(self):
        return camtool.getData().width

    def getHeight(self):
        return camtool.getData().height                

sensors = [     
                CamtoolImage(),
                CamtoolArray("x_fit_gauss_function"),
                CamtoolValue("gr_x_fit_mean"), 
                CamtoolValue("gr_y_fit_mean"),  
                CamtoolValue("gr_x_fit_standard_deviation"),  
                CamtoolValue("gr_y_fit_standard_deviation")]


if camtool.getCurrentCamera() != "simulation":
    camtool.start("simulation")

tscan(sensors, 10, 1.0)
