def set(self, value, samples=0):
        '''
        Set the current value and optionally maintain it for a period
        :param value: New current value
        :param samples: Add current value for this number of samples (if not zero)
        :return:
        '''
        if self.params.length > self.pos and samples > 0:
            l = min(samples, self.params.length-self.pos)
            self.data[self.pos:self.pos+l] = np.full(l, value, dtype=np.float)
            self.pos += l
        self.latest = value
        return self
Set the current value and optionally maintain it for a period
        :param value: New current value
        :param samples: Add current value for this number of samples (if not zero)
        :return: