3A test for comparing the calculated energy fluence spectrum in a phantom region
4with the expected value. A uniform spectrum between 15keV-25keV in a
5near-vaccuum geometry is used so the expected spectrum can easily be calculated
14EGSINP =
"spec_vox.egsinp"
15TIME_LIMIT_S_PER_MHZ = 7/2993.
18EMIN, EMAX = 0.015, 0.025
24N_BINS_IN_RANGE = (EMAX-EMIN)/BIN_WIDTH
26SCORED_IN_BIN = TRACK_LENGTH/N_BINS_IN_RANGE
28VOLUME = 4/3.*math.pi*(0.2**3-0.1**3)
32 return SCORED_IN_BIN/(VOLUME*BIN_WIDTH)
35def compare_results(egslst, inp_name):
37 energies, counts, uncs = read_csv_spectrum(inp_name+
".voxelflu.csv")
39 for e, c
in zip(energies, counts):
41 if (exp > 0
and not values_close(c, exp, 0.005))
or (exp == 0
and c > 0.01):
42 return False,
"Fluence at E = %f MeV was %f" %(e, c),
"Expected %f" % exp