@@ -69,10 +69,10 @@ class ImagingPlane(NWBContainer):
6969 {'name' : 'optical_channel' , 'type' : (list , OpticalChannel ), # required
7070 'doc' : 'One of possibly many groups storing channel-specific data.' },
7171 {'name' : 'description' , 'type' : str , 'doc' : 'Description of this ImagingPlane.' , 'default' : None },
72- {'name' : 'device' , 'type' : Device , 'doc' : 'the device that was used to record' }, # required
73- {'name' : 'excitation_lambda' , 'type' : float , 'doc' : 'Excitation wavelength in nm.' }, # required
74- {'name' : 'indicator' , 'type' : str , 'doc' : 'Calcium indicator' }, # required
75- {'name' : 'location' , 'type' : str , 'doc' : 'Location of image plane.' }, # required
72+ {'name' : 'device' , 'type' : Device , 'doc' : 'the device that was used to record' , 'default' : None }, # required
73+ {'name' : 'excitation_lambda' , 'type' : float , 'doc' : 'Excitation wavelength in nm.' , 'default' : None }, # required
74+ {'name' : 'indicator' , 'type' : str , 'doc' : 'Calcium indicator' , 'default' : None }, # required
75+ {'name' : 'location' , 'type' : str , 'doc' : 'Location of image plane.' , 'default' : None }, # required
7676 {'name' : 'imaging_rate' , 'type' : float ,
7777 'doc' : 'Rate images are acquired, in Hz. If the corresponding TimeSeries is present, the rate should be '
7878 'stored there instead.' , 'default' : None },
@@ -128,6 +128,21 @@ def __init__(self, **kwargs):
128128
129129 if not isinstance (args_to_set ['optical_channel' ], list ):
130130 args_to_set ['optical_channel' ] = [args_to_set ['optical_channel' ]]
131+
132+ # Note: device, excitation_lambda, indicator, and location are required arguments.
133+ # Description was made to be optional in PyNWB 3.1.0, however to avoid breaking API changes,
134+ # the order of the arguments needs to be maintained even though the optional arguments came before the required ones.
135+ # So in docval these required arguments are displayed as optional when really they are required.
136+ # This section can be removed when positional arguments are no longer allowed.
137+ if args_to_set ['device' ] is None :
138+ raise ValueError ("The 'device' argument is required for ImagingPlane." )
139+ if args_to_set ['excitation_lambda' ] is None :
140+ raise ValueError ("The 'excitation_lambda' argument is required for ImagingPlane." )
141+ if args_to_set ['indicator' ] is None :
142+ raise ValueError ("The 'indicator' argument is required for ImagingPlane." )
143+ if args_to_set ['location' ] is None :
144+ raise ValueError ("The 'location' argument is required for ImagingPlane." )
145+
131146 if args_to_set ['manifold' ] is not None :
132147 error_msg = "The 'manifold' argument is deprecated in favor of 'origin_coords' and 'grid_spacing'."
133148 self ._error_on_new_pass_on_construct (error_msg = error_msg )
0 commit comments