From c0ef4d207b67e951f363775cffe261090b501133 Mon Sep 17 00:00:00 2001 From: Jack Date: Fri, 1 Dec 2017 13:04:20 +0000 Subject: [PATCH] Added check in F-test for enough ndf --- splitwavepy/core/core.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/splitwavepy/core/core.py b/splitwavepy/core/core.py index a1bc013..5e8cf8b 100644 --- a/splitwavepy/core/core.py +++ b/splitwavepy/core/core.py @@ -215,6 +215,11 @@ def ftest(lam2,ndf,alpha=0.05): by default alpha = 0.05 = 95% confidence interval following Silver and Chan (1991) """ + + # check ndf is big enough + if ndf < 3: + raise Exception('Number of degrees of freedom is less than 3. This likely indicates a problem which would lead to a spurios mesaurement. Check window length.') + lam2min = lam2.min() k = 2 # two parameters, phi and dt. F = stats.f.ppf(1-alpha,k,ndf)