nispace.io.load_spinmat

nispace.io.load_spinmat(spinmat)[source]

Load one or more spin-permutation index/weight arrays from paths or arrays.

Parameters:

spinmat (None, str, os.PathLike, np.ndarray, list, or tuple) – A single spin matrix source, or a tuple of up to 2 such elements (e.g. left/right hemisphere spins). None (or a tuple/list of all None) is passed through unchanged. .npz paths are read via their "data" key; other array file paths are memory-mapped (mmap_mode='c') rather than fully loaded into memory.

Returns:

A single array if spinmat had 1 element; otherwise a 2-tuple of arrays. None is passed through unchanged.

Return type:

np.ndarray, tuple, or None

Raises:

ValueError – If spinmat is not a path/ndarray/list/tuple thereof, or an element’s type is unsupported.