-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
154 lines (125 loc) · 5.17 KB
/
config.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/usr/bin/python
######################################
# Copyright 2009 Tamara Broderick
# This file is part of Nomon Keyboard.
#
# Nomon Keyboard is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Nomon Keyboard is 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 General Public License
# along with Nomon Keyboard. If not, see <http://www.gnu.org/licenses/>.
######################################
import numpy as np
from PyQt5 import QtGui
import pickle
import os, sys
#sys.path.insert(0, os.path.realpath('user_preferences'))
current_folder= os.path.dirname(os.path.abspath(__file__))
### Configuration settings for the BroderClocks module ###
### Clock animation parameters ###
# time for single rotation of the clock
# time_rotate = 1.2 #1.35 #2.0**(0.5)
period_li = np.arange(21)
period_li = 1.5*np.exp(-period_li/11)
print(period_li)
pause_li = np.arange(11)
pause_li = (1-pause_li/10)
print(pause_li)
scale_min = 1
scale_max = len(period_li) - 1
extra_scale_min = 1
extra_scale_max = len(pause_li) - 1
default_rotate_ind = 10 # 19 # (22,) 19, 16, 13, 10, 7
default_pause_ind = 5
# number of clock divisions that register as a unique place to click
num_divs_click = 80
# seconds / frame; display update rate to aim for
ideal_wait_s = 0.05
# auto save time in minutes
auto_save_time = 1
# starting point of the highest scorer
frac_period = 4.0 / 8.0 # 4.0/8.0 # 7, 6, 5, 4, 3, 2, 1
theta0 = frac_period * 2.0 * np.pi # numpy.pi
# words per min tracking
wpm_history_length = 20
class Stack(list):
def __init__(self, max_size):
super(Stack, self).__init__()
self.max_size = max_size
def __add__(self, other):
if len(self) < self.max_size:
self.insert(0, other)
else:
self.pop(-1)
self.insert(0, other)
def average(self):
return 60./(float(sum(self)) / float(len(self)))
### Colors ###
# Background Color
bg_color_highlt = "#ddf6dd"
# clock colors [regular, high_contrast]
clock_bg_color = [QtGui.QColor(255, 255, 255), QtGui.QColor(255, 255, 255)]
clock_text_color = [QtGui.QColor(0, 0, 0), QtGui.QColor(0, 0, 0)]
clock_text_hl_color = [QtGui.QColor(0, 0, 0), QtGui.QColor(200, 0, 0)]
clock_text_reg_color = [QtGui.QColor(0, 0, 0), QtGui.QColor(0, 0, 200)]
# default
default_hh_color = [QtGui.QColor(255, 0, 0), QtGui.QColor(0, 200, 0)]
default_selct_color = [QtGui.QColor(20, 245, 20), QtGui.QColor(20, 245, 20)]
default_highlt_color = [QtGui.QColor(0, 0, 255), QtGui.QColor(255, 0, 0)]
default_reg_color = [QtGui.QColor(0, 0, 0), QtGui.QColor(0, 0, 255)]
# bar
bar_hh_selct_color =[QtGui.QColor(10, 255, 10), QtGui.QColor(10, 255, 10)]
bar_hh_highlt_color = [QtGui.QColor(75, 75, 255), QtGui.QColor(255, 0, 0)]
bar_hh_reg_color = [QtGui.QColor(0, 0, 0), QtGui.QColor(00, 0, 255)]
bar_mh_selct_color = [QtGui.QColor(20, 245, 20), QtGui.QColor(20, 245, 20)]
bar_mh_highlt_color = [QtGui.QColor(150, 150, 255), QtGui.QColor(255, 150, 150)]
bar_mh_reg_color = [QtGui.QColor(170, 170, 170), QtGui.QColor(150, 150, 255)]
# ball
ball_mh_selct_color = [QtGui.QColor(20, 245, 20), QtGui.QColor(20, 245, 20)]
ball_mh_highlt_color = [QtGui.QColor(150, 150, 255), QtGui.QColor(255, 150, 150)]
ball_mh_reg_color = [QtGui.QColor(100, 100, 100), QtGui.QColor(150, 150, 255)]
# pac_man
pac_man_selct_color = [QtGui.QColor(20, 245, 20), QtGui.QColor(20, 245, 20)]
pac_man_highlt_color = [QtGui.QColor(0, 0, 255), QtGui.QColor(255, 0, 0)]
pac_man_reg_color = [QtGui.QColor(0, 0, 0), QtGui.QColor(0, 0, 255)]
### Fonts ###
base_font = 'helvetica'
splash_font = [QtGui.QFont(base_font, 11), QtGui.QFont(base_font, 15), QtGui.QFont(base_font, 22)]
welcome_main_font = [QtGui.QFont(base_font, 11), QtGui.QFont(base_font, 15), QtGui.QFont(base_font, 22)]
welcome_sub_font = [QtGui.QFont(base_font, 9), QtGui.QFont(base_font, 12), QtGui.QFont(base_font, 18)]
clock_font = QtGui.QFont(base_font)
clock_font.setBold(False)
top_bar_font = [QtGui.QFont(base_font, 11), QtGui.QFont(base_font, 15), QtGui.QFont(base_font, 24)]
for font in top_bar_font:
font.setStretch(80)
font.setBold(True)
text_box_font = [QtGui.QFont(base_font, 15), QtGui.QFont(base_font, 20), QtGui.QFont(base_font, 24)]
for font in text_box_font:
font.setStretch(90)
### Algorithm parameters ###
# winning score difference
win_diff_base = np.log(99)
win_diff_high = np.log(999)
max_init_diff = win_diff_base - np.log(4)
# learning press distribution or not
is_learning = True
is_pre_learning = True
# whether to output data
is_write_data = True
# last index to include when "undo"-ing scores
undo_index = 5
# time to delay learning to wait for "undos" (The value "0" means learn from the winner this round)
learn_delay = 2
# click density prior
## prior def
mu0 = 0.05 # on a range [-1s,1s]
sigma0 = 0.14 # on a range [-1s,1s]
sigma0_sq = sigma0 * sigma0
range0 = 2