@@ -200,7 +200,8 @@ def average_networks(in_files, ntwk_res_file, group_id):
200200
201201 # Writes the networks and returns the name
202202 network_name = group_id + "_average.pck"
203- nx .write_gpickle (avg_ntwk , op .abspath (network_name ))
203+ with open (op .abspath (network_name ), 'wb' ) as f :
204+ pickle .dump (avg_ntwk , f , pickle .HIGHEST_PROTOCOL )
204205 iflogger .info ("Saving average network as %s" , op .abspath (network_name ))
205206 avg_ntwk = fix_keys_for_gexf (avg_ntwk )
206207 network_name = group_id + "_average.gexf"
@@ -483,7 +484,8 @@ def _run_interface(self, runtime):
483484 for key in list (node_measures .keys ()):
484485 newntwk = add_node_data (node_measures [key ], ntwk )
485486 out_file = op .abspath (self ._gen_outfilename (key , "pck" ))
486- nx .write_gpickle (newntwk , out_file )
487+ with open (out_file , 'wb' ) as f :
488+ pickle .dump (newntwk , f , pickle .HIGHEST_PROTOCOL )
487489 nodentwks .append (out_file )
488490 if isdefined (self .inputs .out_node_metrics_matlab ):
489491 node_out_file = op .abspath (self .inputs .out_node_metrics_matlab )
@@ -497,7 +499,8 @@ def _run_interface(self, runtime):
497499 for key in list (edge_measures .keys ()):
498500 newntwk = add_edge_data (edge_measures [key ], ntwk )
499501 out_file = op .abspath (self ._gen_outfilename (key , "pck" ))
500- nx .write_gpickle (newntwk , out_file )
502+ with open (out_file , 'wb' ) as f :
503+ pickle .dump (newntwk , f , pickle .HIGHEST_PROTOCOL )
501504 edgentwks .append (out_file )
502505 if isdefined (self .inputs .out_edge_metrics_matlab ):
503506 edge_out_file = op .abspath (self .inputs .out_edge_metrics_matlab )
@@ -521,7 +524,8 @@ def _run_interface(self, runtime):
521524 out_file = op .abspath (
522525 self ._gen_outfilename (self .inputs .out_k_crust , "pck" )
523526 )
524- nx .write_gpickle (ntwk_measures [key ], out_file )
527+ with open (out_file , 'wb' ) as f :
528+ pickle .dump (ntwk_measures [key ], f , pickle .HIGHEST_PROTOCOL )
525529 kntwks .append (out_file )
526530 gpickled .extend (kntwks )
527531
0 commit comments