Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit spikesorting artifacts to valid timestamps #1196

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,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
Loading