def test_la_get_loc_from_packets(self): new_la = la.LocationAnalyzer() for w_p in self.wrapped_packets: new_la.get_loc_from_packets(w_p) self.assertEqual(new_la.all_stations_mean_df.shape, (2, 5)) self.assertEqual(new_la.all_stations_std_df.shape, (2, 5)) self.assertEqual(len(new_la.all_gps_data), 2)
def test_la_packet_init(self): new_la = la.LocationAnalyzer(self.wrapped_packets) self.assertIsNone(new_la.invalid_points) self.assertIsNone(new_la.get_real_location()) self.assertEqual(new_la.all_stations_mean_df.shape, (2, 5)) self.assertEqual(new_la.all_stations_std_df.shape, (2, 5)) self.assertEqual(len(new_la.all_gps_data), 2)
def test_la_blacklist_init(self): new_la = la.LocationAnalyzer(invalid_points=BLACKLIST) self.assertIsNone(new_la.get_real_location()) self.assertEqual(new_la.valid_gps_data, []) self.assertEqual(new_la.all_gps_data, []) self.assertEqual(len(new_la.invalid_points), 2) self.assertEqual(new_la.invalid_points[0], blacklist_point1)
def test_la_survey_init(self): new_la = la.LocationAnalyzer(real_location=SURVEY) self.assertIsNone(new_la.invalid_points) self.assertEqual(new_la.valid_gps_data, []) self.assertEqual(new_la.all_gps_data, []) self.assertEqual(new_la.get_real_location()["lat"], SURVEY_LAT) self.assertEqual(new_la.get_real_location()["lon"], SURVEY_LON)
def test_write_kml(self): new_la = la.LocationAnalyzer(self.wrapped_packets) data_dict = new_la.get_stats_dataframes().T.to_dict() current_kml_path = os.path.join(LA_TEST_DATA_DIR, "all.kml") la.write_kml(current_kml_path, data_dict) kml_test_data = la.load_kml( os.path.join(LA_TEST_DATA_DIR, "master.kml")) data = la.load_kml(current_kml_path) self.assertEqual(data, kml_test_data) os.remove(current_kml_path)
def setUp(self) -> None: super().setUp() self.valid_gps_point = pd.Series({ "latitude": SURVEY_LAT + .001, "longitude": SURVEY_LON + .01, "altitude": SURVEY_ALT + 20. }) self.dist_gps_point = pd.Series({ "latitude": SURVEY_LAT + .01, "longitude": SURVEY_LON + .01, "altitude": SURVEY_ALT + 100. }) self.new_la = la.LocationAnalyzer(self.wrapped_packets) self.test_w_p = self.redvox_packets["testios1:2"] self.gps_data = la.load_position_data(self.test_w_p) self.survey = SURVEY self.bar_mean = la.AVG_SEA_LEVEL_PRESSURE_KPA self.inclusion_ranges = (la.DEFAULT_INCLUSION_HORIZONTAL_M, la.DEFAULT_INCLUSION_VERTICAL_M, la.DEFAULT_INCLUSION_VERTICAL_BAR_M)
def test_la_get_real_location(self): new_la = la.LocationAnalyzer(real_location=SURVEY) surveyed_point = new_la.get_real_location() self.assertEqual(surveyed_point["lat"], SURVEY_LAT) self.assertEqual(surveyed_point["bar"], SURVEY_BAR)
def test_la_set_real_location(self): new_la = la.LocationAnalyzer() new_la.set_real_location(SURVEY) self.assertEqual(new_la.get_real_location()["lat"], SURVEY_LAT) self.assertEqual(new_la.get_real_location()["lon"], SURVEY_LON)
def test_la_empty_init(self): new_la = la.LocationAnalyzer() self.assertIsNone(new_la.invalid_points) self.assertIsNone(new_la.get_real_location()) self.assertEqual(new_la.valid_gps_data, []) self.assertEqual(new_la.all_gps_data, [])
def setUp(self) -> None: super().setUp() self.new_la = la.LocationAnalyzer(self.wrapped_packets, SURVEY, BLACKLIST)