iv = results.get_itervars("(" + filter_expression + ") AND NOT name =~ " + x_runattr, include_itervars=True, include_runattrs=True) except ValueError as e: plot.set_warning("Error while querying results: " + str(e)) exit(1) iv['module'] = "" df = pd.concat([sc]) # , iv ? if df.empty: plot.set_warning("The result filter returned no data.") exit(1) utils.assert_columns_exist(df, ["value"]) df['value'] = pd.to_numeric(df['value']) if x_runattr and iso_runattr: utils.assert_columns_exist(df, [x_runattr, iso_runattr]) df = pd.pivot_table(df, index=[x_runattr], columns=[iso_runattr], values="value") df.reset_index(inplace=True) x_column = x_runattr elif iso_runattr and x_module and x_name: utils.assert_columns_exist(df, [iso_runattr, x_module, x_name]) cols = ["experiment", "measurement"] if avg_repls else [ "runID", "experiment", "measurement", "replication" ]
if df.empty: plot.set_warning("The result filter returned no data.") exit(1) if not xaxis_itervar and not iso_itervars: print( "The 'Itervar for X Axis' and 'Itervar for iso line' options were not set in the dialog, inferring them from the data.." ) xaxis_itervar, iso_itervar = utils.pick_two_columns(df) iso_itervars = [iso_itervar] if iso_itervar else [] print("X axis: " + xaxis_itervar + " iso lines: " + ",".join(iso_itervars)) if xaxis_itervar: utils.assert_columns_exist( df, [xaxis_itervar], "The iteration variable for the X axis could not be found") df[xaxis_itervar] = pd.to_numeric(df[xaxis_itervar], errors="ignore") else: plot.set_warning("Please select the iteration variable for the X axis!") exit(1) if iso_itervars: utils.assert_columns_exist( df, iso_itervars, "An iteration variable for the iso lines could not be found") for iv in iso_itervars: if iv: df[iv] = pd.to_numeric(df[iv], errors="ignore") if df.empty:
if df.empty: raise chart.ChartScriptError("The result filter returned no data.") if not xaxis_itervar and not yaxis_itervar: print( "The X Axis and Y Axis options were not set in the dialog, inferring them from the data.." ) xaxis_itervar, yaxis_itervar = utils.pick_two_columns(df) if not xaxis_itervar or not yaxis_itervar: raise chart.ChartScriptError( "Please set both the X Axis and Y Axis options in the dialog - or neither, for automatic selection!" ) utils.assert_columns_exist( df, [xaxis_itervar], "The iteration variable for the X axis could not be found") utils.assert_columns_exist( df, [yaxis_itervar], "The iteration variable for the Y axis could not be found") if xaxis_itervar == yaxis_itervar: raise chart.ChartScriptError( "The itervar for the X and Y axes are the same: " + xaxis_itervar) df[xaxis_itervar] = pd.to_numeric(df[xaxis_itervar], errors="ignore") df[yaxis_itervar] = pd.to_numeric(df[yaxis_itervar], errors="ignore") title_col, legend_cols = utils.extract_label_columns(df) title = str(list(df[title_col])[0]) if title_col else None
"The Groups and Series options were not set in the dialog, inferring them from the data." ) g, s = ("module", "name") if len(df) == 1 else utils.pick_two_columns(df) groups, series = [g], [s] if not groups or not groups[0] or not series or not series[0]: raise chart.ChartScriptError( "Please set both the Groups and Series properties in the dialog - or neither, for automatic setup." ) common = list(set(groups) & set(series)) if common: raise chart.ChartScriptError("Overlap between Group and Series columns: " + ", ".join(common)) utils.assert_columns_exist(df, groups + series, "No such iteration variable or run attribute") for c in groups + series: df[c] = pd.to_numeric(df[c], errors="ignore") # names for title, confidence level names = ", ".join(utils.get_names_for_title(df, props)) confidence_level_str = props[ "confidence_level"] if "confidence_level" in props else "none" # pivoting and plotting df.sort_values(by=groups + series, axis='index', inplace=True) if confidence_level_str == "none": df = pd.pivot_table(df, index=groups, columns=series, values='value') utils.plot_bars(df, props, names) else:
groups = props["groups"].split(",") series = props["series"].split(",") if not groups[0] and not series[0]: print( "The Groups and Series options were not set in the dialog, inferring them from the data." ) g, s = ("module", "name") if len(df) == 1 else utils.pick_two_columns(df) if not g or not s: plot.set_warning( "Please set the Groups and Series options in the dialog!") exit(1) groups, series = [g], [s] utils.assert_columns_exist(df, groups + series) for c in groups + series: df[c] = pd.to_numeric(df[c], errors="ignore") df.sort_values(by=groups + series, axis='index', inplace=True) names = utils.get_names_for_title(df, props) df = pd.pivot_table(df, index=groups, columns=series, values='value') utils.plot_bars(df, props, names) utils.postconfigure_plot(props) utils.export_image_if_needed(props)
if df.empty: plot.set_warning("The result filter returned no data.") exit(1) if not xaxis_itervar and not iso_itervar: print( "The X Axis and Iso Line options were not set in the dialog, inferring them from the data.." ) xaxis_itervar, iso_itervar = utils.pick_two_columns(df) if not iso_itervar or not iso_itervar: plot.set_warning( "Please set the X Axis and Iso Lines options in the dialog!") exit(1) utils.assert_columns_exist(df, [xaxis_itervar, iso_itervar]) df[xaxis_itervar] = pd.to_numeric(df[xaxis_itervar], errors="ignore") df[iso_itervar] = pd.to_numeric(df[iso_itervar], errors="ignore") if df.empty: plot.set_warning("Select scalars for the Y axis in the Properties dialog") exit(1) unique_names = df["name"].unique() if len(unique_names) != 1: plot.set_warning("Selected scalars must share the same name.") exit(1) scalar_name = unique_names[0]
raise chart.ChartScriptError("Error while querying results: " + str(e)) if df.empty: raise chart.ChartScriptError("The result filter returned no data.") if not xaxis_itervar and not group_by: print( "The 'X Axis' and 'Group By' options were not set in the dialog, inferring them from the data.." ) xaxis_itervar, group_by = utils.pick_two_columns(df) group_by = [group_by] if group_by else [] print("X Axis: " + xaxis_itervar + ", Group By: " + ",".join(group_by)) if xaxis_itervar: utils.assert_columns_exist( df, [xaxis_itervar], "The iteration variable for the X axis could not be found") df[xaxis_itervar] = pd.to_numeric(df[xaxis_itervar], errors="ignore") else: raise chart.ChartScriptError( "Please select the iteration variable for the X axis!") if xaxis_itervar in group_by: raise chart.ChartScriptError("X axis column also in grouper columns: " + xaxis_itervar) if group_by: utils.assert_columns_exist( df, group_by, "An iteration variable for grouping could not be found") for iv in group_by: if iv: