3A test for comparing the calculated energy fluence spectrum on the surface of a
4source with the expected value. A uniform spectrum between 15keV-25keV in a
5near-vaccuum source is used so the expected spectrum can easily be calculated
15EGSINP =
"spec_eflu.egsinp"
16TIME_LIMIT_S_PER_MHZ = 6/2993.
18EMIN, EMAX = 0.015, 0.025
24TOTAL_E = AVG_E * NHIST
25N_BINS_IN_RANGE = (EMAX-EMIN)/BIN_WIDTH
27SCORED_IN_BIN = NHIST/N_BINS_IN_RANGE
28SCORED_IN_BIN_PER_MEV = SCORED_IN_BIN / BIN_WIDTH
32 return e*SCORED_IN_BIN_PER_MEV / TOTAL_E
35def compare_results(egslst, inp_name):
37 energies, counts, uncs = read_csv_spectrum(inp_name+
".ewsurf.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.0001):
42 return False,
"Fluence at E = %f MeV was %f" %(e, c),
"Expected %f" % exp