예제 #1
0
 def _findbytime(self, t, cache=False):
     if t < self._times[0]:
         raise IndexError('time before beginning of data')
     filenum = find_index(self._times, t)
     times = self._read_frame_time(filenum, cache=cache)
     if t > times[-1]:
         raise IndexError('time after end of data')
     framenum = find_index(times, t)
     
     return filenum, framenum
예제 #2
0
def find_pulse(time, times, files):
    if time < times[0]:
        raise IndexError('time before beginning of data')
    fnum = find_index(times, time)

    with h5py.File(files[fnum], 'r') as f:
        t = read_frame_time(f)
    if time > t[-1]:
        raise IndexError('time after end of data')
    pnum = find_index(t, time)

    return fnum, pnum
예제 #3
0
 def _findbyframe(self, f):
     if (f < 0) or (f > self.shape[0]):
         raise IndexError('frame index out of range')
     filenum = find_index(self._framenums, f)
     framenum = f - self._framenums[filenum]
     
     return filenum, framenum