code: def _create_subepochs(x, nperseg, step):
      
      axis = x.ndim - 1  # last dim
      nsmp = x.shape[axis]
      stride = x.strides[axis]
      noverlap = nperseg - step
      v_shape = *x.shape[:axis], (nsmp - noverlap) // step, nperseg
      v_strides = *x.strides[:axis], stride * step, stride
      v = as_strided(x, shape=v_shape, strides=v_strides,
                     writeable=False)  # much safer
      return v
docs: Transform the data into a matrix for easy manipulation
  
      Parameters
      ----------
      x : 1d ndarray
          actual data values
      nperseg : int
          number of samples in each row to create
      step : int
          distance in samples between rows
      Returns
      -------
      2d ndarray
          a view (i.e. doesn't copy data) of the original x, with shape
          determined by nperseg and step. You should use the last dimension