def compare_results(egslst, inp_name): gold_standard = os.path.join(os.path.dirname(os.path.abspath(__file__)), "gold_standard.3ddose") run_doses = inp_name+".phantom.3ddose" doses_close = compare_3ddose_files(gold_standard, run_doses, max_percent_diff=0.01) return doses_close, read3ddose(run_doses), read3ddose(gold_standard)
def compare_results(egslst, inp_name): gold_standard = os.path.join(os.path.dirname(os.path.abspath(__file__)), "gold_standard.3ddose") run_doses_file = inp_name+".phantom.3ddose" # central axis doses gold_doses = read3ddose(gold_standard)['doses'][:5] run_doses = read3ddose(run_doses_file)['doses'][:5] close = [values_close(g, r, 0.005) for g, r in zip(gold_doses, run_doses)] return all(close), run_doses, gold_doses
def compare_results(egslst, inp_name): gold_standard = read3ddose( os.path.join(os.path.dirname(os.path.abspath(__file__)), "gold_standard.3ddose")) run_doses = read3ddose(inp_name + ".phantom.3ddose") dose_pairs = get_n_highest_dose_pairs(gold_standard['doses'], run_doses['doses']) dose_diff = [abs(a - b) / a for a, b in dose_pairs] doses_close = max(dose_diff) < 0.01 rd, gs = list(zip(*dose_pairs)) return doses_close, rd, gs
def compare_results(egslst, inp_name): gold_standard = read3ddose( os.path.join(os.path.dirname(os.path.abspath(__file__)), "gold_standard.3ddose")) run_doses = read3ddose(inp_name + ".phantom.3ddose") # only look at voxels overlapped by zero activity source dose_pairs = list(zip(gold_standard['doses'], run_doses['doses']))[7:12] dose_diff = [abs(a - b) / a for a, b in dose_pairs] doses_close = max(dose_diff) < 0.01 # make sure energy deposition and tlen doses roughly equal run_doses_edep = read3ddose(inp_name + ".phantom.edep.3ddose") dose_pairs_edep = get_n_highest_dose_pairs(run_doses['doses'], run_doses_edep['doses'], n=5) dose_diff_edep = [abs(a - b) / a for a, b in dose_pairs_edep] doses_close_edep = max(dose_diff_edep) < 0.10 actual = {'edep': run_doses_edep['doses'], 'tlen': run_doses['doses']} expected = {'edep': run_doses['doses'], 'tlen': gold_standard['doses']} return doses_close and doses_close_edep, actual, expected