/timm's /charming /python /tricks

statsd.py

Download statsd.py.
Read more on How to be Charming (in Python).


01: import sys
02: sys.dont_write_bytecode=True # don't make .pyc files
03: from lib   import *
04: from stats import *
05: from about import *
06: 
07: def rdivDemo(data):
08:   data = map(lambda lst:Num(lst[0],lst[1:],keep=512),
09:              data)
10:   for x in sorted(scottknott(data),key=lambda y:y.rank):
11:     print x.rank, x.name, gs([x.mu, x.s])
12: 
13: @demo
14: def rdiv0():
15:   rdivDemo([
16:         ["x1",0.34, 0.49, 0.51, 0.6],
17:         ["x2",6,  7,  8,  9]
18:         ])
19: 
20: @demo
21: def rdiv1():
22:   rdivDemo([
23:         ["x1",0.1,  0.2,  0.3,  0.4],
24:         ["x2",0.1,  0.2,  0.3,  0.4],
25:         ["x3",6,  7,  8,  9]
26:         ])
27: 
28: @demo
29: def rdiv2():
30:   rdivDemo([
31:         ["x1",0.34, 0.49, 0.51, 0.6],
32:         ["x2",0.6,  0.7,  0.8,  0.9],
33:         ["x3",0.15, 0.25, 0.4,  0.35],
34:         ["x4",0.6,  0.7,  0.8,  0.9],
35:         ["x5",0.1,  0.2,  0.3,  0.4]
36:         ])
37: 
38: @demo
39: def rdiv3():
40:   rdivDemo([
41:       ["x1",101, 100, 99,   101,  99.5],
42:       ["x2",101, 100, 99,   101, 100],
43:       ["x3",101, 100, 99.5, 101,  99],
44:       ["x4",101, 100, 99,   101, 100]
45:       ])
46: 
47: @demo
48: def rdiv4():
49:   rdivDemo([
50:       ["1",11,12,13],
51:       ["2",14,31,22],
52:       ["3",23,24,31],
53:       ["5",32,33,34]])
54: 
55: @demo
56: def rdiv5():
57:   rdivDemo([
58:       ["1",11,11,11],
59:       ["2",11,11,11],
60:       ["3",11,11,11]])
61: 
62: @demo
63: def rdiv6():
64:   rdivDemo([
65:       ["1",11,11,11],
66:       ["2",11,11,11],
67:       ["4",32,33,34,35]])
68: 
69: if __name__ == '__main__' : 
70:   eval(cmd('demo()'))
71: 

This file is part of Timm's charming Python tricks.
© 2014, Tim Menzies: tim.menzies@gmail.com, http://menzies.us.

Timm's charming Python tricks are free software: you can redistribute it and/or modify it under the terms of the GNU Lesser Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Timm's charming Python tricks are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU Lesser Public License along with Foobar. If not, see http://www.gnu.org/licenses.