How to use the stonesoup.types.time.TimeRange function in stonesoup

To help you get started, we’ve selected a few stonesoup examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dstl / Stone-Soup / stonesoup / metricgenerator / tracktotruthmetrics.py View on Github external
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)
github dstl / Stone-Soup / stonesoup / metricgenerator / ospametric.py View on Github external
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)
github dstl / Stone-Soup / stonesoup / dataassociator / tracktotrack.py View on Github external
if n_unsuccesful == 1:
                            end_timestamp = state1.timestamp

                        if n_unsuccesful >= self.consec_misses_end and \
                                start_timestamp:
                            associations.add(TimeRangeAssociation(
                                (track1, track2),
                                TimeRange(start_timestamp, end_timestamp)))
                            start_timestamp = None

                # close any open associations
                if start_timestamp:
                    end_timestamp = track1_states[-1].timestamp
                    associations.add(TimeRangeAssociation(
                        (track1, track2),
                        TimeRange(start_timestamp, end_timestamp)))

        return AssociationSet(associations)
github dstl / Stone-Soup / stonesoup / metricgenerator / tracktotruthmetrics.py View on Github external
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)
github dstl / Stone-Soup / stonesoup / metricgenerator / tracktotruthmetrics.py View on Github external
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)
github dstl / Stone-Soup / stonesoup / dataassociator / tracktotrack.py View on Github external
start_timestamp = potential_start_timestep
                            end_timestamp = track_state.timestamp

                        else:
                            # Otherwise wait for a new
                            # association to be good enough
                            current_truth = None
                            start_timestamp = None
                            end_timestamp = None

            # Close any open associations when the track ends
            if current_truth:

                associations.add(TimeRangeAssociation(
                    (track, current_truth),
                    TimeRange(start_timestamp, end_timestamp)))

        return AssociationSet(associations)
github dstl / Stone-Soup / stonesoup / dataassociator / tracktotrack.py View on Github external
if n_succesful == 1:
                            first_timestamp = state1.timestamp
                        if n_succesful == self.consec_pairs_confirm:
                            start_timestamp = first_timestamp
                    else:
                        n_succesful = 0
                        n_unsuccesful += 1

                        if n_unsuccesful == 1:
                            end_timestamp = state1.timestamp

                        if n_unsuccesful >= self.consec_misses_end and \
                                start_timestamp:
                            associations.add(TimeRangeAssociation(
                                (track1, track2),
                                TimeRange(start_timestamp, end_timestamp)))
                            start_timestamp = None

                # close any open associations
                if start_timestamp:
                    end_timestamp = track1_states[-1].timestamp
                    associations.add(TimeRangeAssociation(
                        (track1, track2),
                        TimeRange(start_timestamp, end_timestamp)))

        return AssociationSet(associations)