Skip to content

Commit 11084c5

Browse files
committed
move add_sv_states tutorial to sv_models
1 parent e4c58f5 commit 11084c5

2 files changed

Lines changed: 121 additions & 142 deletions

File tree

notebooks/tutorials/parsers.ipynb

Lines changed: 0 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -436,140 +436,6 @@
436436
" rinex_obs_3.where('gps_millis', rinex_obs_3['gps_millis', 0], 'eq'))"
437437
]
438438
},
439-
{
440-
"cell_type": "markdown",
441-
"id": "cf51b89e",
442-
"metadata": {},
443-
"source": [
444-
"# Precise Ephemerides Processing"
445-
]
446-
},
447-
{
448-
"cell_type": "markdown",
449-
"id": "3c5de62f",
450-
"metadata": {},
451-
"source": [
452-
"The data required to calculate with precise ephemerides uses .sp3 and .clk files, which can be downloaded from [CDDIS](https://cddis.nasa.gov/Data_and_Derived_Products/GNSS/gnss_mgex.html) or [CORS](https://geodesy.noaa.gov/UFCORS/).\n",
453-
"\n",
454-
"The .sp3 files provide post-processed, accurate, and precise information regarding 3-D satellite position in the Earth-Centered Earth-Fixed (ECEF) frame at intervals of 15mins each. \n",
455-
"\n",
456-
"Similarly, the .clk files provide post-processed, accurate and precise information on satellite clock errors at intervals of 30secs each. \n",
457-
"\n",
458-
"These .sp3 and .clk files are available for any GNSS constellation, and hence, provide a common processing platform for applications that involve multi-GNSS satellite signals (without requiring to parse the broadcast ephemeris from each constellation separately one at a time). Also, unlike broadcast ephemeris that can suffer from signal-in-space anomalies, the .sp3 and .clk files are guaranteed to provide accurate satellite information. However, note that, these files are only available in a post-processed manner, and not in real-time"
459-
]
460-
},
461-
{
462-
"cell_type": "markdown",
463-
"id": "67fc4f2e",
464-
"metadata": {},
465-
"source": [
466-
"We show how to analyze this precise ephemerides functionality for the Android derived dataset in the following cells, \n",
467-
"\n",
468-
"1. Load the derived data from AndroidDerived"
469-
]
470-
},
471-
{
472-
"cell_type": "code",
473-
"execution_count": null,
474-
"id": "364e7fb3",
475-
"metadata": {},
476-
"outputs": [],
477-
"source": [
478-
"import numpy as np\n",
479-
"\n",
480-
"# load Android Google Challenge data\n",
481-
"!wget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/android_2021/Pixel4_derived_clkdiscnt.csv --quiet -O \"Pixel4_derived_clkdiscnt.csv\"\n",
482-
"derived_data = glp.AndroidDerived2021(\"Pixel4_derived_clkdiscnt.csv\", remove_timing_outliers=False)"
483-
]
484-
},
485-
{
486-
"cell_type": "markdown",
487-
"id": "4e4ee7c8",
488-
"metadata": {},
489-
"source": [
490-
"2. Specify the paths to the .sp3 and .clk files, as well as the desired constellations from which one intends to extract satellite information"
491-
]
492-
},
493-
{
494-
"cell_type": "code",
495-
"execution_count": null,
496-
"id": "e62ed8ee",
497-
"metadata": {},
498-
"outputs": [],
499-
"source": [
500-
"# download .sp3 data file\n",
501-
"!wget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/sp3/COD0MGXFIN_20211180000_01D_05M_ORB.SP3 --quiet -O \"COD0MGXFIN_20211180000_01D_05M_ORB.SP3\"\n",
502-
"# Specify .sp3 file path to extract precise ephemerides\n",
503-
"sp3_path = \"COD0MGXFIN_20211180000_01D_05M_ORB.SP3\"\n",
504-
"\n",
505-
"# download .clk data file\n",
506-
"!wget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/clk/COD0MGXFIN_20211180000_01D_30S_CLK.CLK --quiet -O \"COD0MGXFIN_20211180000_01D_30S_CLK.CLK\"\n",
507-
"# Specify .clk file path to extract precise ephemerides\n",
508-
"clk_path = \"COD0MGXFIN_20211180000_01D_30S_CLK.CLK\""
509-
]
510-
},
511-
{
512-
"cell_type": "markdown",
513-
"id": "2567ff0f",
514-
"metadata": {},
515-
"source": [
516-
"3. Remove the rows in NavData class that refer to satellite information (3-D satellite position, 3-D satellite velocity, clock bias and clock drift), \n",
517-
"\n",
518-
" i.e., `SV_KEYS =['x_sv_m', 'y_sv_m', 'z_sv_m', 'vx_sv_mps','vy_sv_mps','vz_sv_mps', 'b_sv_m', 'b_dot_sv_mps']`"
519-
]
520-
},
521-
{
522-
"cell_type": "code",
523-
"execution_count": null,
524-
"id": "3761b169",
525-
"metadata": {},
526-
"outputs": [],
527-
"source": [
528-
"# Define the keys relevant for satellite information, and remove the data within these fields\n",
529-
"SV_KEYS = ['x_sv_m', 'y_sv_m', 'z_sv_m', \\\n",
530-
" 'vx_sv_mps','vy_sv_mps','vz_sv_mps', \\\n",
531-
" 'b_sv_m', 'b_dot_sv_mps']\n",
532-
"derived_data[SV_KEYS] = np.nan"
533-
]
534-
},
535-
{
536-
"cell_type": "markdown",
537-
"id": "458b0a46",
538-
"metadata": {},
539-
"source": [
540-
"4. Populate the columns of SV_KEYS with information extracted via precise ephemerides"
541-
]
542-
},
543-
{
544-
"cell_type": "code",
545-
"execution_count": null,
546-
"id": "f4e3f349",
547-
"metadata": {},
548-
"outputs": [],
549-
"source": [
550-
"# Update derived_data class with satellite information computed via precise ephemerides\n",
551-
"# derived_gps_glonass = derived_data.where(\"gnss_id\",(\"gps\",\"glonass\"))\n",
552-
"derived_multi_gnss = glp.add_sv_states_sp3_and_clk(derived_data, sp3_path, \\\n",
553-
" clk_path, verbose = False)"
554-
]
555-
},
556-
{
557-
"cell_type": "code",
558-
"execution_count": null,
559-
"id": "10563cec",
560-
"metadata": {},
561-
"outputs": [],
562-
"source": [
563-
"# Check that all the desired fields related to satellite information have useful\n",
564-
"# information, and norm of computed satellite position matches the altitude of GNSS constellation\n",
565-
"sat_alt = np.linalg.norm(derived_multi_gnss[[\"x_sv_m\",\"y_sv_m\",\"z_sv_m\"],9:12],axis=0)\n",
566-
"print('Distance of two satellites from the center of the Earth (expected around 26000000 m)')\n",
567-
"print(\"Three GPS SVs calculated to be at:\", sat_alt,\"\\n\")\n",
568-
"\n",
569-
"print(\"Small section of calculated positions:\")\n",
570-
"print(derived_multi_gnss.copy(cols=[2,3,4,5],rows=[\"gnss_id\"]+SV_KEYS))"
571-
]
572-
},
573439
{
574440
"cell_type": "markdown",
575441
"id": "95e58b71",

notebooks/tutorials/sv_models.ipynb

Lines changed: 121 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,124 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"This tutorial explains how to estimate SV states, both as estimation for\n",
8-
"a single time instance and measurements and as a wrapper for an entire\n",
9-
"set of received measurements."
7+
"Load `gnss_lib_py` into the Python workspace"
8+
]
9+
},
10+
{
11+
"cell_type": "code",
12+
"execution_count": null,
13+
"metadata": {},
14+
"outputs": [],
15+
"source": [
16+
"import gnss_lib_py as glp"
1017
]
1118
},
1219
{
1320
"cell_type": "markdown",
1421
"metadata": {},
1522
"source": [
16-
"For this tutorial, we will work with the `AndroidDerived2022` dataset.\n",
17-
"This serves the dual purpose of showing how each functionality works and\n",
18-
"allowing us to compare the SV states estimated in `sv_models.py` to that\n",
19-
"estimated by Google. The latter verifies state computation from our method."
23+
"# Adding SV States with Precise Ephemerides (SP3 & CLK)"
24+
]
25+
},
26+
{
27+
"cell_type": "markdown",
28+
"metadata": {},
29+
"source": [
30+
"This tutorial explains how to calculate satellite states using precise SP3 and CLK files.\n",
31+
"\n",
32+
"The data required to calculate with precise ephemerides uses .sp3 and .clk files, which can be downloaded from [CDDIS](https://cddis.nasa.gov/Data_and_Derived_Products/GNSS/gnss_mgex.html) or [CORS](https://geodesy.noaa.gov/UFCORS/).\n",
33+
"\n",
34+
"The .sp3 files provide post-processed, accurate, and precise information regarding 3-D satellite position in the Earth-Centered Earth-Fixed (ECEF) frame at intervals of 15mins each. \n",
35+
"\n",
36+
"Similarly, the .clk files provide post-processed, accurate and precise information on satellite clock errors at intervals of 30secs each. \n",
37+
"\n",
38+
"These .sp3 and .clk files are available for any GNSS constellation, and hence, provide a common processing platform for applications that involve multi-GNSS satellite signals (without requiring to parse the broadcast ephemeris from each constellation separately one at a time). Also, unlike broadcast ephemeris that can suffer from signal-in-space anomalies, the .sp3 and .clk files are guaranteed to provide accurate satellite information. However, note that, these files are only available in a post-processed manner, and not in real-time\n",
39+
"\n",
40+
"We show how to analyze this precise ephemerides functionality for the Android derived dataset in the following cells, \n",
41+
"\n",
42+
"1. Load the derived data from AndroidDerived and remove the rows in NavData class that refer to satellite information (3-D satellite position, 3-D satellite velocity, clock bias and clock drift),"
43+
]
44+
},
45+
{
46+
"cell_type": "code",
47+
"execution_count": null,
48+
"metadata": {},
49+
"outputs": [],
50+
"source": [
51+
"import numpy as np\n",
52+
"\n",
53+
"# load Android Google Challenge data\n",
54+
"!wget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/android_2021/Pixel4_derived_clkdiscnt.csv --quiet -O \"Pixel4_derived_clkdiscnt.csv\"\n",
55+
"derived_data = glp.AndroidDerived2021(\"Pixel4_derived_clkdiscnt.csv\", remove_timing_outliers=False)\n",
56+
"# Define the keys relevant for satellite information, and remove the data within these fields\n",
57+
"SV_KEYS = ['x_sv_m', 'y_sv_m', 'z_sv_m', \\\n",
58+
" 'vx_sv_mps','vy_sv_mps','vz_sv_mps', \\\n",
59+
" 'b_sv_m', 'b_dot_sv_mps']\n",
60+
"derived_data.remove(rows=SV_KEYS,inplace=True)"
61+
]
62+
},
63+
{
64+
"cell_type": "markdown",
65+
"metadata": {},
66+
"source": [
67+
"2. Specify the paths to the .sp3 and .clk files using the `file_path` variable. If files are not specified, they will be automatically downloaded using the ephemeris downloader."
68+
]
69+
},
70+
{
71+
"cell_type": "code",
72+
"execution_count": null,
73+
"metadata": {},
74+
"outputs": [],
75+
"source": [
76+
"# download .sp3 data file\n",
77+
"!wget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/sp3/COD0MGXFIN_20211180000_01D_05M_ORB.SP3 --quiet -O \"COD0MGXFIN_20211180000_01D_05M_ORB.SP3\"\n",
78+
"# Specify .sp3 file path to extract precise ephemerides\n",
79+
"sp3_path = \"COD0MGXFIN_20211180000_01D_05M_ORB.SP3\"\n",
80+
"\n",
81+
"# download .clk data file\n",
82+
"!wget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/clk/COD0MGXFIN_20211180000_01D_30S_CLK.CLK --quiet -O \"COD0MGXFIN_20211180000_01D_30S_CLK.CLK\"\n",
83+
"# Specify .clk file path to extract precise ephemerides\n",
84+
"clk_path = \"COD0MGXFIN_20211180000_01D_30S_CLK.CLK\""
85+
]
86+
},
87+
{
88+
"cell_type": "markdown",
89+
"metadata": {},
90+
"source": [
91+
"3. Populate the columns of SV_KEYS with information extracted via precise ephemerides"
92+
]
93+
},
94+
{
95+
"cell_type": "code",
96+
"execution_count": null,
97+
"metadata": {},
98+
"outputs": [],
99+
"source": [
100+
"# Update derived_data class with satellite information computed via precise ephemerides\n",
101+
"derived_multi_gnss = glp.add_sv_states(derived_data, source=\"precise\", file_paths=[sp3_path, clk_path],\n",
102+
" verbose = False)"
103+
]
104+
},
105+
{
106+
"cell_type": "markdown",
107+
"metadata": {},
108+
"source": [
109+
"Check that all the desired fields related to satellite information have useful information and the norm of computed satellite position matches the altitude of GNSS constellations"
110+
]
111+
},
112+
{
113+
"cell_type": "code",
114+
"execution_count": null,
115+
"metadata": {},
116+
"outputs": [],
117+
"source": [
118+
"\n",
119+
"sat_alt = np.linalg.norm(derived_multi_gnss[[\"x_sv_m\",\"y_sv_m\",\"z_sv_m\"],9:12],axis=0)\n",
120+
"print('Distance of two satellites from the center of the Earth (expected around 26000000 m)')\n",
121+
"print(\"Three GPS SVs calculated to be at:\", sat_alt,\"\\n\")\n",
122+
"\n",
123+
"print(\"Small section of calculated positions:\")\n",
124+
"print(derived_multi_gnss.copy(cols=[2,3,4,5],rows=[\"gnss_id\"]+SV_KEYS))"
20125
]
21126
},
22127
{
@@ -30,6 +135,15 @@
30135
"cell_type": "markdown",
31136
"metadata": {},
32137
"source": [
138+
"This tutorial explains how to estimate SV states, both as estimation for\n",
139+
"a single time instance and measurements and as a wrapper for an entire\n",
140+
"set of received measurements.\n",
141+
"\n",
142+
"For this tutorial, we will work with the `AndroidDerived2022` dataset.\n",
143+
"This serves the dual purpose of showing how each functionality works and\n",
144+
"allowing us to compare the SV states estimated in `sv_models.py` to that\n",
145+
"estimated by Google. The latter verifies state computation from our method.\n",
146+
"\n",
33147
"Load the test dataset for the Android Derived 2022 dataset"
34148
]
35149
},
@@ -40,7 +154,6 @@
40154
"outputs": [],
41155
"source": [
42156
"import numpy as np\n",
43-
"import gnss_lib_py as glp\n",
44157
"# download Android data file\n",
45158
"!wget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/android_2022/device_gnss.csv --quiet -O \"device_gnss.csv\"\n",
46159
"# load Android Google Challenge data\n",

0 commit comments

Comments
 (0)