'Crop raw data file.
Limit the data from the raw file to go between specific times. Note
that the new tmin is assumed to be t=0 for all subsequently called
functions (e.g., time_as_index, or Epochs). New first_samp and
last_samp are set accordingly.
Parameters
tmin : float
New start time in seconds (must be >= 0).
tmax : float | None
New end time in seconds of the data (cannot exceed data duration).
Returns
raw : instance of Raw
The cropped raw object.'

def crop(self, tmin=0.0, tmax=None):

    max_time = ((self.n_times - 1) / self.info['sfreq'])
    if (tmax is None):
        tmax = max_time
    if (tmin > tmax):
        raise ValueError('tmin    must    be    less    than    tmax')
    if (tmin < 0.0):
        raise ValueError('tmin    must    be    >=    0')
    elif (tmax > max_time):
        raise ValueError(('tmax    must    be    less    than    or    equal    to    the    max    raw    time    (%0.4f    sec)' % max_time))
    (smin, smax) = np.where(_time_mask(self.times, tmin, tmax, sfreq=self.info['sfreq']))[0][[0, (-1)]]
    cumul_lens = np.concatenate(([0], np.array(self._raw_lengths, dtype='int')))
    cumul_lens = np.cumsum(cumul_lens)
    keepers = np.logical_and(np.less(smin, cumul_lens[1:]), np.greater_equal(smax, cumul_lens[:(-1)]))
    keepers = np.where(keepers)[0]
    self._first_samps = np.atleast_1d(self._first_samps[keepers])
    self._first_samps[0] += (smin - cumul_lens[keepers[0]])
    self._last_samps = np.atleast_1d(self._last_samps[keepers])
    self._last_samps[(-1)] -= ((cumul_lens[(keepers[(-1)] + 1)] - 1) - smax)
    self._raw_extras = [r for (ri, r) in enumerate(self._raw_extras) if (ri in keepers)]
    self._filenames = [r for (ri, r) in enumerate(self._filenames) if (ri in keepers)]
    if self.preload:
        self._data = self._data[:, smin:(smax + 1)].copy()
    self._update_times()
    if (self.annotations is not None):
        annotations = self.annotations
        annotations.onset -= tmin
        BaseRaw.annotations.fset(self, annotations, emit_warning=False)
    return self
