Skip to content

Commit 49534ce

Browse files
authored
Merge pull request #1615 from NeuralEnsemble/black-formatting
Black formatting
2 parents 45ec350 + 4343a25 commit 49534ce

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

neo/rawio/intanrawio.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def _parse_header(self):
173173
self._block_size,
174174
channel_number_dict,
175175
) = read_rhd(self.filename, self.file_format)
176-
176+
177177
#############################################
178178
# memmap the raw data for each format type
179179
#############################################
@@ -207,7 +207,6 @@ def _parse_header(self):
207207
channel_file_paths = raw_file_paths_dict[stream_name]
208208
channel_memmap_list = [np.memmap(fp, dtype=stream_dtype, mode="r") for fp in channel_file_paths]
209209
self._raw_data[stream_name] = channel_memmap_list
210-
211210

212211
# Data Integrity checks
213212
# strictness of check is controlled by ignore_integrity_checks
@@ -747,12 +746,12 @@ def read_rhs(filename, file_format: str):
747746

748747
# Build a dictionary with channel count
749748
special_cases_for_counting = [
750-
"DC Amplifier channel",
751-
"Stim channel",
749+
"DC Amplifier channel",
750+
"Stim channel",
752751
]
753752
names_to_count = [name for name in stream_names if name not in special_cases_for_counting]
754753
channel_number_dict = {name: len(stream_name_to_channel_info_list[name]) for name in names_to_count}
755-
754+
756755
# Both DC Amplifier and Stim streams have the same number of channels as the amplifier stream
757756
channel_number_dict["DC Amplifier channel"] = channel_number_dict["RHS2000 amplifier channel"]
758757
channel_number_dict["Stim channel"] = channel_number_dict["RHS2000 amplifier channel"]
@@ -1204,6 +1203,7 @@ def create_one_file_per_signal_dict_rhd(dirname):
12041203

12051204
return raw_file_paths_dict
12061205

1206+
12071207
stream_name_to_file_name_rhs = {
12081208
"RHS2000 amplifier channel": "amplifier.dat",
12091209
"RHS2000 auxiliary input channel": "auxiliary.dat",
@@ -1214,6 +1214,7 @@ def create_one_file_per_signal_dict_rhd(dirname):
12141214
"USB board digital output channel": "digitalout.dat",
12151215
}
12161216

1217+
12171218
def create_one_file_per_signal_dict_rhs(dirname):
12181219
"""Function for One File Per Signal Type
12191220
@@ -1275,10 +1276,10 @@ def create_one_file_per_channel_dict_rhd(dirname):
12751276
for stream_name, file_prefix in stream_name_to_file_prefix_rhd.items():
12761277
stream_files = [file for file in files if file_prefix in file.name]
12771278
# Map file name to channel name amp-A-000.dat -> A-000 amp-B-006.dat -> B-006 etc
1278-
file_path_to_channel_name = lambda x: '-'.join(x.stem.split('-')[1:])
1279+
file_path_to_channel_name = lambda x: "-".join(x.stem.split("-")[1:])
12791280
sorted_stream_files = sorted(stream_files, key=file_path_to_channel_name)
12801281
raw_file_paths_dict[stream_name] = sorted_stream_files
1281-
1282+
12821283
raw_file_paths_dict["timestamp"] = [Path(dirname / "time.dat")]
12831284
return raw_file_paths_dict
12841285

@@ -1294,6 +1295,7 @@ def create_one_file_per_channel_dict_rhd(dirname):
12941295
"USB board digital output channel": "board-DIGITAL-OUT",
12951296
}
12961297

1298+
12971299
def create_one_file_per_channel_dict_rhs(
12981300
dirname,
12991301
):
@@ -1316,7 +1318,7 @@ def create_one_file_per_channel_dict_rhs(
13161318
for stream_name, file_prefix in stream_name_to_file_prefix_rhs.items():
13171319
stream_files = [file for file in files if file_prefix in file.name]
13181320
# Map file name to channel name amp-A-000.dat -> A-000 amp-B-006.dat -> B-006 etc
1319-
file_path_to_channel_name = lambda x: '-'.join(x.stem.split('-')[1:])
1321+
file_path_to_channel_name = lambda x: "-".join(x.stem.split("-")[1:])
13201322
sorted_stream_files = sorted(stream_files, key=file_path_to_channel_name)
13211323
raw_file_paths_dict[stream_name] = sorted_stream_files
13221324

neo/test/rawiotest/test_intanrawio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ def test_annotations(self):
6767
)
6868
np.testing.assert_array_equal(signal_array_annotations["board_stream_num"][:10], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
6969

70-
7170
def test_correct_reading_one_file_per_channel(self):
7271
"Issue: https://github.com/NeuralEnsemble/python-neo/issues/1599"
7372
# Test reading of one-file-per-channel format file. The channels should match the raw files
@@ -77,7 +76,7 @@ def test_correct_reading_one_file_per_channel(self):
7776

7877
# This should be the folder where the files of all the channels are stored
7978
folder_path = file_path.parent
80-
79+
8180
# The paths are named as amp-A-000.dat, amp-A-001.dat, amp-A-002.dat, ...
8281
amplifier_file_paths = [path for path in folder_path.iterdir() if "amp" in path.name]
8382
channel_names = [path.name[4:-4] for path in amplifier_file_paths]
@@ -87,5 +86,6 @@ def test_correct_reading_one_file_per_channel(self):
8786
data_from_neo = intan_reader.get_analogsignal_chunk(channel_ids=[channel_name], stream_index=0).squeeze()
8887
np.testing.assert_allclose(data_raw, data_from_neo)
8988

89+
9090
if __name__ == "__main__":
9191
unittest.main()

0 commit comments

Comments
 (0)