Closed JuanPimientoCaicedo closed 6 months ago
Hi @JuanPimientoCaicedo
Do these weird artifact happen at the concatenation times? Can you try to first concatenate and then do the phase shift? Phase shift needs a "margin" to work, so if your data is continuous in time it's better to concatenate first.
The zarr compression is lossless :) it uses the Blosc implementation of the Z-standard codec (as default).
A couple of additional comments:
si.filter
instead of the si.bandpass_filter
?correct_motion
function already returns the interpolated traces, so the interpolate_recording
step can be removedThank you, @alejoe91 for your rapid response.
The recordings are not exactly continuous, there is a gap between them of at least 1 or 2 minutes (The time it takes to transition from one task to the other in the setup), so I believed it was better to demux them before concatenating them. Does that make sense? Do you still believe it is better to concatenate and then demux them?
Yeah, I can use si.bandpass_filter
in this case. I thought they were equivalent, aren't they?
The interpolate_recording
step is necessary because I am using the drift estimation from bandpass filtered data to the broadband recording, https://github.com/SpikeInterface/spikeinterface/issues/2749. Do you think this may be the cause of the artifact?
Furthermore, This broadband recording is what I use to spikesort the data, I turn off the Kilosort drift correction and let it to filter the data before the sorting starts.
Since the artifact looks quite distributed on time (looking at the amplitude plot), I don't think it's related to a particular processing step...does it make sense?
Exploring the artifacts, I find that they do not happen randomly.
They happen in steps of 2 seconds:
I am wondering if this has something to do with the SpikeGLX - inter_sample_shifts.
Interesting. I think this can be due to the motion interpolation, since temporal bins are 2sec. @samuelgarcia what do you think?
Ok, I think I figured out what is happening:
It is in fact related to the motion interpolation step and the fact that somehow the offset of the channels is not fully corrected:
Here you can see the spike triggered average of the noise cluster before the motion interpolation:
and this is after the motion interpolation:
After eliminating bad channels I still have channels with weird offsets, these offsets are eliminated with filtering, as you can see here:
Before:
After:
Given that I am interested in the broadband data, I believe that an easy solution here would be correct the offsets of those channels and see if that works. What do you think, @alejoe91? By the way, do you have a function to do this? I am taking a look at spikeinterface.preprocessing.scale(recording, gain=1.0, offset=new_offsets)
and it seems it should do the work.
Yes you can use the center
preprocessing function (or a high pass with a very low cutoff!)
Excellent, thank you very much. You were very helpful!
Hi. The motion interpolation should be applied on a high pass filter traces.
Hi, I hope you are doing well.
I have been working with Spikeinterface for some time and I am noticing some weird signals coming from my data with neuropixels and preprocessed with your tools (see attached image), it looks like the are sudden voltage changes in the signal, which is very unlikely a biological phenomenon but more an artifact of the recording or an artifact of the subsequent manipulation.
This is more or less, the pipeline that I use.
I basically:
phase_shift
function.I then use Kilosort4, do some precuration with your tools and manually curate in phy.
I noticed that the amount of times I see this weird "waveform" has increased after doing two things:
I am starting to suspect that maybe I am losing data with the Zarr compression implementation. But I don't know, is the compression that you implement lossy?
Another thing is that the first time I actually saw this phenomenon was after applying the
phase_shift
function. Maybe the phase shift function applied to different recordings that are so long (about 4 hours), could sum up to get what I am seeing?I also noticed a decrease in the yield I can get from the recordings, which can be caused by the duration of the recordings. However, I am wondering if maybe something that I am doing in my pipeline could be affecting that yield.
Here is the code I am using:
as a summary:
I am seeing two things:
My principal suspects related to the pipeline are:
phase_shift
function.Thank you very much for your time!