grss 3.4.0__tar.gz → 3.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. {grss-3.4.0/grss.egg-info → grss-3.4.2}/PKG-INFO +1 -1
  2. {grss-3.4.0 → grss-3.4.2}/grss/fit/fit_simulation.py +44 -37
  3. grss-3.4.2/grss/version.txt +1 -0
  4. {grss-3.4.0 → grss-3.4.2/grss.egg-info}/PKG-INFO +1 -1
  5. {grss-3.4.0 → grss-3.4.2}/src/grss.cpp +25 -0
  6. grss-3.4.0/grss/version.txt +0 -1
  7. {grss-3.4.0 → grss-3.4.2}/CMakeLists.txt +0 -0
  8. {grss-3.4.0 → grss-3.4.2}/LICENSE +0 -0
  9. {grss-3.4.0 → grss-3.4.2}/MANIFEST.in +0 -0
  10. {grss-3.4.0 → grss-3.4.2}/README.md +0 -0
  11. {grss-3.4.0 → grss-3.4.2}/build_cpp.sh +0 -0
  12. {grss-3.4.0 → grss-3.4.2}/docs/source/conf.py +0 -0
  13. {grss-3.4.0 → grss-3.4.2}/extern/get_cspice.py +0 -0
  14. {grss-3.4.0 → grss-3.4.2}/grss/__init__.py +0 -0
  15. {grss-3.4.0 → grss-3.4.2}/grss/debias/get_debiasing_data.py +0 -0
  16. {grss-3.4.0 → grss-3.4.2}/grss/fit/__init__.py +0 -0
  17. {grss-3.4.0 → grss-3.4.2}/grss/fit/fit_optical.py +0 -0
  18. {grss-3.4.0 → grss-3.4.2}/grss/fit/fit_radar.py +0 -0
  19. {grss-3.4.0 → grss-3.4.2}/grss/fit/fit_utils.py +0 -0
  20. {grss-3.4.0 → grss-3.4.2}/grss/kernels/create_kernel_431.txt +0 -0
  21. {grss-3.4.0 → grss-3.4.2}/grss/kernels/create_kernel_441.txt +0 -0
  22. {grss-3.4.0 → grss-3.4.2}/grss/kernels/get_kernels.py +0 -0
  23. {grss-3.4.0 → grss-3.4.2}/grss/kernels/pck00011.tpc +0 -0
  24. {grss-3.4.0 → grss-3.4.2}/grss/kernels/planets_big16_de431_1950_2350.log +0 -0
  25. {grss-3.4.0 → grss-3.4.2}/grss/kernels/planets_big16_de431_1950_2350.tm +0 -0
  26. {grss-3.4.0 → grss-3.4.2}/grss/kernels/planets_big16_de441_1950_2350.log +0 -0
  27. {grss-3.4.0 → grss-3.4.2}/grss/kernels/planets_big16_de441_1950_2350.tm +0 -0
  28. {grss-3.4.0 → grss-3.4.2}/grss/prop/__init__.py +0 -0
  29. {grss-3.4.0 → grss-3.4.2}/grss/prop/prop_parallel.py +0 -0
  30. {grss-3.4.0 → grss-3.4.2}/grss/prop/prop_unscented.py +0 -0
  31. {grss-3.4.0 → grss-3.4.2}/grss/prop/prop_utils.py +0 -0
  32. {grss-3.4.0 → grss-3.4.2}/grss/utils.py +0 -0
  33. {grss-3.4.0 → grss-3.4.2}/grss.egg-info/SOURCES.txt +0 -0
  34. {grss-3.4.0 → grss-3.4.2}/grss.egg-info/dependency_links.txt +0 -0
  35. {grss-3.4.0 → grss-3.4.2}/grss.egg-info/requires.txt +0 -0
  36. {grss-3.4.0 → grss-3.4.2}/grss.egg-info/top_level.txt +0 -0
  37. {grss-3.4.0 → grss-3.4.2}/include/approach.h +0 -0
  38. {grss-3.4.0 → grss-3.4.2}/include/elements.h +0 -0
  39. {grss-3.4.0 → grss-3.4.2}/include/force.h +0 -0
  40. {grss-3.4.0 → grss-3.4.2}/include/gr15.h +0 -0
  41. {grss-3.4.0 → grss-3.4.2}/include/grss.h +0 -0
  42. {grss-3.4.0 → grss-3.4.2}/include/interpolate.h +0 -0
  43. {grss-3.4.0 → grss-3.4.2}/include/parallel.h +0 -0
  44. {grss-3.4.0 → grss-3.4.2}/include/simulation.h +0 -0
  45. {grss-3.4.0 → grss-3.4.2}/include/spk.h +0 -0
  46. {grss-3.4.0 → grss-3.4.2}/include/stm.h +0 -0
  47. {grss-3.4.0 → grss-3.4.2}/include/utilities.h +0 -0
  48. {grss-3.4.0 → grss-3.4.2}/pyproject.toml +0 -0
  49. {grss-3.4.0 → grss-3.4.2}/requirements.txt +0 -0
  50. {grss-3.4.0 → grss-3.4.2}/setup.cfg +0 -0
  51. {grss-3.4.0 → grss-3.4.2}/setup.py +0 -0
  52. {grss-3.4.0 → grss-3.4.2}/src/CMakeLists.txt +0 -0
  53. {grss-3.4.0 → grss-3.4.2}/src/approach.cpp +0 -0
  54. {grss-3.4.0 → grss-3.4.2}/src/elements.cpp +0 -0
  55. {grss-3.4.0 → grss-3.4.2}/src/force.cpp +0 -0
  56. {grss-3.4.0 → grss-3.4.2}/src/gr15.cpp +0 -0
  57. {grss-3.4.0 → grss-3.4.2}/src/interpolate.cpp +0 -0
  58. {grss-3.4.0 → grss-3.4.2}/src/parallel.cpp +0 -0
  59. {grss-3.4.0 → grss-3.4.2}/src/simulation.cpp +0 -0
  60. {grss-3.4.0 → grss-3.4.2}/src/spk.cpp +0 -0
  61. {grss-3.4.0 → grss-3.4.2}/src/stm.cpp +0 -0
  62. {grss-3.4.0 → grss-3.4.2}/src/utilities.cpp +0 -0
  63. {grss-3.4.0 → grss-3.4.2}/tests/cpp/prop/CMakeLists.txt +0 -0
  64. {grss-3.4.0 → grss-3.4.2}/tests/cpp/prop/apophis.cpp +0 -0
  65. {grss-3.4.0 → grss-3.4.2}/tests/cpp/prop/didymos.cpp +0 -0
  66. {grss-3.4.0 → grss-3.4.2}/tests/cpp/prop/spk_map.cpp +0 -0
  67. {grss-3.4.0 → grss-3.4.2}/tests/python/fit/chesley.ipynb +0 -0
  68. {grss-3.4.0 → grss-3.4.2}/tests/python/fit/eggl.ipynb +0 -0
  69. {grss-3.4.0 → grss-3.4.2}/tests/python/fit/farnocchia.ipynb +0 -0
  70. {grss-3.4.0 → grss-3.4.2}/tests/python/fit/shantanunaidu.ipynb +0 -0
  71. {grss-3.4.0 → grss-3.4.2}/tests/python/prop/apophis.ipynb +0 -0
  72. {grss-3.4.0 → grss-3.4.2}/tests/python/prop/didymos.ipynb +0 -0
  73. {grss-3.4.0 → grss-3.4.2}/tests/python/prop/icarus.ipynb +0 -0
  74. {grss-3.4.0 → grss-3.4.2}/tests/python/prop/moshup.ipynb +0 -0
  75. {grss-3.4.0 → grss-3.4.2}/tests/python/run_tests.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: grss
