Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to include dio comments from metadata yaml #91

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading