code: def downsample(self, xstart, xend):
      # get the points in the view range
      mask = (self.origXData > xstart) & (self.origXData < xend)
      # dilate the mask by one to catch the points just outside
      # of the view range to not truncate the line
      mask = np.convolve([1, 1, 1], mask, mode="same").astype(bool)
      # sort out how many points to drop
      ratio = max(np.sum(mask) // self.max_points, 1)
  
      # mask data
      xdata = self.origXData[mask]
      ydata = self.origYData[mask]
  
      # downsample data
      xdata = xdata[::ratio]
      ydata = ydata[::ratio]
  
      print(f"using {len(ydata)} of {np.sum(mask)} visible points")
  
      return xdata, ydata
  
imports: import matplotlib.pyplot
  import numpy
label_desc: Use image node_id 2 for calling the DataDisplayDownsampler obj's underlying member method code with example usage: obj.downsample(xstart, xend) and returns: xdata,  ydata