@@ -112,6 +112,7 @@ def create_nwbs(
112112 n_workers : int = 1 ,
113113 query_expression : str | None = None ,
114114 disable_ptp : bool = False ,
115+ behavior_only : bool = False ,
115116):
116117 """
117118 Convert SpikeGadgets data to NWB format.
@@ -166,6 +167,7 @@ def pass_func(args):
166167 output_dir ,
167168 video_directory ,
168169 convert_video ,
170+ behavior_only = behavior_only ,
169171 )
170172 return True
171173 except Exception as e :
@@ -194,6 +196,7 @@ def pass_func(args):
194196 video_directory ,
195197 convert_video ,
196198 disable_ptp ,
199+ behavior_only = behavior_only ,
197200 )
198201
199202
@@ -206,6 +209,7 @@ def _create_nwb(
206209 video_directory : str = "" ,
207210 convert_video : bool = False ,
208211 disable_ptp : bool = False ,
212+ behavior_only : bool = False ,
209213):
210214 # create loggers
211215 logger = setup_logger ("convert" , f"{ session [1 ]} { session [0 ]} _convert.log" )
@@ -217,7 +221,10 @@ def _create_nwb(
217221 logger .info ("CREATING REC DATA ITERATORS" )
218222 # make generic rec file data chunk iterator to pass to functions
219223 rec_dci = RecFileDataChunkIterator (
220- rec_filepaths , interpolate_dropped_packets = False , stream_id = "trodes"
224+ rec_filepaths ,
225+ interpolate_dropped_packets = False ,
226+ stream_id = "ECU_analog" if behavior_only else "trodes" ,
227+ behavior_only = behavior_only ,
221228 )
222229 rec_dci_timestamps = (
223230 rec_dci .timestamps
@@ -263,30 +270,36 @@ def _create_nwb(
263270 add_acquisition_devices (nwb_file , metadata )
264271 add_tasks (nwb_file , metadata )
265272 add_associated_files (nwb_file , metadata )
266- add_electrode_groups (
267- nwb_file , metadata , device_metadata , hw_channel_map , ref_electrode_map
268- )
269273 add_header_device (nwb_file , rec_header )
270274 add_associated_video_files (
271275 nwb_file , metadata , session_df , video_directory , convert_video
272276 )
273277 add_optogenetics (nwb_file , metadata , device_metadata )
274278
275- logger .info ("ADDING EPHYS DATA" )
276- # add rec file data
277- map_row_ephys_data_to_row_electrodes_table = list (
278- range (len (nwb_file .electrodes ))
279- ) # TODO: Double check this
280- add_raw_ephys (
281- nwb_file ,
282- rec_filepaths ,
283- map_row_ephys_data_to_row_electrodes_table ,
284- metadata ,
285- )
279+ if not behavior_only :
280+ add_electrode_groups (
281+ nwb_file , metadata , device_metadata , hw_channel_map , ref_electrode_map
282+ )
283+ logger .info ("ADDING EPHYS DATA" )
284+ # add rec file data
285+ map_row_ephys_data_to_row_electrodes_table = list (
286+ range (len (nwb_file .electrodes ))
287+ ) # TODO: Double check this
288+ add_raw_ephys (
289+ nwb_file ,
290+ rec_filepaths ,
291+ map_row_ephys_data_to_row_electrodes_table ,
292+ metadata ,
293+ )
286294 logger .info ("ADDING DIO DATA" )
287295 add_dios (nwb_file , rec_filepaths , metadata )
288296 logger .info ("ADDING ANALOG DATA" )
289- add_analog_data (nwb_file , rec_filepaths , timestamps = rec_dci_timestamps )
297+ add_analog_data (
298+ nwb_file ,
299+ rec_filepaths ,
300+ timestamps = rec_dci_timestamps ,
301+ behavior_only = behavior_only ,
302+ )
290303 logger .info ("ADDING SAMPLE COUNTS" )
291304 add_sample_count (nwb_file , rec_dci )
292305 logger .info ("ADDING EPOCHS" )
0 commit comments