class_docstr: example application main window 
class_docstr_tok: ["example","application","main","window"]
docstr: called by timer at 30 Hz 
docstr_tok: ["called","by","timer","at","30","Hz"]
code: def update(self):
      """called by timer at 30 Hz"""
      timestamp = time.perf_counter()
      # measure actual update rate:
      dt = timestamp - self.last_update
      if self.mean_dt is None:
          self.mean_dt = dt
      else:
          self.mean_dt = (
              0.95 * self.mean_dt + 0.05 * dt
          )  # average over fluctuating measurements
      self.top_plot.setTitle(
          "refresh: {:0.1f}ms -> {:0.1f} fps".format(
              1000 * self.mean_dt, 1 / self.mean_dt
          )
      )
      # handle rolling buffer:
      self.last_update = timestamp
      for dic in self.traces:
          new_data = dic["ds"].get_data(timestamp)
          idx_a = dic["ptr"]
          idx_b = idx_a + len(new_data)
          len_buffer = dic["buf"].shape[0]
          if idx_b < len_buffer:  # data does not cross buffer boundary
              dic["buf"][idx_a:idx_b] = new_data
          else:  # part of the new data needs to roll over to beginning of buffer
              len_1 = len_buffer - idx_a  # this many elements still fit
              dic["buf"][idx_a : idx_a + len_1] = new_data[
                  :len_1
              ]  # first part of data at end
              idx_b = len(new_data) - len_1
              dic["buf"][0:idx_b] = new_data[
                  len_1:
              ]  # second part of data at re-start
          dic["ptr"] = idx_b
          dic["crv"].setData(dic["buf"])
  
file_path: pyqtgraph/pyqtgraph/examples/ColorGradientPlots.py
imports: import time
  import numpy
  import pyqtgraph
  from pyqtgraph.Qt import QtCore, mkQApp
label_desc: Use image node_id 2 for calling the MainWindow obj's underlying member method code with example usage: obj.update() without return types