osl_dynamics.inference.modes.match_vectors#

osl_dynamics.inference.modes.match_vectors(*vectors, comparison='correlation', return_order=False)#

Matches vectors.

Parameters:
vectorstuple of np.ndarray

Sets of vectors to match. Each variable must be shape (n_vectors, n_channels).

comparisonstr, optional

Must be 'correlation' or 'cosine_similarity'.

return_orderbool, optional

Should we return the order instead of the matched vectors?

Returns:
matched_vectorstuple of np.ndarray

Set of matched vectors of shape (n_vectors, n_channels) or order if return_order=True.

Examples

Reorder the vectors directly:

>>> v1, v2 = match_vectors(v1, v2, comparison="correlation")

Just get the reordering:

>>> orders = match_vectors(v1, v2, comparison="correlation", return_order=True)
>>> print(orders[0])  # order for v1 (always unchanged)
>>> print(orders[1])  # order for v2