def __getitem__(self, idx_slice):
        if isinstance(idx_slice, int):  # make sure attributes stay 2d
            idx_slice = [idx_slice]

        selected_times = self.times[idx_slice].copy()
        selected_pos = self.pos[idx_slice, :].copy()
        selected_amplitude = self.amplitude[idx_slice].copy()
        selected_ori = self.ori[idx_slice, :].copy()
        selected_gof = self.gof[idx_slice].copy()
        selected_name = self.name

        new_dipole = Dipole(selected_times, selected_pos,
                            selected_amplitude, selected_ori,
                            selected_gof, selected_name)
        return new_dipole
Handle indexing
dataset/ETHPy150Open mne-tools/mne-python/mne/dipole.py/Dipole.__getitem__