-
Notifications
You must be signed in to change notification settings - Fork 0
/
TemporalParameters.cpp
109 lines (100 loc) · 1.99 KB
/
TemporalParameters.cpp
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
#include "TemporalParameters.h"
TemporalParameters::TemporalParameters(string filename) {
th_score = 0;
th_ev2 = 0;
th_beta = 0;
th_io_half = 0;
th_io_beta = 0;
kcore = 0;
th_topo_beta = 0;
th_topo_half = 0;
th_alpha = 0;
th_topo_alpha = 0;
th_io_alpha = 0;
t_s = 0;
t_e = 0;
duration = t_e - t_s;
combonum = 0;
ifstream input(filename, ios::in);
string item;
double dval;
int ival;
while (input >> item) {
if (item == "T1") {
input >> dval;
th_beta = dval;
}
else if (item == "T5") {
input >> dval;
th_ev2 = dval;
}
else if (item == "R1") {
input >> dval;
th_io_beta = dval;
}
else if (item == "R5") {
input >> dval;
th_io_half = dval;
}
else if (item == "D1") {
input >> dval;
th_topo_beta = dval;
}
else if (item == "D5") {
input >> dval;
th_topo_half = dval;
}
else if (item == "K") {
input >> ival;
kcore = ival;
}
else if (item == "SCORE") {
input >> dval;
th_score = dval;
}
else if (item == "TS") {
input >> ival;
t_s = ival;
}
else if (item == "TE") {
input >> ival;
t_e = ival;
}
else if (item == "DUR") {
input >> ival;
duration = ival;
}
else if (item == "NUM") {
input >> ival;
combonum = ival;
}
else if (item == "PHI") {
input >> dval;
phi = dval;
}
else if (item == "WWIDTH") {
input >> ival;
window_width = ival;
}
else if (item == "WSTEP") {
input >> ival;
window_step = ival;
}
}
input.close();
}
void TemporalParameters::setPara(vector<double>& parameters) {
if (parameters.empty())
return;
th_score = parameters[0];
th_ev2 = parameters[1];
th_beta = parameters[2];
th_io_half = parameters[3];
th_io_beta = parameters[4];
kcore = parameters[5];
th_topo_beta = parameters[6];
th_topo_half = 1 - 1.0 / kcore;
th_alpha = (exp(1.0 / th_score - 1) - 1) / (th_ev2 - th_beta);
th_topo_alpha = (exp(1.0 / th_score - 1) - 1) / (th_topo_beta - th_topo_half);
th_io_alpha = (exp(1.0 / th_score - 1) - 1) / (th_io_beta - th_io_half);
}