code: def delay_embedding(data, emb_dim, lag=1):
    
    data = np.asarray(data)
    min_len = (emb_dim - 1) * lag + 1
    if len(data) < min_len:
      msg = "cannot embed data of length {} with embedding dimension {} " \
          + "and lag {}, minimum required length is {}"
      raise ValueError(msg.format(len(data), emb_dim, lag, min_len))
    m = len(data) - min_len + 1
    indices = np.repeat([np.arange(emb_dim) * lag], m, axis=0)
    indices += np.arange(m).reshape((m, 1))
    return data[indices]
docs: Perform a time-delay embedding of a time series
  
    Args:
      data (array-like):
        the data that should be embedded
      emb_dim (int):
        the embedding dimension
    Kwargs:
      lag (int):
        the lag between elements in the embedded vectors
  
    Returns:
      emb_dim x m array:
        matrix of embedded vectors of the form
        [data[i], data[i+lag], data[i+2*lag], ... data[i+(emb_dim-1)*lag]]
        for i in 0 to m-1 (m = len(data)-(emb_dim-1)*lag)