Skip to content

Commit 6a3a707

Browse files
author
Mirco
committed
Modify ci definition and parsing
CI values are now defined as columns with name '<VALUE_NAME>-CI', csv-test files adjusted for this change, added commentary for CI integration
1 parent ebfbb38 commit 6a3a707

File tree

6 files changed

+89
-60
lines changed

6 files changed

+89
-60
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,6 @@ example_simulation_data
105105

106106
#additional data logs
107107
datDec/
108+
109+
# macos
110+
.DS_STORE

src/rdplot/SimulationDataItemClasses/CsvLogs.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,32 @@ def __init__(self, config, header, line):
5454
# skip the header entries
5555
if i in [sequence_idx, qp_idx, rate_idx]:
5656
continue
57-
# check if a value has a confidence interval
58-
if line[i].find('+-') == -1:
59-
data[header[i]] = [(rate, float(line[i]))]
57+
# check if value is a confidence value (CI)
58+
# if entry is a ci-value we can skip it, since
59+
# it will be later processed with the according value
60+
if header[i].find('-ci') != -1:
6061
continue
6162
else:
62-
ci_value = line[i].split('+-')
63-
data[header[i]] = [(rate, float(ci_value[0]), float(ci_value[1]))]
64-
continue
63+
# Check if CI value can be found, else just read the data.
64+
# In case that a CI value is found, store its header index.
65+
# Afterwards store the value and CI into a tuple with three
66+
# entries (rate, value, ci-value). Otherwise we will just
67+
# store the data in a tuple with two entries (rate, value).
68+
# CI columns are always labeled as '<VALUE_NAME>-CI'.
69+
ci_idx = -1
70+
for j in range(0, len(header)):
71+
if header[j].find(header[i]+'-ci') != -1:
72+
ci_idx = j
73+
break
74+
75+
if ci_idx == -1:
76+
# Read only the data (no CI available)
77+
data[header[i]] = [(rate, float(line[i]))]
78+
continue
79+
else:
80+
# Read the data and CI in one tuple
81+
data[header[i]] = [(rate, float(line[i]), float(line[ci_idx]))]
82+
continue
6583

6684
self.summary_data = data
6785

src/rdplot/Widgets/MainWindow.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,9 @@ def change_table_temporal(self, plot_data_collect):
476476
header = legend[0]
477477

478478
for plot_data in plot_data_collection:
479-
# check if confidence interval is used
479+
# check if plot_data value has a confidence interval
480+
# confidence intervals are stored in tuples with three entries
481+
# (rate, value, ci-value) instead of (rate, value) in the default case
480482
if len(plot_data.values[0]) == 2:
481483
values = ((float(x), float(y)) for (x, y) in plot_data.values)
482484
else:
@@ -537,7 +539,9 @@ def change_table_summary(self, plot_data_collect):
537539

538540
for plot_data in plot_data_collection:
539541

540-
# check if confidence interval is used
542+
# check if plot_data value has a confidence interval
543+
# confidence intervals are stored in tuples with three entries
544+
# (rate, value, ci-value) instead of (rate, value) in the default case
541545
if len(plot_data.values[0]) == 2:
542546
values = ((float(x), float(y)) for (x, y) in plot_data.values)
543547
else:

src/rdplot/Widgets/PlotWidget.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ def change_plot(self, plot_data_collection, user_generated_curves=False):
163163
l = legend[plot_count] #" ".join([i for i in plot_data.identifiers] + plot_data.path)
164164

165165
# Convert list of pairs of strings to two sorted lists of floats
166-
# Check if a confidence interval is given
166+
# Check if plot_data value has a confidence interval
167+
# Confidence intervals are stored in tuples with three entries
168+
# (rate, value, ci-value) instead of (rate, value) in the default case
167169
try:
168170
if len(plot_data.values[0]) == 2:
169171
values = ((float(x), float(y)) for (x, y) in plot_data.values)
@@ -175,16 +177,18 @@ def change_plot(self, plot_data_collection, user_generated_curves=False):
175177

176178
plot_count += 1
177179
else:
180+
# A confidence interval is included in the data
178181
values = ((float(x), float(y), float(z)) for (x, y, z) in plot_data.values)
179182
sorted_value_pairs = sorted(values, key=lambda pair: pair[0])
180183
[xs, ys, zs] = list(zip(*sorted_value_pairs))
181184

182-
# plot the current plot data
185+
# calculate the lower and upper boundaries of the CI
183186
ys_low = np.subtract(ys, zs)
184187
ys_up = np.add(ys, zs)
185188
ys_ci = np.concatenate((ys_low, ys_up[::-1]))
186189
xs_ci = np.concatenate((xs, xs[::-1]))
187190

191+
# plot the curve and afterwards the CI as polygon
188192
curve = self.ax.plot(xs, ys, label=l)
189193
curve_ci = self.ax.fill(xs_ci, ys_ci, alpha=0.3, ec='black')
190194

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
Sequence;QP;Bitrate;MOS
2-
Sequence01;27;15544.26;7.65+-0.31
3-
Sequence01;32;8207.94;5.12+-0.44
4-
Sequence01;37;4677.54;3.53+-0.24
5-
Sequence01;42;2696.16;2.08+-0.32
6-
Sequence02;30;11802.85;6.92+-0.27
7-
Sequence02;34;7243.2;5.03+-0.37
8-
Sequence02;38;4695.95;3.12+-0.43
9-
Sequence02;42;3090.75;2.02+-0.33
10-
Sequence03;28;17165.46;6.75+-0.27
11-
Sequence03;32;9502.2;4.82+-0.25
12-
Sequence03;36;5767.26;3.72+-0.25
13-
Sequence03;42;3628.44;2.54+-0.28
14-
Sequence04;30;7664.7;6.82+-0.22
15-
Sequence04;34;4649.76;4.33+-0.3
16-
Sequence04;38;3449.92;2.44+-0.39
17-
Sequence04;42;2492.52;0.55+-0.41
18-
Sequence05;26;2705.64;7.02+-0.48
19-
Sequence05;30;1723.74;5.72+-0.38
20-
Sequence05;34;1139.64;4.73+-0.52
21-
Sequence05;40;636.96;3.12+-0.38
22-
Sequence06;28;3651.72;7.2+-0.46
23-
Sequence06;32;2014.02;5.64+-0.61
24-
Sequence06;36;1166.88;4.21+-0.45
25-
Sequence06;40;678.06;2.53+-0.55
1+
Sequence;QP;Bitrate;MOS;MOS-CI
2+
Sequence01;27;15544.26;7.65;0.31
3+
Sequence01;32;8207.94;5.12;0.44
4+
Sequence01;37;4677.54;3.53;0.24
5+
Sequence01;42;2696.16;2.08;0.32
6+
Sequence02;30;11802.85;6.92;0.27
7+
Sequence02;34;7243.2;5.03;0.37
8+
Sequence02;38;4695.95;3.12;0.43
9+
Sequence02;42;3090.75;2.02;0.33
10+
Sequence03;28;17165.46;6.75;0.27
11+
Sequence03;32;9502.2;4.82;0.25
12+
Sequence03;36;5767.26;3.72;0.25
13+
Sequence03;42;3628.44;2.54;0.28
14+
Sequence04;30;7664.7;6.82;0.22
15+
Sequence04;34;4649.76;4.33;0.3
16+
Sequence04;38;3449.92;2.44;0.39
17+
Sequence04;42;2492.52;0.55;0.41
18+
Sequence05;26;2705.64;7.02;0.48
19+
Sequence05;30;1723.74;5.72;0.38
20+
Sequence05;34;1139.64;4.73;0.52
21+
Sequence05;40;636.96;3.12;0.38
22+
Sequence06;28;3651.72;7.2;0.46
23+
Sequence06;32;2014.02;5.64;0.61
24+
Sequence06;36;1166.88;4.21;0.45
25+
Sequence06;40;678.06;2.53;0.55
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
Sequence;QP;Bitrate;MOS
2-
Sequence01;23;10620.9;7.35+-0.24
3-
Sequence01;28;5359.38;5.77+-0.24
4-
Sequence01;33;2883.36;3.82+-0.27
5-
Sequence01;37;1834.08;3.01+-0.27
6-
Sequence02;26;7284.9;7.48+-0.3
7-
Sequence02;29;4694.9;6.12+-0.46
8-
Sequence02;33;2732.7;4.23+-0.34
9-
Sequence02;37;1722.8;2.95+-0.39
10-
Sequence03;24;12248.78;6.73+-0.42
11-
Sequence03;28;6779.34;5.04+-0.2
12-
Sequence03;31;4517.04;3.68+-0.24
13-
Sequence03;35;2738.34;3.07+-0.35
14-
Sequence04;24;4522.26;7.23+-0.26
15-
Sequence04;28;3005.34;6.04+-0.27
16-
Sequence04;31;2296.86;5.12+-0.34
17-
Sequence04;34;1788.42;4.24+-0.29
18-
Sequence05;24;1724.46;7.48+-0.3
19-
Sequence05;26;1306.98;6.42+-0.56
20-
Sequence05;30;796.2;4.41+-0.62
21-
Sequence05;32;618.9;3.4+-0.51
22-
Sequence06;25;2410.56;7.43+-0.33
23-
Sequence06;27;1677.3;6.39+-0.35
24-
Sequence06;30;1034.4;4.41+-0.3
25-
Sequence06;33;647.1;3.02+-0.57
1+
Sequence;QP;Bitrate;MOS;MOS-CI
2+
Sequence01;23;10620.9;7.35;0.24
3+
Sequence01;28;5359.38;5.77;0.24
4+
Sequence01;33;2883.36;3.82;0.27
5+
Sequence01;37;1834.08;3.01;0.27
6+
Sequence02;26;7284.9;7.48;0.3
7+
Sequence02;29;4694.9;6.12;0.46
8+
Sequence02;33;2732.7;4.23;0.34
9+
Sequence02;37;1722.8;2.95;0.39
10+
Sequence03;24;12248.78;6.73;0.42
11+
Sequence03;28;6779.34;5.04;0.2
12+
Sequence03;31;4517.04;3.68;0.24
13+
Sequence03;35;2738.34;3.07;0.35
14+
Sequence04;24;4522.26;7.23;0.26
15+
Sequence04;28;3005.34;6.04;0.27
16+
Sequence04;31;2296.86;5.12;0.34
17+
Sequence04;34;1788.42;4.24;0.29
18+
Sequence05;24;1724.46;7.48;0.3
19+
Sequence05;26;1306.98;6.42;0.56
20+
Sequence05;30;796.2;4.41;0.62
21+
Sequence05;32;618.9;3.4;0.51
22+
Sequence06;25;2410.56;7.43;0.33
23+
Sequence06;27;1677.3;6.39;0.35
24+
Sequence06;30;1034.4;4.41;0.3
25+
Sequence06;33;647.1;3.02;0.57

0 commit comments

Comments
 (0)