Hi all,
I would like to remove eog artifacts from several files in a loop using ica
and save some plots of the ica results without displaying them while the
loop is running. I have tried this as follows:
subjects = ['av','li','kk','mh','ml']
for s in range(0,5):
sessions = ['_s1','_s2','_s3']
for x in range(0, 3):
...
fig = ica.plot_scores(scores, exclude=eog_inds)
file_end= 'scores.png'
filename = subjects[s]+sessions[x]+file_end
plt.savefig(filename)
plt.close(fig)
fig=ica.plot_sources(epochs_bp,eog_inds)
file_end = 'sources.png'
filename = subjects[s]+sessions[x]+file_end
plt.savefig(filename)
plt.close(fig)
fig=ica.plot_components(eog_inds, colorbar=True)
file_end = 'components.png'
filename = subjects[s]+sessions[x]+file_end
plt.savefig(filename)
plt.close(fig)
ica.exclude += eog_inds[:1]
...
However, I get errors pasted below. They seem to come from plt.close(fig).
Could somebody please let me know what I am doing wrong. Thanks already in
advance!
RuntimeError Traceback (most recent call last)
/usr/lib/pymodules/python2.7/matplotlib/backends/backend_qt4.pyc in
<lambda>()
149 # self.close_event)
150 QtCore.QObject.connect(self, QtCore.SIGNAL('destroyed()'),
--> 151 lambda: self.close_event())
152
153 def __timerEvent(self, event):
/usr/lib/pymodules/python2.7/matplotlib/backend_bases.pyc in
close_event(self, guiEvent)
1562 try:
1563 event = CloseEvent(s, self, guiEvent=guiEvent)
-> 1564 self.callbacks.process(s, event)
1565 except TypeError:
1566 pass
RuntimeError: underlying C/C++ object has been deleted
Best Regards,
Maria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20140816/105cec07/attachment.html