From 15c5d9fc8388f6d4c145b48a04c45860a193e835 Mon Sep 17 00:00:00 2001 From: Letizia Signorelli Date: Mon, 5 Aug 2024 10:47:19 +0200 Subject: [PATCH 1/4] fixed channels selection in AxonaRawIO --- neo/rawio/axonarawio.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/neo/rawio/axonarawio.py b/neo/rawio/axonarawio.py index 42b710f8f..55bc917e8 100644 --- a/neo/rawio/axonarawio.py +++ b/neo/rawio/axonarawio.py @@ -374,8 +374,7 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, strea if channel_indexes is None: channel_indexes = [i for i in range(bin_dict["num_channels"])] elif isinstance(channel_indexes, slice): - channel_indexes_all = [i for i in range(bin_dict["num_channels"])] - channel_indexes = channel_indexes_all[channel_indexes] + channel_indexes = self.get_active_channels() num_samples = i_stop - i_start @@ -558,6 +557,20 @@ def get_active_tetrode(self): tetrode_id = int(key.strip("collectMask_")) active_tetrodes.append(tetrode_id) return active_tetrodes + + def get_active_channels(self): + """ + Returns the ID numbers of the active channels as a list. + E.g.: [20,21,22,23] for tetrode 6 active. + """ + active_tetrodes = self.get_active_tetrode() + active_channels = [] + + for tetrode in active_tetrodes: + chan = self._get_channel_from_tetrode(tetrode) + active_channels.append(chan) + + return np.concatenate(active_channels) def _get_channel_from_tetrode(self, tetrode): """ @@ -629,12 +642,13 @@ def _get_signal_chan_header(self): gain_list = self._get_channel_gain() offset = 0 # What is the offset? + first_channel = (active_tetrode_set[0] - 1)*elec_per_tetrode sig_channels = [] for itetr in range(num_active_tetrode): for ielec in range(elec_per_tetrode): - cntr = (itetr * elec_per_tetrode) + ielec - ch_name = f"{itetr + 1}{letters[ielec]}" + cntr = (itetr * elec_per_tetrode) + ielec + first_channel + ch_name = "{}{}".format(itetr + active_tetrode_set[0], letters[ielec]) chan_id = str(cntr) gain = gain_list[cntr] stream_id = "0" From 547c8ae76c6f5dc73342f26fbc08fb181dd94d91 Mon Sep 17 00:00:00 2001 From: Letizia Signorelli Date: Mon, 5 Aug 2024 10:53:26 +0200 Subject: [PATCH 2/4] add author name and affiliation --- doc/source/authors.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/source/authors.rst b/doc/source/authors.rst index 5e51ee6e0..d7b2554ca 100644 --- a/doc/source/authors.rst +++ b/doc/source/authors.rst @@ -88,6 +88,7 @@ and may not be the current affiliation of a contributor. * Téo Lohrer * Anthony Pinto [41] * Xin Niu +* Letizia Signorelli [42] 1. Centre de Recherche en Neuroscience de Lyon, CNRS UMR5292 - INSERM U1028 - Universite Claude Bernard Lyon 1 2. Unité de Neuroscience, Information et Complexité, CNRS UPR 3293, Gif-sur-Yvette, France @@ -130,6 +131,7 @@ and may not be the current affiliation of a contributor. 39. Massachusetts General Hospital, Department of Molecular Biology 40. Plexon Inc. 41. Paris Brain Institute +42. Centre for Molecular Medicine Norway (NCMM), University of Oslo, Norway From 0d4b92e9e6203ec3bf4001c95622996e0e404f9a Mon Sep 17 00:00:00 2001 From: Letizia Signorelli Date: Wed, 4 Dec 2024 14:09:18 +0100 Subject: [PATCH 3/4] update fix neo/rawio/axonarawio.py --- neo/rawio/axonarawio.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/neo/rawio/axonarawio.py b/neo/rawio/axonarawio.py index 55bc917e8..990cdd27b 100644 --- a/neo/rawio/axonarawio.py +++ b/neo/rawio/axonarawio.py @@ -558,7 +558,7 @@ def get_active_tetrode(self): active_tetrodes.append(tetrode_id) return active_tetrodes - def get_active_channels(self): + def _get_active_channels(self): """ Returns the ID numbers of the active channels as a list. E.g.: [20,21,22,23] for tetrode 6 active. @@ -567,8 +567,8 @@ def get_active_channels(self): active_channels = [] for tetrode in active_tetrodes: - chan = self._get_channel_from_tetrode(tetrode) - active_channels.append(chan) + chans = self._get_channel_from_tetrode(tetrode) + active_channels.append(chans) return np.concatenate(active_channels) @@ -648,7 +648,7 @@ def _get_signal_chan_header(self): for ielec in range(elec_per_tetrode): cntr = (itetr * elec_per_tetrode) + ielec + first_channel - ch_name = "{}{}".format(itetr + active_tetrode_set[0], letters[ielec]) + ch_name = f"{itetr + active_tetrode_set[0]}{letters[ielec]}" chan_id = str(cntr) gain = gain_list[cntr] stream_id = "0" From 03affe4acec23fd392b453f13d30e2124f6d683e Mon Sep 17 00:00:00 2001 From: Zach McKenzie <92116279+zm711@users.noreply.github.com> Date: Thu, 5 Dec 2024 08:15:08 -0500 Subject: [PATCH 4/4] switch function to private version. --- neo/rawio/axonarawio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neo/rawio/axonarawio.py b/neo/rawio/axonarawio.py index 5ccc5bd04..958edea48 100644 --- a/neo/rawio/axonarawio.py +++ b/neo/rawio/axonarawio.py @@ -377,7 +377,7 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, strea if channel_indexes is None: channel_indexes = [i for i in range(bin_dict["num_channels"])] elif isinstance(channel_indexes, slice): - channel_indexes = self.get_active_channels() + channel_indexes = self._get_active_channels() num_samples = i_stop - i_start