Ejemplo n.º 1
0
 def compute_frame_indices(self):
     """
     For each frame, find the start and end indices of the
     time synchronized events
     """
     frame_indices = []
     for start_t, end_t in self.timestamps:
         start_idx = binary_search_h5_dset(self.frame_ts, start_t)
         end_idx = binary_search_h5_dset(self.frame_ts, end_t)
         frame_indices.append([start_idx, end_idx])
         # assert start_idx != end_idx, "frame start_idx shoudn't be the same as end_idx"
     return frame_indices
Ejemplo n.º 2
0
    def find_ts_frame_index(self, timestamp):
        indices = np.array(self.frame_indices)
        indices = indices[:, 1]
        _, _, ts, _ = self.get_events_by_idx(indices)

        idx = binary_search_h5_dset(ts, timestamp)
        return idx
Ejemplo n.º 3
0
 def find_ts_index(self, timestamp):
     with h5py.File(self.h5_file_path, 'r') as h5_file:
         idx = binary_search_h5_dset(h5_file['events/ts'], timestamp)
     return idx