Skip to content

Commit 7d111f4

Browse files
authored
Merge pull request #1483 from NeuralEnsemble/black-formatting
Black formatting
2 parents 7244efc + 7b4a799 commit 7d111f4

File tree

3 files changed

+36
-20
lines changed

3 files changed

+36
-20
lines changed

neo/rawio/intanrawio.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class IntanRawIO(BaseRawIO):
4646
ignore_integrity_checks: bool, default: False
4747
If True, data that violates integrity assumptions will be loaded. At the moment the only integrity
4848
check we perform is that timestamps are continuous. Setting this to True will ignore this check and set
49-
the attribute `discontinuous_timestamps` to True if the timestamps are not continous. This attribute can be checked
49+
the attribute `discontinuous_timestamps` to True if the timestamps are not continous. This attribute can be checked
5050
after parsing the header to see if the timestamps are continuous or not.
5151
Notes
5252
-----
@@ -83,7 +83,7 @@ class IntanRawIO(BaseRawIO):
8383
11: 'Stim channel',
8484
8585
* For the "header-attached" and "one-file-per-signal" formats, the structure of the digital input and output channels is
86-
one long vector, which must be post-processed to extract individual digital channel information.
86+
one long vector, which must be post-processed to extract individual digital channel information.
8787
See the intantech website for more information on performing this post-processing.
8888
8989
Examples
@@ -108,7 +108,6 @@ def __init__(self, filename="", ignore_integrity_checks=False):
108108
self.ignore_integrity_checks = ignore_integrity_checks
109109
self.discontinuous_timestamps = False
110110

111-
112111
def _source_name(self):
113112
return self.filename
114113

@@ -207,7 +206,7 @@ def _parse_header(self):
207206
elif self.file_format == "one-file-per-channel":
208207
time_stream_index = max(self._raw_data.keys())
209208
timestamp = self._raw_data[time_stream_index][0]
210-
209+
211210
discontinuous_timestamps = np.diff(timestamp) != 1
212211
timestamps_are_not_contiguous = np.any(discontinuous_timestamps)
213212
if timestamps_are_not_contiguous:
@@ -267,7 +266,7 @@ def _parse_header(self):
267266
# are in a list we just take the first channel in each list of channels
268267
else:
269268
self._max_sigs_length = max([raw_data[0].size for raw_data in self._raw_data.values()])
270-
269+
271270
# No events
272271
event_channels = []
273272
event_channels = np.array(event_channels, dtype=_event_channel_dtype)

