From 31b92c47e73ba886495d9ce05eed8b3f72420c09 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Wed, 4 Dec 2024 11:19:34 -0600 Subject: [PATCH] zach feedback --- neo/rawio/intanrawio.py | 10 ++++++---- neo/test/rawiotest/test_intanrawio.py | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/neo/rawio/intanrawio.py b/neo/rawio/intanrawio.py index d93013125..a7b0e56bc 100644 --- a/neo/rawio/intanrawio.py +++ b/neo/rawio/intanrawio.py @@ -747,11 +747,13 @@ def read_rhs(filename, file_format: str): # Build a dictionary with channel count special_cases_for_counting = [ - "DC Amplifier channel", # Same as RHS2000 amplifier channel - "Stim channel", # Same as RHS2000 amplifier channel + "DC Amplifier channel", + "Stim channel", ] names_to_count = [name for name in stream_names if name not in special_cases_for_counting] channel_number_dict = {name: len(stream_name_to_channel_info_list[name]) for name in names_to_count} + + # Both DC Amplifier and Stim streams have the same number of channels as the amplifier stream channel_number_dict["DC Amplifier channel"] = channel_number_dict["RHS2000 amplifier channel"] channel_number_dict["Stim channel"] = channel_number_dict["RHS2000 amplifier channel"] @@ -1264,6 +1266,8 @@ def create_one_file_per_channel_dict_rhd(dirname): raw_files_paths_dict: dict A dict of all the file paths """ + # Developer note, at the moment, the channels require to be n in order + # See https://github.com/NeuralEnsemble/python-neo/issues/1599 fo file_names = dirname.glob("**/*.dat") files = [file for file in file_names if file.is_file()] @@ -1316,9 +1320,7 @@ def create_one_file_per_channel_dict_rhs( sorted_stream_files = sorted(stream_files, key=file_path_to_channel_name) raw_file_paths_dict[stream_name] = sorted_stream_files - # we need time to be the last value raw_file_paths_dict["timestamp"] = [Path(dirname / "time.dat")] - # 10 and 11 are hardcoded in the rhs reader so hardcoded here raw_file_paths_dict["DC Amplifier channel"] = [file for file in files if "dc-" in file.name] # we can find the files, but I can see how to read them out of header # so for now we don't expose the stim files in one-file-per-channel diff --git a/neo/test/rawiotest/test_intanrawio.py b/neo/test/rawiotest/test_intanrawio.py index db70db6ba..3dfe57e4f 100644 --- a/neo/test/rawiotest/test_intanrawio.py +++ b/neo/test/rawiotest/test_intanrawio.py @@ -69,6 +69,7 @@ def test_annotations(self): def test_correct_reading_one_file_per_channel(self): + "Issue: https://github.com/NeuralEnsemble/python-neo/issues/1599" # Test reading of one-file-per-channel format file. The channels should match the raw files file_path = Path(self.get_local_path("intan/intan_fpc_test_231117_052630/info.rhd")) intan_reader = IntanRawIO(filename=file_path)