Skip to content

Commit

Permalink
Merge pull request #154 from Stanford-NavLab/ashwin+daniel/dop
Browse files Browse the repository at this point in the history
Added DOP functionality
  • Loading branch information
danineamati authored Feb 10, 2024
2 parents c2b2b2f + ad8eb85 commit c9457b1
Show file tree
Hide file tree
Showing 35 changed files with 1,426 additions and 29 deletions.
8 changes: 8 additions & 0 deletions build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@ cd docs
echo "Rebuilding References"
rm -r ./source/reference/algorithms/*
poetry run sphinx-apidoc -f -M -q -o ./source/reference/algorithms/ ./../gnss_lib_py/algorithms/
rm -r ./source/reference/navdata/*
poetry run sphinx-apidoc -f -M -q -o ./source/reference/navdata/ ./../gnss_lib_py/navdata/
rm -r ./source/reference/parsers/*
poetry run sphinx-apidoc -f -M -q -o ./source/reference/parsers/ ./../gnss_lib_py/parsers/
rm -r ./source/reference/utils/*
poetry run sphinx-apidoc -f -M -q -o ./source/reference/utils/ ./../gnss_lib_py/utils/
rm -r ./source/reference/visualizations/*
poetry run sphinx-apidoc -f -M -q -o ./source/reference/visualizations/ ./../gnss_lib_py/visualizations/
rm -r ./source/reference/test_algorithms/*
poetry run sphinx-apidoc -f -M -q -o ./source/reference/test_algorithms/ ./../tests/algorithms/
rm -r ./source/reference/test_navdata/*
poetry run sphinx-apidoc -f -M -q -o ./source/reference/test_navdata/ ./../tests/navdata/
rm -r ./source/reference/test_parsers/*
poetry run sphinx-apidoc -f -M -q -o ./source/reference/test_parsers/ ./../tests/parsers/
rm -r ./source/reference/test_utils/*
poetry run sphinx-apidoc -f -M -q -o ./source/reference/test_utils/ ./../tests/utils/
rm -r ./source/reference/test_visualizations/*
poetry run sphinx-apidoc -f -M -q -o ./source/reference/test_visualizations/ ./../tests/visualizations/

# remove previously downloaded .csv files if they exist
rm ./source/*/*.csv
Expand Down
4 changes: 4 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@
sys.path.insert(0, os.path.abspath('../../'))
sys.path.insert(0, os.path.abspath('../../gnss_lib_py/'))
sys.path.insert(0, os.path.abspath('../../gnss_lib_py/algorithms/'))
sys.path.insert(0, os.path.abspath('../../gnss_lib_py/navdata/'))
sys.path.insert(0, os.path.abspath('../../gnss_lib_py/parsers/'))
sys.path.insert(0, os.path.abspath('../../gnss_lib_py/utils/'))
sys.path.insert(0, os.path.abspath('../../gnss_lib_py/visualizations/'))
sys.path.insert(0, os.path.abspath('../../tests/'))
sys.path.insert(0, os.path.abspath('../../tests/algorithms'))
sys.path.insert(0, os.path.abspath('../../tests/navdata'))
sys.path.insert(0, os.path.abspath('../../tests/parsers'))
sys.path.insert(0, os.path.abspath('../../tests/utils'))
sys.path.insert(0, os.path.abspath('../../tests/visualizations'))


# -- Project information -----------------------------------------------------
Expand Down
34 changes: 6 additions & 28 deletions docs/source/contributing/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,17 @@ Standard GitHub Workflow
folders for PyCharm and :code:`.vscode` folders for VS Code are not
committed by updating the :code:`.gitignore` file.

10. Improve code readability by linting it. Run :code:`pylint` to preview
issues with the code:
10. Add your name to the `contributors list <https://github.com/Stanford-NavLab/gnss_lib_py/blob/main/CONTRIBUTORS.md>`__.

.. code-block:: bash
poetry run python -m pylint path-to-file-to-lint
Resolve issues that do not impact how you have implemented your functionality,
such as conforming to snake case naming, removing TODOs and using suggested
defaults.

11. Add your name to the `contributors list <https://github.com/Stanford-NavLab/gnss_lib_py/blob/main/CONTRIBUTORS.md>`__.

12. Commit your changes and publish your branch to GitHub:
11. Commit your changes and publish your branch to GitHub:

.. code-block:: bash
git add -A
git commit -m "<describe changes in this commit>"
git push origin your-name/name-of-your-bugfix-or-feature
13. Submit a pull request through GitHub. For the base branch
12. Submit a pull request through GitHub. For the base branch
in the pull request, select the latest version release branch :code:`vX.Y.Z`
(with the highest number of all such branches). *Do not target the*
:code:`main` *branch in your pull request.* In the pull request,
Expand Down Expand Up @@ -173,20 +162,9 @@ NAVLab GitHub Workflow
folders for PyCharm and :code:`.vscode` folders for VS Code are not
committed by updating the :code:`.gitignore` file.

10. Improve code readability by linting it. Run :code:`pylint` to preview
issues with the code:

.. code-block:: bash
poetry run python -m pylint path-to-file-to-lint
Resolve issues that do not impact how you have implemented your functionality,
such as conforming to snake case naming, removing TODOs and using suggested
defaults.

11. Add your name to the `contributors list <https://github.com/Stanford-NavLab/gnss_lib_py/blob/main/CONTRIBUTORS.md>`__.
10. Add your name to the `contributors list <https://github.com/Stanford-NavLab/gnss_lib_py/blob/main/CONTRIBUTORS.md>`__.