neo/test/iotest/test_intanio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class TestIntanIO(
1515
ioclass = IntanIO
1616
entities_to_download = ["intan"]
1717
entities_to_test = [
18-
"intan/intan_rhs_test_1.rhs", # Format header-attached
18+
"intan/intan_rhs_test_1.rhs", # Format header-attached
1919
"intan/intan_rhd_test_1.rhd", # Format header-attached
2020
"intan/rhs_fpc_multistim_240514_082243/rhs_fpc_multistim_240514_082243.rhs", # Format header-attached newer version
2121
"intan/intan_fpc_test_231117_052630/info.rhd", # Format one-file-per-channel
2222
"intan/intan_fps_test_231117_052500/info.rhd", # Format one file per signal
2323
"intan/intan_fpc_rhs_test_240329_091637/info.rhs", # Format one-file-per-channel
24-
"intan/intan_fps_rhs_test_240329_091536/info.rhs", # Format one-file-per-signal
24+
"intan/intan_fps_rhs_test_240329_091536/info.rhs", # Format one-file-per-signal
2525
"intan/rhd_fpc_multistim_240514_082044/info.rhd", # Multiple digital channels one-file-per-channel rhd
2626
]
2727

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import unittest
2-
import numpy as np
2+
import numpy as np
33

44
from neo.rawio.intanrawio import IntanRawIO
55
from neo.test.rawiotest.common_rawio_test import BaseTestRawIO
@@ -12,32 +12,46 @@ class TestIntanRawIO(
1212
rawioclass = IntanRawIO
1313
entities_to_download = ["intan"]
1414
entities_to_test = [
15-
"intan/intan_rhs_test_1.rhs", # Format header-attached
15+
"intan/intan_rhs_test_1.rhs", # Format header-attached
1616
"intan/intan_rhd_test_1.rhd", # Format header-attached
1717
"intan/rhs_fpc_multistim_240514_082243/rhs_fpc_multistim_240514_082243.rhs", # Format header-attached newer version
1818
"intan/intan_fpc_test_231117_052630/info.rhd", # Format one-file-per-channel
1919
"intan/intan_fps_test_231117_052500/info.rhd", # Format one file per signal
2020
"intan/intan_fpc_rhs_test_240329_091637/info.rhs", # Format one-file-per-channel
21-
"intan/intan_fps_rhs_test_240329_091536/info.rhs", # Format one-file-per-signal
21+
"intan/intan_fps_rhs_test_240329_091536/info.rhs", # Format one-file-per-signal
2222
"intan/rhd_fpc_multistim_240514_082044/info.rhd", # Multiple digital channels one-file-per-channel rhd
2323
]
2424

25-
2625
def test_annotations(self):
27-
26+
2827
intan_reader = IntanRawIO(filename=self.get_local_path("intan/intan_rhd_test_1.rhd"))
2928
intan_reader.parse_header()
30-
29+
3130
raw_annotations = intan_reader.raw_annotations
3231
annotations = raw_annotations["blocks"][0]["segments"][0] # Intan is mono segment
3332
signal_annotations = annotations["signals"][0] # As in the other exmaples, annotaions are duplicated
34-
35-
33+
3634
# Scalar annotations
37-
exepcted_annotations = {'intan_version': '1.5', 'desired_impedance_test_frequency': 1000.0, 'desired_upper_bandwidth': 7500.0, 'note1': '', 'notch_filter_mode': 1, 'notch_filter': False, 'nb_signal_group': 7,
38-
'dsp_enabled': 1, 'actual_impedance_test_frequency': 1000.0, 'desired_lower_bandwidth': 0.1, 'note3': '', 'actual_dsp_cutoff_frequency': 1.165828,
39-
'desired_dsp_cutoff_frequency': 1.0, 'actual_lower_bandwidth': 0.0945291, 'eval_board_mode': 0, 'note2': '', 'num_temp_sensor_channels': 0}
40-
35+
exepcted_annotations = {
36+
"intan_version": "1.5",
37+
"desired_impedance_test_frequency": 1000.0,
38+
"desired_upper_bandwidth": 7500.0,
39+
"note1": "",
40+
"notch_filter_mode": 1,
41+
"notch_filter": False,
42+
"nb_signal_group": 7,
43+
"dsp_enabled": 1,
44+
"actual_impedance_test_frequency": 1000.0,
45+
"desired_lower_bandwidth": 0.1,
46+
"note3": "",
47+
"actual_dsp_cutoff_frequency": 1.165828,
48+
"desired_dsp_cutoff_frequency": 1.0,
49+
"actual_lower_bandwidth": 0.0945291,
50+
"eval_board_mode": 0,
51+
"note2": "",
52+
"num_temp_sensor_channels": 0,
53+
}
54+
4155
for key in exepcted_annotations:
4256
if isinstance(exepcted_annotations[key], float):
4357
self.assertAlmostEqual(signal_annotations[key], exepcted_annotations[key], places=2)
@@ -47,8 +61,11 @@ def test_annotations(self):
4761
# Array annotations
4862
signal_array_annotations = signal_annotations["__array_annotations__"]
4963
np.testing.assert_array_equal(signal_array_annotations["native_order"][:10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
50-
np.testing.assert_array_equal(signal_array_annotations["spike_scope_digital_edge_polarity"][:10], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
64+
np.testing.assert_array_equal(
65+
signal_array_annotations["spike_scope_digital_edge_polarity"][:10], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
66+
)
5167
np.testing.assert_array_equal(signal_array_annotations["board_stream_num"][:10], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
5268

69+
5370
if __name__ == "__main__":
5471
unittest.main()

0 commit comments

Comments
 (0)