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.
- {grss-3.4.0/grss.egg-info → grss-3.4.2}/PKG-INFO +1 -1
- {grss-3.4.0 → grss-3.4.2}/grss/fit/fit_simulation.py +44 -37
- grss-3.4.2/grss/version.txt +1 -0
- {grss-3.4.0 → grss-3.4.2/grss.egg-info}/PKG-INFO +1 -1
- {grss-3.4.0 → grss-3.4.2}/src/grss.cpp +25 -0
- grss-3.4.0/grss/version.txt +0 -1
- {grss-3.4.0 → grss-3.4.2}/CMakeLists.txt +0 -0
- {grss-3.4.0 → grss-3.4.2}/LICENSE +0 -0
- {grss-3.4.0 → grss-3.4.2}/MANIFEST.in +0 -0
- {grss-3.4.0 → grss-3.4.2}/README.md +0 -0
- {grss-3.4.0 → grss-3.4.2}/build_cpp.sh +0 -0
- {grss-3.4.0 → grss-3.4.2}/docs/source/conf.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/extern/get_cspice.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/__init__.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/debias/get_debiasing_data.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/fit/__init__.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/fit/fit_optical.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/fit/fit_radar.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/fit/fit_utils.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/kernels/create_kernel_431.txt +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/kernels/create_kernel_441.txt +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/kernels/get_kernels.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/kernels/pck00011.tpc +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/kernels/planets_big16_de431_1950_2350.log +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/kernels/planets_big16_de431_1950_2350.tm +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/kernels/planets_big16_de441_1950_2350.log +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/kernels/planets_big16_de441_1950_2350.tm +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/prop/__init__.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/prop/prop_parallel.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/prop/prop_unscented.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/prop/prop_utils.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss/utils.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss.egg-info/SOURCES.txt +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss.egg-info/dependency_links.txt +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss.egg-info/requires.txt +0 -0
- {grss-3.4.0 → grss-3.4.2}/grss.egg-info/top_level.txt +0 -0
- {grss-3.4.0 → grss-3.4.2}/include/approach.h +0 -0
- {grss-3.4.0 → grss-3.4.2}/include/elements.h +0 -0
- {grss-3.4.0 → grss-3.4.2}/include/force.h +0 -0
- {grss-3.4.0 → grss-3.4.2}/include/gr15.h +0 -0
- {grss-3.4.0 → grss-3.4.2}/include/grss.h +0 -0
- {grss-3.4.0 → grss-3.4.2}/include/interpolate.h +0 -0
- {grss-3.4.0 → grss-3.4.2}/include/parallel.h +0 -0
- {grss-3.4.0 → grss-3.4.2}/include/simulation.h +0 -0
- {grss-3.4.0 → grss-3.4.2}/include/spk.h +0 -0
- {grss-3.4.0 → grss-3.4.2}/include/stm.h +0 -0
- {grss-3.4.0 → grss-3.4.2}/include/utilities.h +0 -0
- {grss-3.4.0 → grss-3.4.2}/pyproject.toml +0 -0
- {grss-3.4.0 → grss-3.4.2}/requirements.txt +0 -0
- {grss-3.4.0 → grss-3.4.2}/setup.cfg +0 -0
- {grss-3.4.0 → grss-3.4.2}/setup.py +0 -0
- {grss-3.4.0 → grss-3.4.2}/src/CMakeLists.txt +0 -0
- {grss-3.4.0 → grss-3.4.2}/src/approach.cpp +0 -0
- {grss-3.4.0 → grss-3.4.2}/src/elements.cpp +0 -0
- {grss-3.4.0 → grss-3.4.2}/src/force.cpp +0 -0
- {grss-3.4.0 → grss-3.4.2}/src/gr15.cpp +0 -0
- {grss-3.4.0 → grss-3.4.2}/src/interpolate.cpp +0 -0
- {grss-3.4.0 → grss-3.4.2}/src/parallel.cpp +0 -0
- {grss-3.4.0 → grss-3.4.2}/src/simulation.cpp +0 -0
- {grss-3.4.0 → grss-3.4.2}/src/spk.cpp +0 -0
- {grss-3.4.0 → grss-3.4.2}/src/stm.cpp +0 -0
- {grss-3.4.0 → grss-3.4.2}/src/utilities.cpp +0 -0
- {grss-3.4.0 → grss-3.4.2}/tests/cpp/prop/CMakeLists.txt +0 -0
- {grss-3.4.0 → grss-3.4.2}/tests/cpp/prop/apophis.cpp +0 -0
- {grss-3.4.0 → grss-3.4.2}/tests/cpp/prop/didymos.cpp +0 -0
- {grss-3.4.0 → grss-3.4.2}/tests/cpp/prop/spk_map.cpp +0 -0
- {grss-3.4.0 → grss-3.4.2}/tests/python/fit/chesley.ipynb +0 -0
- {grss-3.4.0 → grss-3.4.2}/tests/python/fit/eggl.ipynb +0 -0
- {grss-3.4.0 → grss-3.4.2}/tests/python/fit/farnocchia.ipynb +0 -0
- {grss-3.4.0 → grss-3.4.2}/tests/python/fit/shantanunaidu.ipynb +0 -0
- {grss-3.4.0 → grss-3.4.2}/tests/python/prop/apophis.ipynb +0 -0
- {grss-3.4.0 → grss-3.4.2}/tests/python/prop/didymos.ipynb +0 -0
- {grss-3.4.0 → grss-3.4.2}/tests/python/prop/icarus.ipynb +0 -0
- {grss-3.4.0 → grss-3.4.2}/tests/python/prop/moshup.ipynb +0 -0
- {grss-3.4.0 → grss-3.4.2}/tests/python/run_tests.sh +0 -0
|
@@ -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
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
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
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
if
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
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,
|
|
1573
|
-
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
@@ -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.
|
grss-3.4.0/grss/version.txt
DELETED
|
@@ -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
|
|
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
|