|
13 | 13 | from neo.test.iotest.common_io_test import BaseTestIO |
14 | 14 | from neo.core import AnalogSignal, Segment, Block |
15 | 15 |
|
| 16 | +import string |
16 | 17 |
|
17 | 18 | class TestAsciiSignalIOWithTestFiles(BaseTestIO, unittest.TestCase): |
18 | 19 | ioclass = AsciiSignalIO |
@@ -133,8 +134,27 @@ def reader(filename, comment_rows): |
133 | 134 |
|
134 | 135 | os.remove(filename) |
135 | 136 |
|
136 | | - # test usecols |
137 | | - # test skiprows |
| 137 | + def test_skiprows(self): |
| 138 | + filename = 'test_skiprows.txt' |
| 139 | + sample_data = [ |
| 140 | + (-65, -65, -65, 0.5), |
| 141 | + (-64.8, -64.5, -64.0, 0.6), |
| 142 | + (-64.6, -64.2, -77.0, 0.7), |
| 143 | + (-64.3, -64.0, -99.9, 0.8), |
| 144 | + (-66, -64.3, -61.0, 1.4), |
| 145 | + ] |
| 146 | + with open(filename, 'w') as datafile: |
| 147 | + for row in sample_data: |
| 148 | + datafile.write("\t ".join(map(str, row)) + "\t\n") |
| 149 | + io = AsciiSignalIO(filename, skiprows=1) |
| 150 | + block = io.read_block() |
| 151 | + signal = block.segments[0].analogsignals[0] |
| 152 | + self.assertEqual(signal.shape, (4, 1)) |
| 153 | + self.assertEqual(len(block.segments[0].analogsignals), 5) |
| 154 | + self.assertEqual(len(block.segments[0].analogsignals[0]), 4) |
| 155 | + self.assertEqual(signal.units, pq.V) |
| 156 | + |
| 157 | + os.remove(filename) |
138 | 158 |
|
139 | 159 | def test_timecolumn(self): |
140 | 160 | sample_data = np.random.uniform(size=(200, 3)) |
|
0 commit comments