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

Fix AttributeError in NWB export for session_with_id #35

Merged
merged 3 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.

## [0.1.6] - 2023-09-18

+ Update - NWB export checks for activated session schema to allow use of both
`session_with_id` and `session_with_datetime`


## [0.1.5] - 2023-06-20

+ Update - GitHub Actions workflows
Expand Down Expand Up @@ -39,6 +45,7 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
+ Add - GitHub Action release process
+ Add - `session` schema

[0.1.6]: https://github.com/datajoint/element-session/releases/tag/0.1.6
[0.1.5]: https://github.com/datajoint/element-session/releases/tag/0.1.5
[0.1.4]: https://github.com/datajoint/element-session/releases/tag/0.1.4
[0.1.3]: https://github.com/datajoint/element-session/releases/tag/0.1.3
Expand Down
2 changes: 1 addition & 1 deletion element_session/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import session_with_datetime as session
from . import session_with_id as session
kabilar marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 9 additions & 3 deletions element_session/export/nwb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
from uuid import uuid4
import pynwb

from .. import session
from .. import session_with_id, session_with_datetime

for session_module in [session_with_datetime, session_with_id]:
if session_module.schema.is_activated():
session = session_module
else:
continue
kabilar marked this conversation as resolved.
Show resolved Hide resolved


def session_to_nwb(
Expand All @@ -12,7 +18,7 @@ def session_to_nwb(
protocol_key: dict = None,
additional_nwbfile_kwargs=None,
) -> pynwb.NWBFile:
"""Return subject and session metadata ass NWBFile object
"""Return subject and session metadata as NWBFile object

Gather session- and subject-level metadata and use it to create an NWBFile. If there
is no subject_to_nwb export function in the current namespace, subject_id will be
Expand Down Expand Up @@ -58,7 +64,7 @@ def session_to_nwb(
session_key = (session.Session & session_key).fetch1("KEY")

session_identifier = {
k: v.isoformat() if isinstance(v, datetime.datetime) else v
k: v.isoformat() if isinstance(v, datetime.datetime) else str(v)
for k, v in session_key.items()
}

Expand Down
2 changes: 1 addition & 1 deletion element_session/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""Package metadata."""
__version__ = "0.1.5"
__version__ = "0.1.6"