code: def resample_ann(resampled_t, ann_sample):
      
      tmp = np.zeros(len(resampled_t), dtype='int16')
      j = 0
      tprec = resampled_t[j]
      for i, v in enumerate(ann_sample):
          while True:
              d = False
              if v < tprec:
                  j -= 1
                  tprec = resampled_t[j]
  
              if j+1 == len(resampled_t):
                  tmp[j] += 1
                  break
  
              tnow = resampled_t[j+1]
              if tprec <= v and v <= tnow:
                  if v-tprec < tnow-v:
                      tmp[j] += 1
                  else:
                      tmp[j+1] += 1
                  d = True
              j += 1
              tprec = tnow
              if d:
                  break
  
      idx = np.where(tmp>0)[0].astype('int64')
      res = []
      for i in idx:
          for j in range(tmp[i]):
              res.append(i)
      assert len(res) == len(ann_sample)
  
      return np.asarray(res, dtype='int64')
docs: Compute the new annotation indices
  
      Parameters
      ----------
      resampled_t : numpy array
          Array of signal locations as returned by scipy.signal.resample
      ann_sample : numpy array
          Array of annotation locations
  
      Returns
      -------
      resampled_ann_sample : numpy array
          Array of resampled annotation locations