From 37f961cbf9d3a18d6c6b3e2c44d9ee11723a2b51 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Thu, 29 Apr 2021 18:07:53 +0200 Subject: [PATCH 01/16] Start maxwell implementation. --- neo/rawio/__init__.py | 7 ++ neo/rawio/maxwellrawio.py | 168 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 175 insertions(+) create mode 100644 neo/rawio/maxwellrawio.py diff --git a/neo/rawio/__init__.py b/neo/rawio/__init__.py index 9a27d93f5..85c72b8ca 100644 --- a/neo/rawio/__init__.py +++ b/neo/rawio/__init__.py @@ -19,6 +19,7 @@ * :attr:`BrainVisionRawIO` * :attr:`ElanRawIO` * :attr:`IntanRawIO` +* :attr:`MaxwellRawIO` * :attr:`MEArecRawIO` * :attr:`MicromedRawIO` * :attr:`NeuralynxRawIO` @@ -66,6 +67,10 @@ .. autoattribute:: extensions +.. autoclass:: neo.rawio.MaxwellRawIO + + .. autoattribute:: extensions + .. autoclass:: neo.rawio.MEArecRawIO .. autoattribute:: extensions @@ -145,6 +150,7 @@ from neo.rawio.elanrawio import ElanRawIO from neo.rawio.examplerawio import ExampleRawIO from neo.rawio.intanrawio import IntanRawIO +from neo.rawio.maxwellrawio import MaxwellRawIO from neo.rawio.mearecrawio import MEArecRawIO from neo.rawio.micromedrawio import MicromedRawIO from neo.rawio.neuralynxrawio import NeuralynxRawIO @@ -172,6 +178,7 @@ ElanRawIO, IntanRawIO, MicromedRawIO, + MaxwellRawIO, MEArecRawIO, NeuralynxRawIO, NeuroExplorerRawIO, diff --git a/neo/rawio/maxwellrawio.py b/neo/rawio/maxwellrawio.py new file mode 100644 index 000000000..cce93d40f --- /dev/null +++ b/neo/rawio/maxwellrawio.py @@ -0,0 +1,168 @@ +""" +Class for reading data from maxwell biosystem device: + * MaxOne + * MaxTwo + +https://www.mxwbio.com/resources/mea/ + +The implementation is a mix between: + * the implementation in spikeextractors + https://github.com/SpikeInterface/spikeextractors/blob/master/spikeextractors/extractors/maxwellextractors/maxwellextractors.py + * the implementation in spyking-circus + https://github.com/spyking-circus/spyking-circus/blob/master/circus/files/maxwell.py + + + +Author : Samuel Garcia +""" + +from .baserawio import (BaseRawIO, _signal_channel_dtype, _signal_stream_dtype, + _spike_channel_dtype, _event_channel_dtype) + +import numpy as np + +try: + import h5py + HAVE_H5 = True +except: + HAVE_H5 = False + + +class MaxwellRawIO(BaseRawIO): + """ + Class for reading MaxOne or MaxTwo files. + """ + extensions = ['h5'] + rawmode = 'one-file' + + def __init__(self, filename='', rec_name=None): + BaseRawIO.__init__(self) + self.filename = filename + self.rec_name = rec_name + + def _source_name(self): + return self.filename + + def _parse_header(self): + try: + import MEArec as mr + HAVE_MEAREC = True + except ImportError: + HAVE_MEAREC = False + assert HAVE_H5, 'h5py is not installed' + + h5 = h5py.File(self.filename, mode='r') + self.h5_file = h5 + version = h5['version'][0].decode() + + signal_streams = [] + self._signals = {} + if int(version) == 20160704: + # one stream only + #~ sampling_rate = 20000. + #~ gain_uV = h5['settings']['lsb'][0] * 1e6 + # one segment + self._signals['well000'] = h5['sig'] + + signal_streams.append(('well000', 'well000')) + elif int(version) > 20160704: + # multi stream stream (one well is one stream) + + stream_ids = list(h5['wells'].keys()) + for stream_id in stream_ids: + rec_names = list(h5['wells'][stream_id].keys()) + if len(rec_names) > 1: + if self.rec_name is not None: + raise ValueError('several recording need select with rec_name="rec0000"') + else: + self.rec_name = rec_names[0] + + #~ settings = h5['wells'][stream_id][self.rec_name]['settings'] + #~ gain_uV = settings['lsb'][:][0] * 1e6 + signal_streams.append((stream_id, stream_id)) + + sig_path = h5['wells'][stream_id][self.rec_name]['groups']['routed']['raw'] + self._signals[stream_id] = sig_path + + signal_streams = np.array(signal_streams, dtype=_signal_stream_dtype) + print(signal_streams) + + sig_channels = [] + for stream_id in signal_streams['id']: + if int(version) == 20160704: + sr = 20000. + gain_uV = h5['settings']['lsb'][0] * 1e6 + elif int(version) > 20160704: + settings = h5['wells'][stream_id][self.rec_name]['settings'] + sr = settings['sampling'][:][0] + gain_uV = settings['lsb'][:][0] * 1e6 + mapping = settings['mapping'] + channel_ids = np.array(mapping['channel']) + electrode_ids = np.array(mapping['electrode']) + mask = channel_ids >= 0 + channel_ids = channel_ids[mask] + electrode_ids = electrode_ids[mask] + + for i, chan_id in enumerate(channel_ids): + elec_id = electrode_ids[i] + ch_name = f'ch{chan_id} elec{elec_id}' + offset_uV = 0 + sig_channels.append((ch_name, str(chan_id), sr, 'uint16', 'uV', gain_uV, offset_uV, stream_id)) + + sig_channels = np.array(sig_channels, dtype=_signal_channel_dtype) + + spike_channels = [] + spike_channels = np.array(spike_channels, dtype=_spike_channel_dtype) + + event_channels = [] + event_channels = np.array(event_channels, dtype=_event_channel_dtype) + + self.header = {} + self.header['nb_block'] = 1 + self.header['nb_segment'] = [1] + self.header['signal_streams'] = signal_streams + self.header['signal_channels'] = sig_channels + self.header['spike_channels'] = spike_channels + self.header['event_channels'] = event_channels + + self._generate_minimal_annotations() + bl_ann = self.raw_annotations['blocks'][0] + bl_ann['maxwell_version'] = version + + def _segment_t_start(self, block_index, seg_index): + return 0. + + def _segment_t_stop(self, block_index, seg_index): + # TODO + return 1000. + + def _get_signal_size(self, block_index, seg_index, stream_index): + stream_id = self.header['signal_streams'][stream_index]['id'] + sigs = self._signals[stream_id] + return sigs.shape[1] + + def _get_signal_t_start(self, block_index, seg_index, stream_index): + return 0. + + def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, + stream_index, channel_indexes): + + stream_id = self.header['signal_streams'][stream_index]['id'] + sigs = self._signals[stream_id] + print(sigs) + + if i_start is None: + i_start = 0 + if i_stop is None: + i_stop = sigs.shape[1] + + + + if channel_indexes is None: + channel_indexes = slice(None) + + sigs = sigs[channel_indexes, i_start:i_stop] + sigs =sigs.T + + return sigs + From 6b5eca3845bbd34e38c15b6c9139c008aac0d921 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Fri, 30 Apr 2021 11:08:41 +0200 Subject: [PATCH 02/16] Implement maxwell reader. --- neo/io/__init__.py | 7 +++ neo/io/maxwellio.py | 9 ++++ neo/rawio/maxwellrawio.py | 70 ++++++++++++++----------- neo/test/iotest/test_maxwellio.py | 14 +++++ neo/test/rawiotest/test_maxwellrawio.py | 14 +++++ 5 files changed, 84 insertions(+), 30 deletions(-) create mode 100644 neo/io/maxwellio.py create mode 100644 neo/test/iotest/test_maxwellio.py create mode 100644 neo/test/rawiotest/test_maxwellrawio.py diff --git a/neo/io/__init__.py b/neo/io/__init__.py index ed8796b21..868fe5490 100644 --- a/neo/io/__init__.py +++ b/neo/io/__init__.py @@ -34,6 +34,7 @@ * :attr:`MEArecIO` * :attr:`KlustaKwikIO` * :attr:`KwikIO` +* :attr:`MaxwellIO` * :attr:`MicromedIO` * :attr:`NeoMatlabIO` * :attr:`NestIO` @@ -142,6 +143,10 @@ .. autoattribute:: extensions +.. autoclass:: neo.io.MaxwellIO + + .. autoattribute:: extensions + .. autoclass:: neo.io.MicromedIO .. autoattribute:: extensions @@ -272,6 +277,7 @@ from neo.io.klustakwikio import KlustaKwikIO from neo.io.kwikio import KwikIO from neo.io.mearecio import MEArecIO +from neo.io.maxwellio import MaxwellIO from neo.io.micromedio import MicromedIO from neo.io.neomatlabio import NeoMatlabIO from neo.io.nestio import NestIO @@ -318,6 +324,7 @@ KlustaKwikIO, KwikIO, MEArecIO, + MaxwellIO, MicromedIO, NixIO, # place NixIO before other IOs that use HDF5 to make it the default for .h5 files NeoMatlabIO, diff --git a/neo/io/maxwellio.py b/neo/io/maxwellio.py new file mode 100644 index 000000000..d548dd2ca --- /dev/null +++ b/neo/io/maxwellio.py @@ -0,0 +1,9 @@ +from neo.io.basefromrawio import BaseFromRaw +from neo.rawio.maxwellrawio import MaxwellRawIO + + +class MaxwellIO(MaxwellRawIO, BaseFromRaw): + mode = 'file' + def __init__(self, filename): + MaxwellRawIO.__init__(self, filename=filename) + BaseFromRaw.__init__(self, filename) diff --git a/neo/rawio/maxwellrawio.py b/neo/rawio/maxwellrawio.py index cce93d40f..a7b748893 100644 --- a/neo/rawio/maxwellrawio.py +++ b/neo/rawio/maxwellrawio.py @@ -11,9 +11,11 @@ * the implementation in spyking-circus https://github.com/spyking-circus/spyking-circus/blob/master/circus/files/maxwell.py +The implementation do not handle spike at the moment. +For maxtwo device, each well will be a different signal stream. -Author : Samuel Garcia +Author : Samuel Garcia, Alessio Buccino, Pierre Yger """ from .baserawio import (BaseRawIO, _signal_channel_dtype, _signal_stream_dtype, @@ -34,7 +36,7 @@ class MaxwellRawIO(BaseRawIO): """ extensions = ['h5'] rawmode = 'one-file' - + def __init__(self, filename='', rec_name=None): BaseRawIO.__init__(self) self.filename = filename @@ -50,48 +52,39 @@ def _parse_header(self): except ImportError: HAVE_MEAREC = False assert HAVE_H5, 'h5py is not installed' - + h5 = h5py.File(self.filename, mode='r') self.h5_file = h5 version = h5['version'][0].decode() - + + # create signal stream + # one stream per well signal_streams = [] - self._signals = {} if int(version) == 20160704: - # one stream only - #~ sampling_rate = 20000. - #~ gain_uV = h5['settings']['lsb'][0] * 1e6 - # one segment - self._signals['well000'] = h5['sig'] - signal_streams.append(('well000', 'well000')) elif int(version) > 20160704: # multi stream stream (one well is one stream) - stream_ids = list(h5['wells'].keys()) for stream_id in stream_ids: rec_names = list(h5['wells'][stream_id].keys()) if len(rec_names) > 1: if self.rec_name is not None: + #~ print(self.get_rec_list()) raise ValueError('several recording need select with rec_name="rec0000"') else: self.rec_name = rec_names[0] - - #~ settings = h5['wells'][stream_id][self.rec_name]['settings'] - #~ gain_uV = settings['lsb'][:][0] * 1e6 signal_streams.append((stream_id, stream_id)) - - sig_path = h5['wells'][stream_id][self.rec_name]['groups']['routed']['raw'] - self._signals[stream_id] = sig_path - signal_streams = np.array(signal_streams, dtype=_signal_stream_dtype) - print(signal_streams) - + + # create signal channels + max_sig_length = 0 + self._signals = {} sig_channels = [] for stream_id in signal_streams['id']: if int(version) == 20160704: sr = 20000. gain_uV = h5['settings']['lsb'][0] * 1e6 + sigs = h5['sig'] elif int(version) > 20160704: settings = h5['wells'][stream_id][self.rec_name]['settings'] sr = settings['sampling'][:][0] @@ -102,12 +95,19 @@ def _parse_header(self): mask = channel_ids >= 0 channel_ids = channel_ids[mask] electrode_ids = electrode_ids[mask] + sigs = h5['wells'][stream_id][self.rec_name]['groups']['routed']['raw'] + for i, chan_id in enumerate(channel_ids): elec_id = electrode_ids[i] ch_name = f'ch{chan_id} elec{elec_id}' offset_uV = 0 sig_channels.append((ch_name, str(chan_id), sr, 'uint16', 'uV', gain_uV, offset_uV, stream_id)) + + self._signals[stream_id] = sigs + max_sig_length = max(max_sig_length, sigs.shape[1]) + + self._t_stop = max_sig_length / sr sig_channels = np.array(sig_channels, dtype=_signal_channel_dtype) @@ -133,8 +133,7 @@ def _segment_t_start(self, block_index, seg_index): return 0. def _segment_t_stop(self, block_index, seg_index): - # TODO - return 1000. + return self._t_stop def _get_signal_size(self, block_index, seg_index, stream_index): stream_id = self.header['signal_streams'][stream_index]['id'] @@ -146,23 +145,34 @@ def _get_signal_t_start(self, block_index, seg_index, stream_index): def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, stream_index, channel_indexes): - stream_id = self.header['signal_streams'][stream_index]['id'] sigs = self._signals[stream_id] - print(sigs) if i_start is None: i_start = 0 if i_stop is None: i_stop = sigs.shape[1] - - if channel_indexes is None: channel_indexes = slice(None) - - sigs = sigs[channel_indexes, i_start:i_stop] + + try: + sigs = sigs[channel_indexes, i_start:i_stop] + except OSError as e: + print('*'*10) + print(_hdf_maxwell_error) + print('*'*10) + raise(e) sigs =sigs.T - + return sigs + +_hdf_maxwell_error = """Maxwell file format is based on HDF5. +The internal compression custum plugin!!! +This is a big pain for the end user. +You, as a end user, should ask Maxwell company to change this. +Please visit this page and install what is missing: +https://share.mxwbio.com/d/4742248b2e674a85be97/ +Then, you will need to do something like this in your code +os.environ['HDF5_PLUGIN_PATH'] = '/path/to/cutum/hdf5/plugin/'""" diff --git a/neo/test/iotest/test_maxwellio.py b/neo/test/iotest/test_maxwellio.py new file mode 100644 index 000000000..f07819b59 --- /dev/null +++ b/neo/test/iotest/test_maxwellio.py @@ -0,0 +1,14 @@ +import unittest + +from neo.io import MaxwellIO +from neo.test.iotest.common_io_test import BaseTestIO + + +class TestMaxwellIO(BaseTestIO, unittest.TestCase, ): + ioclass = MaxwellIO + files_to_test = [] + files_to_download = files_to_test + + +if __name__ == "__main__": + unittest.main() diff --git a/neo/test/rawiotest/test_maxwellrawio.py b/neo/test/rawiotest/test_maxwellrawio.py new file mode 100644 index 000000000..820194788 --- /dev/null +++ b/neo/test/rawiotest/test_maxwellrawio.py @@ -0,0 +1,14 @@ +import unittest + +from neo.rawio.maxwellrawio import MaxwellRawIO +from neo.test.rawiotest.common_rawio_test import BaseTestRawIO + + +class TestMaxwellRawIO(BaseTestRawIO, unittest.TestCase, ): + rawioclass = MaxwellRawIO + entities_to_test = [] + files_to_download = entities_to_test + + +if __name__ == "__main__": + unittest.main() From acad955339460e609dcf2d53543b6445f7e54944 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Fri, 30 Apr 2021 11:15:46 +0200 Subject: [PATCH 03/16] Better handling for maxtwo. --- neo/rawio/maxwellrawio.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/neo/rawio/maxwellrawio.py b/neo/rawio/maxwellrawio.py index a7b748893..c1a13fd4d 100644 --- a/neo/rawio/maxwellrawio.py +++ b/neo/rawio/maxwellrawio.py @@ -68,9 +68,9 @@ def _parse_header(self): for stream_id in stream_ids: rec_names = list(h5['wells'][stream_id].keys()) if len(rec_names) > 1: - if self.rec_name is not None: - #~ print(self.get_rec_list()) - raise ValueError('several recording need select with rec_name="rec0000"') + if self.rec_name is None: + raise ValueError('several recording need select with rec_name="rec0000"'\ + f'\nPossible rec_name {rec_names}') else: self.rec_name = rec_names[0] signal_streams.append((stream_id, stream_id)) From 4fdb9cf8e64bdf2648be67f6becabb83c3af935c Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 5 May 2021 17:07:13 +0200 Subject: [PATCH 04/16] Add maxwell files. --- neo/test/iotest/test_maxwellio.py | 9 +++++++-- neo/test/rawiotest/test_maxwellrawio.py | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/neo/test/iotest/test_maxwellio.py b/neo/test/iotest/test_maxwellio.py index f07819b59..767023673 100644 --- a/neo/test/iotest/test_maxwellio.py +++ b/neo/test/iotest/test_maxwellio.py @@ -6,8 +6,13 @@ class TestMaxwellIO(BaseTestIO, unittest.TestCase, ): ioclass = MaxwellIO - files_to_test = [] - files_to_download = files_to_test + entities_to_download = [ + 'maxwell' + ] + entities_to_test = files_to_test = [ + 'maxwell/MaxOne_data/Record/000011/data.raw.h5', + 'maxwell/MaxTwo_data/Network/000028/data.raw.h5' + ] if __name__ == "__main__": diff --git a/neo/test/rawiotest/test_maxwellrawio.py b/neo/test/rawiotest/test_maxwellrawio.py index 820194788..01fc74f4d 100644 --- a/neo/test/rawiotest/test_maxwellrawio.py +++ b/neo/test/rawiotest/test_maxwellrawio.py @@ -6,8 +6,13 @@ class TestMaxwellRawIO(BaseTestRawIO, unittest.TestCase, ): rawioclass = MaxwellRawIO - entities_to_test = [] - files_to_download = entities_to_test + entities_to_download = [ + 'maxwell' + ] + entities_to_test = files_to_test = [ + 'maxwell/MaxOne_data/Record/000011/data.raw.h5', + 'maxwell/MaxTwo_data/Network/000028/data.raw.h5' + ] if __name__ == "__main__": From 06caa2bfd2ffe0d6c5560d3bdba09dbb2cf2d407 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 5 May 2021 17:13:42 +0200 Subject: [PATCH 05/16] pep8 --- neo/io/maxwellio.py | 1 + neo/rawio/maxwellrawio.py | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/neo/io/maxwellio.py b/neo/io/maxwellio.py index d548dd2ca..f5edc726e 100644 --- a/neo/io/maxwellio.py +++ b/neo/io/maxwellio.py @@ -4,6 +4,7 @@ class MaxwellIO(MaxwellRawIO, BaseFromRaw): mode = 'file' + def __init__(self, filename): MaxwellRawIO.__init__(self, filename=filename) BaseFromRaw.__init__(self, filename) diff --git a/neo/rawio/maxwellrawio.py b/neo/rawio/maxwellrawio.py index c1a13fd4d..7c6d0ada3 100644 --- a/neo/rawio/maxwellrawio.py +++ b/neo/rawio/maxwellrawio.py @@ -2,11 +2,11 @@ Class for reading data from maxwell biosystem device: * MaxOne * MaxTwo - + https://www.mxwbio.com/resources/mea/ The implementation is a mix between: - * the implementation in spikeextractors + * the implementation in spikeextractors https://github.com/SpikeInterface/spikeextractors/blob/master/spikeextractors/extractors/maxwellextractors/maxwellextractors.py * the implementation in spyking-circus https://github.com/spyking-circus/spyking-circus/blob/master/circus/files/maxwell.py @@ -36,8 +36,8 @@ class MaxwellRawIO(BaseRawIO): """ extensions = ['h5'] rawmode = 'one-file' - - def __init__(self, filename='', rec_name=None): + + def __init__(self, filename='', rec_name=None): BaseRawIO.__init__(self) self.filename = filename self.rec_name = rec_name @@ -69,7 +69,7 @@ def _parse_header(self): rec_names = list(h5['wells'][stream_id].keys()) if len(rec_names) > 1: if self.rec_name is None: - raise ValueError('several recording need select with rec_name="rec0000"'\ + raise ValueError('several recording need select with rec_name="rec0000"' f'\nPossible rec_name {rec_names}') else: self.rec_name = rec_names[0] @@ -96,17 +96,17 @@ def _parse_header(self): channel_ids = channel_ids[mask] electrode_ids = electrode_ids[mask] sigs = h5['wells'][stream_id][self.rec_name]['groups']['routed']['raw'] - for i, chan_id in enumerate(channel_ids): elec_id = electrode_ids[i] ch_name = f'ch{chan_id} elec{elec_id}' offset_uV = 0 - sig_channels.append((ch_name, str(chan_id), sr, 'uint16', 'uV', gain_uV, offset_uV, stream_id)) - + sig_channels.append((ch_name, str(chan_id), sr, 'uint16', 'uV', + gain_uV, offset_uV, stream_id)) + self._signals[stream_id] = sigs max_sig_length = max(max_sig_length, sigs.shape[1]) - + self._t_stop = max_sig_length / sr sig_channels = np.array(sig_channels, dtype=_signal_channel_dtype) @@ -136,7 +136,7 @@ def _segment_t_stop(self, block_index, seg_index): return self._t_stop def _get_signal_size(self, block_index, seg_index, stream_index): - stream_id = self.header['signal_streams'][stream_index]['id'] + stream_id = self.header['signal_streams'][stream_index]['id'] sigs = self._signals[stream_id] return sigs.shape[1] @@ -145,7 +145,7 @@ def _get_signal_t_start(self, block_index, seg_index, stream_index): def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, stream_index, channel_indexes): - stream_id = self.header['signal_streams'][stream_index]['id'] + stream_id = self.header['signal_streams'][stream_index]['id'] sigs = self._signals[stream_id] if i_start is None: @@ -159,11 +159,11 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, try: sigs = sigs[channel_indexes, i_start:i_stop] except OSError as e: - print('*'*10) + print('*' * 10) print(_hdf_maxwell_error) - print('*'*10) + print('*' * 10) raise(e) - sigs =sigs.T + sigs = sigs.T return sigs From af30009beb35df6e4b941d200d450d0f7690f349 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Thu, 6 May 2021 17:01:20 +0200 Subject: [PATCH 06/16] Fix bug for OLD format by Alessio. --- neo/rawio/maxwellrawio.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/neo/rawio/maxwellrawio.py b/neo/rawio/maxwellrawio.py index 7c6d0ada3..521bc6be4 100644 --- a/neo/rawio/maxwellrawio.py +++ b/neo/rawio/maxwellrawio.py @@ -61,9 +61,11 @@ def _parse_header(self): # one stream per well signal_streams = [] if int(version) == 20160704: + self._old_format = True signal_streams.append(('well000', 'well000')) elif int(version) > 20160704: # multi stream stream (one well is one stream) + self._old_format = False stream_ids = list(h5['wells'].keys()) for stream_id in stream_ids: rec_names = list(h5['wells'][stream_id].keys()) @@ -85,18 +87,23 @@ def _parse_header(self): sr = 20000. gain_uV = h5['settings']['lsb'][0] * 1e6 sigs = h5['sig'] + mapping = h5["mapping"] + ids = np.array(mapping['channel']) + ids = ids[ids >= 0] + self._channel_slice = ids elif int(version) > 20160704: settings = h5['wells'][stream_id][self.rec_name]['settings'] sr = settings['sampling'][:][0] gain_uV = settings['lsb'][:][0] * 1e6 mapping = settings['mapping'] - channel_ids = np.array(mapping['channel']) - electrode_ids = np.array(mapping['electrode']) - mask = channel_ids >= 0 - channel_ids = channel_ids[mask] - electrode_ids = electrode_ids[mask] sigs = h5['wells'][stream_id][self.rec_name]['groups']['routed']['raw'] + channel_ids = np.array(mapping['channel']) + electrode_ids = np.array(mapping['electrode']) + mask = channel_ids >= 0 + channel_ids = channel_ids[mask] + electrode_ids = electrode_ids[mask] + for i, chan_id in enumerate(channel_ids): elec_id = electrode_ids[i] ch_name = f'ch{chan_id} elec{elec_id}' @@ -157,7 +164,11 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, channel_indexes = slice(None) try: - sigs = sigs[channel_indexes, i_start:i_stop] + if self._old_format: + sigs = sigs[self._channel_slice, i_start:i_stop] + sigs = sigs[channel_indexes] + else: + sigs = sigs[channel_indexes, i_start:i_stop] except OSError as e: print('*' * 10) print(_hdf_maxwell_error) From b19415cab3ee5da44c1b0662cb5e1f976da475ce Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 12 May 2021 08:47:59 +0200 Subject: [PATCH 07/16] Disable test in GH actions because this reader need custum HDF5 plugin from maxwell. --- neo/rawio/maxwellrawio.py | 2 +- neo/test/iotest/test_maxwellio.py | 3 +++ neo/test/rawiotest/test_maxwellrawio.py | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/neo/rawio/maxwellrawio.py b/neo/rawio/maxwellrawio.py index 521bc6be4..9b23c253c 100644 --- a/neo/rawio/maxwellrawio.py +++ b/neo/rawio/maxwellrawio.py @@ -26,7 +26,7 @@ try: import h5py HAVE_H5 = True -except: +except ImportError: HAVE_H5 = False diff --git a/neo/test/iotest/test_maxwellio.py b/neo/test/iotest/test_maxwellio.py index 767023673..30ed9c6e3 100644 --- a/neo/test/iotest/test_maxwellio.py +++ b/neo/test/iotest/test_maxwellio.py @@ -1,9 +1,12 @@ import unittest +import os from neo.io import MaxwellIO from neo.test.iotest.common_io_test import BaseTestIO +in_gh_actions = os.getenv('GITHUB_ACTIONS', 'False') == True +@unittest.skipUnless(not in_gh_actions, "Need specific hdf5 plugin") class TestMaxwellIO(BaseTestIO, unittest.TestCase, ): ioclass = MaxwellIO entities_to_download = [ diff --git a/neo/test/rawiotest/test_maxwellrawio.py b/neo/test/rawiotest/test_maxwellrawio.py index 01fc74f4d..97a69e8e8 100644 --- a/neo/test/rawiotest/test_maxwellrawio.py +++ b/neo/test/rawiotest/test_maxwellrawio.py @@ -1,9 +1,12 @@ import unittest +import os from neo.rawio.maxwellrawio import MaxwellRawIO from neo.test.rawiotest.common_rawio_test import BaseTestRawIO +in_gh_actions = os.getenv('GITHUB_ACTIONS', 'False') == True +@unittest.skipUnless(not in_gh_actions, "Need specific hdf5 plugin") class TestMaxwellRawIO(BaseTestRawIO, unittest.TestCase, ): rawioclass = MaxwellRawIO entities_to_download = [ From 83c9002e3fab6e64ef351a8196b92e90ba0d0de6 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 12 May 2021 09:25:02 +0200 Subject: [PATCH 08/16] Add dataset.merge() if the local folder exists to update changes. --- neo/utils/datasets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neo/utils/datasets.py b/neo/utils/datasets.py index 58a8af29a..409280a65 100644 --- a/neo/utils/datasets.py +++ b/neo/utils/datasets.py @@ -66,7 +66,7 @@ def download_dataset(repo=default_testing_repo, remote_path=None, local_folder=N if local_folder.exists(): dataset = datalad.api.Dataset(path=local_folder) - # TODO : some kind git pull to update distant change ?? + dataset.update(merge=True) else: dataset = datalad.api.install(path=local_folder, source=repo) From 5fca8b224abbfdb85bc6edc73031bc90dc0963e2 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 12 May 2021 09:46:42 +0200 Subject: [PATCH 09/16] Add auto_install_maxwell_hdf5_compression_plugin() --- neo/rawio/maxwellrawio.py | 35 +++++++++++++++++++++++-- neo/test/rawiotest/test_maxwellrawio.py | 7 ++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/neo/rawio/maxwellrawio.py b/neo/rawio/maxwellrawio.py index 9b23c253c..868ac8418 100644 --- a/neo/rawio/maxwellrawio.py +++ b/neo/rawio/maxwellrawio.py @@ -17,6 +17,10 @@ Author : Samuel Garcia, Alessio Buccino, Pierre Yger """ +import os +from pathlib import Path +import platform +from urllib.request import urlopen from .baserawio import (BaseRawIO, _signal_channel_dtype, _signal_stream_dtype, _spike_channel_dtype, _event_channel_dtype) @@ -180,10 +184,37 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, _hdf_maxwell_error = """Maxwell file format is based on HDF5. -The internal compression custum plugin!!! +The internal compression need a custum plugin!!! This is a big pain for the end user. You, as a end user, should ask Maxwell company to change this. Please visit this page and install what is missing: https://share.mxwbio.com/d/4742248b2e674a85be97/ Then, you will need to do something like this in your code -os.environ['HDF5_PLUGIN_PATH'] = '/path/to/cutum/hdf5/plugin/'""" +os.environ['HDF5_PLUGIN_PATH'] = '/path/to/cutum/hdf5/plugin/' + +Alternatively, you can use the auto_install_maxwell_hdf5_compression_plugin() +function that do it automamagically. +""" + +def auto_install_maxwell_hdf5_compression_plugin(hdf5_plugin_path=None): + if hdf5_plugin_path is None: + hdf5_plugin_path = os.getenv('HDF5_PLUGIN_PATH', None) + if hdf5_plugin_path is None: + hdf5_plugin_path = Path.home() / 'hdf5_plugin_path_maxwell' + os.environ['HDF5_PLUGIN_PATH'] = str(hdf5_plugin_path) + hdf5_plugin_path = Path(hdf5_plugin_path) + hdf5_plugin_path.mkdir(exist_ok=True) + + if platform.system() == 'Linux': + remote_lib = 'https://share.mxwbio.com/d/4742248b2e674a85be97/files/?p=%2FLinux%2Flibcompression.so' + local_lib = hdf5_plugin_path / 'Flibcompression.so' + elif platform.system() == 'Darwin': + remote_lib = 'https://share.mxwbio.com/d/4742248b2e674a85be97/files/?p=%2FMacOS%2Flibcompression.dylib' + local_lib = hdf5_plugin_path / 'libcompression.dylib' + elif platform.system() == 'Windows': + remote_lib = 'https://share.mxwbio.com/d/4742248b2e674a85be97/files/?p=%2FWindows%2Fcompression.dll' + local_lib = hdf5_plugin_path / 'compression.dll' + + dist = urlopen(remote_lib) + with open(local_lib, 'wb') as f: + f.write(dist.read()) diff --git a/neo/test/rawiotest/test_maxwellrawio.py b/neo/test/rawiotest/test_maxwellrawio.py index 97a69e8e8..d3a822ce0 100644 --- a/neo/test/rawiotest/test_maxwellrawio.py +++ b/neo/test/rawiotest/test_maxwellrawio.py @@ -1,7 +1,8 @@ import unittest import os -from neo.rawio.maxwellrawio import MaxwellRawIO +from neo.rawio.maxwellrawio import (MaxwellRawIO, + auto_install_maxwell_hdf5_compression_plugin) from neo.test.rawiotest.common_rawio_test import BaseTestRawIO in_gh_actions = os.getenv('GITHUB_ACTIONS', 'False') == True @@ -17,6 +18,10 @@ class TestMaxwellRawIO(BaseTestRawIO, unittest.TestCase, ): 'maxwell/MaxTwo_data/Network/000028/data.raw.h5' ] + def setUp(self): + auto_install_maxwell_hdf5_compression_plugin() + print(os.environ['HDF5_PLUGIN_PATH']) + BaseTestRawIO.setUp(self) if __name__ == "__main__": unittest.main() From 7011fe541c5fbe799a4d7092d7627e4b035e902e Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 12 May 2021 09:54:38 +0200 Subject: [PATCH 10/16] clean --- neo/rawio/maxwellrawio.py | 1 + neo/test/iotest/test_maxwellio.py | 3 ++- neo/test/rawiotest/test_maxwellrawio.py | 7 ++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/neo/rawio/maxwellrawio.py b/neo/rawio/maxwellrawio.py index 868ac8418..1e3cd061e 100644 --- a/neo/rawio/maxwellrawio.py +++ b/neo/rawio/maxwellrawio.py @@ -196,6 +196,7 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, function that do it automamagically. """ + def auto_install_maxwell_hdf5_compression_plugin(hdf5_plugin_path=None): if hdf5_plugin_path is None: hdf5_plugin_path = os.getenv('HDF5_PLUGIN_PATH', None) diff --git a/neo/test/iotest/test_maxwellio.py b/neo/test/iotest/test_maxwellio.py index 30ed9c6e3..636f4f7d0 100644 --- a/neo/test/iotest/test_maxwellio.py +++ b/neo/test/iotest/test_maxwellio.py @@ -4,7 +4,8 @@ from neo.io import MaxwellIO from neo.test.iotest.common_io_test import BaseTestIO -in_gh_actions = os.getenv('GITHUB_ACTIONS', 'False') == True +in_gh_actions = os.getenv('GITHUB_ACTIONS', 'False') == 'true' + @unittest.skipUnless(not in_gh_actions, "Need specific hdf5 plugin") class TestMaxwellIO(BaseTestIO, unittest.TestCase, ): diff --git a/neo/test/rawiotest/test_maxwellrawio.py b/neo/test/rawiotest/test_maxwellrawio.py index d3a822ce0..0f725421f 100644 --- a/neo/test/rawiotest/test_maxwellrawio.py +++ b/neo/test/rawiotest/test_maxwellrawio.py @@ -1,11 +1,12 @@ import unittest import os -from neo.rawio.maxwellrawio import (MaxwellRawIO, +from neo.rawio.maxwellrawio import (MaxwellRawIO, auto_install_maxwell_hdf5_compression_plugin) from neo.test.rawiotest.common_rawio_test import BaseTestRawIO -in_gh_actions = os.getenv('GITHUB_ACTIONS', 'False') == True +in_gh_actions = os.getenv('GITHUB_ACTIONS', 'False') == 'true' + @unittest.skipUnless(not in_gh_actions, "Need specific hdf5 plugin") class TestMaxwellRawIO(BaseTestRawIO, unittest.TestCase, ): @@ -20,8 +21,8 @@ class TestMaxwellRawIO(BaseTestRawIO, unittest.TestCase, ): def setUp(self): auto_install_maxwell_hdf5_compression_plugin() - print(os.environ['HDF5_PLUGIN_PATH']) BaseTestRawIO.setUp(self) + if __name__ == "__main__": unittest.main() From d529e7853866d17faae9f9686e5d8288ce7e3cb4 Mon Sep 17 00:00:00 2001 From: Garcia Samuel Date: Fri, 21 May 2021 13:37:46 +0200 Subject: [PATCH 11/16] Apply suggestions from code review Co-authored-by: Julia Sprenger --- neo/rawio/maxwellrawio.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/neo/rawio/maxwellrawio.py b/neo/rawio/maxwellrawio.py index 1e3cd061e..4985e30b1 100644 --- a/neo/rawio/maxwellrawio.py +++ b/neo/rawio/maxwellrawio.py @@ -75,7 +75,7 @@ def _parse_header(self): rec_names = list(h5['wells'][stream_id].keys()) if len(rec_names) > 1: if self.rec_name is None: - raise ValueError('several recording need select with rec_name="rec0000"' + raise ValueError("Detected multiple recordings. Please select a single recording using the `rec_name` paramter." f'\nPossible rec_name {rec_names}') else: self.rec_name = rec_names[0] @@ -184,16 +184,16 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, _hdf_maxwell_error = """Maxwell file format is based on HDF5. -The internal compression need a custum plugin!!! +The internal compression requires a custom plugin!!! This is a big pain for the end user. You, as a end user, should ask Maxwell company to change this. -Please visit this page and install what is missing: +Please visit this page and install the missing decompression libraries: https://share.mxwbio.com/d/4742248b2e674a85be97/ -Then, you will need to do something like this in your code +Then, link the decompression library by setting the `HDF5_PLUGIN_PATH` to your installation location, e.g. via os.environ['HDF5_PLUGIN_PATH'] = '/path/to/cutum/hdf5/plugin/' -Alternatively, you can use the auto_install_maxwell_hdf5_compression_plugin() -function that do it automamagically. +Alternatively, you can use the auto_install_maxwell_hdf5_compression_plugin() below +function that do it automagically. """ From a4d7280035d79414e1aa8fff412e45a617043a30 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 26 May 2021 11:14:37 +0200 Subject: [PATCH 12/16] fix auto_install_maxwell_hdf5_compression_plugin() --- neo/rawio/maxwellrawio.py | 8 ++++---- neo/test/iotest/test_maxwellio.py | 6 ++++-- neo/test/rawiotest/test_maxwellrawio.py | 2 -- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/neo/rawio/maxwellrawio.py b/neo/rawio/maxwellrawio.py index 4985e30b1..d47ead22b 100644 --- a/neo/rawio/maxwellrawio.py +++ b/neo/rawio/maxwellrawio.py @@ -207,13 +207,13 @@ def auto_install_maxwell_hdf5_compression_plugin(hdf5_plugin_path=None): hdf5_plugin_path.mkdir(exist_ok=True) if platform.system() == 'Linux': - remote_lib = 'https://share.mxwbio.com/d/4742248b2e674a85be97/files/?p=%2FLinux%2Flibcompression.so' - local_lib = hdf5_plugin_path / 'Flibcompression.so' + remote_lib = 'https://share.mxwbio.com/d/4742248b2e674a85be97/files/?p=%2FLinux%2Flibcompression.so&dl=1' + local_lib = hdf5_plugin_path / 'libcompression.so' elif platform.system() == 'Darwin': - remote_lib = 'https://share.mxwbio.com/d/4742248b2e674a85be97/files/?p=%2FMacOS%2Flibcompression.dylib' + remote_lib = 'https://share.mxwbio.com/d/4742248b2e674a85be97/files/?p=%2FMacOS%2Flibcompression.dylib&dl=1' local_lib = hdf5_plugin_path / 'libcompression.dylib' elif platform.system() == 'Windows': - remote_lib = 'https://share.mxwbio.com/d/4742248b2e674a85be97/files/?p=%2FWindows%2Fcompression.dll' + remote_lib = 'https://share.mxwbio.com/d/4742248b2e674a85be97/files/?p=%2FWindows%2Fcompression.dll&dl=1' local_lib = hdf5_plugin_path / 'compression.dll' dist = urlopen(remote_lib) diff --git a/neo/test/iotest/test_maxwellio.py b/neo/test/iotest/test_maxwellio.py index 636f4f7d0..cfced22f2 100644 --- a/neo/test/iotest/test_maxwellio.py +++ b/neo/test/iotest/test_maxwellio.py @@ -4,10 +4,9 @@ from neo.io import MaxwellIO from neo.test.iotest.common_io_test import BaseTestIO -in_gh_actions = os.getenv('GITHUB_ACTIONS', 'False') == 'true' +from neo.rawio.maxwellrawio import auto_install_maxwell_hdf5_compression_plugin -@unittest.skipUnless(not in_gh_actions, "Need specific hdf5 plugin") class TestMaxwellIO(BaseTestIO, unittest.TestCase, ): ioclass = MaxwellIO entities_to_download = [ @@ -17,6 +16,9 @@ class TestMaxwellIO(BaseTestIO, unittest.TestCase, ): 'maxwell/MaxOne_data/Record/000011/data.raw.h5', 'maxwell/MaxTwo_data/Network/000028/data.raw.h5' ] + def setUp(self): + auto_install_maxwell_hdf5_compression_plugin() + BaseTestIO.setUp(self) if __name__ == "__main__": diff --git a/neo/test/rawiotest/test_maxwellrawio.py b/neo/test/rawiotest/test_maxwellrawio.py index 0f725421f..3492b6040 100644 --- a/neo/test/rawiotest/test_maxwellrawio.py +++ b/neo/test/rawiotest/test_maxwellrawio.py @@ -5,10 +5,8 @@ auto_install_maxwell_hdf5_compression_plugin) from neo.test.rawiotest.common_rawio_test import BaseTestRawIO -in_gh_actions = os.getenv('GITHUB_ACTIONS', 'False') == 'true' -@unittest.skipUnless(not in_gh_actions, "Need specific hdf5 plugin") class TestMaxwellRawIO(BaseTestRawIO, unittest.TestCase, ): rawioclass = MaxwellRawIO entities_to_download = [ From dca81d0b1aff9deb0b90ae3f3e856e02141161b5 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 26 May 2021 12:15:30 +0200 Subject: [PATCH 13/16] Stil fix maxwell auto_install_maxwell_hdf5_compression_plugin() --- neo/rawio/maxwellrawio.py | 6 +++++- neo/test/iotest/test_maxwellio.py | 2 +- neo/test/rawiotest/test_maxwellrawio.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/neo/rawio/maxwellrawio.py b/neo/rawio/maxwellrawio.py index d47ead22b..ae1f37259 100644 --- a/neo/rawio/maxwellrawio.py +++ b/neo/rawio/maxwellrawio.py @@ -197,7 +197,7 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, """ -def auto_install_maxwell_hdf5_compression_plugin(hdf5_plugin_path=None): +def auto_install_maxwell_hdf5_compression_plugin(hdf5_plugin_path=None, force_download=True): if hdf5_plugin_path is None: hdf5_plugin_path = os.getenv('HDF5_PLUGIN_PATH', None) if hdf5_plugin_path is None: @@ -216,6 +216,10 @@ def auto_install_maxwell_hdf5_compression_plugin(hdf5_plugin_path=None): remote_lib = 'https://share.mxwbio.com/d/4742248b2e674a85be97/files/?p=%2FWindows%2Fcompression.dll&dl=1' local_lib = hdf5_plugin_path / 'compression.dll' + if not force_download and local_lib.is_file(): + print(f'lib h5 compression for maxwell already already in {local_lib}') + return + dist = urlopen(remote_lib) with open(local_lib, 'wb') as f: f.write(dist.read()) diff --git a/neo/test/iotest/test_maxwellio.py b/neo/test/iotest/test_maxwellio.py index cfced22f2..ea62a9233 100644 --- a/neo/test/iotest/test_maxwellio.py +++ b/neo/test/iotest/test_maxwellio.py @@ -17,7 +17,7 @@ class TestMaxwellIO(BaseTestIO, unittest.TestCase, ): 'maxwell/MaxTwo_data/Network/000028/data.raw.h5' ] def setUp(self): - auto_install_maxwell_hdf5_compression_plugin() + auto_install_maxwell_hdf5_compression_plugin(force_download=False) BaseTestIO.setUp(self) diff --git a/neo/test/rawiotest/test_maxwellrawio.py b/neo/test/rawiotest/test_maxwellrawio.py index 3492b6040..ea0ccf93c 100644 --- a/neo/test/rawiotest/test_maxwellrawio.py +++ b/neo/test/rawiotest/test_maxwellrawio.py @@ -18,7 +18,7 @@ class TestMaxwellRawIO(BaseTestRawIO, unittest.TestCase, ): ] def setUp(self): - auto_install_maxwell_hdf5_compression_plugin() + auto_install_maxwell_hdf5_compression_plugin(force_download=False) BaseTestRawIO.setUp(self) From 25e801f4de881f0e363b63e23a7de8de6a1def28 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Mon, 14 Jun 2021 18:06:15 +0200 Subject: [PATCH 14/16] pep8 --- neo/rawio/maxwellrawio.py | 7 ++++--- neo/test/iotest/test_maxwellio.py | 1 + neo/test/rawiotest/test_maxwellrawio.py | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/neo/rawio/maxwellrawio.py b/neo/rawio/maxwellrawio.py index ae1f37259..aef351e94 100644 --- a/neo/rawio/maxwellrawio.py +++ b/neo/rawio/maxwellrawio.py @@ -75,8 +75,8 @@ def _parse_header(self): rec_names = list(h5['wells'][stream_id].keys()) if len(rec_names) > 1: if self.rec_name is None: - raise ValueError("Detected multiple recordings. Please select a single recording using the `rec_name` paramter." - f'\nPossible rec_name {rec_names}') + raise ValueError("Detected multiple recordings. Please select a single recording using" + f' the `rec_name` paramter.\nPossible rec_name {rec_names}') else: self.rec_name = rec_names[0] signal_streams.append((stream_id, stream_id)) @@ -189,7 +189,8 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, You, as a end user, should ask Maxwell company to change this. Please visit this page and install the missing decompression libraries: https://share.mxwbio.com/d/4742248b2e674a85be97/ -Then, link the decompression library by setting the `HDF5_PLUGIN_PATH` to your installation location, e.g. via +Then, link the decompression library by setting the `HDF5_PLUGIN_PATH` to your +installation location, e.g. via os.environ['HDF5_PLUGIN_PATH'] = '/path/to/cutum/hdf5/plugin/' Alternatively, you can use the auto_install_maxwell_hdf5_compression_plugin() below diff --git a/neo/test/iotest/test_maxwellio.py b/neo/test/iotest/test_maxwellio.py index ea62a9233..c1ac30059 100644 --- a/neo/test/iotest/test_maxwellio.py +++ b/neo/test/iotest/test_maxwellio.py @@ -16,6 +16,7 @@ class TestMaxwellIO(BaseTestIO, unittest.TestCase, ): 'maxwell/MaxOne_data/Record/000011/data.raw.h5', 'maxwell/MaxTwo_data/Network/000028/data.raw.h5' ] + def setUp(self): auto_install_maxwell_hdf5_compression_plugin(force_download=False) BaseTestIO.setUp(self) diff --git a/neo/test/rawiotest/test_maxwellrawio.py b/neo/test/rawiotest/test_maxwellrawio.py index ea0ccf93c..0c90ec306 100644 --- a/neo/test/rawiotest/test_maxwellrawio.py +++ b/neo/test/rawiotest/test_maxwellrawio.py @@ -6,7 +6,6 @@ from neo.test.rawiotest.common_rawio_test import BaseTestRawIO - class TestMaxwellRawIO(BaseTestRawIO, unittest.TestCase, ): rawioclass = MaxwellRawIO entities_to_download = [ From 0415ce059dde24925788250aafdcd4fc98b084d0 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Fri, 18 Jun 2021 12:10:07 +0200 Subject: [PATCH 15/16] Raise error when version is not supported --- neo/rawio/maxwellrawio.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/neo/rawio/maxwellrawio.py b/neo/rawio/maxwellrawio.py index aef351e94..00ceba90b 100644 --- a/neo/rawio/maxwellrawio.py +++ b/neo/rawio/maxwellrawio.py @@ -80,6 +80,8 @@ def _parse_header(self): else: self.rec_name = rec_names[0] signal_streams.append((stream_id, stream_id)) + else: + raise NotImplementedError(f'This version {version} is not supported') signal_streams = np.array(signal_streams, dtype=_signal_stream_dtype) # create signal channels From 3093034886c19a911bd1bd71befdbab8fad8abdc Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Fri, 18 Jun 2021 12:19:29 +0200 Subject: [PATCH 16/16] oups --- neo/rawio/maxwellrawio.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neo/rawio/maxwellrawio.py b/neo/rawio/maxwellrawio.py index 00ceba90b..9205a0d03 100644 --- a/neo/rawio/maxwellrawio.py +++ b/neo/rawio/maxwellrawio.py @@ -80,8 +80,8 @@ def _parse_header(self): else: self.rec_name = rec_names[0] signal_streams.append((stream_id, stream_id)) - else: - raise NotImplementedError(f'This version {version} is not supported') + else: + raise NotImplementedError(f'This version {version} is not supported') signal_streams = np.array(signal_streams, dtype=_signal_stream_dtype) # create signal channels