Merge branch 'bokeh' into 'analysis'

Use bokeh instead of matplotlib

See merge request boschresearch/ros-wg/tracing/tracetools_analysis!4
This commit is contained in:
Christophe Bedard 2019-07-01 08:12:33 +00:00
commit ce69dba82a
2 changed files with 498 additions and 39 deletions

File diff suppressed because one or more lines are too long

View file

@ -14,6 +14,7 @@
"""Module for data model utility class.""" """Module for data model utility class."""
from datetime import datetime as dt
from typing import Any from typing import Any
from typing import Mapping from typing import Mapping
from typing import Union from typing import Union
@ -59,12 +60,20 @@ class DataModelUtil():
Get durations of callback instances for a given callback object. Get durations of callback instances for a given callback object.
:param callback_obj: the callback object value :param callback_obj: the callback object value
:return: a dataframe containing the durations of all callback instances for that object :return: a dataframe containing the start timestamp (datetime)
and duration (ms) of all callback instances for that object
""" """
return self._data.callback_instances.loc[ data = self._data.callback_instances.loc[
self._data.callback_instances.loc[:, 'callback_object'] == callback_obj, self._data.callback_instances.loc[:, 'callback_object'] == callback_obj,
: ['timestamp', 'duration']
] ]
# Transform both columns to ms
data[['timestamp', 'duration']] = data[
['timestamp', 'duration']
].apply(lambda d: d / 1000000.0)
# Transform start timestamp column to datetime objects
data['timestamp'] = data['timestamp'].apply(lambda t: dt.fromtimestamp(t / 1000.0))
return data
def get_callback_owner_info( def get_callback_owner_info(
self, callback_obj: int self, callback_obj: int