Skip to content

Commit 60efa44

Browse files
committed
Renaming to dop
1 parent f273cf9 commit 60efa44

8 files changed

Lines changed: 30 additions & 80 deletions

File tree

docs/source/reference/test_utils/modules.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ utils
66

77
conftest
88
test_coordinates
9+
test_dop
910
test_ephemeris_downloader
1011
test_file_operations
1112
test_filters
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
test\_dop module
2+
================
3+
4+
.. automodule:: test_dop
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dop module
2+
==========
3+
4+
.. automodule:: dop
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/source/reference/utils/modules.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ utils
66

77
constants
88
coordinates
9+
dop
910
ephemeris_downloader
1011
file_operations
1112
filters

gnss_lib_py/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222

2323
from gnss_lib_py.utils.constants import *
2424
from gnss_lib_py.utils.coordinates import *
25+
from gnss_lib_py.utils.dop import *
2526
from gnss_lib_py.utils.ephemeris_downloader import *
2627
from gnss_lib_py.utils.file_operations import *
2728
from gnss_lib_py.utils.filters import *
2829
from gnss_lib_py.utils.gnss_models import *
29-
from gnss_lib_py.utils.metrics import *
3030
from gnss_lib_py.utils.sv_models import *
3131
from gnss_lib_py.utils.time_conversions import *
3232

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def calculate_dop(derived):
133133

134134
# Use the elevation and azimuth angles to get the ENU and Time matrix
135135
# Each row is [d_e, d_n, d_u, 1] for each satellite.
136-
enut_matrix = calculate_enut_matrix(derived)
136+
enut_matrix = _calculate_enut_matrix(derived)
137137
enut_gram_matrix = enut_matrix.T @ enut_matrix
138138

139139
try:
@@ -195,7 +195,7 @@ def calculate_enu_unit_vectors(derived):
195195
return unit_dir_mat
196196

197197

198-
def calculate_enut_matrix(derived):
198+
def _calculate_enut_matrix(derived):
199199
"""
200200
Calculate the ENU and Time Matrix from elevation and azimuth.
201201
Each row is [d_e, d_n, d_u, 1] for each satellite.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# DOP Metrics\n",
7+
"# DOP\n",
88
"\n",
99
"Dillution of Precision (DOP) describes the effect of satellite geometry on the \n",
1010
"user's positioning accuracy. \n",
Lines changed: 10 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
import copy
1616

1717
from gnss_lib_py.navdata.navdata import NavData
18-
from gnss_lib_py.utils.metrics import \
19-
get_dop, calculate_dop, calculate_enu_unit_vectors, calculate_enut_matrix
18+
from gnss_lib_py.utils.dop import \
19+
get_dop, calculate_dop, calculate_enu_unit_vectors, _calculate_enut_matrix
2020
from gnss_lib_py.parsers.google_decimeter import AndroidDerived2022
2121

2222

2323
#####################################################################
24-
# NEW FIXTURES AND TESTS
24+
# Test under a simplified satellite scenario
2525
@pytest.fixture(name="simple_sat_scenario")
2626
def fixture_simple_sat_scenario():
2727
"""
@@ -110,7 +110,7 @@ def test_simple_enu_unit_vectors(navdata, expected_los_vectors):
110110
np.ones(expected_los_vectors.shape[0]))
111111

112112
# Check the we get the expected ENUT matrix
113-
enut_matrix = calculate_enut_matrix(navdata)
113+
enut_matrix = _calculate_enut_matrix(navdata)
114114

