20
20
from ..utils import (nx , dfs_preorder )
21
21
from ..engine import (MapNode , str2bool )
22
22
23
+ import nipype
23
24
from nipype .utils .filemanip import savepkl , loadpkl
24
25
from nipype .interfaces .utility import Function
25
26
@@ -90,6 +91,13 @@ def report_nodes_not_run(notrun):
90
91
'Check log for details' ))
91
92
92
93
94
+ def write_matplotlibrc (batch_dir ):
95
+ """Set the matplotlib backend in a local rc file."""
96
+ backend = nipype .config .get ("execution" , "matplotlib_backend" )
97
+ with open (os .path .join (batch_dir , "matplotlibrc" ), "w" ) as fid :
98
+ fid .write ("backend : %s" % backend )
99
+
100
+
93
101
def create_pyscript (node , updatehash = False , store_exception = True ):
94
102
# pickle node
95
103
timestamp = strftime ('%Y%m%d_%H%M%S' )
@@ -103,6 +111,7 @@ def create_pyscript(node, updatehash=False, store_exception=True):
103
111
batch_dir = os .path .join (node .base_dir , 'batch' )
104
112
if not os .path .exists (batch_dir ):
105
113
os .makedirs (batch_dir )
114
+ write_matplotlibrc (batch_dir )
106
115
pkl_file = os .path .join (batch_dir , 'node_%s.pklz' % suffix )
107
116
savepkl (pkl_file , dict (node = node , updatehash = updatehash ))
108
117
# create python script to load and trap exception
0 commit comments