def _load_at(self, time, channels=None):
        """Load a waveform at a given time."""
        if channels is None:
            channels = slice(None, None, None)
        time = int(time)
        time_o = time
        ns = self.n_samples_trace
        if not (0 <= time_o < ns):
            raise ValueError("Invalid time {0:d}/{1:d}.".format(time_o, ns))
        slice_extract = _slice(time_o,
                               self.n_samples_before_after,
                               self._filter_margin)
        extract = self._traces[slice_extract][:, channels].astype(np.float32)

        # Pad the extracted chunk if needed.
        if slice_extract.start <= 0:
            extract = _pad(extract, self._n_samples_extract, 'left')
        elif slice_extract.stop >= ns - 1:
            extract = _pad(extract, self._n_samples_extract, 'right')

        assert extract.shape[0] == self._n_samples_extract
        return extract
def _load_at ( self , time , channels = None ) : if channels is None : channels = slice ( None , None , None ) time = int ( time ) time_o = time ns = self . n_samples_trace if not ( 0 <= time_o < ns ) : raise ValueError ( "Invalid time {0:d}/{1:d}." . format ( time_o , ns ) ) slice_extract = _slice ( time_o , self . n_samples_before_after , self . _filter_margin ) extract = self . _traces [ slice_extract ] [ : , channels ] . astype ( np . float32 ) if slice_extract . start <= 0 : extract = _pad ( extract , self . _n_samples_extract , 'left' ) elif slice_extract . stop >= ns - 1 : extract = _pad ( extract , self . _n_samples_extract , 'right' ) assert extract . shape [ 0 ] == self . _n_samples_extract return extract
Load a waveform at a given time.