in lib/report.py [0:0]
def createCDFComparison(self, segment, metric, metric_type):
t = get_template("cdf.html")
control = self.data["branches"][0]
values_control = self.data[control][segment][metric_type][metric]["pdf"]["values"]
cdf_control = self.data[control][segment][metric_type][metric]["pdf"]["cdf"]
maxValue = find_value_at_quantile(values_control, cdf_control)
values_int = list(np.around(np.linspace(0, maxValue, 100), 2))
datasets = []
for branch in self.data["branches"]:
values = self.data[branch][segment][metric_type][metric]["pdf"]["values"]
density = self.data[branch][segment][metric_type][metric]["pdf"]["density"]
cdf = self.data[branch][segment][metric_type][metric]["pdf"]["cdf"]
# Smooth out pdf and cdf, and use common X values for each branch.
density_int = cubic_spline_smooth(values, density, values_int)
cdf_int = cubic_spline_smooth(values, cdf, values_int)
dataset = {
"branch": branch,
"cdf": cdf_int,
"density": density_int,
}
datasets.append(dataset)
context = {
"segment": segment,
"metric": metric,
"values": values_int,
"datasets": datasets
}
self.doc(t.render(context))
return