Skip to content

Commit 93c9ad8

Browse files
committed
Add RAG Plotter Tests
1 parent 481fd26 commit 93c9ad8

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

stonesoup/tests/test_plotter.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import warnings
22
from datetime import datetime, timedelta
3+
from dataclasses import dataclass
34

45
import matplotlib.pyplot as plt
56
import numpy as np
@@ -14,7 +15,7 @@
1415
from stonesoup.platform.base import Obstacle
1516
from stonesoup.platform.shape import Shape
1617
from stonesoup.plotter import Plotter, Dimension, AnimatedPlotterly, AnimationPlotter, Plotterly, \
17-
PolarPlotterly, AnimatedPolarPlotterly, merge_dicts
18+
PolarPlotterly, AnimatedPolarPlotterly, RAGPlotterly, RAG, merge_dicts
1819
from stonesoup.predictor.kalman import KalmanPredictor
1920
from stonesoup.sensor.radar.radar import RadarElevationBearingRange
2021
from stonesoup.types.detection import TrueDetection, Clutter
@@ -686,3 +687,21 @@ def test_obstacles(plotters, obstacles):
686687
plotters.plot_measurements(all_measurements, [0, 1])
687688
plotters.plot_tracks(track, [0, 1])
688689
plotters.plot_obstacles(obstacles)
690+
691+
692+
@dataclass
693+
class TestMetric:
694+
value: float
695+
timestamp: int = None
696+
697+
def test_rag_plot():
698+
track = Track([State([0, 0], timestamp=0),
699+
State([1, 1], timestamp=1),
700+
State([2, 2], timestamp=2)], id="track_1")
701+
plotter = RAGPlotterly(metric_name="Test Metric", target_value=0,
702+
rag_boundaries=RAG(GREEN=1, AMBER=2))
703+
metrics = {("track_1", 1): {"Test Metric": TestMetric(value=[
704+
TestMetric(value=0.5, timestamp=0),
705+
TestMetric(value=1.5, timestamp=1),
706+
TestMetric(value=2.5, timestamp=2)])}}
707+
plotter.plot_tracks({track}, [0, 1], metrics)

0 commit comments

Comments
 (0)