Skip to content

Commit

Permalink
Limit spikesorting artifacts to valid timestamps (#1196)
Browse files Browse the repository at this point in the history
* limit artifacts to valid timestamps

* update changelog
  • Loading branch information
samuelbray32 authored Nov 26, 2024
1 parent 37ddfc1 commit 6faed4c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ dj.FreeTable(dj.conn(), "common_session.session_group").drop()
- Fix bug in `_compute_metric` #1099
- Fix bug in `insert_curation` returned key #1114
- Fix handling of waveform extraction sparse parameter #1132
- Limit Artifact detection intervals to valid times #1196

## [0.5.3] (August 27, 2024)

Expand Down
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 6faed4c

Please sign in to comment.