Skip to content

Commit

Permalink
Only apply include labels filter if include_labels not empty (LorenFr…
Browse files Browse the repository at this point in the history
…ankLab#827)

* dont skip unit if include_labels list is empty

* update check for np array size
  • Loading branch information
samuelbray32 authored Feb 12, 2024
1 parent be6e414 commit b7a81d4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/spyglass/spikesorting/analysis/v1/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ def filter_units(
for ind, unit_labels in enumerate(labels):
if isinstance(unit_labels, str):
unit_labels = [unit_labels]
if np.all(~np.isin(unit_labels, include_labels)) or np.any(
np.isin(unit_labels, exclude_labels)
):
if (
include_labels.size > 0
and np.all(~np.isin(unit_labels, include_labels))
) or np.any(np.isin(unit_labels, exclude_labels)):
# if the unit does not have any of the include labels
# or has any of the exclude labels, skip
continue
Expand Down

0 comments on commit b7a81d4

Please sign in to comment.