def append(self, value):
        "adds value to ring buffer"
        idx = self.index = (self.index + 1) % self.data.size
        self.data[idx] = max(0, value - self.lastval)
        self.lastval  = value
        dt = time.time() - self.toffset
        # avoid first time point
        if (idx == 0 and max(self.times) < 0):
            dt = 0
        self.times[idx] =  dt
dataset/ETHPy150Open xraypy/xraylarch/plugins/wx/xrfdisplay_utils.py/ROI_Averager.append/original