[CalendarServer-changes] [6247] CalendarServer/trunk/contrib/performance/compare.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Sep 7 07:09:43 PDT 2010
Revision: 6247
http://trac.macosforge.org/projects/calendarserver/changeset/6247
Author: exarkun at twistedmatrix.com
Date: 2010-09-07 07:09:42 -0700 (Tue, 07 Sep 2010)
Log Message:
-----------
Actually match the scipy return signature for ttest_1samp
Also examine the p value correctly
Modified Paths:
--------------
CalendarServer/trunk/contrib/performance/compare.py
Modified: CalendarServer/trunk/contrib/performance/compare.py
===================================================================
--- CalendarServer/trunk/contrib/performance/compare.py 2010-09-05 02:00:16 UTC (rev 6246)
+++ CalendarServer/trunk/contrib/performance/compare.py 2010-09-07 14:09:42 UTC (rev 6247)
@@ -9,17 +9,19 @@
except ImportError:
from math import pi
from ctypes import CDLL, c_double
- libc = CDLL('libc.dylib')
- gamma = libc.gamma
+ for lib in ['libc.dylib', 'libm.so']:
+ try:
+ libc = CDLL(lib)
+ except OSError:
+ pass
+ gamma = libc.tgamma
gamma.argtypes = [c_double]
gamma.restype = c_double
def ttest_1samp(a, popmean):
t = (stats.mean(a) - popmean) / (stats.stddev(a) / len(a) ** 0.5)
v = len(a) - 1.0
p = gamma((v + 1) / 2) / ((v * pi) ** 0.5 * gamma(v / 2)) * (1 + t ** 2 / v) ** (-(v + 1) / 2)
- return (
- [t, None],
- [p, None])
+ return (t, p)
def trim(sequence, amount):
@@ -44,7 +46,7 @@
fmean = stats.mean(first)
smean = stats.mean(second)
- p = 1 - ttest_1samp(second, fmean)[1][0]
+ p = ttest_1samp(second, fmean)[1]
if p >= 0.95:
# rejected the null hypothesis
print sys.argv[1], 'mean of', fmean, 'differs from', sys.argv[2], 'mean of', smean, '(%2.0f%%)' % (p * 100,)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100907/31be625c/attachment.html>
More information about the calendarserver-changes
mailing list