python-neo
python-neo copied to clipboard
Spike2IO. AssertionError: Signal channel have differents pause so diffrents nb_segment
Good morning,
I am trying to read some .smr files from Spike2. It is working for some of the files (that I got from someone else) but it is not for some others. I think the files that I can not open are those in which different channels are available (like raw signal + filtered signal + spikes). I am just interested in the channels containing the raw signal, or analog signal, but I just can not open anything because I'm not able to read the file at all.
For these files, I get the following error when I run this :
reader = neo.io.Spike2IO(filename=spike2_filepath)
Traceback (most recent call last): File "
", line 1, in File "C:\Users\GARDy\AppData\Local\Continuum\anaconda3\envs\Deep_Learning0\lib\site-packages\neo\io\spike2io.py", line 10, in init BaseFromRaw.init(self, filename) File "C:\Users\GARDy\AppData\Local\Continuum\anaconda3\envs\Deep_Learning0\lib\site-packages\neo\io\basefromrawio.py", line 75, in init self.parse_header() File "C:\Users\GARDy\AppData\Local\Continuum\anaconda3\envs\Deep_Learning0\lib\site-packages\neo\rawio\baserawio.py", line 149, in parse_header self._parse_header() File "C:\Users\GARDy\AppData\Local\Continuum\anaconda3\envs\Deep_Learning0\lib\site-packages\neo\rawio\spike2rawio.py", line 157, in _parse_header 'Signal channel have differents pause so diffrents nb_segment' AssertionError: Signal channel have differents pause so diffrents nb_segment
Do you please have any idea about how I could solve this problem ?
Thanks a lot
When you channel are not symetric in spike2io you have to split then with:
reader = neo.io.Spike2IO(filename=spike2_filepath, try_signal_grouping=False)
Hi Samuel, thanks a lot for your quick answer !
I tried and got the exact same error.
Actually, the error that I have happens at line 154 in spike2rawio.py, and try_signal_grouping argument is called for the first time at line 266.
I tried to remove the following line (oups, I probably should not touch :'D)
assert np.all(all_nb_seg[0] == all_nb_seg), \ 'Signal channel have differents pause so diffrents nb_segment'
but got the following error :
Traceback (most recent call last): File "
", line 1, in File "C:\Users\GARDy\AppData\Local\Continuum\anaconda3\envs\Deep_Learning0\lib\site-packages\neo\io\spike2io.py", line 10, in init BaseFromRaw.init(self, filename) File "C:\Users\GARDy\AppData\Local\Continuum\anaconda3\envs\Deep_Learning0\lib\site-packages\neo\io\basefromrawio.py", line 75, in init self.parse_header() File "C:\Users\GARDy\AppData\Local\Continuum\anaconda3\envs\Deep_Learning0\lib\site-packages\neo\rawio\baserawio.py", line 149, in parse_header self._parse_header() File "C:\Users\GARDy\AppData\Local\Continuum\anaconda3\envs\Deep_Learning0\lib\site-packages\neo\rawio\spike2rawio.py", line 170, in _parse_header last_bl = gaps_block_ind[seg_ind] IndexError: index 0 is out of bounds for axis 0 with size 0
I'm trying to understand. I remove every changes I do in the original files after trying.
Can you you send me th file ?
Can you you send me th file ?
Sure ! Thank you
any news about that? I get the exact same error
I had this error message with older versions of neo (0.8.0 i i think) and some older versions of spike2 files and I think the issue stemmed from the size of the variable interval used to check for gaps. For some reason there seemed to be a 'dropped' data point in some of these older spike2 files and doubling the interval that is used to check for gaps seemed to solve the problem. Try adding this line after the the assignment of interval (line 129 on neo==0.10.0 or 126 on neo==0.9.0 of spike2rawio.py, i think):
interval = 2*interval
@samuelgarcia Did you receive the file by @LudovicGardy ?
Yes. I get the file. I tested it and the case was more complicated that it looks like.
Maybe this simple trick is enough.
@pnm4sfix : interval = intervael * 2
is a lot does it also work with 1.5
?
Or maybe we could add a parameters for this tolerance in gap detection.
I'll try and dig out the old file and give it a go- is interval equivalent to sampling interval? Also on a side note- I'm working from Windows and the developers guide is unix specific - is there anything I'd need to do different to contribute from windows? big fan of neo but looking to expand some of the image sequence functionality for calcium imaging analysis
Any news on that? I am working on a mac m1 on neo 0.10.0. I am getting the exact same error.I inserted a line 129:
interval = 2*interval
and
interval = 20*interval
In both cases,the error remains the same.
Not yet on this. Sorry I try my best to fix this soon.