code: def detect(self, x, conf, adc_zero):
          
          self.c = conf
          self.annotations = []
          self.sample_valid = False
  
          if len(x) < 1:
              return []
  
          self.x = x
          self.adc_zero = adc_zero
  
          self.qfv = np.zeros((self.c._BUFLN), dtype="int64")
          self.smv = np.zeros((self.c._BUFLN), dtype="int64")
          self.v1 = 0
  
          t0 = 0
          self.tf = len(x) - 1
          self.t = 0 - self.c.dt4
  
          self.annot = GQRS.Annotation(0, "NOTE", 0, 0)
  
          # Cicular buffer of Peaks
          first_peak = GQRS.Peak(0, 0, 0)
          tmp = first_peak
          for _ in range(1, self.c._NPEAKS):
              tmp.next_peak = GQRS.Peak(0, 0, 0)
              tmp.next_peak.prev_peak = tmp
              tmp = tmp.next_peak
          tmp.next_peak = first_peak
          first_peak.prev_peak = tmp
          self.current_peak = first_peak
  
          if self.c.spm > self.c._BUFLN:
              if self.tf - t0 > self.c._BUFLN:
                  tf_learn = t0 + self.c._BUFLN - self.c.dt4
              else:
                  tf_learn = self.tf - self.c.dt4
          else:
              if self.tf - t0 > self.c.spm:
                  tf_learn = t0 + self.c.spm - self.c.dt4
              else:
                  tf_learn = self.tf - self.c.dt4
  
          self.countdown = -1
          self.state = "LEARNING"
          self.gqrs(t0, tf_learn)
  
          self.rewind_gqrs()
  
          self.state = "RUNNING"
          self.t = t0 - self.c.dt4
          self.gqrs(t0, self.tf)
  
          return self.annotations
docs: Run detection. x is digital signal