drift correction (Dredge) parameter optimization for long NHP recording
Hi all, I’m using Dredge (with default SpikeInterface parameters, except for a longer chunk_duration of 6s) to correct motion in my 3-4 hour acute recording in head-fixed macaque. However, I’m seeing spikes in the motion vector trace, even though the animal wasn’t moving much at those times. Could these spikes be real, or might they reflectartifacts? If they’re artifactual, how should I adjust my parameters to improve the motion correction? Thanks in advance for your help!
@cwindolf can you hel @liyipeng-moon on this one?
Could you please send a zoomed image of 1 such "noisy/spiky" period? These are typically "hallucinations" and not real motions, when DREDge is not finding the right direction and therefore "jumping" within the given spatial limits (as you can see, with roughly similar amplitudes all the time). Your recording indeed doesn't seem to have a lot of motion, only slow drift. Here's what I would do (and have done before) in such poor motion estimation: save this motion vector as a CSV, paste an envelope/curve on it to get this nice slow drift, and use that smooth curve for motion correction instead of this glitchy original. Not sure if such a smoothing function is already available as a built-in feature for motion correction, so I did it separately (but it might make sense, what do you think?)
Hi, I’ll take a closer look at the spikes once I’m back to the office. Thank you for your suggestion—I’ll try applying the blue envelope to my recording and compare the results - would take some time though. I’ll share feedback here once I’ve tested it.
Hi. IN dredge, smoothing in time (first) and space (then) can help.
histogram_depth_smooth_um=1,
histogram_time_smooth_s=1,
can be change to
histogram_depth_smooth_um=2,
histogram_time_smooth_s=1.5,
for instance
Hi @liyipeng-moon , you could in addition to Sam's suggestion try SI's motion cleaner function https://github.com/SpikeInterface/spikeinterface/blob/main/src/spikeinterface/sortingcomponents/motion/motion_cleaner.py#L6 . I'd also suggest trying to increase the spatial window size parameter (win_scale_um) to get some more signal in each window, but if you do that I'd suggest to visualize the motion tracking results to make sure have the appropriate level of nonrigidity (difference along depth of the probe)
Hi all, I’ve added smooth binning (both spatial and temporal), and the data look much better now. However, I still need to dive into the dredge code with several Ctrl+D in the notebook, since I couldn’t find where to pass these two dredge-specific parameters into si.correct_motion.
Do you have any suggestions? Thanks!