brainstat.stats.utils.ismember

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

Tests whether elements of A appear in B.

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

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

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

Returns

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

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

Notes

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