Skip to content

Commit

Permalink
Merge pull request #1551 from nikhilchandra/issue_1549
Browse files Browse the repository at this point in the history
Fixed bug that prevented PL2 spike channels with unsorted spikes from…
  • Loading branch information
zm711 authored Sep 13, 2024
2 parents e14c956 + 5bc3e3a commit c4b67c8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion neo/rawio/plexon2rawio/plexon2rawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,14 @@ def _parse_header(self):
if not (schannel_info.m_ChannelEnabled and schannel_info.m_ChannelRecordingEnabled):
continue

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

0 comments on commit c4b67c8

Please sign in to comment.