Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for timestamp in timestamps:
meas_points = [state
for state in measured_states
if state.timestamp == timestamp]
truth_points = [state
for state in truth_states
if state.timestamp == timestamp]
metric, truth_to_measured_assignment = self.compute_gospa_metric(
meas_points, truth_points)
gospa_metrics.append(metric)
# If only one timestamp is present then return a SingleTimeMetric
if len(timestamps) == 1:
return gospa_metrics[0]
else:
return TimeRangeMetric(
title='GOSPA Metrics',
value=gospa_metrics,
time_range=TimeRange(min(timestamps), max(timestamps)),
generator=self)
----------
manager: MetricManager
Containing the data to be used to create the metric
Returns
-------
TimeRangeMetric
Contains the metric information
"""
numerator = sum(self._tl_j(manager, truth).total_seconds()
for truth in manager.groundtruth_paths)
denominator = sum(self._t_j(truth).total_seconds()
for truth in manager.groundtruth_paths)
timestamps = manager.list_timestamps()
return TimeRangeMetric(
title="SIAP LS",
value=numerator / denominator,
time_range=TimeRange(min(timestamps), max(timestamps)),
generator=self)
Containing the data to be used to create the metric
Returns
-------
TimeRangeMetric
Contains the metric information
"""
r = self._r(manager)
if r == 0:
value = np.inf
else:
value = 1 / r
timestamps = manager.list_timestamps()
return TimeRangeMetric(
title="SIAP LT",
value=value,
time_range=TimeRange(min(timestamps), max(timestamps)),
generator=self)
Parameters
----------
manager : MetricManager
Containing the data to be used to create the metric(s)
Returns
-------
TimeRangeMetric
Contains the metric information
"""
timestamps = manager.list_timestamps()
C = self._jt_sum(manager, timestamps) / self._j_sum(
manager, timestamps)
return TimeRangeMetric(
title="SIAP C",
value=C,
time_range=TimeRange(min(timestamps), max(timestamps)),
generator=self)
----------
manager: MetricManager
Containing the data to be used to create the metric
Returns
-------
TimeRangeMetric
Contains the metric information
"""
timestamps = manager.list_timestamps()
numerator = sum(
self._n_t(manager, timestamp) - self._na_t(manager, timestamp)
for timestamp in timestamps)
S = numerator / self._n_sum(manager, timestamps)
return TimeRangeMetric(
title="SIAP S",
value=S,
time_range=TimeRange(min(timestamps), max(timestamps)),
generator=self)
for timestamp in timestamps:
meas_points = [state
for state in measured_states
if state.timestamp == timestamp]
truth_points = [state
for state in truth_states
if state.timestamp == timestamp]
ospa_distances.append(
self.compute_OSPA_distance(meas_points, truth_points))
# If only one timestamp is present then return a SingleTimeMetric
if len(timestamps) == 1:
return ospa_distances[0]
else:
return TimeRangeMetric(
title='OSPA distances',
value=ospa_distances,
time_range=TimeRange(min(timestamps), max(timestamps)),
generator=self)
Parameters
----------
manager: MetricManager
Containing the data to be used to create the metric
Returns
-------
TimeRangeMetric
Contains the metric information
"""
timestamps = manager.list_timestamps()
A = self._na_sum(manager, timestamps) / self._jt_sum(
manager, timestamps)
return TimeRangeMetric(
title="SIAP A",
value=A,
time_range=TimeRange(min(timestamps), max(timestamps)),
generator=self)
# Make a list of all the unique timestamps used
timestamps = {state.timestamp for state in manager.tracks}
timestamps |= {state.timestamp
for path in manager.groundtruth_paths
for state in path}
# Number of tracks
metrics.append(TimeRangeMetric(
title='Number of targets',
value=len(manager.groundtruth_paths),
time_range=TimeRange(
start_timestamp=min(timestamps),
end_timestamp=max(timestamps)),
generator=self))
metrics.append(TimeRangeMetric(
title='Number of tracks',
value=len(manager.tracks),
time_range=TimeRange(
start_timestamp=min(timestamps),
end_timestamp=max(timestamps)),
generator=self))
metrics.append(TimeRangeMetric(
title='Track-to-target ratio',
value=len(manager.tracks) / len(manager.groundtruth_paths),
time_range=TimeRange(
start_timestamp=min(timestamps),
end_timestamp=max(timestamps)),
generator=self))
return metrics