Commit f27a471e authored by Richard O'Shaughnessy's avatar Richard O'Shaughnessy

convergence_test_samples.py: adding KS test

parent d94adeb8
......@@ -24,7 +24,7 @@ parser = argparse.ArgumentParser()
parser.add_argument("--samples", action='append', help="Samples used in convergence test")
parser.add_argument("--parameter", action='append', help="Parameters used in convergence test")
parser.add_argument("--parameter-range", action='append', help="Parameter ranges used in convergence test (used if KDEs or similar knowledge of the PDF is needed). If used, must specify for ALL variables, in order")
parser.add_argument("--method", help="Test to perform: lame|ks1d|...")
parser.add_argument("--method", default='lame', help="Test to perform: lame|ks1d|...")
parser.add_argument("--threshold",default=None, help="Manual threshold for the test being performed. (If not specified, the success condition is determined by default for that diagnostic, based on the samples size and properties")
parser.add_argument("--test-output", help="Filename to return output. Result is a scalar >=0 and ideally <=1. Closer to 0 should be good. Second column is the diagnostic, first column is 0 or 1 (success or failure)")
parser.add_argument("--always-succeed",action='store_true',help="Test output is always success. Use for plotting convergence diagnostics so jobs insured to run for many iterations.")
......@@ -105,7 +105,15 @@ for param in opts.parameter:
# Perform test
val_test = test_lame(dat1,dat2)
val_test = np.inf
if opts.method is 'lame':
val_test = test_lame(dat1,dat2)
elif opts.method == 'KS_1d':
val_test = test_ks1d(dat1[:,0],dat2[:,0])
elif opts.method == 'KL_1d':
val_test = test_KL1d(dat1,dat2)
else:
print " No known method ", opts.method
print val_test
if opts.always_succeed:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment