Skip to content

Commit 66a0ea0

Browse files
committed
reference coordinates tutorial in html
1 parent 7954ecd commit 66a0ea0

5 files changed

Lines changed: 78 additions & 80 deletions

File tree

docs/source/tutorials/tutorials.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@ available in the :code:`utils` directory.
5555
:maxdepth: 2
5656

5757
tutorials_visualizations_notebook
58+
tutorials_coordinates_notebook
5859
tutorials_utilities_notebook
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"path": "../../../notebooks/tutorials/coordinates.ipynb"
3+
}

notebooks/tutorials/coordinates.ipynb

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# Global coordinate conversions"
7+
"# Global Coordinate Conversions"
88
]
99
},
1010
{
@@ -45,7 +45,7 @@
4545
"cell_type": "markdown",
4646
"metadata": {},
4747
"source": [
48-
"# Local NED frame conversions"
48+
"# Local NED Frame Conversions"
4949
]
5050
},
5151
{
@@ -122,6 +122,76 @@
122122
"print('The converted free vector in NED is ')\n",
123123
"print(v_ecef)"
124124
]
125+
},
126+
{
127+
"cell_type": "markdown",
128+
"metadata": {},
129+
"source": [
130+
"# Elevation and Aziumth from ECEF Positions"
131+
]
132+
},
133+
{
134+
"cell_type": "markdown",
135+
"metadata": {},
136+
"source": [
137+
"Find elevation and azimuth angle from receiver and satellite ECEF positions."
138+
]
139+
},
140+
{
141+
"cell_type": "code",
142+
"execution_count": null,
143+
"metadata": {},
144+
"outputs": [],
145+
"source": [
146+
"from gnss_lib_py.utils.coordinates import ecef_to_el_az\n",
147+
"from gnss_lib_py.parsers.android import AndroidDerived2022\n",
148+
"\n",
149+
"# load Android Google Challenge data\n",
150+
"!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",
151+
"navdata = AndroidDerived2022(\"device_gnss.csv\")\n",
152+
"navdata_subset = navdata.where(\"gps_millis\",navdata[\"gps_millis\",0]) # only use data from first timestep"
153+
]
154+
},
155+
{
156+
"cell_type": "markdown",
157+
"metadata": {},
158+
"source": [
159+
"To calculate the elevation and azimuth, pass in the receiver and satellites' ECEF positions."
160+
]
161+
},
162+
{
163+
"cell_type": "code",
164+
"execution_count": null,
165+
"metadata": {},
166+
"outputs": [],
167+
"source": [
168+
"pos_sv_m = navdata_subset[[\"x_sv_m\",\"y_sv_m\",\"z_sv_m\"]].T\n",
169+
"pos_rx_m = navdata_subset[[\"WlsPositionXEcefMeters\",\n",
170+
" \"WlsPositionYEcefMeters\",\n",
171+
" \"WlsPositionZEcefMeters\"],0].reshape(1,-1)\n",
172+
"\n",
173+
"calculated_el_az = ecef_to_el_az(pos_rx_m,pos_sv_m)\n",
174+
"truth_el_az = navdata_subset[[\"el_sv_deg\",\"az_sv_deg\"]].T"
175+
]
176+
},
177+
{
178+
"cell_type": "markdown",
179+
"metadata": {},
180+
"source": [
181+
"We can now compare the calculated elevation and azimuth with their respective \"truth\" values included in the Google Decimeter Challenge 2022 dataset."
182+
]
183+
},
184+
{
185+
"cell_type": "code",
186+
"execution_count": null,
187+
"metadata": {},
188+
"outputs": [],
189+
"source": [
190+
"for sat_idx in range(3):\n",
191+
" print(f\"SV ID: {int(navdata_subset['sv_id',sat_idx])}\")\n",
192+
" print(f\"Calculated elevation: {calculated_el_az[sat_idx,0]}, Truth elevation: {truth_el_az[sat_idx,0]}\")\n",
193+
" print(f\"Calculated azimuth: {calculated_el_az[sat_idx,1]}, Truth azimuth: {truth_el_az[sat_idx,1]}\")"
194+
]
125195
}
126196
],
127197
"metadata": {

notebooks/tutorials/utilities.ipynb

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -151,83 +151,6 @@
151151
"gps_millis = tc.unix_to_gps_millis(unix_millis)\n",
152152
"print(f\"GPS milliseconds: {gps_millis}\")"
153153
]
154-
},
155-
{
156-
"cell_type": "markdown",
157-
"id": "76ee7e5e",
158-
"metadata": {},
159-
"source": [
160-
"# Coordinates"
161-
]
162-
},
163-
{
164-
"cell_type": "markdown",
165-
"id": "952766c1",
166-
"metadata": {},
167-
"source": [
168-
"Find elevation and azimuth angle from receiver and satellite ECEF positions."
169-
]
170-
},
171-
{
172-
"cell_type": "code",
173-
"execution_count": null,
174-
"id": "7469642e",
175-
"metadata": {},
176-
"outputs": [],
177-
"source": [
178-
"from gnss_lib_py.utils.coordinates import ecef_to_el_az\n",
179-
"from gnss_lib_py.parsers.android import AndroidDerived2022\n",
180-
"\n",
181-
"# load Android Google Challenge data\n",
182-
"!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",
183-
"navdata = AndroidDerived2022(\"device_gnss.csv\")\n",
184-
"navdata_subset = navdata.where(\"gps_millis\",navdata[\"gps_millis\",0]) # only use data from first timestep"
185-
]
186-
},
187-
{
188-
"cell_type": "markdown",
189-
"id": "fd284f3e",
190-
"metadata": {},
191-
"source": [
192-
"To calculate the elevation and azimuth, pass in the receiver and satellites' ECEF positions."
193-
]
194-
},
195-
{
196-
"cell_type": "code",
197-
"execution_count": null,
198-
"id": "7d5be2b4",
199-
"metadata": {},
200-
"outputs": [],
201-
"source": [
202-
"pos_sv_m = navdata_subset[[\"x_sv_m\",\"y_sv_m\",\"z_sv_m\"]].T\n",
203-
"pos_rx_m = navdata_subset[[\"WlsPositionXEcefMeters\",\n",
204-
" \"WlsPositionYEcefMeters\",\n",
205-
" \"WlsPositionZEcefMeters\"],0].reshape(1,-1)\n",
206-
"\n",
207-
"calculated_el_az = ecef_to_el_az(pos_rx_m,pos_sv_m)\n",
208-
"truth_el_az = navdata_subset[[\"el_sv_deg\",\"az_sv_deg\"]].T"
209-
]
210-
},
211-
{
212-
"cell_type": "markdown",
213-
"id": "6f1348ea",
214-
"metadata": {},
215-
"source": [
216-
"We can now compare the calculated elevation and azimuth with their respective \"truth\" values included in the Google Decimeter Challenge 2022 dataset."
217-
]
218-
},
219-
{
220-
"cell_type": "code",
221-
"execution_count": null,
222-
"id": "b256241b",
223-
"metadata": {},
224-
"outputs": [],
225-
"source": [
226-
"for sat_idx in range(3):\n",
227-
" print(f\"SV ID: {int(navdata_subset['sv_id',sat_idx])}\")\n",
228-
" print(f\"Calculated elevation: {calculated_el_az[sat_idx,0]}, Truth elevation: {truth_el_az[sat_idx,0]}\")\n",
229-
" print(f\"Calculated azimuth: {calculated_el_az[sat_idx,1]}, Truth azimuth: {truth_el_az[sat_idx,1]}\")"
230-
]
231154
}
232155
],
233156
"metadata": {

notebooks/tutorials/visualizations.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@
156156
"outputs": [],
157157
"source": [
158158
"fig = plot_metric(glonass_data, \"iono_delay_m\", \"tropo_delay_m\", groupby=\"sv_id\",\n",
159-
" linestyle=\"None\", markeredgecolor=\"r\", markersize=12, markeredgewidth=1.0)"
159+
" linestyle=\"None\", markeredgecolor=\"g\", markersize=12, \n",
160+
" markeredgewidth=1.0)"
160161
]
161162
},
162163
{

0 commit comments

Comments
 (0)