brainstat.stats.utils.ismember

brainstat.stats.utils.ismember(A, B, rows=False)[source]

Tests whether elements of A appear in B.

Parameters
  • A (numpy.ndarray) – 1D or 2D array

  • B (numpy.ndarray) – 1D or 2D array

  • rows (bool, optional) – If true test for row correspondence rather than element correpondence.

Returns

  • bool – Boolean of the same size as A denoting which elements (or rows) occur in B.

  • numpy.ndarray – Indices of matching elements/rows in A.

Notes

For row-wise comparisons, row_ismember should be significantly faster.