Skip to content

Commit d84141b

Browse files
committed
Initial tutorial
1 parent d985ae4 commit d84141b

3 files changed

Lines changed: 111 additions & 6 deletions

File tree

gnss_lib_py/utils/metrics.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ def get_dop(navdata, **which_dop):
5252
'dop_matrix': False}
5353
# This syntax allows for the user to override the default values.
5454
which_dop = {**default_which_dop, **which_dop}
55-
print("HERE #############################################")
56-
print(f"which_dop = {which_dop}")
57-
print("THERE #############################################")
58-
5955

6056
# Initialize the gps_millis to output
6157
times = []
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# DOP Metrics\n",
8+
"\n",
9+
"Dillution of Precision (DOP) describes the effect of satellite geometry on the \n",
10+
"user's positioning accuracy. \n",
11+
"DOP can refer to multiple ideas:\n",
12+
"1. The full DOP matrix (or tensor),\n",
13+
"2. DOP in the horizontal or vertical direction,\n",
14+
"3. DOP on the time uncertainty, or\n",
15+
"4. DOP in a particular direction.\n",
16+
"\n",
17+
"Here we show how to make use of existing functionality."
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": 1,
23+
"metadata": {},
24+
"outputs": [],
25+
"source": [
26+
"import gnss_lib_py as glp"
27+
]
28+
},
29+
{
30+
"cell_type": "markdown",
31+
"metadata": {},
32+
"source": [
33+
"As an example, we can load in data from the 2022 Google Smartphone Decimeter \n",
34+
"Challenge"
35+
]
36+
},
37+
{
38+
"cell_type": "code",
39+
"execution_count": 2,
40+
"metadata": {},
41+
"outputs": [
42+
{
43+
"name": "stderr",
44+
"output_type": "stream",
45+
"text": [
46+
"'wget' is not recognized as an internal or external command,\n",
47+
"operable program or batch file.\n"
48+
]
49+
},
50+
{
51+
"ename": "FileNotFoundError",
52+
"evalue": "[Errno ../data/device_gnss.csv] file not found",
53+
"output_type": "error",
54+
"traceback": [
55+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
56+
"\u001b[1;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
57+
"Cell \u001b[1;32mIn[2], line 3\u001b[0m\n\u001b[0;32m 1\u001b[0m glp\u001b[38;5;241m.\u001b[39mmake_dir(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m../data\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 2\u001b[0m get_ipython()\u001b[38;5;241m.\u001b[39msystem(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mwget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/google_decimeter_2022/device_gnss.csv --quiet -nc -O \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m../data/device_gnss.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m----> 3\u001b[0m navdata \u001b[38;5;241m=\u001b[39m \u001b[43mglp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mAndroidDerived2022\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m../data/device_gnss.csv\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n",
58+
"File \u001b[1;32m~\\Desktop\\GitHub\\gnss_lib_py\\gnss_lib_py\\parsers\\google_decimeter.py:152\u001b[0m, in \u001b[0;36mAndroidDerived2022.__init__\u001b[1;34m(self, input_path, **kwargs)\u001b[0m\n\u001b[0;32m 151\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\u001b[38;5;28mself\u001b[39m, input_path, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m--> 152\u001b[0m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__init__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mcsv_path\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minput_path\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
59+
"File \u001b[1;32m~\\Desktop\\GitHub\\gnss_lib_py\\gnss_lib_py\\navdata\\navdata.py:76\u001b[0m, in \u001b[0;36mNavData.__init__\u001b[1;34m(self, csv_path, pandas_df, numpy_array, **kwargs)\u001b[0m\n\u001b[0;32m 73\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnum_cols \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0\u001b[39m\n\u001b[0;32m 75\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m csv_path \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m---> 76\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_csv_path\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcsv_path\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 77\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m pandas_df \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 78\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfrom_pandas_df(pandas_df)\n",
60+
"File \u001b[1;32m~\\Desktop\\GitHub\\gnss_lib_py\\gnss_lib_py\\navdata\\navdata.py:109\u001b[0m, in \u001b[0;36mNavData.from_csv_path\u001b[1;34m(self, csv_path, **kwargs)\u001b[0m\n\u001b[0;32m 107\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcsv_path must be string or path-like\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 108\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mexists(csv_path):\n\u001b[1;32m--> 109\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m(csv_path,\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfile not found\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 111\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_build_navdata()\n\u001b[0;32m 113\u001b[0m pandas_df \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mread_csv(csv_path, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n",
61+
"\u001b[1;31mFileNotFoundError\u001b[0m: [Errno ../data/device_gnss.csv] file not found"
62+
]
63+
}
64+
],
65+
"source": [
66+
"glp.make_dir(\"../data\")\n",
67+
"!wget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/google_decimeter_2022/device_gnss.csv --quiet -nc -O \"../data/device_gnss.csv\"\n",
68+
"navdata = glp.AndroidDerived2022(\"../data/device_gnss.csv\")"
69+
]
70+
},
71+
{
72+
"cell_type": "markdown",
73+
"metadata": {},
74+
"source": [
75+
"Since we already have elevation and azimuth data available to us, we can simply\n",
76+
"call the `get_dop` function."
77+
]
78+
},
79+
{
80+
"cell_type": "code",
81+
"execution_count": null,
82+
"metadata": {},
83+
"outputs": [],
84+
"source": [
85+
"dop_navdata = glp.get_dop(navdata)\n",
86+
"print(dop_navdata)"
87+
]
88+
}
89+
],
90+
"metadata": {
91+
"kernelspec": {
92+
"display_name": "gnss-lib-py-FzLQXRBT-py3.11",
93+
"language": "python",
94+
"name": "python3"
95+
},
96+
"language_info": {
97+
"codemirror_mode": {
98+
"name": "ipython",
99+
"version": 3
100+
},
101+
"file_extension": ".py",
102+
"mimetype": "text/x-python",
103+
"name": "python",
104+
"nbconvert_exporter": "python",
105+
"pygments_lexer": "ipython3",
106+
"version": "3.11.7"
107+
}
108+
},
109+
"nbformat": 4,
110+
"nbformat_minor": 2
111+
}

tests/utils/test_metrics.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717
from gnss_lib_py.navdata.navdata import NavData
1818
from gnss_lib_py.utils.metrics import \
1919
get_dop, calculate_dop, calculate_enu_unit_vectors, calculate_enut_matrix
20-
# from gnss_lib_py.navdata.operations import loop_time
2120
from gnss_lib_py.parsers.google_decimeter import AndroidDerived2022
2221

2322

24-
2523
#####################################################################
2624
# NEW FIXTURES AND TESTS
2725
@pytest.fixture(name="simple_sat_scenario")

0 commit comments

Comments
 (0)