def time_slice(self, t_start, t_stop):

        # checking start time and transforming to start index
        if t_start is None:
            i = 0
        else:
            t_start = t_start.rescale(self.sampling_period.units)
            i = (t_start - self.t_start) / self.sampling_period
            i = int(np.rint(i.magnitude))

        # checking stop time and transforming to stop index
        if t_stop is None:
            j = len(self)
        else:
            t_stop = t_stop.rescale(self.sampling_period.units)
            j = (t_stop - self.t_start) / self.sampling_period
            j = int(np.rint(j.magnitude))

        if (i < 0) or (j > len(self)):
            raise ValueError('t_start, t_stop have to be withing the analog \
                              signal duration')

        # we're going to send the list of indicies so that we get *copy* of the
        # sliced data
        obj = super(BaseAnalogSignal, self).__getitem__(np.arange(i, j, 1))
        obj.t_start = self.t_start + i * self.sampling_period

        return obj
Creates a new AnalogSignal corresponding to the time slice of the
dataset/ETHPy150Open NeuralEnsemble/python-neo/neo/core/analogsignalarray.py/AnalogSignalArray.time_slice