Skip to content

Commit 43d6614

Browse files
author
Thinh Nguyen
committed
handles extraction of connected channels for NP_PROBE format in OpenEphys
1 parent adffe34 commit 43d6614

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

element_array_ephys/ephys_no_curation.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -971,9 +971,8 @@ def get_recording_channels_details(ephys_recording_key):
971971
elif acq_software == 'Open Ephys':
972972
oe_probe = get_openephys_probe_data(ephys_recording_key)
973973
channels_details['uVPerBit'] = oe_probe.ap_meta['channels_gains'][0]
974-
channels_details['connected'] = np.array([int(v == 1)
975-
for c, v in
976-
oe_probe.channel_status.items()
977-
if c in channels_details['channel_ind']])
974+
channels_details['connected'] = np.array([
975+
int(v == 1) for c, v in oe_probe.channels_connected.items()
976+
if c in channels_details['channel_ind']])
978977

979978
return channels_details

element_array_ephys/readers/openephys.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ def __init__(self, processor, probe_index=0):
134134
self.probe_model = {
135135
"Neuropix-PXI": "neuropixels 1.0 - 3B",
136136
"Neuropix-3a": "neuropixels 1.0 - 3A"}[processor['@pluginName']]
137-
channel_status_str = 'CHANNELSTATUS'
137+
self._channels_connected = {int(re.search(r'\d+$', k).group()): int(v)
138+
for k, v in self.probe_info.pop('CHANNELSTATUS').items()}
139+
138140
else:
139141
self.probe_info = processor['EDITOR']['NP_PROBE'][probe_index]
140142
self.probe_SN = self.probe_info['@probe_serial_number']
@@ -143,10 +145,8 @@ def __init__(self, processor, probe_index=0):
143145
"Neuropixels Ultra": "neuropixels UHD",
144146
"Neuropixels 21": "neuropixels 2.0 - SS",
145147
"Neuropixels 24": "neuropixels 2.0 - MS"}[self.probe_info['@probe_name']]
146-
channel_status_str = 'CHANNELS'
147-
148-
self.channel_status = {int(re.search(r'\d+$', k).group()): int(v)
149-
for k, v in self.probe_info.pop(channel_status_str).items()}
148+
self._channels_connected = {int(re.search(r'\d+$', k).group()): 1
149+
for k in self.probe_info.pop('CHANNELS')}
150150

151151
self.ap_meta = {}
152152
self.lfp_meta = {}
@@ -164,6 +164,11 @@ def __init__(self, processor, probe_index=0):
164164
self._lfp_timeseries = None
165165
self._lfp_timestamps = None
166166

167+
@property
168+
def channels_connected(self):
169+
return {chn_idx: self._channels_connected.get(chn_idx, 0)
170+
for chn_idx in self.ap_meta['channels_indices']}
171+
167172
@property
168173
def ap_timeseries(self):
169174
"""

0 commit comments

Comments
 (0)