File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -140,18 +140,20 @@ def add_cameras(nwbfile: NWBFile, metadata: dict) -> None:
140140 metadata from the yaml generator
141141 """
142142 # add each camera device to the nwb
143+ camera_devices = {}
143144 for camera_metadata in metadata ["cameras" ]:
144- model = DeviceModel (
145- name = camera_metadata ["model" ],
146- manufacturer = camera_metadata ["manufacturer" ],
147- description = "" ,
148- )
145+ if (model_name := camera_metadata ["model" ]) not in camera_devices :
146+ camera_devices [model_name ] = nwbfile .create_device_model (
147+ name = camera_metadata ["model" ],
148+ manufacturer = camera_metadata ["manufacturer" ],
149+ description = "" ,
150+ )
149151 nwbfile .add_device (
150152 CameraDevice (
151153 name = "camera_device " + str (camera_metadata ["id" ]),
152154 meters_per_pixel = camera_metadata ["meters_per_pixel" ],
153155 manufacturer = camera_metadata ["manufacturer" ],
154- model = model ,
156+ model = camera_devices [ model_name ] ,
155157 lens = camera_metadata ["lens" ],
156158 camera_name = camera_metadata ["camera_name" ],
157159 )
You can’t perform that action at this time.
0 commit comments