Skip to content

Commit f211392

Browse files
authored
Merge pull request #91 from LorenFrankLab/dio_comments
Add ability to include dio comments from metadata yaml
2 parents 1f559fe + 669064d commit f211392

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/trodes_to_nwb/convert_dios.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ def _get_channel_name_map(metadata: dict) -> dict[str, str]:
2525
raise ValueError(
2626
f"Duplicate channel name {dio_event['description']} in metadata YAML"
2727
)
28-
channel_name_map[dio_event["description"]] = dio_event["name"]
28+
channel_name_map[dio_event["description"]] = {
29+
"name": dio_event["name"],
30+
"comments": (
31+
dio_event["comments"] if "comments" in dio_event else "no comments"
32+
),
33+
}
2934
return channel_name_map
3035

3136

@@ -88,7 +93,8 @@ def add_dios(nwbfile: NWBFile, recfile: list[str], metadata: dict) -> None:
8893
assert isinstance(timestamps[0], np.float64)
8994
assert isinstance(timestamps, np.ndarray)
9095
ts = TimeSeries(
91-
name=channel_name_map[channel_name],
96+
name=channel_name_map[channel_name]["name"],
97+
comments=channel_name_map[channel_name]["comments"],
9298
description=channel_name,
9399
data=state_changes,
94100
unit="-1", # TODO change to "N/A",

src/trodes_to_nwb/tests/test_data/20230622_sample_metadata.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ device:
8080
behavioral_events:
8181
- description: Din1
8282
name: Light_1
83+
comments: Indicator for reward delivery
8384
- description: Din2
8485
name: Light_2
8586
- description: Dout2

0 commit comments

Comments
 (0)