Gater

class stonesoup.gater.base.Gater(hypothesiser: Hypothesiser | Gater)[source]

Bases: Hypothesiser

Gater base class

Gaters wrap Hypothesiser objects and can be used to modify (typically reduce) the returned hypotheses.

Parameters:

hypothesiser (Union[Hypothesiser, ForwardRef('Gater')]) – Hypothesiser or Gater that is being wrapped.

hypothesiser: Hypothesiser | Gater

Hypothesiser or Gater that is being wrapped.

Distance

class stonesoup.gater.distance.DistanceGater(hypothesiser: Hypothesiser | Gater, measure: Measure, gate_threshold: float)[source]

Bases: Gater

Distance based gater

Uses a measure to calculate the distance between a hypothesis’ measurement prediction and the hypothised measurement, then removes any hypotheses whose calculated distance exceeds the specified gate threshold.

Parameters:
  • hypothesiser (Union[Hypothesiser, ForwardRef('Gater')]) – Hypothesiser or Gater that is being wrapped.

  • measure (Measure) – Measure class used to calculate the distance between the measurement prediction and the hypothesised measurement.

  • gate_threshold (float) – The gate threshold. Hypotheses whose calculated distance exceeds this threshold will be filtered out.

measure: Measure

Measure class used to calculate the distance between the measurement prediction and the hypothesised measurement.

gate_threshold: float

The gate threshold. Hypotheses whose calculated distance exceeds this threshold will be filtered out.

hypothesise(track, detections, *args, **kwargs)[source]

Hypothesise track and detection association

Parameters:
  • track (Track) – Track which hypotheses will be generated for.

  • detections (set of Detection) – Detections used to generate hypotheses.

  • timestamp (datetime.datetime) – A timestamp used when evaluating the state and measurement predictions. Note that if a given detection has a non empty timestamp, then prediction will be performed according to the timestamp of the detection.

Returns:

Ordered sequence of “best” to “worse” hypothesis.

Return type:

sequence of Hypothesis

class stonesoup.gater.distance.TrackingStateSpaceDistanceGater(hypothesiser: Hypothesiser | Gater, measure: Measure, gate_threshold: float, allow_non_reversible_detections: bool = True)[source]

Bases: Gater

This Distance Gater measures in the track state space (not measurement state space).

Each measurement is transformed into the state space of the track. In this state space a measure is used to calculate the distance between a hypothesis’ prediction and the measurement. Any hypotheses whose calculated distance exceeds the specified gate threshold are removed.

Parameters:
  • hypothesiser (Union[Hypothesiser, ForwardRef('Gater')]) – Hypothesiser or Gater that is being wrapped.

  • measure (Measure) – Measure class used to calculate the distance between the measurement (in state space) and the track prediction.

  • gate_threshold (float) – The gate threshold. Measurements whose calculated distance exceeds this threshold will be filtered out.

  • allow_non_reversible_detections (bool, optional) – Should detections with non-reversible measurement models be allowed passed the gate.

measure: Measure

Measure class used to calculate the distance between the measurement (in state space) and the track prediction.

gate_threshold: float

The gate threshold. Measurements whose calculated distance exceeds this threshold will be filtered out.

allow_non_reversible_detections: bool

Should detections with non-reversible measurement models be allowed passed the gate.

hypothesise(track, detections, *args, **kwargs) Sequence[Hypothesis][source]

Hypothesise track and detection association

Parameters:
  • track (Track) – Track which hypotheses will be generated for.

  • detections (set of Detection) – Detections used to generate hypotheses.

  • timestamp (datetime.datetime) – A timestamp used when evaluating the state and measurement predictions. Note that if a given detection has a non empty timestamp, then prediction will be performed according to the timestamp of the detection.

Returns:

Ordered sequence of “best” to “worse” hypothesis.

Return type:

sequence of Hypothesis

Filtered

class stonesoup.gater.filtered.FilteredDetectionsGater(hypothesiser: Hypothesiser | Gater, metadata_filter: str, match_missing: bool = True)[source]

Bases: Gater

Wrapper for Hypothesisers - filters input data

Wrapper for any type of hypothesiser - filters the ‘detections’ before they are fed into the hypothesiser.

Parameters:
  • hypothesiser (Union[Hypothesiser, ForwardRef('Gater')]) – Hypothesiser or Gater that is being wrapped.

  • metadata_filter (str) – Metadata attribute used to filter which detections tracks are valid for association.

  • match_missing (bool, optional) – Match detections with missing metadata. Default ‘True’.

metadata_filter: str

Metadata attribute used to filter which detections tracks are valid for association.

match_missing: bool

Match detections with missing metadata. Default ‘True’.

hypothesise(track, detections, *args, **kwargs)[source]
Parameters:
  • track (Track) – A track that contains the target’s state

  • detections (list of Detection) – Retrieved measurements

Returns:

  • MultipleHypothesis – A list containing the hypotheses between each prediction-detections pair.

  • Note (The specific subclass of SingleHypothesis returned) – depends on the Hypothesiser used.