Esempio n. 1
0
stats = results.get_statistics(props["filter"],
                               include_attrs=True,
                               include_runattrs=True,
                               include_itervars=True)
hists = results.get_histograms(props["filter"],
                               include_attrs=True,
                               include_runattrs=True,
                               include_itervars=True)

df = pd.concat([stats, hists], sort=False)

if df.empty:
    plot.set_warning("The result filter returned no data.")
    exit(1)

title, legend = utils.extract_label_columns(df)

df.sort_values(by=[l for i, l in legend], axis='index', inplace=True)

ax = plt.gca()

# This is how much of the standard deviation will give the 25th and 75th
# percentiles, assuming normal distribution.
# >>> math.sqrt(2) * scipy.special.erfinv(0.5)
coeff = 0.6744897501960817

boxes = [(r.min, r.mean - r.stddev * coeff, r.mean, r.mean + r.stddev * coeff,
          r.max) for r in df.itertuples(index=False) if r.count > 0]
utils.customized_box_plot(boxes, ax)

utils.set_plot_title(utils.make_chart_title(df, title, legend))
Esempio n. 2
0
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

unique_names = df["name"].unique()

if len(unique_names) != 1:
    raise chart.ChartScriptError("Selected scalars must share the same name.")

scalar_name = unique_names[0]

df = pd.pivot_table(df,
                    columns=[xaxis_itervar],
                    index=yaxis_itervar,
                    values="value",
                    dropna=False)
    errors_df = None
else:
    confidence_level = float(confidence_level_str[:-1]) / 100
    conf_int = lambda values: utils.confidence_interval(
        confidence_level, values) if len(values) > 1 else math.nan

    pivoted = pd.pivot_table(df,
                             values="value",
                             columns=iso_itervars,
                             index=xaxis_itervar if xaxis_itervar else "name",
                             aggfunc=[np.mean, conf_int],
                             dropna=False)
    df = pivoted["mean"]
    errors_df = pivoted["<lambda>"]

legend_cols, _ = utils.extract_label_columns(df)

p = plot if chart.is_native_chart() else plt

try:
    xs = pd.to_numeric(df.index.values)
    p.xlabel(xaxis_itervar)
except:
    xs = np.zeros_like(df.index.values)

p.ylabel(scalar_names)

for c in df.columns:
    style = utils._make_line_args(props, c, df)
    if len(xs) < 2 and style["marker"] == ' ':
        style["marker"] = '.'
Esempio n. 4
0
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_cols, legend_cols = utils.extract_label_columns(df, props)

title = utils.make_chart_title(df, title_cols)

unique_names = df["name"].unique()

if len(unique_names) != 1:
    raise chart.ChartScriptError("Selected scalars must share the same name.")

scalar_name = unique_names[0]

df = pd.pivot_table(df,
                    columns=[xaxis_itervar],
                    index=yaxis_itervar,
                    values="value",
                    dropna=False)