Skip to content

Commit 1bece42

Browse files
authored
Merge branch 'master' into intan_digital_channel_extraction
2 parents c17a080 + 8e804cf commit 1bece42

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

neo/rawio/plexon2rawio/plexon2rawio.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def __init__(self, filename, pl2_dll_file_path=None):
107107
# download default PL2 dll once if not yet available
108108
if pl2_dll_file_path is None:
109109
architecture = platform.architecture()[0]
110-
if architecture == "64bit" and platform.system() in ["Windows", "Darwin"]:
110+
if architecture == "64bit" and platform.system() in ["Windows", "Darwin"]:
111111
file_name = "PL2FileReader64.dll"
112112
else: # Apparently wine uses the 32 bit version in linux
113113
file_name = "PL2FileReader.dll"
@@ -128,11 +128,10 @@ def __init__(self, filename, pl2_dll_file_path=None):
128128

129129
self.pl2reader = PyPL2FileReader(pl2_dll_file_path=pl2_dll_file_path)
130130

131-
132131
reading_attempts = 10
133132
for attempt in range(reading_attempts):
134133
self.pl2reader.pl2_open_file(self.filename)
135-
134+
136135
# Verify the file handle is valid.
137136
if self.pl2reader._file_handle.value != 0:
138137
# File handle is valid, exit the loop early

neo/rawio/plexon2rawio/pypl2/pypl2lib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
raise ImportError("Wine is not installed. Please install wine to use the PL2FileReader.dll")
2525

2626
from zugbruecke import CtypesSession
27+
2728
if platform.system() == "Darwin":
28-
ctypes = CtypesSession(log_level=100, arch = 'win64')
29+
ctypes = CtypesSession(log_level=100, arch="win64")
2930
else:
3031
ctypes = CtypesSession(log_level=100)
3132

neo/rawio/plexonrawio.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ def _parse_header(self):
9595
)
9696

9797
# dsp channels header = spikes and waveforms
98-
nb_unit_chan = global_header["NumDSPChannels"]
98+
nb_unit_chan = int(global_header["NumDSPChannels"])
9999
offset1 = np.dtype(GlobalHeader).itemsize
100100
dspChannelHeaders = np.memmap(
101101
self.filename, dtype=DspChannelHeader, mode="r", offset=offset1, shape=(nb_unit_chan,)
102102
)
103103

104104
# event channel header
105-
nb_event_chan = global_header["NumEventChannels"]
105+
nb_event_chan = int(global_header["NumEventChannels"])
106106
offset2 = offset1 + np.dtype(DspChannelHeader).itemsize * nb_unit_chan
107107
eventHeaders = np.memmap(
108108
self.filename,
@@ -113,7 +113,7 @@ def _parse_header(self):
113113
)
114114

115115
# slow channel header = signal
116-
nb_sig_chan = global_header["NumSlowChannels"]
116+
nb_sig_chan = int(global_header["NumSlowChannels"])
117117
offset3 = offset2 + np.dtype(EventChannelHeader).itemsize * nb_event_chan
118118
slowChannelHeaders = np.memmap(
119119
self.filename, dtype=SlowChannelHeader, mode="r", offset=offset3, shape=(nb_sig_chan,)
@@ -136,7 +136,9 @@ def _parse_header(self):
136136

137137
while pos < data.size:
138138
bl_header = data[pos : pos + 16].view(DataBlockHeader)[0]
139-
length = bl_header["NumberOfWaveforms"] * bl_header["NumberOfWordsInWaveform"] * 2 + 16
139+
number_of_waveforms = int(bl_header["NumberOfWaveforms"])
140+
number_of_words_in_waveform = int(bl_header["NumberOfWordsInWaveform"])
141+
length = (number_of_waveforms * number_of_words_in_waveform * 2) + 16
140142
bl_type = int(bl_header["Type"])
141143
chan_id = int(bl_header["Channel"])
142144
block_pos[bl_type][chan_id].append(pos)

0 commit comments

Comments
 (0)