-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_tests.py
53 lines (39 loc) · 1.95 KB
/
main_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from tests import khi2, gap, coupons, poker
from tools import piLoader, latex
data = piLoader.piDigits()
def khi2_test():
print '%' + '-' * 69 + '\n' + '% KHI2 TEST\n' + '%' + '-' * 69 + '\n'
dataset = khi2.histopi(data)
print latex.table_generator("r", [dataset], [10 * [100000]])
k = khi2.k(dataset)
print latex.khi2_table_generator([k], len(dataset)), '\n'
def gap_test(digit):
print '%' + '-' * 69 + '\n' + '% GAP TEST\n' + '%' + '-' * 69 + '\n'
gap.histopi(data, digit)
dataset = gap.test(data, digit)
theoretical_values = gap.theoretical_effective(dataset, 80)
print latex.table_generator("longueur du gap", [dataset], [theoretical_values], 0)
khi_gap = khi2.k(dataset, theoretical_values)
print latex.khi2_table_generator([khi_gap], len(dataset)), '\n'
def coupons_test():
print '%' + '-' * 69 + '\n' + '% COUPONS TEST\n' + '%' + '-' * 69 + '\n'
coupons_data = coupons.make_classes(100, data)
samples_number = coupons_data[0]
observed_classes = coupons_data[1]
theoretical_classes = coupons.theoretical(100, 10, samples_number)
khi = khi2.k(observed_classes[10:], theoretical_classes[10:])
print latex.table_generator("longueur de la sequence", [observed_classes[10:]], [theoretical_classes[10:]])
print latex.khi2_table_generator([khi], len(observed_classes)), '\n'
coupons.comparative_histogram(observed_classes, theoretical_classes)
def poker_test():
print '%' + '-' * 69 + '\n' + '% POKER TEST\n' + '%' + '-' * 69 + '\n'
theoretical_classes = poker.theoretical_classes()
observed_classes = poker.observed_classes(data)
khi = khi2.k(observed_classes,theoretical_classes)
print latex.table_generator("Nombre de digits differents", [observed_classes], [theoretical_classes])
print latex.khi2_table_generator([khi], len(observed_classes)), '\n'
poker.comparative_histogram(theoretical_classes,observed_classes)
khi2_test()
gap_test(5)
coupons_test()
poker_test()