Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix electrode selection in Axona raw recording #1520

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions doc/source/authors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ and may not be the current affiliation of a contributor.
* Anthony Pinto [41]
* Xin Niu
* Nikhil Chandra [40]
* 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
Expand Down Expand Up @@ -131,6 +133,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



Expand Down
22 changes: 18 additions & 4 deletions neo/rawio/axonarawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +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_all = [i for i in range(bin_dict["num_channels"])]
channel_indexes = channel_indexes_all[channel_indexes]
channel_indexes = self.get_active_channels()
zm711 marked this conversation as resolved.
Show resolved Hide resolved

num_samples = i_stop - i_start

Expand Down Expand Up @@ -561,6 +560,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:
chans = self._get_channel_from_tetrode(tetrode)
active_channels.append(chans)

return np.concatenate(active_channels)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the benefit of concat? I need to doublecheck what is chan is it a list of all channels from a tetrode. If that is the case I would call it channels or chans instead so we know it's plural.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, chan is a list of all channels from a tetrode, so I agree to call it channels or chans.

Since I was using this function only for the _get_analogsignal_chunk function and it needed the list of active channels as an array I returned directly active_channels as an array. But we can also do it in _get_analogsignal_chunk and keep this function consistent with get_active_tetrodes and return directly active_channels


def _get_channel_from_tetrode(self, tetrode):
"""
Expand Down Expand Up @@ -632,12 +645,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 = f"{itetr + active_tetrode_set[0]}{letters[ielec]}"
chan_id = str(cntr)
gain = gain_list[cntr]
stream_id = "0"
Expand Down