Merge branch 'fix-callback-timestamps' into 'master'
Fix callback timestamps See merge request micro-ROS/ros_tracing/tracetools_analysis!26
This commit is contained in:
commit
d29d54267d
1 changed files with 10 additions and 5 deletions
|
@ -53,19 +53,24 @@ class DataModelUtil():
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def convert_time_columns(
|
def convert_time_columns(
|
||||||
original: DataFrame,
|
original: DataFrame,
|
||||||
columns_ns_to_ms: List[str] = [],
|
columns_ns_to_ms: Union[List[str], str] = [],
|
||||||
columns_ns_to_datetime: List[str] = [],
|
columns_ns_to_datetime: Union[List[str], str] = [],
|
||||||
inplace: bool = True,
|
inplace: bool = True,
|
||||||
) -> DataFrame:
|
) -> DataFrame:
|
||||||
"""
|
"""
|
||||||
Convert time columns from nanoseconds to either milliseconds or `datetime` objects.
|
Convert time columns from nanoseconds to either milliseconds or `datetime` objects.
|
||||||
|
|
||||||
:param original: the original `DataFrame`
|
:param original: the original `DataFrame`
|
||||||
:param columns_ns_to_ms: the columns for which to convert ns to ms
|
:param columns_ns_to_ms: the column(s) for which to convert ns to ms
|
||||||
:param columns_ns_to_datetime: the columns for which to convert ns to `datetime`
|
:param columns_ns_to_datetime: the column(s) for which to convert ns to `datetime`
|
||||||
:param inplace: whether to convert in place or to return a copy
|
:param inplace: whether to convert in place or to return a copy
|
||||||
:return: the resulting `DataFrame`
|
:return: the resulting `DataFrame`
|
||||||
"""
|
"""
|
||||||
|
if not isinstance(columns_ns_to_ms, list):
|
||||||
|
columns_ns_to_ms = list(columns_ns_to_ms)
|
||||||
|
if not isinstance(columns_ns_to_datetime, list):
|
||||||
|
columns_ns_to_datetime = list(columns_ns_to_datetime)
|
||||||
|
|
||||||
df = original if inplace else original.copy()
|
df = original if inplace else original.copy()
|
||||||
# Convert from ns to ms
|
# Convert from ns to ms
|
||||||
if len(columns_ns_to_ms) > 0:
|
if len(columns_ns_to_ms) > 0:
|
||||||
|
@ -272,7 +277,7 @@ class RosDataModelUtil(DataModelUtil):
|
||||||
['timestamp', 'duration']
|
['timestamp', 'duration']
|
||||||
]
|
]
|
||||||
# Time conversion
|
# Time conversion
|
||||||
return self.convert_time_columns(data, ['timestamp', 'duration'], ['timestamp'])
|
return self.convert_time_columns(data, ['duration'], ['timestamp'])
|
||||||
|
|
||||||
def get_node_tid_from_name(
|
def get_node_tid_from_name(
|
||||||
self, node_name: str
|
self, node_name: str
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue