nispace.io.load_distmat

nispace.io.load_distmat(distmat)[source]

Load one or more distance matrices from paths, arrays, or DataFrames.

Parameters:

distmat (None, str, os.PathLike, np.ndarray, pd.DataFrame, list, or tuple) – A single distance matrix source, or a tuple of up to 2 such elements (e.g. left/right hemisphere matrices). None (or a tuple/list of all None) is passed through unchanged. array/DataFrame elements are converted to plain ndarrays; str/Path elements are read as a headerless csv-like file.

Returns:

A single ndarray if distmat had 1 element; otherwise a 2-tuple of ndarrays. None is passed through unchanged.

Return type:

np.ndarray, tuple, or None

Raises:

ValueError – If distmat is not a path/list/tuple/ndarray/DataFrame thereof, or a path element can’t be read as a csv-like file.