code: def resample(data, s_freq=None, axis='time', ftype='fir', n=None):
      
      output = data._copy()
      ratio = int(data.s_freq / s_freq)
  
      for i in range(data.number_of('trial')):
          output.data[i] = decimate(data.data[i], ratio,
                                    axis=data.index_of(axis),
                                    zero_phase=True)
  
          n_samples = output.data[i].shape[data.index_of(axis)]
          output.axis[axis][i] = linspace(data.axis[axis][i][0],
                                          data.axis[axis][i][-1] +
                                          1 / data.s_freq,
                                          n_samples)
  
      output.s_freq = s_freq
  
      return output
docs: Downsample the data after applying a filter.
  
      Parameters
      ----------
      data : instance of Data
          data to downsample
      s_freq : int or float
          desired sampling frequency
      axis : str
          axis you want to apply downsample on (most likely 'time')
      ftype : str
          filter type to apply. The default here is 'fir', like Matlab but unlike
          the default in scipy, because it works better
      n : int
          The order of the filter (1 less than the length for ‘fir’).
  
      Returns
      -------
      instance of Data
          downsampled data