Ejemplo n.º 1
0
# query scalar data into dataframe
try:
    df = results.get_scalars(filter_expression,
                             include_fields=include_fields,
                             include_attrs=True,
                             include_itervars=True,
                             include_runattrs=True)
except ValueError as e:
    raise chart.ChartScriptError("Error while querying results: " + str(e))

if df.empty:
    raise chart.ChartScriptError("The result filter returned no data.")

# determine "groups" and "series" for pivoting, and check them
groups = utils.split(props["groups"])
series = utils.split(props["series"])

if not groups and not series:
    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)
    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))
Ejemplo n.º 2
0
import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from omnetpp.scave import results, chart, utils, plot, vectorops as ops

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

# collect parameters for query
filter_expression = props["filter"]
xaxis_itervar = props["xaxis_itervar"]
iso_itervars = utils.split(props["iso_itervar"])

# query data into a data frame
try:
    df = results.get_scalars(filter_expression,
                             include_runattrs=True,
                             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)

if not xaxis_itervar and not iso_itervars:
    print(
Ejemplo n.º 3
0
import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from omnetpp.scave import results, chart, utils, ideplot

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

# collect parameters for query
filter_expression = props["filter"]
include_fields = props["include_fields"] == "true"
xaxis_itervar = props["xaxis_itervar"]
group_by = utils.split(props["group_by"])

# query data into a data frame
try:
    df = results.get_scalars(filter_expression,
                             include_fields=include_fields,
                             include_runattrs=True,
                             include_attrs=True,
                             include_itervars=True)
except ValueError as e:
    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(