3
- Version: 3.4.0
3
+ Version: 3.4.2
4
4
  Summary: GRSS: Gauss-Radau Small-body Simulator
5
5
  Author: Rahil Makadia
6
6
  Author-email: makadia2@illinois.edu
@@ -17,7 +17,7 @@ class IterationParams:
17
17
  orbit determination process. It is also used for plotting the residuals
18
18
  and chi-squared values for each iteration.
19
19
  """
20
- def __init__(self, iter_number, residuals, rms_u, rms_w,
20
+ def __init__(self, iter_number, residuals, rms_u, rms_w, residual_chi_squared,
21
21
  x_nom, covariance, obs_array, rejection_flags):
22
22
  """
23
23
  Constructor for the IterationParams class
@@ -32,6 +32,8 @@ class IterationParams:
32
32
  Unweighted RMS of the residuals.
33
33
  rms_w : float
34
34
  Weighted RMS of the residuals.
35
+ residual_chi_squared : list
36
+ List of the residual chi-squared values for each observation.
35
37
  x_nom : dict
36
38
  Dictionary of nominal state vector values at the current iteration
37
39
  covariance : array
@@ -59,6 +61,7 @@ class IterationParams:
59
61
  self.sigmas = obs_array[:, 3:5]
60
62
  self.unweighted_rms = rms_u
