1212import pytest
1313
1414from gnss_lib_py .parsers .android import AndroidDerived2021 , AndroidRawFixes , AndroidRawImu , AndroidGroundTruth2021
15+ from gnss_lib_py .parsers .android import AndroidDerived2022 , AndroidGroundTruth2022
1516from gnss_lib_py .parsers .navdata import NavData
1617from gnss_lib_py .parsers .android import make_csv
1718
@@ -37,6 +38,11 @@ def fixture_root_path():
3738def fixture_derived_path (root_path ):
3839 """Filepath of Android Derived measurements
3940
41+ Parameters
42+ ----------
43+ root_path : string
44+ Path of testing dataset root path
45+
4046 Returns
4147 -------
4248 derived_path : string
@@ -65,6 +71,11 @@ def fixture_derived_path(root_path):
6571def fixture_raw_path (root_path ):
6672 """Filepath of Android Raw measurements
6773
74+ Parameters
75+ ----------
76+ root_path : string
77+ Path of testing dataset root path
78+
6879 Returns
6980 -------
7081 raw_path : string
@@ -352,14 +363,14 @@ def fixture_gtruth_path(root_path):
352363
353364 Notes
354365 -----
355- Test data is a subset of the Android Ground Truth Dataset [2 ]_,
366+ Test data is a subset of the Android Ground Truth Dataset [3 ]_,
356367 particularly the train/2020-05-14-US-MTV-1/Pixel4 trace. The dataset
357368 was retrieved from
358369 https://www.kaggle.com/c/google-smartphone-decimeter-challenge/data
359370
360371 References
361372 ----------
362- .. [2 ] Fu, Guoyu Michael, Mohammed Khider, and Frank van Diggelen.
373+ .. [3 ] Fu, Guoyu Michael, Mohammed Khider, and Frank van Diggelen.
363374 "Android Raw GNSS Measurement Datasets for Precise Positioning."
364375 Proceedings of the 33rd International Technical Meeting of the
365376 Satellite Division of The Institute of Navigation (ION GNSS+
@@ -397,3 +408,132 @@ def test_android_gtruth(android_gtruth_path):
397408 isinstance (test_gtruth , NavData )
398409
399410
411+ def test_gt_2022 (root_path ):
412+ """Testing that Android ground truth 2022 is created without errors.
413+
414+ Parameters
415+ ----------
416+ gt_2022_path : string
417+ Location for the unit_test Android ground truth 2022 measurements
418+ """
419+ gt_path = os .path .join (root_path , 'ground_truth.csv' )
420+ gt_2021 = AndroidGroundTruth2021 (gt_path )
421+ assert isinstance (gt_2021 , NavData )
422+
423+
424+ ######################################################################
425+ #### Android Derived 2022 Dataset tests
426+ ######################################################################
427+
428+ @pytest .fixture (name = "root_path_2022" )
429+ def fixture_root_path_2022 ():
430+ """Location of measurements for unit test
431+
432+ Returns
433+ -------
434+ root_path : string
435+ Folder location containing measurements
436+ """
437+ root_path = os .path .dirname (
438+ os .path .dirname (
439+ os .path .dirname (
440+ os .path .realpath (__file__ ))))
441+ root_path = os .path .join (root_path , 'data/unit_test/android_2022' )
442+ return root_path
443+
444+
445+ @pytest .fixture (name = "derived_2022_path" )
446+ def fixture_derived_2022_path (root_path_2022 ):
447+ """Filepath of Android Derived measurements
448+
449+ Returns
450+ -------
451+ derived_path : string
452+ Location for the unit_test Android derived 2022 measurements
453+
454+ Notes
455+ -----
456+ Test data is a subset of the Android Raw Measurement Dataset [4]_,
457+ from the 2022 Decimeter Challenge. Particularly, the
458+ train/2021-04-29-MTV-2/SamsungGalaxyS20Ultra trace. The dataset
459+ was retrieved from
460+ https://www.kaggle.com/competitions/smartphone-decimeter-2022/data
461+
462+ References
463+ ----------
464+ .. [4] Fu, Guoyu Michael, Mohammed Khider, and Frank van Diggelen.
465+ "Android Raw GNSS Measurement Datasets for Precise Positioning."
466+ Proceedings of the 33rd International Technical Meeting of the
467+ Satellite Division of The Institute of Navigation (ION GNSS+
468+ 2020). 2020.
469+ """
470+ derived_path = os .path .join (root_path_2022 , 'device_gnss.csv' )
471+ return derived_path
472+
473+
474+ @pytest .fixture (name = "gt_2022_path" )
475+ def fixture_gt_2022_path (root_path_2022 ):
476+ """Filepath of Android ground truth estimates
477+
478+ Returns
479+ -------
480+ derived_path : string
481+ Location for the unit_test Android ground truth estimates
482+
483+ Notes
484+ -----
485+ Test data is a subset of the Android Raw Measurement Dataset [5]_,
486+ from the 2022 Decimeter Challenge. Particularly, the
487+ train/2021-04-29-MTV-2/SamsungGalaxyS20Ultra trace. The dataset
488+ was retrieved from
489+ https://www.kaggle.com/competitions/smartphone-decimeter-2022/data
490+
491+ References
492+ ----------
493+ .. [5] Fu, Guoyu Michael, Mohammed Khider, and Frank van Diggelen.
494+ "Android Raw GNSS Measurement Datasets for Precise Positioning."
495+ Proceedings of the 33rd International Technical Meeting of the
496+ Satellite Division of The Institute of Navigation (ION GNSS+
497+ 2020). 2020.
498+ """
499+ gt_path = os .path .join (root_path_2022 , 'ground_truth.csv' )
500+ return gt_path
501+
502+
503+ def test_derived_2022 (derived_2022_path ):
504+ """Testing that Android Derived 2022 is created without errors.
505+
506+ Parameters
507+ ----------
508+ derived_2022_path : string
509+ Location for the unit_test Android derived 2022 measurements
510+ """
511+ derived_2022 = AndroidDerived2022 (derived_2022_path )
512+ assert isinstance (derived_2022 , NavData )
513+
514+
515+ def test_gt_2022 (gt_2022_path ):
516+ """Testing that Android ground truth 2022 is created without errors.
517+
518+ Parameters
519+ ----------
520+ gt_2022_path : string
521+ Location for the unit_test Android ground truth 2022 measurements
522+ """
523+ gt_2022 = AndroidGroundTruth2022 (gt_2022_path )
524+ assert isinstance (gt_2022 , NavData )
525+
526+
527+ def test_gt_alt_nan (root_path_2022 ):
528+ """Testing that Android Ground Truth Loader sets blank altitudes to 0.
529+
530+ Parameters
531+ ----------
532+ root_path_2022 : string
533+ Location for the files with missing altitude, including the file
534+ with missing altitude
535+ """
536+ gt_2022_nan = os .path .join (root_path_2022 , 'alt_nan_ground_truth.csv' )
537+ with pytest .warns (RuntimeWarning ):
538+ gt_2022 = AndroidGroundTruth2022 (gt_2022_nan )
539+ np .testing .assert_almost_equal (gt_2022 ['alt_gt_m' ], np .zeros (len (gt_2022 )))
0 commit comments