Skip to content

Commit

Permalink
Merge pull request #26 from rahil-makadia/dev
Browse files Browse the repository at this point in the history
GRSS v1 is ready!
  • Loading branch information
rahil-makadia authored Sep 27, 2023
2 parents 71eab7e + ed3db59 commit 5b60aa5
Show file tree
Hide file tree
Showing 10 changed files with 431 additions and 41 deletions.
8 changes: 1 addition & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@ message(STATUS "GRSS version: ${ver}")
project(grss VERSION ${ver})

# specify the C++ standard and compiler flags
# TODO: add gprof profiling, iee standards for floats
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
add_compile_options(-std=c++11 -O3 -fPIC) # operational flags
# add_compile_options(-std=c++11 -DLONGDOUBLE -O2 -fPIC -Werror -Wall -Wextra -pedantic -Wno-unused-but-set-variable -Wno-unused-result)
# if not clang, add -Wno-maybe-uninitialized
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-maybe-uninitialized)
endif()
# add_compile_options(-std=c++11 -DLONGDOUBLE -g3 -fPIC -Werror -Wall -Wextra -pedantic -Wno-unused-but-set-variable -Wno-unused-result) # debugging flags

# Set header file directories
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/extern/cspice/include)
# include_directories(${CMAKE_SOURCE_DIR}/extern/pybind11/include)

# Set source code directories
add_subdirectory(extern/pybind11)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# grss

[![PyPi Version](https://img.shields.io/pypi/v/grss.svg)](https://pypi.python.org/pypi/grss/)
[![PyPi Version](https://img.shields.io/pypi/v/grss?color=green)](https://pypi.python.org/pypi/grss/)
[![Build Sphinx docs)](https://github.com/rahil-makadia/grss/actions/workflows/docs.yml/badge.svg)](https://github.com/rahil-makadia/grss/actions/workflows/docs.yml)
[![Python tests)](https://github.com/rahil-makadia/grss/actions/workflows/python_tests.yml/badge.svg)](https://github.com/rahil-makadia/grss/actions/workflows/python_tests.yml)
[![C++ tests)](https://github.com/rahil-makadia/grss/actions/workflows/cpp_tests.yml/badge.svg)](https://github.com/rahil-makadia/grss/actions/workflows/cpp_tests.yml)
Expand Down Expand Up @@ -49,7 +49,7 @@ Once the GRSS library has been installed, it can be imported into a Python scrip
import grss
```

The first time the library is imported, it will download some data files such as NAIF SPICE kernels and the data needed to debias optical astrometry. This should not take more than a couple minutes, and if the download was completed, the following message will be printed:
The first time the library is imported, it will download some data files such as NAIF SPICE kernels and the data needed to debias optical astrometry. This should should take a few minutes, and if the download was completed, the following message will be printed for each file:

```console
YYYY-MM-DD HH:MM:SS URL:url-of-downloaded-file [filesize] -> path/to/downloaded/file [1]
Expand Down
2 changes: 1 addition & 1 deletion docs/source/start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Once the GRSS library has been installed, it can be imported into a Python scrip
import grss
The first time the library is imported, it will download some data files such as NAIF SPICE kernels and the data needed to debias optical astrometry. This should not take more than a couple minutes, and if the download was completed, the following message will be printed:
The first time the library is imported, it will download some data files such as NAIF SPICE kernels and the data needed to debias optical astrometry. This should should take a few minutes, and if the download was completed, the following message will be printed for each file:

.. code-block:: console
Expand Down
4 changes: 2 additions & 2 deletions grss/fit/fit_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def plot_chi(self, t_arr, ra_chi, dec_chi, delay_chi, doppler_chi,
plt.axhline(sigma_limit, c='red', linestyle='--', alpha=0.5)
plt.legend(ncol=2)
plt.xlabel('Time [UTC]')
plt.ylabel(r'Weighted Residuals, (O-C)/$\sigma$ $[\cdot]$')
plt.ylabel(r'Weighted Residuals, (O-C) $[\sigma]$')
plt.grid(True, which='both', axis='both', alpha=0.2)
if show_logarithmic:
plt.yscale('log')
Expand All @@ -451,7 +451,7 @@ def plot_chi(self, t_arr, ra_chi, dec_chi, delay_chi, doppler_chi,
markersize=radar_scale*markersize, label='Doppler')
plt.legend(ncol=2)
plt.xlabel('Time [UTC]')
plt.ylabel(r'$\chi^2$, (O-C)$^2/\sigma^2$ $[\cdot]$')
plt.ylabel(r'$\chi^2$')
plt.grid(True, which='both', axis='both', alpha=0.2)
# if show_logarithmic: plt.yscale('log')
plt.yscale('log')
Expand Down
1 change: 1 addition & 0 deletions grss/prop/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""GRSS orbit propagation subpackage"""
from .prop_simulation import *
from .prop_unscented import *
from .prop_utils import *
36 changes: 36 additions & 0 deletions grss/prop/prop_unscented.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""Unscented transformations for the GRSS orbit propagation code"""
import numpy as np

def generate_sigma_points(sol, cov):
"""
Generate sigma points for propagating uncertainties using the unscented
transformation.
Parameters
----------
sol : dict
solution dictionary from the SBDB API
cov : numpy.ndarray
covariance matrix of the solution
Returns
-------
sigma_points : list
list of dictionaries containing each of the sigma points
"""
assert len(sol)-1 == cov.shape[0]
assert cov.shape[0] == cov.shape[1]
dim = cov.shape[0]
sqrt_cov = np.linalg.cholesky(cov)
sol_array = np.array([sol[key] for key in sol if key != 't'])
sigma_points = [list(sol_array)]
fac = dim**0.5
for i in range(dim):
plus = sol_array + fac*sqrt_cov.T[i]
minus = sol_array - fac*sqrt_cov.T[i]
sigma_points.append(list(plus))
sigma_points.append(list(minus))
# convert sigma points to dict
for i in range(2*dim+1):
sigma_points[i] = {key: sigma_points[i][j-1] for j, key in enumerate(sol) if key != 't'}
return sigma_points
Loading

0 comments on commit 5b60aa5

Please sign in to comment.