Skip to content

Commit f97bd06

Browse files
author
sprenger
committed
Add elphy test file
1 parent 33729b5 commit f97bd06

File tree

3 files changed

+36
-7
lines changed

3 files changed

+36
-7
lines changed

neo/io/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@
281281
from neo.io.brainwaresrcio import BrainwareSrcIO
282282
from neo.io.cedio import CedIO
283283
from neo.io.elanio import ElanIO
284-
# from neo.io.elphyio import ElphyIO
284+
from neo.io.elphyio import ElphyIO
285285
from neo.io.exampleio import ExampleIO
286286
from neo.io.igorproio import IgorIO
287287
from neo.io.intanio import IntanIO

neo/io/elphyio.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@
8787
from neo.io.baseio import BaseIO
8888

8989
# to import from core
90-
from neo.core import (Block, Segment,
91-
AnalogSignal, Event, SpikeTrain)
90+
from neo.core import (Block, Segment, AnalogSignal, Event, SpikeTrain)
9291

9392

9493
# --------------------------------------------------------
@@ -562,7 +561,7 @@ def get_protocol_and_version(self):
562561

563562
def get_title(self):
564563
title_length, title = struct.unpack('<B20s', self.file.read(21))
565-
return unicode(title[0:title_length])
564+
return str(title[0:title_length])
566565

567566
def get_user_file_info(self):
568567
header = dict()
@@ -674,7 +673,7 @@ def get_title(self):
674673
title_length = read_from_char(self.file, 'B')
675674
title, = struct.unpack('<%ss' % title_length, self.file.read(title_length))
676675
self.file.seek(self.file.tell() + 255 - title_length)
677-
return unicode(title)
676+
return str(title)
678677

679678
def get_user_file_info(self):
680679
header = dict()
@@ -1858,7 +1857,7 @@ def create_bit_mask(self, ep, ch):
18581857
for _ch in ch_mask:
18591858
size = self.sample_size(ep, _ch)
18601859
val = 1 if _ch == ch else 0
1861-
for _ in xrange(0, size):
1860+
for _ in np.arange(0, size):
18621861
_mask.append(val)
18631862
return np.array(_mask)
18641863

@@ -1899,7 +1898,7 @@ def reshape_bytes(self, databytes, reshape, datatypes, order='<'):
18991898
# create the mask for each shape
19001899
shape_mask = list()
19011900
for shape in reshape:
1902-
for _ in xrange(1, shape + 1):
1901+
for _ in np.arange(1, shape + 1):
19031902
shape_mask.append(shape)
19041903

19051904
# create a set of masks to extract data

neo/test/iotest/test_elphyio.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""
2+
Tests of neo.io.elphyo
3+
"""
4+
5+
import unittest
6+
7+
from neo.io import ElphyIO
8+
from neo.test.iotest.common_io_test import BaseTestIO
9+
10+
11+
12+
class TestElanIO(BaseTestIO, unittest.TestCase):
13+
ioclass = ElphyIO
14+
files_to_test = ['DATA1.DAT', 'ElphyExample.DAT',
15+
'ElphyExample_Mode1.dat', 'ElphyExample_Mode2.dat',
16+
'ElphyExample_Mode3.dat']
17+
files_to_download = ['DATA1.DAT', 'ElphyExample.DAT',
18+
'ElphyExample_Mode1.dat', 'ElphyExample_Mode2.dat',
19+
'ElphyExample_Mode3.dat']
20+
21+
def test_read_data(self):
22+
io = ElphyIO(self.get_filename_path('DATA1.DAT'))
23+
bl = io.read_block()
24+
25+
print(bl)
26+
27+
28+
29+
if __name__ == "__main__":
30+
unittest.main()

0 commit comments

Comments
 (0)