Skip to content

Commit

Permalink
start porting dredge_ap
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgarcia committed Jun 26, 2024
1 parent 1ac451c commit 532ea48
Show file tree
Hide file tree
Showing 4 changed files with 466 additions and 23 deletions.
18 changes: 2 additions & 16 deletions src/spikeinterface/sortingcomponents/motion/decentralized.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,23 +168,9 @@ def run(
bin_duration_s=bin_duration_s,
spatial_bin_edges=spatial_bin_edges,
weight_with_amplitude=weight_with_amplitude,
depth_smooth_um=histogram_depth_smooth_um,
time_smooth_s=histogram_time_smooth_s,
)
import scipy.signal

if histogram_depth_smooth_um is not None:
bins = np.arange(motion_histogram.shape[1]) * bin_um
bins = bins - np.mean(bins)
smooth_kernel = np.exp(-(bins**2) / (2 * histogram_depth_smooth_um**2))
smooth_kernel /= np.sum(smooth_kernel)

motion_histogram = scipy.signal.fftconvolve(motion_histogram, smooth_kernel[None, :], mode="same", axes=1)

if histogram_time_smooth_s is not None:
bins = np.arange(motion_histogram.shape[0]) * bin_duration_s
bins = bins - np.mean(bins)
smooth_kernel = np.exp(-(bins**2) / (2 * histogram_time_smooth_s**2))
smooth_kernel /= np.sum(smooth_kernel)
motion_histogram = scipy.signal.fftconvolve(motion_histogram, smooth_kernel[:, None], mode="same", axes=0)

if extra is not None:
extra["motion_histogram"] = motion_histogram
Expand Down
Loading

0 comments on commit 532ea48

Please sign in to comment.