'Crop data to a given time interval.
Parameters
tmin : float | None
Start time of selection in seconds.
tmax : float | None
End time of selection in seconds.
Returns
self : instance of Dipole
The cropped intance.'

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

    sfreq = None
    if (len(self.times) > 1):
        sfreq = (1.0 / np.median(np.diff(self.times)))
    mask = _time_mask(self.times, tmin, tmax, sfreq=sfreq)
    for attr in ('times', 'pos', 'gof', 'amplitude', 'ori', 'khi2', 'nfree'):
        if (getattr(self, attr) is not None):
            setattr(self, attr, getattr(self, attr)[mask])
    for key in self.conf.keys():
        self.conf[key] = self.conf[key][mask]
    return self