61
63
  self.weighted_rms = rms_w
64
+ self.residual_chi_squared = residual_chi_squared
62
65
  self._calculate_chis()
63
66
  self._assemble_info()
64
67
  return None
@@ -1482,15 +1485,12 @@ class FitSimulation:
1482
1485
 
1483
1486
  Returns
1484
1487
  -------
1485
- partials : array
1486
- The partials of the observations with respect to the
1487
- initial nominal state after outlier rejection.
1488
- weights : array
1489
- The weights of the observations after outlier rejection.
1490
- residuals : array
1491
- The residuals of the observations after outlier rejection.
1492
- residual_chi_squared : array
1493
- The chi squared values of the residuals after outlier rejection.
1488
+ rms_u : float
1489
+ Unweighted RMS of the residuals.
1490
+ rms_w : float
1491
+ Weighted RMS of the residuals.
1492
+ residual_chi_squared : list
1493
+ List of the residual chi-squared values for each observation.
1494
1494
 
1495
1495
  Raises
1496
1496
  ------
@@ -1520,23 +1520,22 @@ class FitSimulation:
1520
1520
  raise ValueError("Observer info length not recognized.")
1521
1521
  resid = residuals[j:j+size].reshape((1, size))
1522
1522
  # calculate chi-squared for each residual
1523
- if start_rejecting:
1524
- obs_cov = self.obs_cov[j:j+size, j:j+size]
1525
- obs_partials = partials[j:j+size, :]
1526
- if self.rejection_flag[i]:
1527
- resid_cov = obs_cov + obs_partials @ full_cov @ obs_partials.T
1528
- else:
1529
- resid_cov = obs_cov - obs_partials @ full_cov @ obs_partials.T
1530
- residual_chi_squared[i] = (resid @ np.linalg.inv(resid_cov) @ resid.T)[0,0]
1531
- # outlier rejection, only reject RA/Dec measurements
1532
- # but not Gaia/radar measurements
1533
- if size == 2 and isinstance(self.observer_codes[i], str):
1534
- if residual_chi_squared[i] > chi_reject**2:
1535
- self.rejection_flag[i] = True
1536
- self.num_rejected += 1
1537
- elif self.rejection_flag[i] and residual_chi_squared[i] < chi_recover**2:
1538
- self.rejection_flag[i] = False
1539
- self.num_rejected -= 1
1523
+ obs_cov = self.obs_cov[j:j+size, j:j+size]
1524
+ obs_partials = partials[j:j+size, :]
1525
+ if self.rejection_flag[i]:
1526
+ resid_cov = obs_cov + obs_partials @ full_cov @ obs_partials.T
1527
+ else:
1528
+ resid_cov = obs_cov - obs_partials @ full_cov @ obs_partials.T
1529
+ residual_chi_squared[i] = (resid @ np.linalg.inv(resid_cov) @ resid.T)[0,0]
1530
+ # outlier rejection, only reject RA/Dec measurements
1531
+ # but not Gaia/radar measurements
1532
+ if start_rejecting and size == 2 and isinstance(self.observer_codes[i], str):
1533
+ if residual_chi_squared[i] > chi_reject**2:
1534
+ self.rejection_flag[i] = True
1535
+ self.num_rejected += 1
1536
+ elif self.rejection_flag[i] and residual_chi_squared[i] < chi_recover**2:
1537
+ self.rejection_flag[i] = False
1538
+ self.num_rejected -= 1
1540
1539
  if not self.rejection_flag[i]:
