Hello all,
I am trying to compute and visualize erds maps as in the tutorial: Compute and visualize ERDS maps β MNE 0.23.0 documentation.
The issue that I am having is that I get many plots that are basically showing the same thing. One plot will suffice.
Here is the piece of coding I am using:
# Run TF decomposition overall epochs
tfrprep5 = tfr_multitaper(concatpreparationb5, freqs=freqs, n_cycles=n_cycles, use_fft=True, return_itc=False, average=False, decim=2)
tfrprep5.apply_baseline(baseline, mode="percent")
tfrprep5.crop(-0.5, 1.5)
for event in concatpreparationb5:
# select desired epochs for visualization
tfrprep5_ev = tfrprep5['47', '86', '113', '167']
fig, axes = plt.subplots(1, 4, figsize=(12, 4),
gridspec_kw={"width_ratios": [10, 10, 10, 1]})
for ch, ax in enumerate(axes[:-1]): # for each channel
# positive clusters
_, c1, p1, _ = pcluster_test(tfrprep5_ev.data[:, ch, ...], tail=1, **kwargs)
# negative clusters
_, c2, p2, _ = pcluster_test(tfrprep5_ev.data[:, ch, ...], tail=-1,
**kwargs)
# note that we keep clusters with p <= 0.05 from the combined clusters
# of two independent tests; in this example, we do not correct for
# these two comparisons
c = np.stack(c1 + c2, axis=2) # combined clusters
p = np.concatenate((p1, p2)) # combined p-values
mask = c[..., p <= 0.05].any(axis=-1)
# plot TFR (ERDS map with masking)
tfrprep5_ev.average().plot([ch], vmin=vmin, vmax=vmax, cmap=(cmap, False),
axes=ax, colorbar=False, show=False, mask=mask,
mask_style="mask")
ax.set_title(concatpreparationb3.ch_names[ch], fontsize=10)
ax.axvline(0, linewidth=1, color="black", linestyle=":") # event
if ch != 0:
ax.set_ylabel("")
ax.set_yticklabels("")
fig.colorbar(axes[0].images[-1], cax=axes[-1])
fig.suptitle("ERDS ({})".format(event))
fig.show()
Atm I have used a variable of concatenated epochs, hence the different labels ['47', '86', '113', '167']
. Even when I use just one type of 48 epochs and 1 label, I still get the issue. This does not seem to be happening in the tutorial.
Is there anyone who knows what the issue is or how I can manipulate the code so it just shows one plot?
Best greetings,
Daphne