12. When you're ready to commit changes follow the steps below to
11. When you're ready to commit changes follow the steps below to
minimize unnecessary merging. This is especially important if
multiple people are working on the same branch. If you pull new
changes, then repeat the tests above to double check that everything
Expand All @@ -201,7 +179,7 @@ NAVLab GitHub Workflow
git commit -m "<describe changes in this commit>"
git push origin your-name/name-of-your-bugfix-or-feature
13. Submit a pull request through GitHub. For the base branch
12. Submit a pull request through GitHub. For the base branch
in the pull request, select the latest version release branch :code:`vX.Y.Z`
(with the highest number of all such branches). *Do not target the*
:code:`main` *branch in your pull request.* In the pull request,
Expand Down
8 changes: 8 additions & 0 deletions docs/source/reference/navdata/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
navdata
=======

.. toctree::
:maxdepth: 4

navdata
operations
7 changes: 7 additions & 0 deletions docs/source/reference/navdata/navdata.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
navdata module
==============

.. automodule:: navdata
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/reference/navdata/operations.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
operations module
=================

.. automodule:: operations
:members:
:undoc-members:
:show-inheritance:
4 changes: 4 additions & 0 deletions docs/source/reference/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,10 @@ documentation below.
:maxdepth: 2

algorithms/modules
navdata/modules
parsers/modules
utils/modules
visualizations/modules

Testing References
--------------------------------
Expand All @@ -302,8 +304,10 @@ documentation below.
:maxdepth: 2

test_algorithms/modules
test_navdata/modules
test_parsers/modules
test_utils/modules
test_visualizations/modules


Additional Indices
Expand Down
7 changes: 7 additions & 0 deletions docs/source/reference/test_navdata/conftest.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
conftest module
===============

.. automodule:: conftest
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/source/reference/test_navdata/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
navdata
=======

.. toctree::
:maxdepth: 4

conftest
test_navdata
test_operations
7 changes: 7 additions & 0 deletions docs/source/reference/test_navdata/test_navdata.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test\_navdata module
====================

.. automodule:: test_navdata
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/reference/test_navdata/test_operations.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test\_operations module
=======================

.. automodule:: test_operations
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/source/reference/test_utils/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ utils

conftest
test_coordinates
test_dop
test_ephemeris_downloader
test_file_operations
test_filters
Expand Down
7 changes: 7 additions & 0 deletions docs/source/reference/test_utils/test_dop.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test\_dop module
================

.. automodule:: test_dop
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/reference/test_visualizations/conftest.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
conftest module
===============

.. automodule:: conftest
:members:
:undoc-members:
:show-inheritance:
11 changes: 11 additions & 0 deletions docs/source/reference/test_visualizations/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
visualizations
==============

.. toctree::
:maxdepth: 4

conftest
test_plot_map
test_plot_metric
test_plot_skyplot
test_style
7 changes: 7 additions & 0 deletions docs/source/reference/test_visualizations/test_plot_map.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test\_plot\_map module
======================

.. automodule:: test_plot_map
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test\_plot\_metric module
=========================

.. automodule:: test_plot_metric
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test\_plot\_skyplot module
==========================

.. automodule:: test_plot_skyplot
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/reference/test_visualizations/test_style.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test\_style module
==================

.. automodule:: test_style
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/reference/utils/dop.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dop module
==========

.. automodule:: dop
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/source/reference/utils/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ utils

constants
coordinates
dop
ephemeris_downloader
file_operations
filters
Expand Down
10 changes: 10 additions & 0 deletions docs/source/reference/visualizations/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
visualizations
==============

.. toctree::
:maxdepth: 4

plot_map
plot_metric
plot_skyplot
style
7 changes: 7 additions & 0 deletions docs/source/reference/visualizations/plot_map.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plot\_map module
================

.. automodule:: plot_map
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/reference/visualizations/plot_metric.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plot\_metric module
===================

.. automodule:: plot_metric
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/reference/visualizations/plot_skyplot.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plot\_skyplot module
====================

.. automodule:: plot_skyplot
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/reference/visualizations/style.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
style module
============

.. automodule:: style
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/source/tutorials/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ available in the :code:`utils` directory.

utils/tutorials_constants_notebook
utils/tutorials_coordinates_notebook
utils/tutorials_dop_notebook
utils/tutorials_ephemeris_downloader_notebook
utils/tutorials_file_operations_notebook
utils/tutorials_filters_notebook
Expand Down
3 changes: 3 additions & 0 deletions docs/source/tutorials/utils/tutorials_dop_notebook.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "../../../../notebooks/tutorials/utils/dop.ipynb"
}
1 change: 1 addition & 0 deletions gnss_lib_py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from gnss_lib_py.utils.constants import *
from gnss_lib_py.utils.coordinates import *
from gnss_lib_py.utils.dop import *
from gnss_lib_py.utils.ephemeris_downloader import *
from gnss_lib_py.utils.file_operations import *
from gnss_lib_py.utils.filters import *
Expand Down
31 changes: 31 additions & 0 deletions gnss_lib_py/utils/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,3 +570,34 @@ def wrap_0_to_2pi(angles):
angles = np.mod(angles, 2*np.pi)

return angles


def el_az_to_enu_unit_vector(el_deg, az_deg):
"""
Convert elevation and azimuth to ENU unit vectors.
Parameters
----------
el_deg : np.ndarray
Elevation angle in degrees.
az_deg : np.ndarray
Azimuth angle in degrees.
Returns
-------
unit_dir_mat : np.ndarray
ENU unit vectors.
"""
el_rad = np.deg2rad(el_deg)
az_rad = np.deg2rad(az_deg)

unit_dir_mat = np.vstack(
(np.atleast_2d(np.cos(el_rad) * np.sin(az_rad)),
np.atleast_2d(np.cos(el_rad) * np.cos(az_rad)),
np.atleast_2d(np.sin(el_rad))
)).T

return unit_dir_mat


Loading

0 comments on commit c9457b1

Please sign in to comment.