def update_plots(self): if self.data.empty: # Initialize empty dicts and return for stat in ["sigma", "s10", "s2"]: dict = { "%s_x" % stat: [], "is_git_commit": [], "date": [], "hash": [], "author": [], "message": [], stat: [], "nsamples": [], "accuracy_threshold": [], "custom_colors": [] } if stat == "s10" or stat == "s2": dict["%s_lower_bound" % stat] = [] self.sources["%s_source" % stat].data = dict # Boxplot dict dict = { "is_git_commit": [], "date": [], "hash": [], "author": [], "message": [], "x": [], "min": [], "quantile25": [], "quantile50": [], "quantile75": [], "max": [], "mu": [], "pvalue": [], "nsamples": [], "custom_colors": [] } self.sources["boxplot_source"].data = dict return # Select all data matching current test/var/backend runs = self.data.loc[[self.widgets["select_test"].value], self.widgets["select_var"].value, self.widgets["select_backend"].value] runs = runs.sort_values(by=["timestamp"]) timestamps = runs["timestamp"] x_series, x_metadata = helper.gen_x_series(self.metadata, timestamps.sort_values(), self.current_n_runs) # Update source main_dict = runs.to_dict("series") main_dict["x"] = x_series # Add metadata (for tooltip) main_dict.update(x_metadata) # Select the last n runs only n = self.current_n_runs main_dict = {key: value[-n:] for key, value in main_dict.items()} # Generate color series for display of failed checks custom_colors = [True] * len(main_dict["check"]) for i in range(len(main_dict["check"])): custom_colors[ i] = "#1f77b4" if main_dict["check"][i] else "#cc2b2b" # Generate ColumnDataSources for the 3 dotplots for stat in ["sigma", "s10", "s2"]: dict = { "%s_x" % stat: main_dict["x"], "is_git_commit": main_dict["is_git_commit"], "date": main_dict["date"], "hash": main_dict["hash"], "author": main_dict["author"], "message": main_dict["message"], stat: main_dict[stat], "nsamples": main_dict["nsamples"], "accuracy_threshold": main_dict["accuracy_threshold"], "custom_colors": custom_colors } if stat == "s10" or stat == "s2": dict["%s_lower_bound" % stat] = main_dict["%s_lower_bound" % stat] # Filter outliers if the box is checked if len(self.widgets["outliers_filtering_compare"].active) > 0: outliers = helper.detect_outliers(dict[stat]) dict[stat] = helper.remove_outliers(dict[stat], outliers) dict["%s_x" % stat] = helper.remove_outliers( dict["%s_x" % stat], outliers) # Assign ColumnDataSource self.sources["%s_source" % stat].data = dict # Generate ColumnDataSource for the boxplot dict = { "is_git_commit": main_dict["is_git_commit"], "date": main_dict["date"], "hash": main_dict["hash"], "author": main_dict["author"], "message": main_dict["message"], "x": main_dict["x"], "min": main_dict["min"], "quantile25": main_dict["quantile25"], "quantile50": main_dict["quantile50"], "quantile75": main_dict["quantile75"], "max": main_dict["max"], "mu": main_dict["mu"], "pvalue": main_dict["pvalue"], "nsamples": main_dict["nsamples"], "custom_colors": custom_colors } self.sources["boxplot_source"].data = dict # Update x axis helper.reset_x_range(self.plots["boxplot"], self.sources["boxplot_source"].data["x"]) helper.reset_x_range(self.plots["sigma_plot"], self.sources["sigma_source"].data["sigma_x"]) helper.reset_x_range(self.plots["s10_plot"], self.sources["s10_source"].data["s10_x"]) helper.reset_x_range(self.plots["s2_plot"], self.sources["s2_source"].data["s2_x"])
def update_plots(self): if self.data.empty: # Initialize empty dict and return dict = { "value_x": [], "value": [], "ieee": [], "custom_colors": [] } self.source.data = dict return # Select all data matching current test/var/backend runs = self.data.loc[ [self.widgets["select_deterministic_test"].value], self.widgets["select_deterministic_var"].value, self.widgets["select_deterministic_backend"].value] runs = runs.sort_values(by=["timestamp"]) timestamps = runs["timestamp"] x_series, x_metadata = helper.gen_x_series(self.metadata, timestamps.sort_values(), self.current_n_runs) # Update source dict = runs.to_dict("series") dict["value_x"] = x_series # Add metadata (for tooltip) dict.update(x_metadata) # Select the last n runs only n = self.current_n_runs dict = {key: value[-n:] for key, value in dict.items()} # Generate color series for display of failed checks dict["custom_colors"] = [True] * len(dict["check"]) for i in range(len(dict["check"])): dict["custom_colors"][ i] = "#1f77b4" if dict["check"][i] else "#cc2b2b" # Filter outliers if the box is checked if len(self.widgets["outliers_filtering_deterministic"].active) > 0: outliers = helper.detect_outliers(dict["value"]) dict["value"] = helper.remove_outliers(dict["value"], outliers) dict["value_x"] = helper.remove_outliers(dict["%value_x"], outliers) # Series to display IEEE results. This is different than reference_value, # because the latter has to be 0 when no reference run has been done # (because the value will be shown in the tooltip) dict["ieee"] = [0] * len(dict["value"]) for i in range(len(dict["value"])): if dict["check"][i]: dict["ieee"][i] = nan else: dict["ieee"][i] = dict["reference_value"][i] self.source.data = dict # Update x axis helper.reset_x_range(self.plots["comparison_plot"], self.source.data["value_x"])
def update_plots(self): # Select all data matching current test/var/backend runs = self.data.loc[[self.widgets["select_test"].value], self.widgets["select_var"].value, self.widgets["select_backend"].value] timestamps = runs["timestamp"] x_series, x_metadata = self.gen_x_series(timestamps.sort_values()) # Update source main_dict = runs.to_dict("series") main_dict["x"] = x_series # Add metadata (for tooltip) main_dict.update(x_metadata) # Select the last n runs only n = self.current_n_runs main_dict = {key: value[-n:] for key, value in main_dict.items()} # Generate ColumnDataSources for the 3 dotplots for stat in ["sigma", "s10", "s2"]: dict = { "%s_x" % stat: main_dict["x"], "is_git_commit": main_dict["is_git_commit"], "date": main_dict["date"], "hash": main_dict["hash"], "author": main_dict["author"], "message": main_dict["message"], stat: main_dict[stat], "nsamples": main_dict["nsamples"], } if stat == "s10" or stat == "s2": dict["%s_lower_bound" % stat] = main_dict["%s_lower_bound" % stat] # Filter outliers if the box is checked if len(self.widgets["outliers_filtering_compare"].active) > 0: outliers = helper.detect_outliers(dict[stat]) dict[stat] = helper.remove_outliers(dict[stat], outliers) dict["%s_x" % stat] = helper.remove_outliers( dict["%s_x" % stat], outliers) # Assign ColumnDataSource self.sources["%s_source" % stat].data = dict # Generate ColumnDataSource for the boxplot dict = { "is_git_commit": main_dict["is_git_commit"], "date": main_dict["date"], "hash": main_dict["hash"], "author": main_dict["author"], "message": main_dict["message"], "x": main_dict["x"], "min": main_dict["min"], "quantile25": main_dict["quantile25"], "quantile50": main_dict["quantile50"], "quantile75": main_dict["quantile75"], "max": main_dict["max"], "mu": main_dict["mu"], "pvalue": main_dict["pvalue"], "nsamples": main_dict["nsamples"] } self.sources["boxplot_source"].data = dict # Update x axis helper.reset_x_range(self.plots["boxplot"], self.sources["boxplot_source"].data["x"]) helper.reset_x_range(self.plots["sigma_plot"], self.sources["sigma_source"].data["sigma_x"]) helper.reset_x_range(self.plots["s10_plot"], self.sources["s10_source"].data["s10_x"]) helper.reset_x_range(self.plots["s2_plot"], self.sources["s2_source"].data["s2_x"])
def update_plots(self): groupby_display = self.widgets["groupby_radio"].labels[ self.widgets["groupby_radio"].active] groupby = self.factors_dict[groupby_display] filterby_display = self.widgets["filterby_radio"].labels[ self.widgets["filterby_radio"].active] filterby = self.factors_dict[filterby_display] # Groupby and aggregate lines belonging to the same group in lists if not self.run_data.empty: groups = self.run_data[self.run_data.index.isin( [self.widgets["select_filter"].value], level=filterby)].groupby(groupby) groups = groups.agg({ "sigma": lambda x: x.tolist(), "s10": lambda x: x.tolist(), "s2": lambda x: x.tolist(), "mu": lambda x: x.tolist(), # Used for mu weighted average first, then will be replaced "nsamples": lambda x: x.tolist() }) # Compute the new distributions, ... groups = self.data_processing(groups).to_dict("list") else: groups = { "mu": [], "nsamples": [], "mu_x": [], "sigma_x": [], "sigma_min": [], "sigma_quantile25": [], "sigma_quantile50": [], "sigma_quantile75": [], "sigma_max": [], "sigma_mu": [], "s10_x": [], "s10_min": [], "s10_quantile25": [], "s10_quantile50": [], "s10_quantile75": [], "s10_max": [], "s10_mu": [], "s2_x": [], "s2_min": [], "s2_quantile25": [], "s2_quantile50": [], "s2_quantile75": [], "s2_max": [], "s2_mu": [] } # Update source # Assign each ColumnDataSource, starting with the boxplots for prefix in ["sigma", "s10", "s2"]: dict = { "%s_x" % prefix: groups["%s_x" % prefix], "%s_min" % prefix: groups["%s_min" % prefix], "%s_quantile25" % prefix: groups["%s_quantile25" % prefix], "%s_quantile50" % prefix: groups["%s_quantile50" % prefix], "%s_quantile75" % prefix: groups["%s_quantile75" % prefix], "%s_max" % prefix: groups["%s_max" % prefix], "%s_mu" % prefix: groups["%s_mu" % prefix], "nsamples": groups["nsamples"] } # Filter outliers if the box is checked if len(self.widgets["outliers_filtering_inspect"].active) > 0: # Boxplots will be filtered by max then min top_outliers = helper.detect_outliers(dict["%s_max" % prefix]) helper.remove_boxplot_outliers(dict, top_outliers, prefix) bottom_outliers = helper.detect_outliers(dict["%s_min" % prefix]) helper.remove_boxplot_outliers(dict, bottom_outliers, prefix) self.sources["%s_source" % prefix].data = dict # Finish with the mu plot dict = { "mu_x": groups["mu_x"], "mu": groups["mu"], "nsamples": groups["nsamples"] } self.sources["mu_source"].data = dict # Filter outliers if the box is checked if len(self.widgets["outliers_filtering_inspect"].active) > 0: mu_outliers = helper.detect_outliers(groups["mu"]) groups["mu"] = helper.remove_outliers(groups["mu"], mu_outliers) groups["mu_x"] = helper.remove_outliers(groups["mu_x"], mu_outliers) # Update plots axis/titles # Get display string of the last (unselected) factor factors_dict = self.factors_dict.copy() del factors_dict[groupby_display] del factors_dict[filterby_display] for_all = list(factors_dict.keys())[0] # Update all display strings for plot title (remove caps, plural) groupby_display = groupby_display.lower() filterby_display = filterby_display.lower()[:-1] for_all = for_all.lower() self.plots["mu_inspect"].title.text = \ "Empirical average μ of %s (groupped by %s, for all %s)" \ % (filterby_display, groupby_display, for_all) self.plots["sigma_inspect"].title.text = \ "Standard deviation σ of %s (groupped by %s, for all %s)" \ % (filterby_display, groupby_display, for_all) self.plots["s10_inspect"].title.text = \ "Significant digits s of %s (groupped by %s, for all %s)" \ % (filterby_display, groupby_display, for_all) self.plots["s2_inspect"].title.text = \ "Significant digits s of %s (groupped by %s, for all %s)" \ % (filterby_display, groupby_display, for_all) helper.reset_x_range(self.plots["mu_inspect"], groups["mu_x"]) helper.reset_x_range(self.plots["sigma_inspect"], groups["sigma_x"]) helper.reset_x_range(self.plots["s10_inspect"], groups["s10_x"]) helper.reset_x_range(self.plots["s2_inspect"], groups["s2_x"])