LorenFrankLab / rec_to_nwb

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

error in position_originator.py #27

Closed shijiegu closed 2 years ago

shijiegu commented 2 years ago
~/Documents/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')

~/Documents/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:

~/Documents/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()

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

~/Documents/rec_to_nwb/rec_to_nwb/processing/builder/originators/position_originator.py in make(self, nwb_content)
     50                 zip(meters_per_pixels, pos_online_paths)):
     51             position_df = self.get_position_with_corrected_timestamps(
---> 52                 pos_online_path)
     53             position.create_spatial_series(
     54                 name=f'series_{series_id}',

~/Documents/rec_to_nwb/rec_to_nwb/processing/builder/originators/position_originator.py in get_position_with_corrected_timestamps(pos_online_path)
     92         dio_systime = np.asarray(continuous_time.loc[dio_camera_ticks])
     93 
---> 94         pause_mid_time = find_acquisition_timing_pause(dio_systime)
     95 
     96         ptp_systime = np.asarray(camera_hwsync.HWTimestamp)

~/Documents/rec_to_nwb/rec_to_nwb/processing/builder/originators/position_originator.py in find_acquisition_timing_pause(timestamps, min_duration, max_duration, n_search)
    278     is_valid_gap = (timestamp_difference > min_duration) & (
    279         timestamp_difference < max_duration)
--> 280     pause_start_ind = np.nonzero(is_valid_gap)[0][0]
    281     pause_end_ind = pause_start_ind + 1
    282     pause_mid_time = (

IndexError: index 0 is out of bounds for axis 0 with size 0
edeno commented 2 years ago

@shijiegu Can you tell me the name and location of the preprocessed and raw data folders?

Also are you using a DIO channel for the camera ticks?

shijiegu commented 2 years ago

/stelmo/shijie/recording_pilot/molly/raw/20220420

shijiegu commented 2 years ago

However, I noticed that even for dates that there was no error, for example, 20220416, the position time in nwb is misaligned.

edeno commented 2 years ago

Should be fixed by 097033dfa1c6e3f12c9a4a63861888860e3bf420