Skip to content

Commit

Permalink
Merge pull request #91 from LorenFrankLab/dio_comments
Browse files Browse the repository at this point in the history
Add ability to include dio comments from metadata yaml
  • Loading branch information
edeno authored Mar 19, 2024
2 parents 1f559fe + 669064d commit f211392
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/trodes_to_nwb/convert_dios.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ def _get_channel_name_map(metadata: dict) -> dict[str, str]:
raise ValueError(
f"Duplicate channel name {dio_event['description']} in metadata YAML"
)
channel_name_map[dio_event["description"]] = dio_event["name"]
channel_name_map[dio_event["description"]] = {
"name": dio_event["name"],
"comments": (
dio_event["comments"] if "comments" in dio_event else "no comments"
),
}
return channel_name_map


Expand Down Expand Up @@ -88,7 +93,8 @@ def add_dios(nwbfile: NWBFile, recfile: list[str], metadata: dict) -> None:
assert isinstance(timestamps[0], np.float64)
assert isinstance(timestamps, np.ndarray)
ts = TimeSeries(
name=channel_name_map[channel_name],
name=channel_name_map[channel_name]["name"],
comments=channel_name_map[channel_name]["comments"],
description=channel_name,
data=state_changes,
unit="-1", # TODO change to "N/A",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ device:
behavioral_events:
- description: Din1
name: Light_1
comments: Indicator for reward delivery
- description: Din2
name: Light_2
- description: Dout2
Expand Down

0 comments on commit f211392

Please sign in to comment.