Skip to content

Commit

Permalink
FIX: event_id can be a single value
Browse files Browse the repository at this point in the history
  • Loading branch information
mmagnuski committed Sep 3, 2024
1 parent e41aed0 commit 0cb758b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pylabianca/selectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ def zeta_test(spk, compare, picks=None, tmin=0., tmax=None, backend='numpy',
perm_abs_max = np.zeros((n_cells, n_permutations))

# prepare random states for the permutations
# (so that every cells gets the same permutations)
# (so that every cell gets the same permutation sequence)
max_val = np.iinfo(int).max
rnd = np.random.randint(0, high=max_val + 1, size=n_permutations)

Expand Down
4 changes: 4 additions & 0 deletions pylabianca/spikes.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,7 @@ def epoch(self, events, event_id=None, tmin=-0.2, tmax=1.,
'''
# event_id support
if event_id is not None:

use_events = np.in1d(events[:, -1], event_id)
if not np.any(use_events):
raise ValueError(
Expand All @@ -781,6 +782,9 @@ def epoch(self, events, event_id=None, tmin=-0.2, tmax=1.,
)
events = events[use_events, :]

if not isinstance(event_id, (list, np.ndarray)):
event_id = [event_id]

# test if some events are missing
unique_events = np.unique(events[:, -1])
if len(event_id) != len(unique_events):
Expand Down

0 comments on commit 0cb758b

Please sign in to comment.