Exemplo n.º 1
0
def test_vectors_start_end_time_at_load():
    trimmed = results.read_result_files(RESULT_FILES,
                                        vector_start_time=40,
                                        vector_end_time=60)
    df = results.get_vectors(trimmed)
    _assert_sequential_index(df)
    _assert(sanitize_and_compare_csv(df, "vectors_start_end_time.csv"),
            "content mismatch")
Exemplo n.º 2
0
from omnetpp.scave import results, chart, vectorops as ops
import matplotlib.pyplot as plt

params = chart.get_properties()

# This expression selects the results (you might be able to logically simplify it)

filter_expression = params["filter"]

# The data is returned as a Pandas DataFrame
df = results.get_vectors(filter_expression,
                         include_attrs=True,
                         include_itervars=True)

# This is where the vector operations will be added:
# <|> vectorops marker <|>

# You can perform any transformations on the data here

print(df)

plt.xlabel('Simulation time (s)')

title, legend = chart.extract_label_columns(df)

for t in df.itertuples(index=False):
    style = dict()
    interp = t.interpolationmode if 'interpolationmode' in df else 'sample-hold' if 'enum' in df else None
    if interp:
        if interp == "none":
            style['linestyle'] = ' '
Exemplo n.º 3
0
import math
from omnetpp.scave import results, chart, utils, vectorops as ops

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

# collect parameters for query
filter_expression = props["filter"]
start_time = float(props["vector_start_time"] or -math.inf)
end_time = float(props["vector_end_time"] or math.inf)

# query vector data into a data frame
df = results.get_vectors(filter_expression,
                         include_attrs=True,
                         include_itervars=True,
                         start_time=start_time,
                         end_time=end_time)

# apply vector operations
df = ops.perform_vector_ops(df, props["vector_operations"])

# plot
utils.plot_vectors(df, props)

utils.postconfigure_plot(props)

utils.export_image_if_needed(props)
utils.export_data_if_needed(df, props)
Exemplo n.º 4
0
def test_vectors_end_time():
    trimmed = results.read_result_files(RESULT_FILES)
    df = results.get_vectors(trimmed, end_time=80)
    _assert_sequential_index(df)
    _assert(sanitize_and_compare_csv(df, "vectors_end_time.csv"),
            "content mismatch")
Exemplo n.º 5
0
def test_vectors_with_attrs():
    df = results.get_vectors(r, include_attrs=True)
    _assert_sequential_index(df)
    _assert(sanitize_and_compare_csv(df, "vectors_with_attrs.csv"),
            "content mismatch")
Exemplo n.º 6
0
def test_vectors():
    df = results.get_vectors(r)
    _assert_sequential_index(df)
    _assert(sanitize_and_compare_csv(df, "vectors.csv"), "content mismatch")