LorenFrankLab / rec_to_nwb

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

Index error in position_originator when generating nwb file #31

Closed jguides closed 2 years ago

jguides commented 2 years ago

I got the following index error in positionoriginator when generating an nwb file ("peanut20201109.nwb"). Thanks in advance for any thoughts on this.

`/home/jguidera/anaconda3/envs/rec_to_nwb/lib/python3.7/site-packages/rec_to_binaries/read_binaries.py:73: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. return np.dtype(typearr)


KeyError Traceback (most recent call last) /tmp/ipykernel_2347308/508651778.py in 46 trodes_rec_export_args=trodes_rec_export_args) 47 ---> 48 content = builder.build_nwb() 49 print(content)

~/Src/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')

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

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

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

~/Src/rec_to_nwb/rec_to_nwb/processing/builder/originators/position_originator.py in make(self, nwb_content) 50 zip(meters_per_pixels, position_tracking_paths)): 51 position_df = self.get_position_with_corrected_timestamps( ---> 52 position_tracking_path) 53 position.create_spatialseries( 54 name=f'series{series_id}',

~/Src/rec_to_nwb/rec_to_nwb/processing/builder/originators/position_originator.py in get_position_with_corrected_timestamps(position_tracking_path) 89 90 dio_systime = np.asarray( ---> 91 mcu_neural_timestamps.loc[dio_camera_ticks]) 92 pause_mid_time = find_acquisition_timing_pause(dio_systime) 93 frame_rate_from_dio = get_framerate(

~/anaconda3/envs/rec_to_nwb/lib/python3.7/site-packages/pandas/core/indexing.py in getitem(self, key) 929 930 maybe_callable = com.apply_if_callable(key, self.obj) --> 931 return self._getitem_axis(maybe_callable, axis=axis) 932 933 def _is_scalar_access(self, key: tuple):

~/anaconda3/envs/rec_to_nwb/lib/python3.7/site-packages/pandas/core/indexing.py in _getitem_axis(self, key, axis) 1151 raise ValueError("Cannot index with multidimensional key") 1152 -> 1153 return self._getitem_iterable(key, axis=axis) 1154 1155 # nested tuple slicing

~/anaconda3/envs/rec_to_nwb/lib/python3.7/site-packages/pandas/core/indexing.py in _getitem_iterable(self, key, axis) 1091 1092 # A collection of keys -> 1093 keyarr, indexer = self._get_listlike_indexer(key, axis) 1094 return self.obj._reindex_with_indexers( 1095 {axis: [keyarr, indexer]}, copy=True, allow_dups=True

~/anaconda3/envs/rec_to_nwb/lib/python3.7/site-packages/pandas/core/indexing.py in _get_listlike_indexer(self, key, axis) 1312 keyarr, indexer, new_indexer = ax._reindex_non_unique(keyarr) 1313 -> 1314 self._validate_read_indexer(keyarr, indexer, axis) 1315 1316 if needs_i8_conversion(ax.dtype) or isinstance(

~/anaconda3/envs/rec_to_nwb/lib/python3.7/site-packages/pandas/core/indexing.py in _validate_read_indexer(self, key, indexer, axis) 1375 1376 not_found = list(ensure_index(key)[missing_mask.nonzero()[0]].unique()) -> 1377 raise KeyError(f"{not_found} not in index") 1378 1379

KeyError: '[43885432] not in index'`