Skip to content

Commit a1b0294

Browse files
committed
test usecols
1 parent 0aa7e65 commit a1b0294

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

neo/test/iotest/test_asciisignalio.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,28 @@ def test_skiprows(self):
156156

157157
os.remove(filename)
158158

159+
def test_usecols(self):
160+
filename = 'test_usecols.txt'
161+
sample_data = [
162+
(-65, -65, -65, 0.5),
163+
(-64.8, -64.5, -64.0, 0.6),
164+
(-64.6, -64.2, -77.0, 0.7),
165+
(-64.3, -64.0, -99.9, 0.8),
166+
(-66, -64.3, -61.0, 1.4),
167+
]
168+
with open(filename, 'w') as datafile:
169+
for row in sample_data:
170+
datafile.write("\t ".join(map(str, row)) + "\t\n")
171+
io = AsciiSignalIO(filename, usecols=3)
172+
block = io.read_block()
173+
signal = block.segments[0].analogsignals[0]
174+
self.assertEqual(signal.shape, (5, 1))
175+
self.assertEqual(len(block.segments[0].analogsignals[0]), 5)
176+
self.assertEqual(len(block.segments[0].analogsignals), 1)
177+
self.assertEqual(signal.units, pq.V)
178+
179+
os.remove(filename)
180+
159181
def test_timecolumn(self):
160182
sample_data = np.random.uniform(size=(200, 3))
161183
sampling_period = 0.5

0 commit comments

Comments
 (0)