1541
1540
  rms_u += (resid @ resid.T)[0,0]
1542
1541
  rms_w += (resid @ self.obs_weight[j:j+size, j:j+size] @ resid.T)[0,0]
@@ -1547,9 +1546,9 @@ class FitSimulation:
1547
1546
  "and chi_recover values, or turning off outlier rejection altogether.")
1548
1547
  rms_u = np.sqrt(rms_u/self.n_obs)
1549
1548
  rms_w = np.sqrt(rms_w/self.n_obs)
1550
- return rms_u, rms_w
1549
+ return rms_u, rms_w, residual_chi_squared
1551
1550
 
1552
- def _add_iteration(self, iter_number, residuals, rms_u, rms_w):
1551
+ def _add_iteration(self, iter_number, residuals, rms_u, rms_w, residual_chi_squared):
1553
1552
  """
1554
1553
  Adds an iteration to the list of iterations in the FitSimulation object.
1555
1554
 
@@ -1563,14 +1562,18 @@ class FitSimulation:
1563
1562
  Unweighted RMS of the residuals.
1564
1563
  rms_w : float
1565
1564
  Weighted RMS of the residuals.
1565
+ residual_chi_squared : list
1566
+ List of the residual chi-squared values for each observation.
1566
1567
 
1567
1568
  Returns
1568
1569
  -------
1569
1570
  None : NoneType
1570
1571
  None
1571
1572
  """
1572
- self.iters.append(IterationParams(iter_number, residuals, rms_u, rms_w, self.x_nom,
1573
- self.covariance, self.obs_array, self.rejection_flag))
1573
+ self.iters.append(IterationParams(iter_number, residuals, rms_u, rms_w,
1574
+ residual_chi_squared, self.x_nom,
1575
+ self.covariance, self.obs_array,
1576
+ self.rejection_flag))
1574
1577
  return None
1575
1578
 
1576
1579
  def _check_convergence(self):
@@ -1583,7 +1586,7 @@ class FitSimulation:
1583
1586
  None
