@@ -274,40 +274,43 @@ def load_resultfile(results_file, resolve=True):
274
274
"""
275
275
Load InterfaceResult file from path.
276
276
277
- Parameter
278
- ---------
279
- path : base_dir of node
280
- name : name of node
277
+ Parameters
278
+ ----------
279
+ results_file : pathlike
280
+ Path to an existing pickle (``result_<interface name>.pklz``) created with
281
+ ``save_resultfile``.
282
+ Raises ``FileNotFoundError`` if ``results_file`` does not exist.
283
+ resolve : bool
284
+ Determines whether relative paths will be resolved to absolute (default is ``True``).
281
285
282
286
Returns
283
287
-------
284
- result : InterfaceResult structure
288
+ result : InterfaceResult
289
+ A Nipype object containing the runtime, inputs, outputs and other interface information
290
+ such as a traceback in the case of errors.
285
291
286
292
"""
287
293
results_file = Path (results_file )
288
-
289
294
if not results_file .exists ():
290
295
raise FileNotFoundError (results_file )
291
296
292
- with indirectory (str (results_file .parent )):
293
- result = loadpkl (results_file )
294
-
295
- if resolve and result .outputs :
296
- try :
297
- outputs = result .outputs .get ()
298
- except TypeError : # This is a Bunch
299
- logger .debug ('Outputs object of loaded result %s is a Bunch.' , results_file )
300
- return result
301
-
302
- logger .debug ('Resolving paths in outputs loaded from results file.' )
303
- for trait_name , old in list (outputs .items ()):
304
- if isdefined (old ):
305
- if result .outputs .trait (trait_name ).is_trait_type (OutputMultiPath ):
306
- old = result .outputs .trait (trait_name ).handler .get_value (
307
- result .outputs , trait_name )
308
- value = resolve_path_traits (result .outputs .trait (trait_name ), old ,
309
- results_file .parent )
310
- setattr (result .outputs , trait_name , value )
297
+ result = loadpkl (results_file )
298
+ if resolve and result .outputs :
299
+ try :
300
+ outputs = result .outputs .get ()
301
+ except TypeError : # This is a Bunch
302
+ logger .debug ('Outputs object of loaded result %s is a Bunch.' , results_file )
303
+ return result
304
+
305
+ logger .debug ('Resolving paths in outputs loaded from results file.' )
306
+ for trait_name , old in list (outputs .items ()):
307
+ if isdefined (old ):
308
+ if result .outputs .trait (trait_name ).is_trait_type (OutputMultiPath ):
309
+ old = result .outputs .trait (trait_name ).handler .get_value (
310
+ result .outputs , trait_name )
311
+ value = resolve_path_traits (result .outputs .trait (trait_name ), old ,
312
+ results_file .parent )
313
+ setattr (result .outputs , trait_name , value )
311
314
return result
312
315
313
316
0 commit comments