SpikeInterface / SpikeInterface/spikeinterface

Suggestions for removing light artifacts issues

Open
#3,936 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

preprocessing
Dominant language
Python
Stars
847
Forks
280
Avg merge
3d 9h
Merged PRs (30d)
29

Description

I'm now doing optotagging with Neuropixel probe. I'm now using red light and get a lot of light artifacts. The optic fiber stimulation site is far from the Neuropixel probe recording site. Therefore, I chose to use the median subtraction method to do so.

Image

Specifically, below is my code:

### Preprocessing
## Phase shift
rec_shift = spre.phase_shift(recording=recording_oe)
## Bandpass filter
recording_f = spre.bandpass_filter(recording=rec_shift, freq_min=300, freq_max=6000)
## Detect and Remove Bad Channels
# detect
bad_channel_ids, channel_labels = spre.detect_bad_channels(recording=recording_f)
# Case 2 : interpolate then
rec_clean = spre.interpolate_bad_channels(recording=recording_f, bad_channel_ids=bad_channel_ids)
## Common Reference
recording_cmr = spre.common_reference(recording=rec_clean, operator="median")
##Remove light artifacts
rec_removed = spre.remove_artifacts(recording=recording_cmr, list_triggers=laser_on_times, mode='median')

Image
Image

Image
Image

It's promising, see attached figures, however the artifacts still exist. Recently I was reading the biorxiv paper https://www.biorxiv.org/content/10.1101/2025.02.04.636286v2. In the supplementary figure 4, they successfully removed the light artifacts in the red light pulses. "The artifact seen for red pulses is highly uniform across recording sites, allowing it to be completely removed by phase shifting and median subtraction (see Methods for details)." I think I did the same things.

I'm wondering whether you have better ideas of how to improve my preprocessing steps!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the shown Python preprocessing pipeline, focusing on phase_shift, common_reference, and remove_artifacts with mode='median'. Compare the intermediate and final recordings against the attached artifact examples and review how the listed triggers are used. Done means identifying a reproducible preprocessing change that removes the remaining red-light artifacts.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.