code: def subsample(time_series, downsample_factor):
      
      Ns = np.int(np.floor(np.size(time_series)/downsample_factor))
      g = gaussian_kernel(0.5*downsample_factor)
      ts_blur = np.convolve(time_series,g,'same')
      ts_out = np.zeros((Ns,1), dtype='float64')
      for k in range(0,Ns):
          cpos  = (k+.5)*downsample_factor-.5
          cfrac = cpos-np.floor(cpos)
          cind  = np.floor(cpos)
          if cfrac>0:
              ts_out[k]=ts_blur[cind]*(1-cfrac)+ts_blur[cind+1]*cfrac
          else:
              ts_out[k]=ts_blur[cind]
              
      return ts_out
docs: Subsample with Gaussian prefilter
  
      The prefilter will have the filter size $\sigma_g=.5*ssfactor$
  
      Parameters
      --------------
      time_series : ndarray
              Input signal
      downsample_factor : float
              Downsampling factor
         
      Returns
      --------------
         ts_out : ndarray
              The downsampled signal