assert 377 < 374 + where 377 = len({Clutter(state_vector=StateVector([[-775.78958849],\n [3370.39113146]]), timestamp=datetime.datetime(2020, ...39.95067859]]), timestamp=datetime.datetime(2020, 1, 28, 23, 16, 51, 77688), measurement_model=None, metadata={}), ...}) + and 374 = len({Clutter(state_vector=StateVector([[1253.82850346],\n [1226.54466325]]), timestamp=datetime.datetime(2020, ...26.2516991 ]]), timestamp=datetime.datetime(2020, 1, 28, 23, 17, 31, 77688), measurement_model=None, metadata={}), ...})
transition_model1 = <stonesoup.simulator.tests.conftest.transition_model1.<locals>.TestTransitionModel object at 0x7f5b423966d0>
transition_model2 = <stonesoup.simulator.tests.conftest.transition_model2.<locals>.TestTransitionModel object at 0x7f5b3fc13950>
measurement_model = <stonesoup.simulator.tests.conftest.measurement_model.<locals>.TestMeasurementModel object at 0x7f5b3fc13dd0>
timestep = datetime.timedelta(seconds=10)
def test_switch_detection_simulator(
transition_model1, transition_model2, measurement_model, timestep):
initial_state = State(
np.array([[0], [0], [0], [0]]), timestamp=datetime.datetime.now())
model_probs = [[0.5, 0.5], [0.5, 0.5]]
groundtruth = SwitchOneTargetGroundTruthSimulator(
transition_models=[transition_model1, transition_model2],
model_probs=model_probs,
initial_state=initial_state,
timestep=timestep)
meas_range = np.array([[-1, 1], [-1, 1]]) * 5000
detector = SwitchDetectionSimulator(
groundtruth, measurement_model, meas_range, clutter_rate=3,
detection_probabilities=[0, 1])
test_detector = SimpleDetectionSimulator(
groundtruth, measurement_model, meas_range, clutter_rate=3,
detection_probability=1
)
total_detections = set()
clutter_detections = set()
for step, (time, detections) in enumerate(detector):
total_detections |= detections
clutter_detections |= detector.clutter_detections
# Check time increments correctly
assert time == initial_state.timestamp + step * timestep
test_detections = set()
for step, (time, detections) in enumerate(test_detector):
test_detections |= detections
# Check both real and clutter detections are generated
assert len(total_detections) > len(clutter_detections)
# Check clutter is generated within specified bounds
for clutter in clutter_detections:
assert (meas_range[:, 0] <= clutter.state_vector.ravel()).all()
assert (meas_range[:, 1] >= clutter.state_vector.ravel()).all()
assert detector.clutter_spatial_density == 3e-8
> assert len(total_detections) < len(test_detections)
E assert 377 < 374
E + where 377 = len({Clutter(state_vector=StateVector([[-775.78958849],\n [3370.39113146]]), timestamp=datetime.datetime(2020, ...39.95067859]]), timestamp=datetime.datetime(2020, 1, 28, 23, 16, 51, 77688), measurement_model=None, metadata={}), ...})
E + and 374 = len({Clutter(state_vector=StateVector([[1253.82850346],\n [1226.54466325]]), timestamp=datetime.datetime(2020, ...26.2516991 ]]), timestamp=datetime.datetime(2020, 1, 28, 23, 17, 31, 77688), measurement_model=None, metadata={}), ...})
stonesoup/simulator/tests/test_detections.py:93: AssertionError