Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 16, 2023
1 parent 07736fd commit 4da65ed
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/spikeinterface/widgets/_legacy_mpl_widgets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# peak activity
from .activity import plot_peak_activity_map, PeakActivityMapWidget

Expand Down
12 changes: 4 additions & 8 deletions src/spikeinterface/widgets/isi_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from .utils import get_unit_colors



class ISIDistributionWidget(BaseWidget):
"""
Plots spike train ISI distribution.
Expand All @@ -20,13 +19,10 @@ class ISIDistributionWidget(BaseWidget):
Bin size in ms
window_ms: float
Window size in ms
"""
def __init__(
self, sorting, unit_ids=None, window_ms=100.0, bin_ms=1.0, backend=None, **backend_kwargs
):
"""

def __init__(self, sorting, unit_ids=None, window_ms=100.0, bin_ms=1.0, backend=None, **backend_kwargs):
if unit_ids is None:
unit_ids = sorting.get_unit_ids()

Expand All @@ -53,14 +49,14 @@ def plot_matplotlib(self, data_plot, **backend_kwargs):
sorting = dp.sorting
num_segments = sorting.get_num_segments()
fs = sorting.sampling_frequency

for i, unit_id in enumerate(dp.unit_ids):
ax = self.axes.flatten()[i]

bins = np.arange(0, dp.window_ms, dp.bin_ms)
bin_counts = None
for segment_index in range(num_segments):
times_ms = sorting.get_unit_spike_train(unit_id=unit_id, segment_index=segment_index) / fs * 1000.
times_ms = sorting.get_unit_spike_train(unit_id=unit_id, segment_index=segment_index) / fs * 1000.0
isi = np.diff(times_ms)

bin_counts_, bin_edges = np.histogram(isi, bins=bins, density=True)
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/widgets/tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ def test_isi_distribution(self):
**self.backend_kwargs[backend],
)


def test_amplitudes(self):
possible_backends = list(sw.AmplitudesWidget.get_possible_backends())
for backend in possible_backends:
Expand Down Expand Up @@ -377,7 +376,6 @@ def test_plot_unit_probe_map(self):
for backend in possible_backends:
if backend not in self.skip_backends:
sw.plot_unit_probe_map(self.we_dense)



if __name__ == "__main__":
Expand Down
5 changes: 2 additions & 3 deletions src/spikeinterface/widgets/unit_probe_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# from probeinterface import ProbeGroup

from .base import BaseWidget, to_attr

# from .utils import get_unit_colors
from ..core.waveform_extractor import WaveformExtractor

Expand All @@ -26,6 +27,7 @@ class UnitProbeMapWidget(BaseWidget):
with_channel_ids: bool False default
add channel ids text on the probe
"""

def __init__(
self,
waveform_extractor,
Expand All @@ -37,15 +39,13 @@ def __init__(
backend=None,
**backend_kwargs,
):

if unit_ids is None:
unit_ids = waveform_extractor.sorting.unit_ids
self.unit_ids = unit_ids
if channel_ids is None:
channel_ids = waveform_extractor.recording.channel_ids
self.channel_ids = channel_ids


data_plot = dict(
waveform_extractor=waveform_extractor,
unit_ids=unit_ids,
Expand All @@ -71,7 +71,6 @@ def plot_matplotlib(self, data_plot, **backend_kwargs):

self.figure, self.axes, self.ax = make_mpl_figure(**backend_kwargs)


we = dp.waveform_extractor
probe = we.get_probe()

Expand Down

0 comments on commit 4da65ed

Please sign in to comment.