Exemplo n.º 1
0
 def test_write_lidar_data(self):
     path = pathlib.Path('LIDARPoints.csv')
     lidar_data = read_lidar_data(_HERE.joinpath('examples', path))
     with tempfile.NamedTemporaryFile(suffix='.csv',
                                      delete=True) as tmp_file:
         tmp_path = pathlib.Path(tmp_file.name)
         write_lidar_data(lidar_data, tmp_path)
         roundtrip_data = read_lidar_data(tmp_path)
     self.assertListEqual(list(lidar_data.keys()),
                          list(roundtrip_data.keys()))
     for val1, val2 in zip(list(lidar_data.values()),
                           list(roundtrip_data.values())):
         self.assertEqual(len(val1), len(val2))
         for (k1, v1), (k2, v2) in zip(val1.items(), val2.items()):
             self.assertEqual(k1, k2)
             self.assertEqual(v1, v2)
Exemplo n.º 2
0
 def test_consistency(self):
     flight_data_path = pathlib.Path('FlightPath.csv')
     flight_data = read_flight_data(
         _HERE.joinpath('examples', flight_data_path))
     lidar_data_path = pathlib.Path('LIDARPoints.csv')
     lidar_data = read_lidar_data(
         _HERE.joinpath('examples', lidar_data_path))
     self.assertEqual(len(flight_data), len(lidar_data))
     self.assertEqual(set(flight_data.index), lidar_data.keys())
Exemplo n.º 3
0
 def test_cartesian_polar_conversion(self):
     path = pathlib.Path('LIDARPoints.csv')
     lidar_data = read_lidar_data(_HERE.joinpath('examples', path))
     for id_, lidar_record in lidar_data.items():
         for angle, distance in lidar_record.items():
             self.assertTrue(
                 np.isclose(angle, math.degrees(math.radians(angle))))
             angle = math.radians(angle)
             x, y = cartesian(distance, angle)
             _distance, _angle = polar(x, y)
             self.assertTrue(np.isclose(distance, _distance),
                             msg=(id_, distance, _distance))
             self.assertTrue(np.isclose(normalize_radians(angle),
                                        normalize_radians(angle))
                             or distance == 0,
                             msg=(id_, angle, _angle))
Exemplo n.º 4
0
 def test_read_lidar_data(self):
     path = pathlib.Path('LIDARPoints.csv')
     lidar_data = read_lidar_data(_HERE.joinpath('examples', path))
     self.assertEqual(len(lidar_data), 34)
Exemplo n.º 5
0
 def setUp(self):
     path = pathlib.Path('FlightPath.csv')
     self.flight_data = read_flight_data(_HERE.joinpath('examples', path))
     path = pathlib.Path('LIDARPoints.csv')
     self.lidar_data = read_lidar_data(_HERE.joinpath('examples', path))