class_docstr: A set of lines that are temporally aligned on a trigger.
  
  Data is added in chunks to the oscilloscope, and each new chunk creates a
  new line to draw. Older lines are slowly faded out until they are removed.
  
  Parameters
  ----------
  n_lines : int
      The maximum number of lines to draw.
  line_size : int
      The number of samples in each line.
  dx : float
      The x spacing between adjacent samples in a line.
  color : tuple
      The base color to use when drawing lines. Older lines are faded by
      decreasing their alpha value.
  trigger : tuple
      A set of parameters (level, height, width) that determine how triggers
      are detected.
  parent : Node
      An optional parent scenegraph node.
class_docstr_tok: ["A","set","of","lines","that","are","temporally","aligned","on","a","trigger",".","Data","is","added","in","chunks","to","the","oscilloscope",",","and","each","new","chunk","creates","a","new","line","to","draw",".","Older","lines","are","slowly","faded","out","until","they","are","removed",".","Parameters","--","--","--","--","--","n_lines",":","int","The","maximum","number","of","lines","to","draw",".","line_size",":","int","The","number","of","samples","in","each","line",".","dx",":","float","The","x","spacing","between","adjacent","samples","in","a","line",".","color",":","tuple","The","base","color","to","use","when","drawing","lines",".","Older","lines","are","faded","by","decreasing","their","alpha","value",".","trigger",":","tuple","A","set","of","parameters","(","level",",","height",",","width",")","that","determine","how","triggers","are","detected",".","parent",":","Node","An","optional","parent","scenegraph","node","."]
code: def new_frame(self, data):
      self.frames.append(data)
  
      # see if we can discard older frames
      while len(self.frames) > 10:
          self.frames.pop(0)
  
      if self._trigger is None:
          dx = 0
      else:
          # search for next trigger
          th = int(self._trigger[1])  # trigger window height
          tw = int(self._trigger[2] / self._dx)  # trigger window width
          thresh = self._trigger[0]
  
          trig = np.argwhere(
              (data[tw:] > thresh + th) & (data[:-tw] < thresh - th)
          )
          if len(trig) > 0:
              m = np.argmin(np.abs(trig - len(data) / 2))
              i = trig[m, 0]
              y1 = data[i]
              y2 = data[min(i + tw * 2, len(data) - 1)]
              s = y2 / (y2 - y1)
              i = i + tw * 2 * (1 - s)
              dx = i * self._dx
          else:
              # default trigger at center of trace
              # (optionally we could skip plotting instead, or place this
              # after the most recent trace)
              dx = self._dx * len(data) / 2.0
  
      # if a trigger was found, add new data to the plot
      self.plot(data, -dx)
  
file_path: vispy/examples/demo/scene/oscilloscope.py
imports: from __future__ import division
  import threading
  import atexit
  import numpy
  from vispy import app, scene, gloo, visuals
  from vispy.util.filter import gaussian_filter
label_desc: Use image node_id 2 for calling the Oscilloscope obj's underlying member method code with example usage: obj.new_frame(data) without return types