Fixed #2 args.upper/lowerbound need to be compared to None

This commit is contained in:
2026-03-12 22:34:34 +00:00
parent 80b100a93d
commit b4c9a4a191

View File

@@ -106,13 +106,14 @@ elif args.mode == "SIM":
df = samplesize - 1
prob = 0
if args.upperbound and args.lowerbound:
if args.upperbound != None and args.lowerbound != None:
prob_upper = t.cdf(df=df,x=args.upperbound, loc=mean, scale=stddev)
prob_lower = t.cdf(df=df,x=args.lowerbound, loc=mean, scale=stddev)
prob = prob_upper - prob_lower
elif args.upperbound:
elif args.upperbound != None:
prob = t.cdf(df=df,x=args.upperbound, loc=mean, scale=stddev)
elif args.lowerbound:
elif args.lowerbound != None:
prob = 1 - t.cdf(df=df,x=args.lowerbound, loc=mean, scale=stddev)
else:
prob = 1# no bounds set!
@@ -147,9 +148,9 @@ y = norm.pdf(x, loc=mean, scale=stddev)
if args.normalizey:
y = y * stddev#rescale back to unity area
plt.axvline(x=mean, color="green", linestyle="dashed", label="mean")
if args.lowerbound:
if args.lowerbound != None:
plt.axvline(args.lowerbound, color="red")
if args.upperbound:
if args.upperbound != None:
plt.axvline(args.upperbound, color="red")
plt.plot(x, y, 'b-', label='Normal distribution')