Skip to content

Handling long recordings #251

@JoeZiminski

Description

@JoeZiminski

Hey! A colleague is trying to load some long recordings, and we are getting the following error:

(aeon_mecha_ephys) C:\Users\Adrian\OneDrive - University College London\code\aeon_mecha>sigui --curation "W:\aeon\dj_store\ephys-processed\social-ephys0.1-aeon3\ephys_blocks\2024-06-04T11-00-00_2024-06-05T17-00-00\0-95\kilosort4_400\sorting_analyzer"
C:\Users\Adrian\anaconda3\envs\aeon_mecha_ephys\Lib\site-packages\spikeinterface_gui\traceview.py:177: RuntimeWarning: libshiboken: Overflow: Value 3341033399 exceeds limits of type  [signed] "int" (4bytes).

for:

self.scroll_time.setMaximum(length - 1)

This is because on the C++ side the number of samples overflows as Qt is fixed to int32.I thought maybe the easiest solution is to patch the values passed to/from the self.scroll_time, but it seems like there is some deeper integration with other objects, like TimeSeeker(). So maybe the below is not optimal, but for a quick patch one solution would be be to map between Python int and int32 just around the slider before passing to timeseek, and do not worry about handling this on the timeseek side (as there is no reason to, as Python int can handle arbitrarily large int). e.g.

INT32_MAX = 2147483647
    def _qt_update_scroll_limits(self):
        segment_index = self.controller.get_time()[1]
        length = self.controller.get_num_samples(segment_index)
        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)

       if length > INT32_MAX :
           length =  INT32_MAX 

        self.scroll_time.setMaximum(length - 1)

and

    def _qt_on_scroll_time(self, val):
        time = self.controller.sample_index_to_time(val)
        self.timeseeker.seek(time)

additionally converts back to the true time:

    def _qt_on_scroll_time(self, val):
        num_samples = <fetch the number of samples>
        if num_samples  > INT32_MAX :
              val = round(val * (num_samples/INT32_MAX ))
        time = self.controller.sample_index_to_time(val)
        self.timeseeker.seek(time)

Obviously this is pretty hacky and needs tidying up, but in theory what do people think? Is this issue likely to arise elsewhere?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions