+ regex_cn = re.compile(r'^(\d*)R(\d*)C$')
+ regex_test_name = re.compile(r'^.*-(\d+ch|\d+pl)-'
+ r'(\d+mif|\d+vh)-'
+ r'(\d+vm\d+t|\d+dcr\d+t|\d+dcr\d+c).*$')
+ vals = dict()
+
+ # Transform the data
+ logging.info(
+ f" Creating the data set for the {plot.get(u'type', u'')} "
+ f"{plot.get(u'title', u'')}."
+ )
+ data = input_data.filter_data(plot, continue_on_error=True)
+ if data is None or data.empty:
+ logging.error(u"No data.")
+ return
+
+ for job in data:
+ for build in job:
+ for test in build:
+ for tag in test[u"tags"]:
+ groups = re.search(regex_cn, tag)
+ if groups:
+ chain = str(groups.group(1))
+ node = str(groups.group(2))
+ break
+ else:
+ continue
+ groups = re.search(regex_test_name, test[u"name"])
+ if groups and len(groups.groups()) == 3:
+ hover_name = (
+ f"{str(groups.group(1))}-"
+ f"{str(groups.group(2))}-"
+ f"{str(groups.group(3))}"
+ )
+ else:
+ hover_name = u""
+ if vals.get(chain, None) is None:
+ vals[chain] = dict()
+ if vals[chain].get(node, None) is None:
+ vals[chain][node] = dict(
+ name=hover_name,
+ vals=list(),
+ nr=None,
+ mean=None,
+ stdev=None
+ )
+ try:
+ if plot[u"include-tests"] == u"MRR":
+ result = test[u"result"][u"receive-rate"]
+ elif plot[u"include-tests"] == u"PDR":
+ result = test[u"throughput"][u"PDR"][u"LOWER"]
+ elif plot[u"include-tests"] == u"NDR":
+ result = test[u"throughput"][u"NDR"][u"LOWER"]
+ else:
+ result = None
+ except TypeError:
+ result = None
+
+ if result:
+ vals[chain][node][u"vals"].append(result)
+
+ if not vals:
+ logging.error(u"No data.")
+ return
+
+ txt_chains = list()
+ txt_nodes = list()
+ for key_c in vals:
+ txt_chains.append(key_c)
+ for key_n in vals[key_c].keys():
+ txt_nodes.append(key_n)
+ if vals[key_c][key_n][u"vals"]:
+ vals[key_c][key_n][u"nr"] = len(vals[key_c][key_n][u"vals"])
+ vals[key_c][key_n][u"mean"] = \
+ round(mean(vals[key_c][key_n][u"vals"]) / 1000000, 1)
+ vals[key_c][key_n][u"stdev"] = \
+ round(stdev(vals[key_c][key_n][u"vals"]) / 1000000, 1)
+ txt_nodes = list(set(txt_nodes))
+
+ def sort_by_int(value):
+ """Makes possible to sort a list of strings which represent integers.
+
+ :param value: Integer as a string.
+ :type value: str
+ :returns: Integer representation of input parameter 'value'.
+ :rtype: int
+ """
+ return int(value)
+
+ txt_chains = sorted(txt_chains, key=sort_by_int)
+ txt_nodes = sorted(txt_nodes, key=sort_by_int)
+