def _function(self):
        """
        This is the actual function that will be executed. It uses only information that is provided in the settings property
        will be overwritten in the __init__
        """
        plant = self.instruments['plant']['instance']
        controler = self.instruments['controler']['instance']
        plant.update(self.instruments['plant']['settings'])
        controler.update(self.instruments['controler']['settings'])

        time_step = 1./self.settings['sample rate']

        controler.update({'time_step': time_step})
        self.last_plot = datetime.datetime.now()

        controler.reset()
        # if length changed we have to redefine the queue and carry over the data
        if self.data['plant_output'].maxlen != self.settings['buffer_length']:
            plant_output = deepcopy(self.data['plant_output'])
            control_output = deepcopy(self.data['control_output'])
            self.data = {'plant_output': deque(maxlen=self.settings['buffer_length']),
                         'control_output': deque(maxlen=self.settings['buffer_length'])}

            x = list(range(min(len(plant_output), self.settings['buffer_length'])))
            x.reverse()
            for i in x:
                self.data['plant_output'].append(plant_output[-i-1])
                self.data['control_output'].append(control_output[-i - 1])

        while not self._abort:

            measurement = plant.output

            self.data['plant_output'].append(measurement)
            control_value = controler.controler_output(measurement)
            self.data['control_output'].append(control_value)

            if self.settings['on/off']:
                print(('set plant control', control_value))
                plant.control = float(control_value)

            self.progress = 50
            self.updateProgress.emit(self.progress)

            time.sleep(time_step)
def _function ( self ) : plant = self . instruments [ 'plant' ] [ 'instance' ] controler = self . instruments [ 'controler' ] [ 'instance' ] plant . update ( self . instruments [ 'plant' ] [ 'settings' ] ) controler . update ( self . instruments [ 'controler' ] [ 'settings' ] ) time_step = 1. / self . settings [ 'sample rate' ] controler . update ( { 'time_step' : time_step } ) self . last_plot = datetime . datetime . now ( ) controler . reset ( ) if self . data [ 'plant_output' ] . maxlen != self . settings [ 'buffer_length' ] : plant_output = deepcopy ( self . data [ 'plant_output' ] ) control_output = deepcopy ( self . data [ 'control_output' ] ) self . data = { 'plant_output' : deque ( maxlen = self . settings [ 'buffer_length' ] ) , 'control_output' : deque ( maxlen = self . settings [ 'buffer_length' ] ) } x = list ( range ( min ( len ( plant_output ) , self . settings [ 'buffer_length' ] ) ) ) x . reverse ( ) for i in x : self . data [ 'plant_output' ] . append ( plant_output [ - i - 1 ] ) self . data [ 'control_output' ] . append ( control_output [ - i - 1 ] ) while not self . _abort : measurement = plant . output self . data [ 'plant_output' ] . append ( measurement ) control_value = controler . controler_output ( measurement ) self . data [ 'control_output' ] . append ( control_value ) if self . settings [ 'on/off' ] : print ( ( 'set plant control' , control_value ) ) plant . control = float ( control_value ) self . progress = 50 self . updateProgress . emit ( self . progress ) time . sleep ( time_step )
This is the actual function that will be executed. It uses only information that is provided in the settings property
        will be overwritten in the __init__