Skip to content

Commit 8094839

Browse files
authored
Merge branch 'NeuralEnsemble:master' into matlabio
2 parents 5ef4f01 + 4ef2801 commit 8094839

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

neo/core/group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Group(Container):
5151
'AnalogSignal', 'IrregularlySampledSignal', 'SpikeTrain',
5252
'Event', 'Epoch', 'ChannelView', 'ImageSequence'
5353
)
54-
_container_child_objects = ('Segment', 'Group')
54+
_container_child_objects = ('Group',)
5555
_parent_objects = ('Block',)
5656

5757
def __init__(self, objects=None, name=None, description=None, file_origin=None,

neo/rawio/blackrockrawio.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import os
6262
import re
6363
import warnings
64+
import math
6465

6566
import numpy as np
6667
import quantities as pq
@@ -646,7 +647,7 @@ def _get_timestamp_slice(self, timestamp, seg_index, t_start, t_stop):
646647
if t_start is None:
647648
ind_start = None
648649
else:
649-
ts = np.math.ceil(t_start * self.__nev_basic_header['timestamp_resolution'])
650+
ts = math.ceil(t_start * self.__nev_basic_header['timestamp_resolution'])
650651
ind_start = np.searchsorted(timestamp, ts)
651652

652653
if t_stop is None:

neo/rawio/plexon2rawio/plexon2rawio.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
"""
2424
import pathlib
2525
import warnings
26+
import platform
27+
2628
from collections import namedtuple
2729
from urllib.request import urlopen
2830
from datetime import datetime
@@ -74,14 +76,19 @@ def __init__(self, filename, pl2_dll_file_path=None):
7476

7577
# download default PL2 dll once if not yet available
7678
if pl2_dll_file_path is None:
77-
pl2_dll_folder = pathlib.Path .home() / '.plexon_dlls_for_neo'
79+
architecture = platform.architecture()[0]
80+
if architecture == '64bit' and platform.system() == 'Windows':
81+
file_name = "PL2FileReader64.dll"
82+
else: # Apparently wine uses the 32 bit version in linux
83+
file_name = "PL2FileReader.dll"
84+
pl2_dll_folder = pathlib.Path.home() / '.plexon_dlls_for_neo'
7885
pl2_dll_folder.mkdir(exist_ok=True)
79-
pl2_dll_file_path = pl2_dll_folder / 'PL2FileReader.dll'
86+
pl2_dll_file_path = pl2_dll_folder / file_name
87+
88+
if not pl2_dll_file_path.exists():
89+
url = f'https://raw.githubusercontent.com/Neuralensemble/pypl2/master/bin/{file_name}'
90+
dist = urlopen(url=url)
8091

81-
if pl2_dll_file_path.exists():
82-
warnings.warn(f'Using cached plexon dll at {pl2_dll_file_path}')
83-
else:
84-
dist = urlopen('https://raw.githubusercontent.com/Neuralensemble/pypl2/master/bin/PL2FileReader.dll')
8592
with open(pl2_dll_file_path, 'wb') as f:
8693
print(f'Downloading plexon dll to {pl2_dll_file_path}')
8794
f.write(dist.read())
@@ -288,7 +295,7 @@ def _get_signal_size(self, block_index, seg_index, stream_index):
288295
stream_id = self.header['signal_streams'][stream_index]['id']
289296
stream_characteristic = list(self.signal_stream_characteristics.values())[stream_index]
290297
assert stream_id == stream_characteristic.id
291-
return stream_characteristic.n_samples
298+
return int(stream_characteristic.n_samples) # Avoids returning a numpy.int64 scalar
292299

293300
def _get_signal_t_start(self, block_index, seg_index, stream_index):
294301
# This returns the t_start of signals as a float value in seconds

neo/test/coretest/test_group.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def setUp(self):
4141
self.test_segment.spiketrains.extend(self.test_spiketrains)
4242

4343
def test_create_group(self):
44-
objects = [self.test_view, self.test_signal, self.test_segment]
44+
objects = [self.test_view, self.test_signal]
4545
objects.extend(self.test_spiketrains)
4646
group = Group(objects)
4747

@@ -50,21 +50,19 @@ def test_create_group(self):
5050
assert group.spiketrains[1] is self.test_spiketrains[1]
5151
assert group.channelviews[0] is self.test_view
5252
assert len(group.irregularlysampledsignals) == 0
53-
assert group.segments[0].analogsignals[0] is self.test_signal
5453

5554
def test_create_empty_group(self):
5655
group = Group()
5756

5857
def test_children(self):
5958
group = Group(self.test_spiketrains + [self.test_view]
60-
+ [self.test_signal] + [self.test_segment])
59+
+ [self.test_signal])
6160

6261
# note: ordering is by class name for data children (AnalogSignal, SpikeTrain),
6362
# then container children (Segment)
6463
assert group.children == (self.test_signal,
6564
*self.test_spiketrains,
66-
self.test_view,
67-
self.test_segment)
65+
self.test_view)
6866

6967
def test_with_allowed_types(self):
7068
objects = [self.test_signal] + self.test_spiketrains

0 commit comments

Comments
 (0)