Skip to content

Commit

Permalink
C++ code is documented!
Browse files Browse the repository at this point in the history
  • Loading branch information
rahil-makadia committed Mar 26, 2024
1 parent 33059eb commit 61f91c1
Show file tree
Hide file tree
Showing 48 changed files with 4,636 additions and 162 deletions.
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,25 @@ target_compile_definitions(libgrss PRIVATE VERSION_INFO=${${PROJECT_NAME}_VERSIO

# compile tests
add_subdirectory(tests/cpp/prop)

# build the documentation
find_package(Doxygen)
if (DOXYGEN_FOUND)
# set input and output files
set(DOXYGEN_IN ${CMAKE_SOURCE_DIR}/docs/doxygen/doxygen.config)
set(DOXYGEN_OUT ${CMAKE_SOURCE_DIR}/docs/doxygen/doxyfile.out)

# configure the file and fill out CMake variables
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)

# note: the option ALL allows building the docs with the binaries
add_custom_target(
doxygen_docs ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/doxygen
COMMENT "Generating API documentation with Doxygen"
VERBATIM
)
else (DOXYGEN_FOUND)
message(FATAL_ERROR "Doxygen needs to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ GRSS Development Team:
* Siegfried Eggl
* Davide Farnocchia

The GRSS library was developed by Rahil Makadia as part of his PhD dissertation at the University of Illinois at Urbana-Champaign. This work was supported by a NASA Space Technologies Graduate Research Opportunities (NSTGRO) Fellowship, Grant #80NSSC22K1173. The author would like to thank his advisor, Dr. Siegfried Eggl as well as his collaborators, Dr. Steven R. Chesley, and Dr. Davide Farnocchia for their guidance and support.
The GRSS library was developed by Rahil Makadia as part of his PhD dissertation at the University of Illinois at Urbana-Champaign. This work was supported by a NASA Space Technologies Graduate Research Opportunities (NSTGRO) Fellowship, Grant #80NSSC22K1173. Rahil would like to thank his advisor, Dr. Siegfried Eggl as well as his collaborators, Dr. Steven R. Chesley, and Dr. Davide Farnocchia for their guidance and support.
2,807 changes: 2,807 additions & 0 deletions docs/doxygen/doxygen.config

Large diffs are not rendered by default.

Binary file added docs/source/_static/grss-doxygen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions docs/source/api_cpp.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
C++ API
=======

.. toctree::
:hidden:

cppsummary/approach
cppsummary/elements
cppsummary/force
cppsummary/gr15
cppsummary/interpolate
cppsummary/parallel
cppsummary/simulation
cppsummary/spk
cppsummary/stm
cppsummary/timeconvert
cppsummary/utilities

.. taken from autosummary code for Python API for consistency and symmetry to satisfy the OCD gods (and my psychotic brain)
.. raw:: html

<table class="autosummary longtable table autosummary">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="cppsummary/approach.html" title="approach.h"><code class="xref py py-obj docutils literal notranslate"><span class="pre">approach.h</span></code></a></p></td>
<td><p>GRSS C++ close approach submodule</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="cppsummary/elements.html" title="elements.h"><code class="xref py py-obj docutils literal notranslate"><span class="pre">elements.h</span></code></a></p></td>
<td><p>GRSS C++ orbital elements submodule</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="cppsummary/force.html" title="force.h"><code class="xref py py-obj docutils literal notranslate"><span class="pre">force.h</span></code></a></p></td>
<td><p>GRSS C++ force function submodule</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="cppsummary/gr15.html" title="gr15.h"><code class="xref py py-obj docutils literal notranslate"><span class="pre">gr15.h</span></code></a></p></td>
<td><p>GRSS C++ Gauss-Radau 15<sup>th</sup> order integrator submodule</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="cppsummary/interpolate.html" title="interpolate.h"><code class="xref py py-obj docutils literal notranslate"><span class="pre">interpolate.h</span></code></a></p></td>
<td><p>GRSS C++ integrator state interpolation submodule</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="cppsummary/parallel.html" title="parallel.h"><code class="xref py py-obj docutils literal notranslate"><span class="pre">parallel.h</span></code></a></p></td>
<td><p>GRSS C++ parallel propagation submodule</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="cppsummary/simulation.html" title="simulation.h"><code class="xref py py-obj docutils literal notranslate"><span class="pre">simulation.h</span></code></a></p></td>
<td><p>GRSS C++ propagator simulation submodule</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="cppsummary/spk.html" title="spk.h"><code class="xref py py-obj docutils literal notranslate"><span class="pre">spk.h</span></code></a></p></td>
<td><p>GRSS C++ SPK file submodule</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="cppsummary/stm.html" title="stm.h"><code class="xref py py-obj docutils literal notranslate"><span class="pre">stm.h</span></code></a></p></td>
<td><p>GRSS C++ state transition matrix submodule</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="cppsummary/timeconvert.html" title="timeconvert.h"><code class="xref py py-obj docutils literal notranslate"><span class="pre">timeconvert.h</span></code></a></p></td>
<td><p>GRSS C++ time conversion submodule</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="cppsummary/utilities.html" title="utilities.h"><code class="xref py py-obj docutils literal notranslate"><span class="pre">utilities.h</span></code></a></p></td>
<td><p>GRSS C++ utilities submodule</p></td>
</tr>
</tbody>
</table>
19 changes: 1 addition & 18 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,7 @@
"alt_text": "GRSS - Home",
"text": f"{project} v{version} documentation",
},
# "icon_links": [
# {
# "name": "GitHub",
# "url": "https://github.com/rahil-makadia/grss",
# "icon": "fa-brands fa-github",
# },
# {
# "name": "PyPI Downloads",
# "url": "https://pypi.org/project/grss/",
# "icon": "https://img.shields.io/pypi/dw/grss",
# "type": "url",
# },
# {
# "name": "PyPI",
# "url": "https://pypi.org/project/grss/",
# "icon": "fa-brands fa-python",
# },
# ],
"navigation_with_keys": True,
"extra_footer": ("Created using "
"<a href=https://sphinx-book-theme.readthedocs.io/>"
"The Sphinx Book Theme</a>."),
Expand Down
6 changes: 6 additions & 0 deletions docs/source/cppsummary/approach.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
approach.h
==========

.. doxygenfile:: approach.h
:project: GRSS

6 changes: 6 additions & 0 deletions docs/source/cppsummary/elements.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
elements.h
==========

.. doxygenfile:: elements.h
:project: GRSS

6 changes: 6 additions & 0 deletions docs/source/cppsummary/force.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
force.h
=======

.. doxygenfile:: force.h
:project: GRSS

6 changes: 6 additions & 0 deletions docs/source/cppsummary/gr15.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
gr15.h
======

.. doxygenfile:: gr15.h
:project: GRSS

6 changes: 6 additions & 0 deletions docs/source/cppsummary/interpolate.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
interpolate.h
=============

.. doxygenfile:: interpolate.h
:project: GRSS

6 changes: 6 additions & 0 deletions docs/source/cppsummary/parallel.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parallel.h
==========

.. doxygenfile:: parallel.h
:project: GRSS

6 changes: 6 additions & 0 deletions docs/source/cppsummary/simulation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
simulation.h
============

.. doxygenfile:: simulation.h
:project: GRSS

6 changes: 6 additions & 0 deletions docs/source/cppsummary/spk.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
spk.h
=====

.. doxygenfile:: spk.h
:project: GRSS

6 changes: 6 additions & 0 deletions docs/source/cppsummary/stm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
stm.h
=====

.. doxygenfile:: stm.h
:project: GRSS

6 changes: 6 additions & 0 deletions docs/source/cppsummary/timeconvert.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
timeconvert.h
=============

.. doxygenfile:: timeconvert.h
:project: GRSS

6 changes: 6 additions & 0 deletions docs/source/cppsummary/utilities.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
utilities.h
===========

.. doxygenfile:: utilities.h
:project: GRSS

3 changes: 2 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Continue reading on the following pages to learn more about the library:
fit
examples
api_py
api_cpp
genindex

----------------
Expand All @@ -35,4 +36,4 @@ GRSS Development Team:
* Siegfried Eggl
* Davide Farnocchia

The GRSS library was developed by Rahil Makadia as part of his PhD dissertation at the University of Illinois at Urbana-Champaign. This work was supported by a NASA Space Technologies Graduate Research Opportunities (NSTGRO) Fellowship, Grant #80NSSC22K1173. The author would like to thank his advisor, Dr. Siegfried Eggl as well as his collaborators, Dr. Steven R. Chesley, and Dr. Davide Farnocchia for their guidance and support.
The GRSS library was developed by Rahil Makadia as part of his PhD dissertation at the University of Illinois at Urbana-Champaign. This work was supported by a NASA Space Technologies Graduate Research Opportunities (NSTGRO) Fellowship, Grant #80NSSC22K1173. Rahil would like to thank his advisor, Dr. Siegfried Eggl as well as his collaborators, Dr. Steven R. Chesley, and Dr. Davide Farnocchia for their guidance and support.
2 changes: 1 addition & 1 deletion grss/fit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""GRSS orbit determination subpackage"""
"""GRSS Python orbit determination subpackage"""
import warnings
from .fit_optical import *
from .fit_radar import *
Expand Down
39 changes: 26 additions & 13 deletions grss/fit/fit_optical.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ def apply_weights(obs_array_optical, star_catalog_codes, observer_codes_optical,
obs_array_optical[i, 3:5] = 2.0
elif obs_type in ['S']: # satellite
if obs_code in ['275']: # non-geocentric occultation
obs_array_optical[i, 3:5] = 3e-3
obs_array_optical[i, 3:5] = 0.05
elif obs_code in ['250']: # HST
obs_array_optical[i, 3:5] = 1.3
elif obs_code in ['249', 'C49', 'C50']: # SOHO, STEREO-A, STEREO-B
Expand Down Expand Up @@ -643,11 +643,11 @@ def apply_weights(obs_array_optical, star_catalog_codes, observer_codes_optical,
obs_array_optical[i, 3:5] = 0.5
if obs_program == '0':
obs_array_optical[i, 3:5] = 0.1
elif obs_program == '1':
elif obs_program in ['1', '4']:
obs_array_optical[i, 3:5] = 1.0
elif obs_program in {'2', '3'}:
elif obs_program in ['2', '3']:
obs_array_optical[i, 3:5] = 0.5
if obs_date_mjd < 60223.0: # until 2023-10-06
if obs_date_mjd < 59858.0: # until 2022-10-06
obs_array_optical[i, 3:5] = 0.1
elif obs_code in ['T10', 'T11', 'T13', 'T16', 'T17']:
obs_array_optical[i, 3:5] = 0.5
Expand All @@ -657,15 +657,15 @@ def apply_weights(obs_array_optical, star_catalog_codes, observer_codes_optical,
obs_array_optical[i, 3:5] = 0.1
elif obs_program == '1':
obs_array_optical[i, 3:5] = 0.2
elif obs_program in {'2', '3'}:
elif obs_program in ['2', '3']:
obs_array_optical[i, 3:5] = 0.5
if obs_date_mjd < 59858.0: # until 2022-10-06
obs_array_optical[i, 3:5] = 0.1
elif obs_code in ['T14']:
obs_array_optical[i, 3:5] = 0.5
if obs_program in {'0', '7'}:
if obs_program in ['0', '7']:
obs_array_optical[i, 3:5] = 0.1
elif obs_program in {'1', '2', '4', '6'}:
elif obs_program in ['1', '2', '4', '6', '8']:
obs_array_optical[i, 3:5] = 0.5
elif obs_program == '3':
obs_array_optical[i, 3:5] = 0.2
Expand All @@ -691,12 +691,13 @@ def apply_weights(obs_array_optical, star_catalog_codes, observer_codes_optical,
if star_catalog in ['U', 'V', 'W', 'X', 't', 'L', 'q', 'r', 'u', 'e']:
obs_array_optical[i, 3:5] = 0.5
if obs_code in ['J04']:
if obs_program == '2' and star_catalog in ['t', 'q', 'U', 'V', 'W', 'X']:
if (obs_program in ['2', '$'] and
star_catalog in ['t', 'q', 'U', 'V', 'W', 'X']):
obs_array_optical[i, 3:5] = 0.3
elif obs_program == '#':
obs_array_optical[i, 3:5] = 1.0
elif obs_code in ['Z84']:
if obs_program == '1' and star_catalog in ['U', 'V', 'W', 'X']:
if obs_program in ['1', '7'] and star_catalog in ['U', 'V', 'W', 'X']:
obs_array_optical[i, 3:5] = 0.3
elif obs_code in ['608']:
obs_array_optical[i, 3:5] = 0.6
Expand All @@ -711,18 +712,22 @@ def apply_weights(obs_array_optical, star_catalog_codes, observer_codes_optical,
obs_array_optical[i, 3:5] = 1.0
elif obs_code in ['E10']:
obs_array_optical[i, 3:5] = 0.4
if obs_program == '(' and star_catalog in ['U', 'V', 'W', 'X']:
if obs_program in ['(', '.'] and star_catalog in ['U', 'V', 'W', 'X']:
obs_array_optical[i, 3:5] = 0.2
elif obs_code in ['F65']:
obs_array_optical[i, 3:5] = 0.4
if obs_program == '8' and star_catalog in ['U', 'V', 'W', 'X']:
obs_array_optical[i, 3:5] = 0.2
elif obs_program == '9' and star_catalog in ['U', 'V', 'W', 'X']:
obs_array_optical[i, 3:5] = 0.2
elif obs_code in ['K91', 'K92', 'K93', 'Q63', 'Q64', 'V37', 'V39',
elif obs_code in ['K91', 'K92', 'K93', 'Q63', 'Q64', 'V39',
'W85', 'W86', 'W87', 'Z24', 'Z31']:
obs_array_optical[i, 3:5] = 0.4
if obs_program == '0':
if obs_program in ['0', '3']:
obs_array_optical[i, 3:5] = 0.3
elif obs_code in ['V37']:
obs_array_optical[i, 3:5] = 0.4
if obs_program in ['0', '6']:
obs_array_optical[i, 3:5] = 0.3
elif obs_code in ['Y28']:
if star_catalog in ['t', 'U', 'V', 'W', 'X']:
Expand Down Expand Up @@ -752,9 +757,12 @@ def apply_weights(obs_array_optical, star_catalog_codes, observer_codes_optical,
elif obs_code in ['Z18']:
if obs_program == '1' and star_catalog in ['U', 'V', 'W', 'X']:
obs_array_optical[i, 3:5] = 0.1
elif obs_code in ['181', 'D20']:
elif obs_code in ['181']:
if obs_program == '1' and star_catalog in ['U', 'V', 'W', 'X']:
obs_array_optical[i, 3:5] = 0.5
elif obs_code in ['D20']:
if obs_program in ['1', '4'] and star_catalog in ['U', 'V', 'W', 'X']:
obs_array_optical[i, 3:5] = 0.5
elif obs_code in ['G37']:
if obs_program == '5' and star_catalog in ['U', 'V', 'W', 'X']:
obs_array_optical[i, 3:5] = 0.2
Expand All @@ -764,6 +772,11 @@ def apply_weights(obs_array_optical, star_catalog_codes, observer_codes_optical,
elif obs_code in ['I41']:
if obs_program == 'Z':
obs_array_optical[i, 3:5] = 1.0
elif obs_code in ['W57']:
if obs_program in ['0', '1']:
obs_array_optical[i, 3:5] = 0.4
elif obs_code in ['M28']:
obs_array_optical[i, 3:5] = 3.0
else:
default_weight_counter += 1
obs_array_optical[i, 3:5] = 1.0
Expand Down
18 changes: 11 additions & 7 deletions grss/fit/fit_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,10 @@ def _plot_residuals(self, t_arr, ra_residuals, dec_residuals, ra_cosdec_residual
plt.suptitle(iter_string, y=0.95)
grid_spec = fig.add_gridspec(1, 3, width_ratios=(1,1,1))
ax1 = fig.add_subplot(grid_spec[0, 0])
ax1.plot(t_arr, ra_residuals, '.', label='RA', markersize=markersize)
ax1.plot(t_arr, dec_residuals, '.', label='Dec', markersize=markersize)
ax1.plot(t_arr, ra_residuals, '.', label='RA', markersize=markersize,
color='C1', alpha=0.5)
ax1.plot(t_arr, dec_residuals, '.', label='Dec', markersize=markersize,
color='C0', alpha=0.5)
ax1.plot(t_arr[is_rejected], ra_residuals[is_rejected], 'ro',
markersize=2*markersize, markerfacecolor='none')
ax1.plot(t_arr[is_rejected], dec_residuals[is_rejected], 'ro',
Expand Down Expand Up @@ -398,10 +400,10 @@ def _plot_chi(self, t_arr, ra_chi, dec_chi, delay_chi, doppler_chi,
if plot_chi_squared:
plt.subplot(1,2,1)
if not np.all(np.isnan(ra_chi)) and not np.all(np.isnan(dec_chi)):
plt.plot(t_arr, ra_chi, '.', markersize=markersize, label='RA')
plt.plot(t_arr, dec_chi, '.', markersize=markersize, label='Dec')
plt.plot(t_arr, ra_chi, '.', markersize=markersize, label='RA', color='C1', alpha=0.5)
plt.plot(t_arr, dec_chi, '.', markersize=markersize, label='Dec', color='C0', alpha=0.5)
plt.plot(t_arr[is_rejected], ra_chi[is_rejected], 'ro',
markersize=2*markersize, markerfacecolor='none')#, label='Rejected Obs.')
markersize=2*markersize, markerfacecolor='none', label='Rejected')
plt.plot(t_arr[is_rejected], dec_chi[is_rejected], 'ro',
markersize=2*markersize, markerfacecolor='none')
if not np.all(np.isnan(doppler_chi)):
Expand All @@ -425,8 +427,10 @@ def _plot_chi(self, t_arr, ra_chi, dec_chi, delay_chi, doppler_chi,
plt.gcf().autofmt_xdate()
if plot_chi_squared:
plt.subplot(1,2,2)
plt.plot(t_arr, ra_chi_squared, '.', markersize=markersize, label='RA')
plt.plot(t_arr, dec_chi_squared, '.', markersize=markersize, label='Dec')
plt.plot(t_arr, ra_chi_squared, '.', markersize=markersize,
label='RA', color='C1', alpha=0.5)
plt.plot(t_arr, dec_chi_squared, '.', markersize=markersize,
label='Dec', color='C0', alpha=0.5)
plt.plot(t_arr[is_rejected], ra_chi_squared[is_rejected], 'ro',
markersize=2*markersize, markerfacecolor='none')
plt.plot(t_arr[is_rejected], dec_chi_squared[is_rejected], 'ro',
Expand Down
2 changes: 1 addition & 1 deletion grss/prop/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""GRSS orbit propagation subpackage"""
"""GRSS Python orbit propagation subpackage"""
from ..libgrss import *
from .prop_parallel import *
from .prop_unscented import *
Expand Down
2 changes: 1 addition & 1 deletion grss/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""GRSS utilities subpackage"""
"""GRSS Python utilities subpackage"""
import os
import sys
import datetime
Expand Down
2 changes: 1 addition & 1 deletion grss/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.2
3.8.0
Loading

0 comments on commit 61f91c1

Please sign in to comment.