Skip to content

Commit

Permalink
Merge pull request #3516 from cwindolf/np_ptp
Browse files Browse the repository at this point in the history
Remove remaining array.ptp()s
  • Loading branch information
alejoe91 authored Nov 2, 2024
2 parents 5bdcfce + 43b085f commit 151947a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
10 changes: 4 additions & 6 deletions src/spikeinterface/postprocessing/localization_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import warnings

import numpy as np
from spikeinterface.core import SortingAnalyzer, Templates, compute_sparsity
from spikeinterface.core.template_tools import _get_nbefore, get_dense_templates_array, get_template_extremum_channel

try:
import numba
Expand All @@ -12,10 +14,6 @@
HAVE_NUMBA = False


from spikeinterface.core import compute_sparsity, SortingAnalyzer, Templates
from spikeinterface.core.template_tools import get_template_extremum_channel, _get_nbefore, get_dense_templates_array


def compute_monopolar_triangulation(
sorting_analyzer_or_templates: SortingAnalyzer | Templates,
unit_ids=None,
Expand Down Expand Up @@ -110,7 +108,7 @@ def compute_monopolar_triangulation(
# wf is (nsample, nchan) - chann is only nieghboor
wf = templates[i, :, :][:, chan_inds]
if feature == "ptp":
wf_data = wf.ptp(axis=0)
wf_data = np.ptp(wf, axis=0)
elif feature == "energy":
wf_data = np.linalg.norm(wf, axis=0)
elif feature == "peak_voltage":
Expand Down Expand Up @@ -188,7 +186,7 @@ def compute_center_of_mass(
wf = templates[i, :, :]

if feature == "ptp":
wf_data = (wf[:, chan_inds]).ptp(axis=0)
wf_data = np.ptp(wf[:, chan_inds], axis=0)
elif feature == "mean":
wf_data = (wf[:, chan_inds]).mean(axis=0)
elif feature == "energy":
Expand Down
11 changes: 5 additions & 6 deletions src/spikeinterface/sortingcomponents/motion/dredge.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,19 @@
"""

import gc
import warnings

from tqdm.auto import trange
import numpy as np

import gc
from tqdm.auto import trange

from .motion_utils import (
Motion,
get_spatial_bin_edges,
get_spatial_windows,
get_window_domains,
scipy_conv1d,
make_2d_motion_histogram,
get_spatial_bin_edges,
scipy_conv1d,
)


Expand Down Expand Up @@ -979,7 +978,7 @@ def xcorr_windows(

if max_disp_um is None:
if rigid:
max_disp_um = int(spatial_bin_edges_um.ptp() // 4)
max_disp_um = int(np.ptp(spatial_bin_edges_um) // 4)
else:
max_disp_um = int(win_scale_um // 4)

Expand Down

0 comments on commit 151947a

Please sign in to comment.