Skip to content

Commit d64df11

Browse files
committed
update for use of DeviceModel
1 parent 883a2a4 commit d64df11

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/trodes_to_nwb/convert_yaml.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
from pynwb import NWBFile
2626
from pynwb.file import ProcessingModule, Subject
2727

28+
try:
29+
from pynwb.device import DeviceModel
30+
except ImportError:
31+
# Temporary error message to ensure existing users have the correct version of pynwb
32+
raise ImportError("Please upgrade pynwb to 3.1.0 or later")
33+
2834
import trodes_to_nwb.metadata_validation
2935
from trodes_to_nwb import __version__
3036

@@ -135,12 +141,17 @@ def add_cameras(nwbfile: NWBFile, metadata: dict) -> None:
135141
"""
136142
# add each camera device to the nwb
137143
for camera_metadata in metadata["cameras"]:
144+
model = DeviceModel(
145+
name=camera_metadata["model"],
146+
manufacturer=camera_metadata["manufacturer"],
147+
description="",
148+
)
138149
nwbfile.add_device(
139150
CameraDevice(
140151
name="camera_device " + str(camera_metadata["id"]),
141152
meters_per_pixel=camera_metadata["meters_per_pixel"],
142153
manufacturer=camera_metadata["manufacturer"],
143-
model=camera_metadata["model"],
154+
model=model,
144155
lens=camera_metadata["lens"],
145156
camera_name=camera_metadata["camera_name"],
146157
)

0 commit comments

Comments
 (0)