LorenFrankLab / rec_to_nwb

Data Migration REC -> NWB 2.0 Service
Other
2 stars 8 forks source link

# DIOs and camera frames unalignment #49

Closed yangsunhwang closed 1 year ago

yangsunhwang commented 1 year ago

I am getting an error following. Thank you!

Checking associated file /stelmo/kyu/L5/raw/20230403/20230403_L5_01_r1.stateScriptLog
Checking associated file /stelmo/kyu/L5/raw/20230403/20230403_L5_02_r2.stateScriptLog

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
~/source/rec_to_nwb/rec_to_nwb/processing/builder/originators/position_originator.py in make(self, nwb_content)
     53                 position_df = self.get_position_with_corrected_timestamps(
---> 54                     position_tracking_path[0]
     55                 )

~/source/rec_to_nwb/rec_to_nwb/processing/builder/originators/position_originator.py in get_position_with_corrected_timestamps(position_tracking_path)
    137         # half second pause at the start to allow for alignment.
--> 138         pause_mid_time = find_acquisition_timing_pause(dio_systime)
    139 

~/source/rec_to_nwb/rec_to_nwb/processing/builder/originators/position_originator.py in find_acquisition_timing_pause(timestamps, min_duration, max_duration, n_search)
    391     )
--> 392     pause_start_ind = np.nonzero(is_valid_gap)[0][0]
    393     pause_end_ind = pause_start_ind + 1

IndexError: index 0 is out of bounds for axis 0 with size 0

During handling of the above exception, another exception occurred:

IndexError                                Traceback (most recent call last)
<timed exec> in <module>

~/source/rec_to_nwb/rec_to_nwb/processing/builder/raw_to_nwb_builder.py in build_nwb(self, run_preprocessing, process_mda_valid_time, process_mda_invalid_time, process_pos_valid_time, process_pos_invalid_time)
    230             process_mda_invalid_time=process_mda_invalid_time,
    231             process_pos_valid_time=process_pos_valid_time,
--> 232             process_pos_invalid_time=process_pos_invalid_time)
    233 
    234         logger.info('Done...\n')

~/source/rec_to_nwb/rec_to_nwb/processing/builder/raw_to_nwb_builder.py in __build_nwb_file(self, process_mda_valid_time, process_mda_invalid_time, process_pos_valid_time, process_pos_invalid_time)
    245             logger.info('Date: {}'.format(date))
    246             nwb_builder = self.get_nwb_builder(date)
--> 247             content = nwb_builder.build()
    248             nwb_builder.write(content)
    249             if self.is_old_dataset:

~/source/rec_to_nwb/rec_to_nwb/processing/builder/nwb_file_builder.py in build(self)
    369             self.associated_files_originator.make(nwb_content)
    370 
--> 371         self.position_originator.make(nwb_content)
    372 
    373         valid_map_dict = self.__build_corrupted_data_manager()

~/source/rec_to_nwb/rec_to_nwb/processing/tools/beartype/beartype.py in func_beartyped(__beartype_func, *args, **kwargs)

~/source/rec_to_nwb/rec_to_nwb/processing/builder/originators/position_originator.py in make(self, nwb_content)
     68                 )
     69                 video_df = self.get_corrected_timestamps_without_position(
---> 70                     video_file_path[0]
     71                 )
     72                 position.create_spatial_series(

~/source/rec_to_nwb/rec_to_nwb/processing/builder/originators/position_originator.py in get_corrected_timestamps_without_position(hw_frame_count_path)
    255         # The DIOs and camera frames are initially unaligned. There is a
    256         # half second pause at the start to allow for alignment.
--> 257         pause_mid_time = find_acquisition_timing_pause(dio_systime)
    258 
    259         if ptp_enabled:

~/source/rec_to_nwb/rec_to_nwb/processing/builder/originators/position_originator.py in find_acquisition_timing_pause(timestamps, min_duration, max_duration, n_search)
    390         timestamp_difference < max_duration
    391     )
--> 392     pause_start_ind = np.nonzero(is_valid_gap)[0][0]
    393     pause_end_ind = pause_start_ind + 1
    394     pause_mid_time = (

IndexError: index 0 is out of bounds for axis 0 with size 0