'Get location and latency of peak amplitude.
Parameters
hemi : {\'lh\', \'rh\', None}
The hemi to be considered. If None, the entire source space is
considered.
tmin : float | None
The minimum point in time to be considered for peak getting.
tmax : float | None
The maximum point in time to be considered for peak getting.
mode : {\'pos\', \'neg\', \'abs\'}
How to deal with the sign of the data. If \'pos\' only positive
values will be considered. If \'neg\' only negative values will
be considered. If \'abs\' absolute values will be considered.
Defaults to \'abs\'.
vert_as_index : bool
whether to return the vertex index instead of of its ID.
Defaults to False.
time_as_index : bool
Whether to return the time index instead of the latency.
Defaults to False.
Returns
pos : int
The vertex exhibiting the maximum response, either ID or index.
latency : float | int
The time point of the maximum response, either latency in seconds
or index.'

def get_peak(self, hemi=None, tmin=None, tmax=None, mode='abs', vert_as_index=False, time_as_index=False):

    data = {'lh': self.lh_data, 'rh': self.rh_data, None: self.data}[hemi]
    vertno = {'lh': self.lh_vertno, 'rh': self.rh_vertno, None: np.concatenate(self.vertices)}[hemi]
    (vert_idx, time_idx) = _get_peak(data, self.times, tmin, tmax, mode)
    return ((vert_idx if vert_as_index else vertno[vert_idx]), (time_idx if time_as_index else self.times[time_idx]))
