Esempio n. 1
0
def expect_message(expected):
    actual = "; ".join(messages)
    if expected not in actual:
        raise RuntimeError(
            "Wrong error message received: EXPECTED '{}', GOT '{}'".format(
                expected, actual))

    # make empty file so that opp_charttool doesn't complain
    fname = utils.get_image_export_filepath(chart.get_properties())
    with open(fname, 'wt') as f:
        pass
Esempio n. 2
0
from omnetpp.scave import results, chart, utils, plot

# get chart properties
props = chart.get_properties()
utils.preconfigure_plot(props)

# collect parameters for query
filter_expression = props["filter"]

# query vector data into a data frame
try:
    df = results.get_histograms(filter_expression,
                                include_attrs=True,
                                include_itervars=True)
except ValueError as e:
    plot.set_warning("Error while querying results: " + str(e))
    exit(1)

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

# plot
utils.plot_histograms(df, props)
utils.postconfigure_plot(props)

utils.export_image_if_needed(props)
utils.export_data_if_needed(df, props)
Esempio n. 3
0
from omnetpp.scave import results, chart
import matplotlib.pyplot as plt
import pandas as pd

params = chart.get_properties()

stats = results.get_statistics(params["filter"],
                               include_attrs=True,
                               include_itervars=True)
hists = results.get_histograms(params["filter"],
                               include_attrs=True,
                               include_itervars=True)

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


# TODO: move this to chart ? (or an utils module)
# source: https://stackoverflow.com/a/39789718/635587
def customized_box_plot(percentiles, axes, redraw=True, *args, **kwargs):
    """
    Generates a customized boxplot based on the given percentile values
    """
    n_box = len(percentiles)
    box_plot = axes.boxplot([
        [-9, -4, 2, 4, 9],
    ] * n_box,
                            showmeans=True,
                            meanprops=dict(marker='+'),
                            *args,
                            **kwargs)
Esempio n. 4
0
def create_blank_image_file():
    # make empty file so that opp_charttool doesn't complain
    fname = utils.get_image_export_filepath(chart.get_properties())
    with open(fname, 'wt') as f:
        pass