115115
# First check the shape
116116
assert enut_matrix.shape[0] == expected_los_vectors.shape[0]
@@ -301,7 +301,7 @@ def test_singularity_dop(navdata):
301301
302302
"""
303303
with pytest.raises(np.linalg.LinAlgError):
304-
enut_matrix = calculate_enut_matrix(navdata)
304+
enut_matrix = _calculate_enut_matrix(navdata)
305305
np.linalg.inv(enut_matrix.T @ enut_matrix)
306306

307307
# Now check that we get all NaNs for the DOP values when we have a
@@ -321,74 +321,8 @@ def test_singularity_dop(navdata):
321321
#############################################
322322
# Real data tests across time
323323

324-
# FROM test_coordinates.py
325-
@pytest.fixture(name="root_path_2022")
326-
def fixture_root_path_2022():
327-
"""Location of measurements for unit test
328-
329-
Returns
330-
-------
331-
root_path : string
332-
Folder location containing measurements
333-
"""
334-
root_path = os.path.dirname(
335-
os.path.dirname(
336-
os.path.dirname(
337-
os.path.realpath(__file__))))
338-
root_path = os.path.join(root_path, 'data/unit_test/google_decimeter_2022')
339-
return root_path
340-
341-
@pytest.fixture(name="derived_2022_path")
342-
def fixture_derived_2022_path(root_path_2022):
343-
"""Filepath of Android Derived measurements
344-
345-
Returns
346-
-------
347-
derived_path : string
348-
Location for the unit_test Android derived 2022 measurements
349-
350-
Notes
351-
-----
352-
Test data is a subset of the Android Raw Measurement Dataset [4]_,
353-
from the 2022 Decimeter Challenge. Particularly, the
354-
train/2021-04-29-MTV-2/SamsungGalaxyS20Ultra trace. The dataset
355-
was retrieved from
356-
https://www.kaggle.com/competitions/smartphone-decimeter-2022/data
357-
358-
References
359-
----------
360-
.. [4] Fu, Guoyu Michael, Mohammed Khider, and Frank van Diggelen.
361-
"Android Raw GNSS Measurement Datasets for Precise Positioning."
362-
Proceedings of the 33rd International Technical Meeting of the
363-
Satellite Division of The Institute of Navigation (ION GNSS+
364-
2020). 2020.
365-
"""
366-
derived_path = os.path.join(root_path_2022, 'device_gnss.csv')
367-
return derived_path
368-
369-
370-
@pytest.fixture(name="derived_2022")
371-
def fixture_load_derived_2022(derived_2022_path):
372-
"""Load instance of AndroidDerived2021
373-
374-
Parameters
375-
----------
376-
derived_path : pytest.fixture
377-
String with location of Android derived measurement file
378-
379-
Returns
380-
-------
381-
derived : AndroidDerived2022
382-
Instance of AndroidDerived2022 for testing
383-
"""
384-
derived = AndroidDerived2022(derived_2022_path)
385-
return derived
386-
387-
#############################################
388-
# New tests for real data
389-
390324
@pytest.mark.parametrize('navdata',[
391-
lazy_fixture('derived_2022')
325+
lazy_fixture('android_derived')
392326
])
393327
def test_dop_across_time(navdata):
394328
"""
@@ -407,16 +341,16 @@ def test_dop_across_time(navdata):
407341

408342
@pytest.mark.parametrize('navdata, which_dop',
409343
[
410-
(lazy_fixture('derived_2022'),
344+
(lazy_fixture('android_derived'),
411345
{'GDOP': True, 'HDOP': True, 'VDOP': True,
412346
'PDOP': True, 'TDOP': True, 'dop_matrix': False}),
413-
(lazy_fixture('derived_2022'),
347+
(lazy_fixture('android_derived'),
414348
{'GDOP': True, 'HDOP': True, 'VDOP': True,
415349
'PDOP': True, 'TDOP': True, 'dop_matrix': True}),
416-
(lazy_fixture('derived_2022'),
350+
(lazy_fixture('android_derived'),
417351
{'GDOP': False, 'HDOP': False, 'VDOP': False,
418352
'PDOP': False, 'TDOP': True, 'dop_matrix': True}),
419-
(lazy_fixture('derived_2022'),
353+
(lazy_fixture('android_derived'),
420354
{'GDOP': False, 'HDOP': False, 'VDOP': False,
421355
'PDOP': False, 'TDOP': False, 'dop_matrix': True})
422356
])

0 commit comments

Comments
 (0)