Skip to content

Commit

Permalink
limit artifacts to valid timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelbray32 committed Nov 26, 2024
1 parent 4231e51 commit 9b2ddee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/spyglass/spikesorting/v0/spikesorting_artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ def _get_artifact_times(
for interval_idx, interval in enumerate(artifact_intervals):
artifact_intervals_s[interval_idx] = [
valid_timestamps[interval[0]] - half_removal_window_s,
valid_timestamps[interval[1]] + half_removal_window_s,
np.minimum(
valid_timestamps[interval[1]] + half_removal_window_s,
valid_timestamps[-1],
),
]
# make the artifact intervals disjoint
if len(artifact_intervals_s) > 1:
Expand Down
5 changes: 4 additions & 1 deletion src/spyglass/spikesorting/v1/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,10 @@ def _get_artifact_times(
),
np.searchsorted(
valid_timestamps,
valid_timestamps[interval[1]] + half_removal_window_s,
np.minimum(
valid_timestamps[interval[1]] + half_removal_window_s,
valid_timestamps[-1],
),
),
]
artifact_intervals_s[interval_idx] = [
Expand Down

0 comments on commit 9b2ddee

Please sign in to comment.