1584
1587
  """
1585
1588
  if self.n_iter > 1:
1586
- del_rms_convergence = 1e-3
1589
+ del_rms_convergence = 1e-4
1587
1590
  curr_rms = self.iters[-1].weighted_rms
1588
1591
  prev_rms = self.iters[-2].weighted_rms
1589
1592
  del_rms = abs(prev_rms - curr_rms)/prev_rms
@@ -1627,7 +1630,11 @@ class FitSimulation:
1627
1630
  atwb += (partials[j:j+size, :].T @ self.obs_weight[j:j+size, j:j+size]
1628
1631
  @ residuals[j:j+size].reshape((size, 1)))
1629
1632
  j += size
1630
- cov = np.linalg.pinv(atwa, rcond=1e-20, hermitian=True)
1633
+ # use pseudo-inverse if the data arc is less than 7 days
1634
+ if self.obs_array[-1,0]-self.obs_array[0,0] < 7.0:
1635
+ cov = np.linalg.pinv(atwa, rcond=1e-20, hermitian=True)
1636
+ else:
1637
+ cov = np.array(prop.matrix_inverse(atwa))
1631
1638
  delta_x = cov @ atwb
1632
1639
  return delta_x.ravel(), cov
1633
1640
 
@@ -1655,11 +1662,11 @@ class FitSimulation:
1655
1662
  residuals, partials = self._get_residuals_and_partials()
1656
1663
  clean_residuals = self._flatten_and_clean(residuals)
1657
1664
  # calculate rms and reject outliers here if desired
1658
- rms_u, rms_w = self._get_rms_and_reject_outliers(partials, clean_residuals,
1659
- start_rejecting)
1665
+ rms_u, rms_w, res_chi_sq = self._get_rms_and_reject_outliers(partials, clean_residuals,
1666
+ start_rejecting)
1660
1667
  if i == 0:
1661
1668
  # add prefit iteration
1662
- self._add_iteration(0, residuals, rms_u, rms_w)
1669
+ self._add_iteration(0, residuals, rms_u, rms_w, res_chi_sq)
1663
1670
  # get initial guess
1664
1671
  curr_state = np.array(list(self.x_nom.values()))
1665
1672
  # get state correction
@@ -1674,7 +1681,7 @@ class FitSimulation:
1674
1681
  # get new covariance
1675
1682
  self.covariance = cov
1676
1683
  # add iteration
1677
- self._add_iteration(i+1, residuals, rms_u, rms_w)
1684
+ self._add_iteration(i+1, residuals, rms_u, rms_w, res_chi_sq)
1678
1685
  if verbose:
1679
1686
  print(f"{self.iters[-1].iter_number}\t\t\t",
1680
1687
  f"{self.iters[-1].unweighted_rms:.3f}\t\t\t",
@@ -0,0 +1 @@
1
+ 3.4.2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: grss
3
- Version: 3.4.0
3
+ Version: 3.4.2
4
4
  Summary: GRSS: Gauss-Radau Small-body Simulator
5
5
  Author: Rahil Makadia
6
6
  Author-email: makadia2@illinois.edu
@@ -337,6 +337,7 @@ PYBIND11_MODULE(prop_simulation, m) {
337
337
  cartesianState : list of real
338
338
  Cartesian state vector.
339
339
  )mydelimiter");
340
+
340
341
  m.def(
341
342
  "cartesian_to_cometary",
342
343
  [](real epochMjd, std::vector<real> cartesianState, real GM) {
@@ -363,6 +364,30 @@ PYBIND11_MODULE(prop_simulation, m) {
363
364
  Cometary state vector.
364
365
  )mydelimiter");
365
366
 
367
+ m.def(
368
+ "matrix_inverse",
369
+ [](std::vector<std::vector<real>> mat, const real &tol) {
370
+ std::vector<std::vector<real>> invMat(
371
+ mat.size(), std::vector<real>(mat[0].size()));
372
+ mat_inv(mat, invMat, tol);
373
+ return invMat;
374
+ },
375
+ py::arg("mat"), py::arg("tol") = 1.0e-16L, R"mydelimiter(
376
+ Calculate the inverse of a matrix using LU decomposition.
377
+
378
+ Parameters
379
+ ----------
380
+ mat : list of list of real
381
+ Matrix to invert.
382
+ tol : real, optional
383
+ Tolerance for the matrix inversion, by default 1.0e-16L.
384
+
385
+ Returns
386
+ -------
387
+ invMat : list of list of real
388
+ Inverse of the matrix.
389
+ )mydelimiter");
390
+
366
391
  // from simulation.h
367
392
  py::class_<Body>(m, "Body", R"mydelimiter(
368
393
  The Body class contains the properties of an integrated or SPICE body.
@@ -1 +0,0 @@
1
- 3.4.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes