2from pathlib
import Path
4import matplotlib.pyplot
as plt
8def plot(infile, outfile):
9 if not (outdir := Path(outfile).parent).exists():
12 figure1, ax1 = plt.subplots()
14 with open(infile)
as f:
17 vals = line.strip().split(
",")
18 arr.append(float(vals[0]))
20 ax1.hist(arr, np.arange(min(arr), max(arr) + 0.02, 0.02), density=
True, ec=
"black")
22 figure1.savefig(outfile)
25if __name__ ==
"__main__":
26 plot(
"output/pd_estimate/estimate_1_0.txt",
"../latex/images/pd_estimate_1_0.pdf")
27 plot(
"output/pd_estimate/estimate_2_4.txt",
"../latex/images/pd_estimate_2_4.pdf")