Skip to content

Commit 399abb0

Browse files
committed
add test for no ref case
1 parent 8f93538 commit 399abb0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/trodes_to_nwb/tests/test_convert_yaml.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,31 @@ def test_add_tasks():
288288
assert task_df["task_environment"][0] == task_metadata["task_environment"]
289289

290290

291+
def test_no_reference_electrode():
292+
metadata_path = data_path / "20230622_sample_metadata.yml"
293+
probe_metadata = [data_path / "tetrode_12.5.yml"]
294+
metadata, probe_metadata = convert_yaml.load_metadata(metadata_path, probe_metadata)
295+
nwbfile = convert_yaml.initialize_nwb(metadata, default_test_xml_tree())
296+
297+
# create the hw_channel map using rec data
298+
recfile = data_path / "20230622_sample_01_a1.rec"
299+
rec_header = convert_rec_header.read_header(recfile)
300+
hw_channel_map = convert_rec_header.make_hw_channel_map(
301+
metadata, rec_header.find("SpikeConfiguration")
302+
)
303+
ref_electrode_map = convert_rec_header.make_ref_electrode_map(
304+
metadata, rec_header.find("SpikeConfiguration")
305+
)
306+
# set one terode to no reference
307+
ref_electrode_map["0"] = ("-1", -1)
308+
convert_yaml.add_electrode_groups(
309+
nwbfile, metadata, probe_metadata, hw_channel_map, ref_electrode_map
310+
)
311+
df = nwbfile.electrodes.to_dataframe()
312+
assert all(df[df["group_name"] == "0"].ref_elect_id.unique() == -1)
313+
assert all(df[df["group_name"] != "0"].ref_elect_id.unique() == 0)
314+
315+
291316
def test_add_associated_files(capsys):
292317
# Create a logger
293318
logger = convert.setup_logger("convert", "testing.log")

0 commit comments

Comments
 (0)