class PeriodRadarTestCase(RadarTestCase):
    def setUp(self):
        self.radar = PeriodRadar(x=200,
                                 y=200,
                                 dt=0.1,
                                 r_std=1.,
                                 theta_std=0.001,
                                 phi_std=0.001,
                                 time_std=0.001)

    def test_compute_meas_time(self):
        size = 10
        computed_meas_times = self.radar.compute_meas_times(size)
        self.assertEqual(size, len(computed_meas_times))
        # ex_time = 0
        # for time in computed_meas_times:
        #     self.assertTrue(isclose(time,ex_time,rel_tol = self.radar.time_std))
        #     ex_time = time + self.radar.dt

    def test_compute_measurements_tags(self):
        position_data = np.array([[0, 0, 0], [1, 1, 1], [2, 2, 2], [3, 3, 3],
                                  [4, 4, 4], [5, 5, 5], [6, 6, 6], [7, 7, 7],
                                  [8, 8, 8], [9, 9, 9]])
        self.radar.tag = 0
        labeled_measurements = self.radar.compute_measurements(position_data)
        for labeled_meas in labeled_measurements:
            self.assertEqual(labeled_meas.tag, self.radar.tag)
 def setUp(self):
     self.radar = PeriodRadar(x=200,
                              y=200,
                              dt=0.1,
                              r_std=1.,
                              theta_std=0.001,
                              phi_std=0.001,
                              time_std=0.001)
 def setUp_radars_states(self):
     # Radars definitions
     dt_rad1 = 0.01
     self.radar1 = PeriodRadar(x=2000,y=2000,dt=dt_rad1)
     dt_rad2 = 0.02
     self.radar2 = PeriodRadar(x=1000,y=1000,dt=dt_rad2)
     self.radars = [self.radar1, self.radar2]
     # States definition
     self.states = np.array([[i,i/2,i/10]*3 for i in range(300)])
 def setUp_radar_states(self):
     # Radar definition
     dt_rad1 = 0.01
     self.radar1 = PeriodRadar(x=2000, y=2000, dt=dt_rad1)
     dt_rad2 = 0.02
     self.radar2 = PeriodRadar(x=1000, y=1000, dt=dt_rad2)
     self.radars = [self.radar1, self.radar2]
     # States definition
     self.states = np.array([[i, i / 2, i / 10] * 3 for i in range(100)])
     self.len_elements = int(len(self.states) / self.radar1.step) + int(
         len(self.states) / self.radar2.step)
Exemple #5
0
def generate_radars(radar_type):
    global std_dict
    global prec_dict
    global radars
    if radar_type == "Radar":
        if std_dict["is_chosen"]:
            x = int(std_dict["x"])
            y = int(std_dict["y"])
            std_radar = Radar(x=x,
                              y=y,
                              r_std=5.,
                              theta_std=0.005,
                              phi_std=0.005)
            radars.append(std_radar)
        if prec_dict["is_chosen"]:
            x = int(prec_dict["x"])
            y = int(prec_dict["y"])
            prec_radar = Radar(x=x, y=y)
            radars.append(prec_radar)

    elif radar_type == "PeriodRadar":
        if std_dict["is_chosen"]:
            x = int(std_dict["x"])
            y = int(std_dict["y"])
            dt = float(std_dict["dt"])
            std_radar = PeriodRadar(x=x,
                                    y=y,
                                    r_std=5.,
                                    theta_std=0.005,
                                    phi_std=0.005,
                                    dt=dt)
            radars.append(std_radar)
        if prec_dict["is_chosen"]:
            x = int(prec_dict["x"])
            y = int(prec_dict["y"])
            dt = float(prec_dict["dt"])
            prec_radar = PeriodRadar(x=x, y=y, dt=dt)
            radars.append(prec_radar)
    # ==========================================================================
    ## =================== Standard Radars (same data rates)
    ## Specify your own radar positions and beliefs over measurements!
    # Radar 1: Precision radar
    radar1 = Radar(x = -6000, y = 10000)

    # Radar 2: Standard radar
    radar2 = Radar(x = 1000, y = 8000,
                   r_std = 5., theta_std = 0.005, phi_std = 0.005)

    radars = [radar1,radar2]

    ## ================== Period Radars (different data rates)
    # Radar 1: Precision radar
    dt_rad1 = 0.1
    pradar1 = PeriodRadar(x = -6000, y = 10000, dt = dt_rad1)

    # Radar 2: Standard radar
    pradar2 = PeriodRadar(x = 1000, y = 8000, dt = dt_rad2,
                            r_std = 5., theta_std = 0.005, phi_std = 0.005)
    dt_rad2 = 0.4

    pradars = [pradar1,pradar2]
    # ==========================================================================
    # ========================= Detector Generation ============================
    # ==========================================================================
    ## Comment the unused detectors!
    detector = None
    detector = MahalanobisDetector()
    detector = EuclidianDetector()
 def test_initialization_noise_finder(self):
     self.assertEqual(self.process_noise_finder.radars, [PeriodRadar(x=2000,y=2000,dt=0.01),PeriodRadar(x=1000,y=1000,dt=0.02)])
     self.assertTrue(np.array_equal(self.process_noise_finder.states,np.array([[i,i/2,i/10]*3 for i in range(300)])))