Compare commits

..

4 Commits

3 changed files with 13 additions and 9 deletions

3
.gitignore vendored
View File

@@ -1,2 +1,5 @@
*~
*.log
flycheck_*.py
\#*#
test.pdf

View File

@@ -1,3 +1,5 @@
# ad-calc
Tools to help calculating values for Axiomatic Design analysis
Tools to help calculating values for Axiomatic Design analysis
`infocalc.py` calculates information content based upon a csv file or statistical parameters and upper/lower limits

View File

@@ -11,7 +11,8 @@ from pathlib import PurePath##https://docs.python.org/3/library/pathlib.html#mod
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from scipy.stats import norm
from scipy.stats import norm,t
import scipy.stats
import pandas as pd
#Main program loop
@@ -96,25 +97,23 @@ if args.mode == "DATA":
data = np.array(pd.read_csv(inpath)[args.column])
mean = data.mean()
stddev = data.std(ddof=1)
# Delta Degrees of Freedom: ddof=0 for population, ddof=1 for sample std dev
samplesize = len(data)
elif args.mode == "SIM":
mean = args.mean
stddev = args.stddev
samplesize = args.samplesize
# time to deal with the bounds
df = samplesize - 1
# Delta Degrees of Freedom: ddof=0 for population, ddof=1 for sample std dev
prob = 0
if args.upperbound and args.lowerbound:
prob = norm.cdf(args.upperbound, mean, stddev) - norm.cdf(args.lowerbound, mean, stddev)
prob = t.cdf(df,args.upperbound, mean, stddev) - t.cdf(df,args.lowerbound, mean, stddev)
elif args.upperbound:
prob = norm.cdf(args.upperbound, mean, stddev)
prob = t.cdf(df,args.upperbound, mean, stddev)
elif args.lowerbound:
prob = 1 - norm.cdf(args.lowerbound, mean, stddev)
prob = 1 - t.cdf(df,args.lowerbound, mean, stddev)
else:
prob = 1# no bounds set!
##TODO!!!!
#print("probability: %f", prob)
info = -np.emath.log2(prob)
#print("information content: %f bits", info)