def ndfrom2d(xtr, rsi):
    """Undo the array shape conversion applied by :func:`ndto2d`,
    returning the input 2D array to its original shape.


    Parameters
    ----------
    xtr : array_like
      Two-dimensional input array
    rsi : tuple
      A tuple containing the shape of the axis-permuted array and the
      permutation order applied in :func:`ndto2d`.

    Returns
    -------
    x : ndarray
      Multi-dimensional output array
    """

    # Extract components of conversion information tuple
    xts = rsi[0]
    prm = rsi[1]
    # Reshape x to the shape obtained after permuting axes in ndto2d
    xt = xtr.reshape(xts)
    # Undo axis permutation performed in ndto2d
    x = np.transpose(xt, np.argsort(prm))
    # Return array with shape corresponding to that of the input to ndto2d
    return x
Undo the array shape conversion applied by :func:`ndto2d`,
    returning the input 2D array to its original shape.


    Parameters
    ----------
    xtr : array_like
      Two-dimensional input array
    rsi : tuple
      A tuple containing the shape of the axis-permuted array and the
      permutation order applied in :func:`ndto2d`.

    Returns
    -------
    x : ndarray
      Multi-dimensional output array