pre-stimulus power

Hello MNE Team,

I am currently analyzing data from a within subjects design. I want to compare two conditions regarding low frequency power (alpha and beta) in the pre-stimulus window (300ms). Ideally I used morlet wavelets to do this anlysis but I am now worried that the effect I find is driven by the post stimulus window. I crop the data before I calculate wavelets to the pre-stimulus window (-1,0) but this might also introduce edge artifacts. The settings for the morelt wavelets are the following:

I run the wavelets on the cropped time windo (0-1second pre-stimulus)

n_cycles = freqs/ 4.0
freqs = np.logspace(*np.log10([8,35]))

This is the effect I find after running a cluster based based permutation test over centro parietal electrodes:

Screenshot (63)

Any help is appreciated :slight_smile:

Best,

Carina

a related question to cluster based permutation tests: how can I have one significant cluster that spans several clusters that are separated in time and frequencies? Am I missing something? this is the code for the cluster test to compare the conditions:

thresh = stats.t.ppf(1 - 0.025, df) #two sided test

print(thresh)

# there is no dependent t test in mne so we create the function here (according to mne office hour)

def ttest_rel_nop(*args):
    tvals, _ = stats.ttest_1samp(*args, popmean=0)
    return tvals

T_obs, clusters, cluster_p_values, H0 = mne.stats.permutation_cluster_1samp_test(
    a[:,spec_channel_list,:,-(epochs.get_data().shape[2]):] - b[:,spec_channel_list,:,-(epochs.get_data().shape[2]):],
    n_jobs=3, n_permutations=10000, threshold=thresh, tail=0, out_type="mask", stat_fun=ttest_rel_nop)

Update:
a colleague recommended zero padding or mirroring the time window of interest before running wavelets, is this implemented in mne or does anyone know a quick way to do that? So I basically want to add the 300ms window to the end and the beginning to end up with 900ms which allows me to get rid of post stimulus activity and edge artifacts at the same time. I know that I can use welchs method to do that but then I loose the time information.