color = cycle([color])
times = evoked[0].times
if not all((e.times == times).all() for e in evoked):
raise ValueError("All evoked.times must be the same")
noise_cov = _check_cov(noise_cov, evoked[0].info)
if noise_cov is not None:
evoked = [whiten_evoked(e, noise_cov) for e in evoked]
else:
evoked = [e.copy() for e in evoked]
info = evoked[0].info
ch_names = evoked[0].ch_names
scalings = _handle_default("scalings", scalings)
if not all(e.ch_names == ch_names for e in evoked):
raise ValueError("All evoked.picks must be the same")
ch_names = _clean_names(ch_names)
if merge_grads:
picks = _pair_grad_sensors(info, topomap_coords=False)
chs = list()
for pick in picks[::2]:
ch = info["chs"][pick]
ch["ch_name"] = ch["ch_name"][:-1] + "X"
chs.append(ch)
info["chs"] = chs
info["bads"] = list() // bads dropped on pair_grad_sensors
info._update_redundant()
info._check_consistency()
new_picks = list()
for e in evoked:
data = _merge_grad_data(e.data[picks])
if noise_cov is None:
data *= scalings["grad"]
e.data = data
new_picks.append(range(len(data)))
picks = new_picks
types_used = ["grad"]
unit = _handle_default("units")["grad"] if noise_cov is None else "NA"
y_label = "RMS amplitude (%s)" % unit
if layout is None:
layout = find_layout(info)
if not merge_grads:
// XXX. at the moment we are committed to 1- / 2-sensor-types layouts
chs_in_layout = set(layout.names) & set(ch_names)
types_used = set(channel_type(info, ch_names.index(ch))
for ch in chs_in_layout)
// remove possible reference meg channels
types_used = set.difference(types_used, set("ref_meg"))
// one check for all vendors
meg_types = set(("mag", "grad"))
is_meg = len(set.intersection(types_used, meg_types)) > 0
if is_meg:
types_used = list(types_used)[::-1] // -> restore kwarg order
picks = [pick_types(info, meg=kk, ref_meg=False, exclude=[])
for kk in types_used]
else:
types_used_kwargs = dict((t, True) for t in types_used)
picks = [pick_types(info, meg=False, exclude=[],
**types_used_kwargs)]
assert isinstance(picks, list) and len(types_used) == len(picks)
if noise_cov is None:
for e in evoked:
for pick, ch_type in zip(picks, types_used):
e.data[pick] *= scalings[ch_type]
if proj is True and all(e.proj is not True for e in evoked):
evoked = [e.apply_proj() for e in evoked]
elif proj == "interactive": // let it fail early.
for e in evoked:
_check_delayed_ssp(e)
// Y labels for picked plots must be reconstructed
y_label = list()
for ch_idx in range(len(chs_in_layout)):
if noise_cov is None:
unit = _handle_default("units")[channel_type(info, ch_idx)]
else:
unit = "NA"
y_label.append("Amplitude (%s)" % unit)
if ylim is None:
def set_ylim(x):
return np.abs(x).max()
ylim_ = [set_ylim([e.data[t] for e in evoked]) for t in picks]
ymax = np.array(ylim_)
ylim_ = (-ymax, ymax)
elif isinstance(ylim, dict):
ylim_ = _handle_default("ylim", ylim)
ylim_ = [ylim_[kk] for kk in types_used]
// extra unpack to avoid bug /
After Change
labels=comments)
time_min = min([t[0] for t in times])
time_max = max([t[-1] for t in times])
fig = _plot_topo(info=info, times=[time_min, time_max],
show_func=show_func, click_func=click_func, layout=layout,
colorbar=False, ylim=ylim_, cmap=None,
layout_scale=layout_scale, border=border,