# requires: mayavi # dataset: mne_sample ''' Example performes a permutation cluster test on source space data and creates an HTML file describing he output. ''' import eelbrain as e # settings n_samples = 1000 # create an HTML report in which to document results report = e.Report("MNE Sample Dataset", author="Prof. Enid Gumby") section = report.add_section("Introduction") text = ("A comparison of auditory stimulation to the left vs. the right ear " "in the MNE sample dataset. " "Spatio-temporal clusters were formed by thresholding the comparison " "at a t-value equivalent to an uncorrected p-value of 0.05. For each " "cluster, a cluster value was calculated as the sum of all t-values " "in the cluster. In order to calculate p-values for each cluster, " "a distribution of cluster values was computed by shuffling condition " "labels %i times and extracting each time the value of the largest " "cluster." % n_samples) section.append(text) ''' use the sample dataset loader to load source space data for the mne samples dataset. Load only auditory data. ''' ds = e.datasets.get_mne_sample(-0.1, 0.2, src='ico', sub="modality == 'A'") # Add a table with trial numbers to the report
'side', 'L', 'R', ds=ds, samples=n_samples, tstart=0.05) # generate parameter map thresholded at p=0.05 pmap = res.masked_parameter_map(pmin=0.05) # the next line could be used to plot the result for inspection # (any area that is significant at any time) ##e.plot.brain.cluster(pmap.sum('time'), surf='inflated') # create an HTML report with the results form the test report = e.Report("Permutation Test", author="Prof. Enid Gumby") # add some information about the test section = report.add_section("Introduction") text = ("A comparison of auditory stimulation to the left vs. the right ear. " "A distribution of t values was calculated by shuffling condition " "labels %i times and for each test picking the largest absolute t-" "value across time and space. P-values were then calculated for " "every source and time point using this distribution." % n_samples) section.append(text) # image with significance maps in time bins section = report.add_section("Result") image = e.plot.brain.bin_table(pmap, tstep=0.05, surf='smoothwm', views=['lat', 'med']) section.add_figure("Significant regions in time bins.", image)