35def compare_results(egslst, inp_name):
42 doses = extract_all_doses(egslst)
43 for reg, tlen, tlen_unc, edep, edep_unc
in doses:
44 actual[
'tlen'].append((float(tlen), float(tlen_unc)/100))
45 actual[
'edep'].append((float(edep), float(edep_unc)/100))
53 for calc_type, region_doses
in list(expected_doses.items()):
54 for region, (expected_dose, expected_unc)
in enumerate(region_doses):
56 calc_dose, calc_unc = actual[calc_type][region]
58 tol = tolerances[calc_type]
59 doses_close = doses_approx_equal(expected_dose, expected_unc, calc_dose, calc_unc, max_percent_diff=tol)
62 msg =
"%s dose comparison failed for reg %d: Actual= %.4E +/- %.2F%% Expected= %.4E +/- %.2F%%"
63 print((msg % (calc_type, region + 1, calc_dose, 100*calc_unc, expected_dose, 100*expected_unc)))
66 return all_close, actual, expected_doses