Created
December 9, 2019 23:43
-
-
Save drammock/434c09cbd44e1a9826d4402d522bcd08 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import tracemalloc | |
tracemalloc.start() | |
import os | |
from mayavi import mlab | |
import mne | |
mlab.options.offscreen = True | |
mne.cuda.init_cuda() | |
mne.set_log_level('ERROR') | |
fname = 'GrandAvgN48FSAverage_postCamp_dSPM_faces' | |
fpath = os.path.join('/mnt/scratch/prek/results/group_averages', fname) | |
stc = mne.read_source_estimate(fpath) | |
stc.crop(tmin=0, tmax=0.1) | |
for n in range(100): | |
print(f'iteration {n}') | |
brain = stc.plot(subject='fsaverage', | |
subjects_dir='/mnt/scratch/prek/anat', | |
views=['lat', 'med', 'ven'], | |
hemi='split', | |
size=[1200, 1200]) | |
brain.save_movie('/mnt/scratch/prek/cache/temp.mov', | |
framerate=30, | |
time_dilation=25, | |
interpolation='linear') | |
# print the memory hogs | |
snapshot = tracemalloc.take_snapshot() | |
top_stats = snapshot.statistics('lineno') | |
print('[ Top 5 ]') | |
for stat in top_stats[:5]: | |
print(stat) | |
del snapshot, top_stats |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment