Loading Profugus/Source/Scripts/check_profugus.py +106 −106 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ def check_solution(path_to_results): ref_k = ref_k_dset[0] ref_k_std = np.sqrt(ref_k_var_dset[0]) print '\nReference k = {0:.6f} +/- {1:.3e}'.format(ref_k,ref_k_std) print('\nReference k = {0:.6f} +/- {1:.3e}'.format(ref_k,ref_k_std)) # Load flux file for comparison flux_filename = os.path.join(path_to_results,'c5g7_3d_flux.h5') Loading @@ -38,7 +38,7 @@ def check_solution(path_to_results): k = k_dset[0] k_std = np.sqrt(k_var_dset[0]) print 'New k = {0:.6f} +/- {1:.3e}'.format(k,k_std) print('New k = {0:.6f} +/- {1:.3e}'.format(k,k_std)) passes = True Loading @@ -48,7 +48,7 @@ def check_solution(path_to_results): # Check k values kdiff = np.abs(k - ref_k) tol = safety_factor*np.sqrt(k_std*k_std + ref_k_std*ref_k_std) print 'Difference in k = {0:.2e} with tolerance of {1:.2e}'.format(kdiff,tol) print('Difference in k = {0:.2e} with tolerance of {1:.2e}'.format(kdiff,tol)) passes = kdiff < tol if passes: Loading Loading @@ -83,15 +83,15 @@ def check_solution(path_to_results): num_failed = len(failed_indices) print '\nMaximum relative error is {0:.3f} times tolerance'.format(max_ratio) print('\nMaximum relative error is {0:.3f} times tolerance'.format(max_ratio)) # Allow one outlier if num_failed > 1: passes = False if num_failed > 0: print '\nThe following flux values were outside of expected tolerance:' print ' Index Reference Value Difference Tolerance' print('\nThe following flux values were outside of expected tolerance:') print(' Index Reference Value Difference Tolerance') for ind in failed_indices: ref_val = ref_flux[ind] ref_std = ref_flux_std[ind] Loading @@ -99,15 +99,15 @@ def check_solution(path_to_results): std = flux_std[ind] tol = safety_factor*np.sqrt(ref_std*ref_std + std*std) flux_diff = np.abs(val - ref_val) print '{0:5} {1:.4e} {2:.4e} {3:.3e} {4:.3e}'.format( ind,ref_val,val,flux_diff,tol) print('{0:5} {1:.4e} {2:.4e} {3:.3e} {4:.3e}'.format( ind,ref_val,val,flux_diff,tol)) # Print pass/fail status print '\n', print('\n'), if passes: print 'Solution PASSED' print('Solution PASSED') return 0 else: print 'Solution FAILED' print('Solution FAILED') return 1 Loading
Profugus/Source/Scripts/check_profugus.py +106 −106 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ def check_solution(path_to_results): ref_k = ref_k_dset[0] ref_k_std = np.sqrt(ref_k_var_dset[0]) print '\nReference k = {0:.6f} +/- {1:.3e}'.format(ref_k,ref_k_std) print('\nReference k = {0:.6f} +/- {1:.3e}'.format(ref_k,ref_k_std)) # Load flux file for comparison flux_filename = os.path.join(path_to_results,'c5g7_3d_flux.h5') Loading @@ -38,7 +38,7 @@ def check_solution(path_to_results): k = k_dset[0] k_std = np.sqrt(k_var_dset[0]) print 'New k = {0:.6f} +/- {1:.3e}'.format(k,k_std) print('New k = {0:.6f} +/- {1:.3e}'.format(k,k_std)) passes = True Loading @@ -48,7 +48,7 @@ def check_solution(path_to_results): # Check k values kdiff = np.abs(k - ref_k) tol = safety_factor*np.sqrt(k_std*k_std + ref_k_std*ref_k_std) print 'Difference in k = {0:.2e} with tolerance of {1:.2e}'.format(kdiff,tol) print('Difference in k = {0:.2e} with tolerance of {1:.2e}'.format(kdiff,tol)) passes = kdiff < tol if passes: Loading Loading @@ -83,15 +83,15 @@ def check_solution(path_to_results): num_failed = len(failed_indices) print '\nMaximum relative error is {0:.3f} times tolerance'.format(max_ratio) print('\nMaximum relative error is {0:.3f} times tolerance'.format(max_ratio)) # Allow one outlier if num_failed > 1: passes = False if num_failed > 0: print '\nThe following flux values were outside of expected tolerance:' print ' Index Reference Value Difference Tolerance' print('\nThe following flux values were outside of expected tolerance:') print(' Index Reference Value Difference Tolerance') for ind in failed_indices: ref_val = ref_flux[ind] ref_std = ref_flux_std[ind] Loading @@ -99,15 +99,15 @@ def check_solution(path_to_results): std = flux_std[ind] tol = safety_factor*np.sqrt(ref_std*ref_std + std*std) flux_diff = np.abs(val - ref_val) print '{0:5} {1:.4e} {2:.4e} {3:.3e} {4:.3e}'.format( ind,ref_val,val,flux_diff,tol) print('{0:5} {1:.4e} {2:.4e} {3:.3e} {4:.3e}'.format( ind,ref_val,val,flux_diff,tol)) # Print pass/fail status print '\n', print('\n'), if passes: print 'Solution PASSED' print('Solution PASSED') return 0 else: print 'Solution FAILED' print('Solution FAILED') return 1