Skip to content

Commit c4b67c8

Browse files
authored
Merge pull request #1551 from nikhilchandra/issue_1549
Fixed bug that prevented PL2 spike channels with unsorted spikes from…
2 parents e14c956 + 5bc3e3a commit c4b67c8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

neo/rawio/plexon2rawio/plexon2rawio.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,14 @@ def _parse_header(self):
232232
if not (schannel_info.m_ChannelEnabled and schannel_info.m_ChannelRecordingEnabled):
233233
continue
234234

235-
for channel_unit_id in range(schannel_info.m_NumberOfUnits):
235+
# In a PL2 spike channel header, the field "m_NumberOfUnits" denotes the number
236+
# of units to which spikes detected on that channel have been assigned. It does
237+
# not account for unsorted spikes, i.e., spikes that have not been assigned to
238+
# a unit. It is Plexon's convention to assign unsorted spikes to channel_unit_id=0,
239+
# and sorted spikes to channel_unit_id's 1, 2, 3...etc. Therefore, for a given value of
240+
# m_NumberOfUnits, there are m_NumberOfUnits+1 channel_unit_ids to consider - 1
241+
# unsorted channel_unit_id (0) + the m_NumberOfUnits sorted channel_unit_ids.
242+
for channel_unit_id in range(schannel_info.m_NumberOfUnits+1):
236243
unit_name = f"{schannel_info.m_Name.decode()}.{channel_unit_id}"
237244
unit_id = f"unit{schannel_info.m_Channel}.{channel_unit_id}"
238245
wf_units = schannel_info.m_Units

0 commit comments

Comments
 (0)