Esempio n. 1
0
 def byframe(self, start, stop=None, step=1, slc=slice(None), nframes=1):
     start = wrap_check_start(self.shape[0], start)
     if stop is None:
         stop = start + step*nframes
     else:
         stop = wrap_check_stop(self.shape[0], stop)
     
     fnumstart, fstart = self._findbyframe(start)
     fnumstop, fstop = self._findbyframe(stop)
     
     return self._read_frames(fnumstart, fstart, fnumstop, fstop, step, slc)
Esempio n. 2
0
 def read_from_block(self, block_num, start, stop=None, step=1, nframes=1,
                     chan_idx=slice(None), sample_idx=slice(None)):
     start = wrap_check_start(self.nprofiles_per_block, start)
     if stop is None:
         stop = start + step*nframes
     else:
         stop = wrap_check_stop(self.nprofiles_per_block, stop)
     ## change ints to lists so that we don't lose dimensions when indexing
     #if isinstance(chan_idx, int):
         #chan_idx = [chan_idx]
     #if isinstance(sample_idx, int):
         #sample_idx = [sample_idx]
     return self._read_from_block(block_num, start, stop, step, chan_idx, sample_idx)
Esempio n. 3
0
    def read_voltage(self, start, stop=None, step=1, nframes=1,
                     chan_idx=slice(None), sample_idx=slice(None)):
        start = wrap_check_start(self.shape[0], start)
        if stop is None:
            stop = start + step*nframes
        else:
            stop = wrap_check_stop(self.shape[0], stop)
        ## change ints to lists so that we don't lose dimensions when indexing
        #if isinstance(chan_idx, int):
            #chan_idx = [chan_idx]
        #if isinstance(sample_idx, int):
            #sample_idx = [sample_idx]

        # find blocks for start and stop
        bstart, strt = divmod(start, self.nprofiles_per_block)
        # want block of last profile to include, hence profile number end = stop - 1
        end = stop - 1
        bend, nend = divmod(end, self.nprofiles_per_block)
        stp = nend + 1

        return self._read_from_blocks(bstart, strt, bend, stp, step, chan_idx, sample_idx)