Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def declarative_class(app, what, name, obj, options, lines):
"""Add declared properties to Parameters list for numpydoc"""
if what == "class" and issubclass(obj, Base):
param_index = _headings("Parameters", lines)
attr_index = _headings("Attributes", lines)
for name, property_ in obj.properties.items():
is_sequence = isinstance(property_.cls, Sequence)
if is_sequence:
cls = property_.cls[0]
else:
cls = property_.cls
class_name = "{}.{}".format(
cls.__module__, cls.__name__)
# To shorten names for builtins and also stonesoup components
tild = class_name.split(".")[0] in ("stonesoup", "builtins")
# To add optional if default value is defined.
is_optional = property_.default is not property_.empty
doc_type = "{}:class:`{}{}`{}".format(
is_sequence and "sequence of " or "",
# -*- coding: utf-8 -*-
from abc import abstractmethod
from ..base import Base, Property
from ..models.measurement import MeasurementModel
class Sensor(Base):
"""Sensor base class
A sensor object that operates according to a given
:class:`~.MeasurementModel`.
"""
measurement_model = Property(
MeasurementModel, default=None, doc="Measurement model")
@abstractmethod
def gen_measurement(**kwargs):
"""Generate a measurement"""
raise NotImplementedError
# -*- coding: utf-8 -*-
from abc import abstractmethod
from ..base import Base
class MetricGenerator(Base):
"""Metric Generator base class
Generates :class:`~.Metric` objects used to asses the performance of a
tracker using data held in a :class:`~.MetricManager` object
"""
@abstractmethod
def compute_metric(self, manager, **kwargs):
"""Compute metric
Parameters
----------
manager : MetricManager
containing the data to be used to create the metric(s)
Returns
# -*- coding: utf-8 -*-
from ..base import Base
class Type(Base):
"""Base type"""
# -*- coding: utf-8 -*-
from ..base import Base
class MeasurementModel(Base):
"""Measurement Model base class"""
# -*- coding: utf-8 -*-
from abc import abstractmethod
from ..base import Base
class Deleter(Base):
"""Deleter base class.
Proposes tracks for deletion.
"""
@abstractmethod
def check_for_deletion(self, track, **kwargs):
"""Abstract method to check if a given track should be deleted"""
pass
def delete_tracks(self, tracks, **kwargs):
"""Generic/Base track deletion method.
Iterates through all tracks in a given list and calls
:py:meth:`~check_for_deletion` to determine which
tracks should be deleted and which should survive.
# -*- coding: utf-8 -*-
from abc import abstractmethod
from ..base import Base
from stonesoup.buffered_generator import BufferedGenerator
class Tracker(Base, BufferedGenerator):
"""Tracker base class"""
@abstractmethod
def tracks_gen(self):
"""Returns a generator of tracks for each time step.
Yields
------
: :class:`datetime.datetime`
Datetime of current time step
: set of :class:`~.Track`
Tracks existing in the time step
"""
raise NotImplementedError
# -*- coding: utf-8 -*-
from ..base import Base
class Hypothesis(Base):
"""Hypothesis base class"""
# -*- coding: utf-8 -*-
from ..base import Base
from ..reader.base import DetectionReader, GroundTruthReader, SensorDataReader
from stonesoup.buffered_generator import BufferedGenerator
class Simulator(Base, BufferedGenerator):
"""Simulator base class"""
class DetectionSimulator(Simulator, DetectionReader):
"""Detection Simulator base class"""
class GroundTruthSimulator(Simulator, GroundTruthReader):
"""Ground truth simulator"""
class SensorSimulator(Simulator, SensorDataReader):
"""Sensor Simulator base class"""
"""Compute metric
Parameters
----------
manager : MetricManager
containing the data to be used to create the metric(s)
Returns
-------
: list of :class:`~.Metric` objects
Generated metrics
"""
raise NotImplementedError
class MetricManager(Base):
"""Metric Manager base class
Holds the data and manages the production of :class:`~.Metric` objects
through a :class:`~.MetricGenerator`
"""
class PlotGenerator(MetricGenerator):
"""PlotGenerator base class