Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion spikeinterface_gui/tracemapview.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from .traceview import MixinViewTrace, find_nearest_spike

INT32_MAX = 2147483647

class TraceMapView(ViewBase, MixinViewTrace):
id = "tracemap"
Expand Down Expand Up @@ -134,11 +135,16 @@ def _qt_seek(self, t):

self.scroll_time.valueChanged.disconnect(self._qt_on_scroll_time)
value = self.controller.time_to_sample_index(t)

segment_index = self.controller.get_time()[1]
num_samples = self.controller.get_num_samples(segment_index)
if num_samples > INT32_MAX:
value = round((value * INT32_MAX) / num_samples)

self.scroll_time.setValue(value)
self.scroll_time.setPageStep(int(sr*xsize))
self.scroll_time.valueChanged.connect(self._qt_on_scroll_time)

segment_index = self.controller.get_time()[1]
times_chunk, data_curves, scatter_x, scatter_y, scatter_colors = \
self.get_data_in_chunk(t1, t2, segment_index)
data_curves = data_curves.T
Expand Down
21 changes: 20 additions & 1 deletion spikeinterface_gui/traceview.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# * segment change
# *

INT32_MAX = 2147483647

class MixinViewTrace:

MAX_RETRIEVE_TIME_FOR_BUSY_CURSOR = 0.5 # seconds
Expand Down Expand Up @@ -174,7 +176,13 @@ def _qt_update_scroll_limits(self):
t_start, t_stop = self.controller.get_t_start_t_stop()
self.timeseeker.set_start_stop(t_start, t_stop, seek=False)
self.scroll_time.setMinimum(0)
self.scroll_time.setMaximum(length - 1)

if length > INT32_MAX:
slider_max = INT32_MAX
else:
slider_max = length - 1

self.scroll_time.setMaximum(slider_max)

def _qt_change_segment(self, segment_index):
#TODO: dirty because now seg_pos IS segment_index
Expand Down Expand Up @@ -214,6 +222,11 @@ def _qt_xsize_zoom(self, xmove):
self.spinbox_xsize.setValue(newsize)

def _qt_on_scroll_time(self, val):
segment_index = self.controller.get_time()[1]
num_samples = self.controller.get_num_samples(segment_index)
if num_samples > INT32_MAX:
val = round(val * (num_samples / INT32_MAX))

time = self.controller.sample_index_to_time(val)
self.timeseeker.seek(time)

Expand Down Expand Up @@ -501,6 +514,12 @@ def _qt_seek(self, t):

self.scroll_time.valueChanged.disconnect(self._qt_on_scroll_time)
value = self.controller.time_to_sample_index(t)

segment_index = self.controller.get_time()[1]
num_samples = self.controller.get_num_samples(segment_index)
if num_samples > INT32_MAX:
value = round((value * INT32_MAX) / num_samples)

self.scroll_time.setValue(value)
self.scroll_time.setPageStep(int(sr*xsize))
self.scroll_time.valueChanged.connect(self._qt_on_scroll_time)
Expand Down