-
Notifications
You must be signed in to change notification settings - Fork 249
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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() | ||
|
||
num_samples = i_stop - i_start | ||
|
||
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the benefit of concat? I need to doublecheck what is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, Since I was using this function only for the |
||
|
||
def _get_channel_from_tetrode(self, tetrode): | ||
""" | ||
|
@@ -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" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@h-mayorquin do you want to doublecheck this. I'm just re-reading and I'm thinking of the case of a channel slice so would love another pair of eyes on the logic here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused on why this function does not take any input, I would expect this to use the slice (channel_indexes) that it was passed?