pyntbci.utilities.find_worst_neighbour

pyntbci.utilities.find_worst_neighbour(score: ndarray[Any, dtype[_ScalarType_co]], neighbours: ndarray[Any, dtype[_ScalarType_co]], layout: ndarray[Any, dtype[_ScalarType_co]]) tuple[tuple[int, int], float][source]

Find the neighbouring pair with maximum score.

Parameters:
  • score (NDArray) – The matrix of scores of shape (n_codes, n_codes).

  • neighbours (NDArray) – The matrix of neighbouring pairs of shape (n_pairs, 2).

  • layout (NDArray) – The vector mapping positions to identities of shape (n_codes).

Returns:

  • idx (tuple[int, int]) – The two indexes of the neighbouring codes in the layout that have a maximum score.

  • val (float) – The maximum score.