55import numpy as np
66from hdmf .common .table import DynamicTable , DynamicTableRegion
77from pynwb import NWBFile
8- from pynwb .device import Device
8+ from pynwb .device import Device , DeviceModel
99from pynwb .ophys import (
1010 ImageSegmentation ,
1111 ImagingPlane ,
@@ -32,9 +32,12 @@ def setUp(self):
3232 session_description = "" , identifier = str (uuid4 ()), session_start_time = datetime .now ().astimezone ()
3333 )
3434
35- device = nwbfile .create_device (
36- name = "Microscope" , description = "My two-photon microscope" , manufacturer = "The best microscope manufacturer"
35+ device_model = nwbfile .create_device_model (
36+ name = "My Microscope" ,
37+ description = "My two-photon microscope" ,
38+ manufacturer = "The best microscope manufacturer" ,
3739 )
40+ device = nwbfile .create_device (name = "Microscope" , description = "My two-photon microscope" , model = device_model )
3841 optical_channel = OpticalChannel (name = "OpticalChannel" , description = "an optical channel" , emission_lambda = 500.0 )
3942 imaging_plane = nwbfile .create_imaging_plane (
4043 name = "ImagingPlane" ,
@@ -180,9 +183,10 @@ def test_pass_check_roi_response_series_link_to_plane_segmentation(self):
180183
181184
182185def test_check_excitation_lambda_in_nm ():
183- device = Device (
184- name = "Microscope" , description = "My two-photon microscope" , manufacturer = "The best microscope manufacturer"
186+ device_model = DeviceModel (
187+ name = "My Microscope" , description = "My two-photon microscope" , manufacturer = "The best microscope manufacturer"
185188 )
189+ device = Device (name = "Microscope" , description = "My two-photon microscope" , model = device_model )
186190 optical_channel = OpticalChannel (name = "OpticalChannel" , description = "an optical channel" , emission_lambda = 500.0 )
187191 imaging_plane = ImagingPlane (
188192 name = "ImagingPlane" ,
@@ -203,9 +207,10 @@ def test_check_excitation_lambda_in_nm():
203207
204208
205209def test_pass_check_excitation_lambda_in_nm ():
206- device = Device (
207- name = "Microscope" , description = "My two-photon microscope" , manufacturer = "The best microscope manufacturer"
210+ device_model = DeviceModel (
211+ name = "My Microscope" , description = "My two-photon microscope" , manufacturer = "The best microscope manufacturer"
208212 )
213+ device = Device (name = "Microscope" , description = "My two-photon microscope" , model = device_model )
209214 optical_channel = OpticalChannel (name = "OpticalChannel" , description = "an optical channel" , emission_lambda = 500.0 )
210215 imaging_plane = ImagingPlane (
211216 name = "ImagingPlane" ,
@@ -236,9 +241,10 @@ def test_pass_check_emission_lambda_in_nm():
236241
237242
238243def test_pass_check_plane_segmentation_image_mask_dims_against_imageseries ():
239- device = Device (
240- name = "Microscope" , description = "My two-photon microscope" , manufacturer = "The best microscope manufacturer"
244+ device_model = DeviceModel (
245+ name = "My Microscope" , description = "My two-photon microscope" , manufacturer = "The best microscope manufacturer"
241246 )
247+ device = Device (name = "Microscope" , description = "My two-photon microscope" , model = device_model )
242248 optical_channel = OpticalChannel (name = "OpticalChannel" , description = "an optical channel" , emission_lambda = 500.0 )
243249 imaging_plane = ImagingPlane (
244250 name = "ImagingPlane" ,
@@ -275,9 +281,10 @@ def test_pass_check_plane_segmentation_image_mask_dims_against_imageseries():
275281
276282
277283def test_fail_check_plane_segmentation_image_mask_dims_against_imageseries ():
278- device = Device (
279- name = "Microscope" , description = "My two-photon microscope" , manufacturer = "The best microscope manufacturer"
284+ device_model = DeviceModel (
285+ name = "My Microscope" , description = "My two-photon microscope" , manufacturer = "The best microscope manufacturer"
280286 )
287+ device = Device (name = "Microscope" , description = "My two-photon microscope" , model = device_model )
281288 optical_channel = OpticalChannel (name = "OpticalChannel" , description = "an optical channel" , emission_lambda = 500.0 )
282289 imaging_plane = ImagingPlane (
283290 name = "ImagingPlane" ,
@@ -323,9 +330,10 @@ def test_fail_check_plane_segmentation_image_mask_dims_against_imageseries():
323330
324331
325332def test_false_positive_skip_check_image_series_data_size ():
326- device = Device (
327- name = "Microscope" , description = "My two-photon microscope" , manufacturer = "The best microscope manufacturer"
333+ device_model = DeviceModel (
334+ name = "My Microscope" , description = "My two-photon microscope" , manufacturer = "The best microscope manufacturer"
328335 )
336+ device = Device (name = "Microscope" , description = "My two-photon microscope" , model = device_model )
329337 optical_channel = OpticalChannel (name = "OpticalChannel" , description = "an optical channel" , emission_lambda = 500.0 )
330338 imaging_plane = ImagingPlane (
331339 name = "ImagingPlane" ,
0 commit comments