Skip to content

Commit

Permalink
Copy all figures into a separate folder
Browse files Browse the repository at this point in the history
  • Loading branch information
jasmainak committed Oct 2, 2017
1 parent a5b6784 commit 420a961
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 12 deletions.
2 changes: 1 addition & 1 deletion scripts/results/_plot_cov.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
# axes[1].legend_.remove()
fig.set_size_inches(8, 6, forward=True)
plt.tight_layout()
fig.savefig('plot_white.pdf', bbox_to_inches='tight')
fig.savefig('figures/plot_white.pdf', bbox_to_inches='tight')
6 changes: 3 additions & 3 deletions scripts/results/plot_fanning.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
ts_args=dict(ylim=ylim, spatial_colors=True),
topomap_args=dict(vmin=-300, vmax=300))
fig.set_size_inches(12, 6, forward=True)
fig.savefig('FanningA.pdf', bbox_to_inches='tight')
fig.savefig('figures/FanningA.pdf', bbox_to_inches='tight')

###############################################################################
# Next, we highpass filter (but no lowpass filter as we have already done it)
Expand All @@ -62,7 +62,7 @@
ts_args=dict(ylim=ylim, spatial_colors=True),
topomap_args=dict(vmin=-300, vmax=300))
fig.set_size_inches(12, 6, forward=True)
fig.savefig('FanningB.pdf', bbox_to_inches='tight')
fig.savefig('figures/FanningB.pdf', bbox_to_inches='tight')

###############################################################################
# Finally, we can also use the tSSS data which has a highpass
Expand All @@ -82,4 +82,4 @@
ts_args=dict(ylim=ylim, spatial_colors=True),
topomap_args=dict(vmin=-300, vmax=300))
fig.set_size_inches(12, 6, forward=True)
fig.savefig('FanningC.pdf', bbox_to_inches='tight')
fig.savefig('figures/FanningC.pdf', bbox_to_inches='tight')
2 changes: 1 addition & 1 deletion scripts/results/plot_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@ def box_off(ax):

plt.tight_layout()
plt.show()
plt.savefig('filters.pdf', bbox_to_inches='tight')
plt.savefig('figures/filters.pdf', bbox_to_inches='tight')
2 changes: 1 addition & 1 deletion scripts/results/plot_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
plt.legend()
plt.tight_layout()
plt.show()
plt.savefig('grand_average_highpass-%sHz.pdf' % l_freq)
plt.savefig('figures/grand_average_highpass-%sHz.pdf' % l_freq)

###############################################################################
# Source-space. See :ref:`sphx_glr_auto_scripts_14-group_average_source.py`
Expand Down
2 changes: 1 addition & 1 deletion scripts/results/plot_maxfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@
ylim=ylim,
titles={'mag': 'After Maxfilter (TM)'})
axes[2].set_title('C')
fig.savefig('Maxfilter.pdf', bbox_to_inches='tight')
fig.savefig('figures/Maxfilter.pdf', bbox_to_inches='tight')
4 changes: 2 additions & 2 deletions scripts/results/plot_psd.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

fig.tight_layout()
plt.show()
fig.savefig('psdA.pdf', bbox_to_inches='tight')
fig.savefig('figures/psdA.pdf', bbox_to_inches='tight')

###############################################################################
# Next, the linear scale to check power line frequency
Expand All @@ -107,4 +107,4 @@
plt.axvline(freq, linestyle='--', alpha=0.25, linewidth=2)

plt.tight_layout()
fig.savefig('psdB.pdf', bbox_to_inches='tight')
fig.savefig('figures/psdB.pdf', bbox_to_inches='tight')
2 changes: 1 addition & 1 deletion scripts/results/plot_sensor_cluster_stats_eeg_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@
plt.xlim([-200, 800])
plt.tight_layout()
plt.show()
plt.savefig('sensorstat.pdf', bbox_to_inches='tight')
plt.savefig('figures/sensorstat.pdf', bbox_to_inches='tight')
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@
mne.viz.tight_layout(fig=fig)
fig.subplots_adjust(bottom=.05)
plt.show()
plt.savefig('spatiotemporal_stats_cluster-%02d.pdf' % i_clu)
plt.savefig('figures/spatiotemporal_stats_cluster-%02d.pdf' % i_clu)
55 changes: 55 additions & 0 deletions scripts/results/plot_source_stats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"""
=====================
Source space clusters
=====================
Clustering in source space.
"""
import os.path as op
import numpy as np
from scipy import stats
from functools import partial

import mne
from mne import spatial_tris_connectivity, grade_to_tris
from mne.stats import (spatio_temporal_cluster_1samp_test,
summarize_clusters_stc, ttest_1samp_no_p)

from library.config import meg_dir, subjects_dir

exclude = [1, 5, 16] # Excluded subjects
contrasts = list()
for subject_id in range(1, 20):
if subject_id in exclude:
continue
subject = "sub%03d" % subject_id
print("processing subject: %s" % subject)
data_path = op.join(meg_dir, subject)
contrast = mne.read_source_estimate(op.join(data_path, 'contrast-morphed'))
contrast.resample(100)
contrast.crop(0., None)
contrasts.append(contrast.data.T)

X = np.abs(np.array(contrasts))

connectivity = spatial_tris_connectivity(grade_to_tris(4))
p_threshold = 0.001
t_threshold = -stats.distributions.t.ppf(p_threshold / 2., 15)

stat_fun = partial(ttest_1samp_no_p, sigma=0.5)
T_obs, clusters, cluster_p_values, H0 = clu = \
spatio_temporal_cluster_1samp_test(X, connectivity=connectivity, n_jobs=1,
threshold=t_threshold,
stat_fun=stat_fun, verbose=True)

good_cluster_inds = np.where(cluster_p_values < p_threshold)[0]
tstep = contrast.tstep
fsave_vertices = [np.arange(2562), np.arange(2562)]
stc_all_cluster_vis = summarize_clusters_stc(clu, tstep=tstep,
vertices=fsave_vertices,
subject='fsaverage')

brain = stc_all_cluster_vis.plot(hemi='both', subjects_dir=subjects_dir,
time_label='Duration significant (ms)',
views='ven',
clim=dict(lims=[0, 15, 30], kind='value'))
2 changes: 1 addition & 1 deletion scripts/results/plot_time_decoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
plt.legend()
plt.tight_layout()
plt.show()
plt.savefig('time_decoding.pdf', bbox_to_inches='tight')
plt.savefig('figures/time_decoding.pdf', bbox_to_inches='tight')

###############################################################################
# It seems that `'famous'` vs `'unfamiliar'` gives much noisier time course of
Expand Down

0 comments on commit 420a961

Please sign in to comment.