satkit 0.3.1__tar.gz → 0.3.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 (120) hide show
  1. {satkit-0.3.1 → satkit-0.3.2}/Cargo.toml +4 -2
  2. {satkit-0.3.1/python/satkit.egg-info → satkit-0.3.2}/PKG-INFO +1 -1
  3. {satkit-0.3.1 → satkit-0.3.2}/pyproject.toml +1 -1
  4. {satkit-0.3.1 → satkit-0.3.2}/python/satkit/__init__.pyi +6 -2
  5. {satkit-0.3.1 → satkit-0.3.2}/python/satkit/satkit.pyi +206 -2
  6. {satkit-0.3.1 → satkit-0.3.2/python/satkit.egg-info}/PKG-INFO +1 -1
  7. {satkit-0.3.1 → satkit-0.3.2}/python/test/test.py +3 -3
  8. {satkit-0.3.1 → satkit-0.3.2}/src/astrotime.rs +5 -1
  9. {satkit-0.3.1 → satkit-0.3.2}/src/ode/types.rs +4 -2
  10. {satkit-0.3.1 → satkit-0.3.2}/src/orbitprop/propagator.rs +3 -1
  11. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/mod.rs +7 -11
  12. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pypropresult.rs +66 -0
  13. {satkit-0.3.1 → satkit-0.3.2}/LICENSE +0 -0
  14. {satkit-0.3.1 → satkit-0.3.2}/MANIFEST.in +0 -0
  15. {satkit-0.3.1 → satkit-0.3.2}/README.md +0 -0
  16. {satkit-0.3.1 → satkit-0.3.2}/python/docs/source/conf.py +0 -0
  17. {satkit-0.3.1 → satkit-0.3.2}/python/satkit/__init__.py +0 -0
  18. {satkit-0.3.1 → satkit-0.3.2}/python/satkit/density.pyi +0 -0
  19. {satkit-0.3.1 → satkit-0.3.2}/python/satkit/frametransform.pyi +0 -0
  20. {satkit-0.3.1 → satkit-0.3.2}/python/satkit/jplephem.pyi +0 -0
  21. {satkit-0.3.1 → satkit-0.3.2}/python/satkit/moon.pyi +0 -0
  22. {satkit-0.3.1 → satkit-0.3.2}/python/satkit/planets.pyi +0 -0
  23. {satkit-0.3.1 → satkit-0.3.2}/python/satkit/py.typed +0 -0
  24. {satkit-0.3.1 → satkit-0.3.2}/python/satkit/satprop.pyi +0 -0
  25. {satkit-0.3.1 → satkit-0.3.2}/python/satkit/sun.pyi +0 -0
  26. {satkit-0.3.1 → satkit-0.3.2}/python/satkit/utils.pyi +0 -0
  27. {satkit-0.3.1 → satkit-0.3.2}/python/satkit.egg-info/SOURCES.txt +0 -0
  28. {satkit-0.3.1 → satkit-0.3.2}/python/satkit.egg-info/dependency_links.txt +0 -0
  29. {satkit-0.3.1 → satkit-0.3.2}/python/satkit.egg-info/requires.txt +0 -0
  30. {satkit-0.3.1 → satkit-0.3.2}/python/satkit.egg-info/top_level.txt +0 -0
  31. {satkit-0.3.1 → satkit-0.3.2}/python/test/download_data.py +0 -0
  32. {satkit-0.3.1 → satkit-0.3.2}/python/test/download_from_json.py +0 -0
  33. {satkit-0.3.1 → satkit-0.3.2}/python/test/download_testvecs.py +0 -0
  34. {satkit-0.3.1 → satkit-0.3.2}/python/test/orbitprop_gps_fit.py +0 -0
  35. {satkit-0.3.1 → satkit-0.3.2}/python/test/sp3file.py +0 -0
  36. {satkit-0.3.1 → satkit-0.3.2}/setup.cfg +0 -0
  37. {satkit-0.3.1 → satkit-0.3.2}/src/consts.rs +0 -0
  38. {satkit-0.3.1 → satkit-0.3.2}/src/duration.rs +0 -0
  39. {satkit-0.3.1 → satkit-0.3.2}/src/earth_orientation_params.rs +0 -0
  40. {satkit-0.3.1 → satkit-0.3.2}/src/earthgravity.rs +0 -0
  41. {satkit-0.3.1 → satkit-0.3.2}/src/frames.rs +0 -0
  42. {satkit-0.3.1 → satkit-0.3.2}/src/frametransform/ierstable.rs +0 -0
  43. {satkit-0.3.1 → satkit-0.3.2}/src/frametransform/mod.rs +0 -0
  44. {satkit-0.3.1 → satkit-0.3.2}/src/frametransform/qcirs2gcrs.rs +0 -0
  45. {satkit-0.3.1 → satkit-0.3.2}/src/itrfcoord.rs +0 -0
  46. {satkit-0.3.1 → satkit-0.3.2}/src/jplephem.rs +0 -0
  47. {satkit-0.3.1 → satkit-0.3.2}/src/kepler.rs +0 -0
  48. {satkit-0.3.1 → satkit-0.3.2}/src/lib.rs +0 -0
  49. {satkit-0.3.1 → satkit-0.3.2}/src/lpephem/mod.rs +0 -0
  50. {satkit-0.3.1 → satkit-0.3.2}/src/lpephem/moon.rs +0 -0
  51. {satkit-0.3.1 → satkit-0.3.2}/src/lpephem/planets.rs +0 -0
  52. {satkit-0.3.1 → satkit-0.3.2}/src/lpephem/sun.rs +0 -0
  53. {satkit-0.3.1 → satkit-0.3.2}/src/nrlmsise.rs +0 -0
  54. {satkit-0.3.1 → satkit-0.3.2}/src/ode/harmonic_oscillator.rs +0 -0
  55. {satkit-0.3.1 → satkit-0.3.2}/src/ode/mod.rs +0 -0
  56. {satkit-0.3.1 → satkit-0.3.2}/src/ode/nalgebra.rs +0 -0
  57. {satkit-0.3.1 → satkit-0.3.2}/src/ode/rk_adaptive.rs +0 -0
  58. {satkit-0.3.1 → satkit-0.3.2}/src/ode/rk_adaptive_settings.rs +0 -0
  59. {satkit-0.3.1 → satkit-0.3.2}/src/ode/rk_explicit.rs +0 -0
  60. {satkit-0.3.1 → satkit-0.3.2}/src/ode/rkf45.rs +0 -0
  61. {satkit-0.3.1 → satkit-0.3.2}/src/ode/rkts54.rs +0 -0
  62. {satkit-0.3.1 → satkit-0.3.2}/src/ode/rkv65.rs +0 -0
  63. {satkit-0.3.1 → satkit-0.3.2}/src/ode/rkv65_table.rs +0 -0
  64. {satkit-0.3.1 → satkit-0.3.2}/src/ode/rkv87.rs +0 -0
  65. {satkit-0.3.1 → satkit-0.3.2}/src/ode/rkv87_table.rs +0 -0
  66. {satkit-0.3.1 → satkit-0.3.2}/src/ode/rkv98.rs +0 -0
  67. {satkit-0.3.1 → satkit-0.3.2}/src/ode/rkv98_nointerp.rs +0 -0
  68. {satkit-0.3.1 → satkit-0.3.2}/src/ode/rkv98_nointerp_table.rs +0 -0
  69. {satkit-0.3.1 → satkit-0.3.2}/src/ode/rkv98_table.rs +0 -0
  70. {satkit-0.3.1 → satkit-0.3.2}/src/orbitprop/drag.rs +0 -0
  71. {satkit-0.3.1 → satkit-0.3.2}/src/orbitprop/mod.rs +0 -0
  72. {satkit-0.3.1 → satkit-0.3.2}/src/orbitprop/point_gravity.rs +0 -0
  73. {satkit-0.3.1 → satkit-0.3.2}/src/orbitprop/satproperties.rs +0 -0
  74. {satkit-0.3.1 → satkit-0.3.2}/src/orbitprop/satstate.rs +0 -0
  75. {satkit-0.3.1 → satkit-0.3.2}/src/orbitprop/settings.rs +0 -0
  76. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/mod_utils.rs +0 -0
  77. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pyastrotime.rs +0 -0
  78. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pyconsts.rs +0 -0
  79. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pydensity.rs +0 -0
  80. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pyduration.rs +0 -0
  81. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pyframes.rs +0 -0
  82. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pyframetransform.rs +0 -0
  83. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pygravity.rs +0 -0
  84. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pyitrfcoord.rs +0 -0
  85. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pyjplephem.rs +0 -0
  86. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pykepler.rs +0 -0
  87. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pylpephem_moon.rs +0 -0
  88. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pylpephem_planets.rs +0 -0
  89. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pylpephem_sun.rs +0 -0
  90. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pynrlmsise.rs +0 -0
  91. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pypropagate.rs +0 -0
  92. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pypropsettings.rs +0 -0
  93. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pyquaternion.rs +0 -0
  94. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pysatproperties.rs +0 -0
  95. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pysatstate.rs +0 -0
  96. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pysgp4.rs +0 -0
  97. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pysolarsystem.rs +0 -0
  98. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pytle.rs +0 -0
  99. {satkit-0.3.1 → satkit-0.3.2}/src/pybindings/pyutils.rs +0 -0
  100. {satkit-0.3.1 → satkit-0.3.2}/src/sgp4/dpper.rs +0 -0
  101. {satkit-0.3.1 → satkit-0.3.2}/src/sgp4/dscom.rs +0 -0
  102. {satkit-0.3.1 → satkit-0.3.2}/src/sgp4/dsinit.rs +0 -0
  103. {satkit-0.3.1 → satkit-0.3.2}/src/sgp4/dspace.rs +0 -0
  104. {satkit-0.3.1 → satkit-0.3.2}/src/sgp4/getgravconst.rs +0 -0
  105. {satkit-0.3.1 → satkit-0.3.2}/src/sgp4/initl.rs +0 -0
  106. {satkit-0.3.1 → satkit-0.3.2}/src/sgp4/mod.rs +0 -0
  107. {satkit-0.3.1 → satkit-0.3.2}/src/sgp4/satrec.rs +0 -0
  108. {satkit-0.3.1 → satkit-0.3.2}/src/sgp4/sgp4.rs +0 -0
  109. {satkit-0.3.1 → satkit-0.3.2}/src/sgp4/sgp4_lowlevel.rs +0 -0
  110. {satkit-0.3.1 → satkit-0.3.2}/src/sgp4/sgp4init.rs +0 -0
  111. {satkit-0.3.1 → satkit-0.3.2}/src/solarsystem.rs +0 -0
  112. {satkit-0.3.1 → satkit-0.3.2}/src/spaceweather.rs +0 -0
  113. {satkit-0.3.1 → satkit-0.3.2}/src/tle.rs +0 -0
  114. {satkit-0.3.1 → satkit-0.3.2}/src/types.rs +0 -0
  115. {satkit-0.3.1 → satkit-0.3.2}/src/utils/datadir.rs +0 -0
  116. {satkit-0.3.1 → satkit-0.3.2}/src/utils/download.rs +0 -0
  117. {satkit-0.3.1 → satkit-0.3.2}/src/utils/mod.rs +0 -0
  118. {satkit-0.3.1 → satkit-0.3.2}/src/utils/skerror.rs +0 -0
  119. {satkit-0.3.1 → satkit-0.3.2}/src/utils/test.rs +0 -0
  120. {satkit-0.3.1 → satkit-0.3.2}/src/utils/update_data.rs +0 -0
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "satkit"
3
- version = "0.3.1"
3
+ version = "0.3.2"
4
4
  edition = "2021"
5
5
  description = "Satellite Toolkit"
6
6
  readme = "README.md"
@@ -20,7 +20,7 @@ name = "satkit"
20
20
 
21
21
 
22
22
  [dependencies]
23
- nalgebra = "0.33.0"
23
+ nalgebra = { version = "0.33.0", features = ["serde-serialize"] }
24
24
  ndarray = "0.15.4"
25
25
  libc = "0.2.158"
26
26
  chrono = "0.4.19"
@@ -34,6 +34,8 @@ pyo3 = { version = "0.21", features = ["extension-module"], optional = true }
34
34
  ureq = "2.10.1"
35
35
  json = "0.12.4"
36
36
  process_path = "0.1.4"
37
+ serde = { version = "1.0.130", features = ["derive"] }
38
+ serde-pickle = "1.1.1"
37
39
 
38
40
  [build-dependencies]
39
41
  cc = { version = "1.1.15", features = ["parallel"] }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: satkit
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Satellite Orbital Dynamics Toolkit
5
5
  Author-email: Steven Michael <ssmichael@gmail.com>
6
6
  Maintainer-email: Steven Michael <ssmichael@gmail.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "satkit"
7
- version = "0.3.1"
7
+ version = "0.3.2"
8
8
  dependencies = ["numpy>=1.20.0"]
9
9
  requires-python = ">= 3.8"
10
10
  authors = [{ name = "Steven Michael", email = "ssmichael@gmail.com" }]
@@ -5,7 +5,6 @@ from . import jplephem
5
5
  from . import frametransform
6
6
  from . import moon
7
7
  from . import sun
8
- from . import satprop
9
8
  from . import density
10
9
  from . import utils
11
10
  from . import planets
@@ -30,8 +29,13 @@ __all__ = [
30
29
  "moon",
31
30
  "sun",
32
31
  "planets",
33
- "satprop",
34
32
  "satstate",
35
33
  "density",
36
34
  "utils",
35
+ "propagate",
36
+ "propsettings",
37
+ "satproperties_static",
38
+ "propresult",
39
+ "propstats",
40
+ "satstate",
37
41
  ]
@@ -1491,8 +1491,212 @@ class satstate:
1491
1491
  time (satkit.time|satkit.duration): Time or duration from current time to which to propagate the state
1492
1492
 
1493
1493
  Keyword Args:
1494
- propsettings: satkit.satprop.propsettings object describing settings to use in the propagation. If omitted, default is used
1494
+ propsettings: satkit.propsettings object describing settings to use in the propagation. If omitted, default is used
1495
1495
 
1496
1496
  Returns:
1497
1497
  satstate: New satellite state object representing the state at the new time
1498
- """
1498
+ """
1499
+
1500
+ class propstats:
1501
+ @property
1502
+ def num_eval() -> int:
1503
+ """Number of function evaluations"""
1504
+
1505
+ @property
1506
+ def num_accept() -> int:
1507
+ """Number of accepted steps in adaptive RK integrator"""
1508
+
1509
+ @property
1510
+ def num_reject() -> int:
1511
+ """Number of rejected steps in adaptive RK integrator"""
1512
+
1513
+ class propresult:
1514
+ """Results of a satellite propagation
1515
+
1516
+ This class lets the user access results of the satellite propagation
1517
+ """
1518
+
1519
+ @property
1520
+ def pos() -> npt.ArrayLike[float]:
1521
+ """GCRF position of satellite, meters"""
1522
+
1523
+ @property
1524
+ def vel() -> npt.ArrayLike[float]:
1525
+ """GCRF velocity of satellite, meters/second"""
1526
+
1527
+ @property
1528
+ def state() -> npt.ArrayLike[float]:
1529
+ """6-element state (pos + vel) of satellite in meters & meters/second"""
1530
+
1531
+ @property
1532
+ def time() -> satkit.time:
1533
+ """Time at which state is valid"""
1534
+
1535
+ @property
1536
+ def stats() -> propstats:
1537
+ """Statistics of propagation"""
1538
+
1539
+ @property
1540
+ def phi() -> npt.ArrayLike[np.float64]|None:
1541
+ """6x6 State transition matrix
1542
+ or None if not computed
1543
+ """
1544
+
1545
+ def interp(time: satkit.time, output_phi: bool=False) -> npt.ArrayLike[np.float64]|typing.Tuple[npt.ArrayLike[np.float64], npt.ArrayLike[np.float64]]:
1546
+ """Interpolate state at given time
1547
+
1548
+ Args:
1549
+ time (satkit.time): Time at which to interpolate state
1550
+
1551
+ Keyword Arguments:
1552
+ output_phi (bool): Output 6x6 state transition matrix at the interpolated time
1553
+
1554
+ Returns:
1555
+ 6-element vector representing state at given time
1556
+ if output_phi, also output 6x6 state transition matrix at given time
1557
+ """
1558
+
1559
+
1560
+ class satproperties_static:
1561
+ """Satellite properties relevant for drag and radiation pressure
1562
+
1563
+ This class lets the satellite radiation pressure and drag
1564
+ paramters be set to static values for duration of propagation
1565
+ """
1566
+
1567
+ def __init__(self, *args, **kwargs):
1568
+ """Create a satproperties_static object with given craoverm and cdaoverm in m^2/kg
1569
+
1570
+ Args:
1571
+ cdaroverm (float): Coefficient of drag times area over mass in m^2/kg
1572
+ craoverm (float): Coefficient of radiation pressure times area over mass in m^2/kg
1573
+
1574
+ Keyword Arguments:
1575
+ craoverm (float): Coefficient of radiation pressure times area over mass in m^2/kg
1576
+ cdaoverm (float): Coefficient of drag times area over mass in m^2/kg
1577
+
1578
+
1579
+ Notes:
1580
+ The two arguments can be passed as positional arguments or as keyword arguments
1581
+
1582
+ Example:
1583
+
1584
+ >>> properties = satproperties_static(craoverm = 0.5, cdaoverm = 0.4)
1585
+
1586
+ or with same output
1587
+
1588
+ >>> properties = satproperties_static(0.5, 0.4)
1589
+
1590
+ """
1591
+
1592
+ @property
1593
+ def cdaoverm() -> float:
1594
+ """Coeffecient of drag times area over mass. Units are m^2/kg
1595
+ """
1596
+
1597
+ @property
1598
+ def craoverm() -> float:
1599
+ """Coefficient of radiation pressure times area over mass. Units are m^2/kg
1600
+ """
1601
+
1602
+
1603
+ class propsettings:
1604
+ """This class contains settings used in the high-precision orbit propgator part of the "satkit" python toolbox
1605
+ """
1606
+
1607
+ def __init__(self):
1608
+ """ Create default propsetting object
1609
+
1610
+ Notes:
1611
+ * Default settings:
1612
+ * abs_error: 1e-8
1613
+ * rel_error: 1e-8
1614
+ * gravity_order: 4
1615
+ * use_spaceweather: True
1616
+ * use_jplephem: True
1617
+
1618
+
1619
+ Returns:
1620
+ propsettings: New propsettings object with default settings
1621
+ """
1622
+
1623
+ @property
1624
+ def abs_error() -> float:
1625
+ """Maxmum absolute value of error for any element in propagated state following ODE integration
1626
+
1627
+ Default: 1e-8
1628
+ """
1629
+
1630
+ @property
1631
+ def rel_error() -> float:
1632
+ """Maximum relative error of any element in propagated state following ODE integration
1633
+
1634
+ Default: 1e-8
1635
+ """
1636
+
1637
+ @property
1638
+ def gravity_order() -> int:
1639
+ """Earth gravity order to use in ODE integration
1640
+
1641
+ Default: 4
1642
+ """
1643
+
1644
+ @property
1645
+ def use_spaceweather() -> bool:
1646
+ """Use space weather data when computing atmospheric density for drag forces
1647
+
1648
+ Default: true
1649
+
1650
+ Notes:
1651
+ * Space weather data can have a large effect on the density of the atmosphere
1652
+ * This can be important for accurate drag force calculations
1653
+ * Space weather data is updated every 3 hours. Most-recent data can be downloaded with ``satkit.utils.update_datafiles()``
1654
+
1655
+ """
1656
+
1657
+ @property
1658
+ def use_jplephem() -> bool:
1659
+ """Use high-precision but computationally expensive JPL ephemerides for sun and mun when computing their gravitational force
1660
+ """
1661
+
1662
+ def propagate(
1663
+ pos: npt.ArrayLike[float],
1664
+ vel: npt.ArrayLike[float],
1665
+ start: time,
1666
+ **kwargs,
1667
+ ) -> propresult:
1668
+ """High-precision orbit propagator
1669
+
1670
+ Notes:
1671
+ * Propagator uses advanced Runga-Kutta integrators and includes the following forces:
1672
+ * Earth gravity with higher-order zonal terms
1673
+ * Sun, Moon gravity
1674
+ * Radiation pressure
1675
+ * Atmospheric drag: NRL-MISE 2000 density model, with option to include space weather effects (can be large)
1676
+ * Stop time must be set by keyword argument, either explicitely or by duration
1677
+ * Solid Earth tides are not (yet) included in the model
1678
+
1679
+
1680
+ Propagate statellite ephemeris (position, velocity in gcrs & time) to new time
1681
+ and output new position and velocity via Runge-Kutta integration.
1682
+
1683
+ Inputs and outputs are all in the Geocentric Celestial Reference Frame (GCRF)
1684
+
1685
+ Args:
1686
+ pos (npt.ArrayLike[float]): 3-element numpy array representing satellite GCRF position in meters
1687
+ vel (npt.ArrayLike[float]): 3-element numpy array representing satellite GCRF velocity in m/s
1688
+ tm (satkit.time): satkit.time object representing instant at which satellite is at "pos" & "vel"
1689
+
1690
+ Keyword Args:
1691
+ stop_time (satkit.time): satkit.time object representing instant at which new position and velocity will be computed
1692
+ duration_secs (float): duration in seconds from "tm" for at which new position and velocity will be computed.
1693
+ duration_days (float): duration in days from "tm" at which new position and velocity will be computed.
1694
+ duration (satkit.duration): duration from "tm" at which new position & velocity will be computed.
1695
+ output_phi (bool): Output 6x6 state transition matrix between "starttime" and "stoptime" (and at intervals, if specified)
1696
+ propsettings (propsettings): "propsettings" object with input settings for the propagation. if left out, default will be used.
1697
+ satproperties (satproperties_static): "SatPropertiesStatic" object with drag and radiation pressure succeptibility of satellite. If left out, drag and radiation pressure are neglected
1698
+ output_dense: boolean indicting whether or not dense output should be recorded. Default is false. If true, this will allow for calling the "interp" function to query states at arbitrary times between the start time and the stop time
1699
+
1700
+ Returns:
1701
+ (propresult): Propagation result object holding state outputs, statistics, and dense output if requested
1702
+ """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: satkit
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Satellite Orbital Dynamics Toolkit
5
5
  Author-email: Steven Michael <ssmichael@gmail.com>
6
6
  Maintainer-email: Steven Michael <ssmichael@gmail.com>
@@ -595,7 +595,7 @@ class TestHighPrecisionPropagation:
595
595
  ),
596
596
  axis=0,
597
597
  )
598
- settings = sk.satprop.propsettings()
598
+ settings = sk.propsettings()
599
599
  settings.use_jplephem = False
600
600
 
601
601
  # Determined by orbitprop_gps_fit.py
@@ -605,10 +605,10 @@ class TestHighPrecisionPropagation:
605
605
 
606
606
 
607
607
  # Values for craoverm and velocity come from orbitprop_gps_fit.py
608
- satprops = sk.satprop.satproperties_static()
608
+ satprops = sk.satproperties_static()
609
609
  satprops.craoverm = fitparam[3]
610
610
 
611
- res = sk.satprop.propagate(
611
+ res = sk.propagate(
612
612
  pgcrf[0, :],
613
613
  fitparam[0:3],
614
614
  timearr[0],
@@ -35,7 +35,11 @@
35
35
  //!
36
36
  //! For a good description, see [here](https://www.stjarnhimlen.se/comp/time.html)
37
37
  //!
38
- #[derive(PartialEq, PartialOrd, Copy, Clone, Debug)]
38
+ //!
39
+
40
+ use serde::{Deserialize, Serialize};
41
+
42
+ #[derive(PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize)]
39
43
  pub struct AstroTime {
40
44
  pub(crate) mjd_tai: f64,
41
45
  }
@@ -3,6 +3,8 @@ use std::ops::{Add, Div, Mul, Sub};
3
3
  use std::fmt::Debug;
4
4
  use thiserror::Error;
5
5
 
6
+ use serde::{Deserialize, Serialize};
7
+
6
8
  pub type ODEResult<T> = Result<T, Box<dyn std::error::Error + Send + Sync>>;
7
9
 
8
10
  pub trait ODEState:
@@ -57,7 +59,7 @@ pub enum ODEError {
57
59
  InterpNotImplemented,
58
60
  }
59
61
 
60
- #[derive(Debug, Clone)]
62
+ #[derive(Debug, Clone, Serialize, Deserialize)]
61
63
  pub struct DenseOutput<S>
62
64
  where
63
65
  S: ODEState,
@@ -68,7 +70,7 @@ where
68
70
  pub y: Vec<S>,
69
71
  }
70
72
 
71
- #[derive(Debug, Clone)]
73
+ #[derive(Debug, Clone, Serialize, Deserialize)]
72
74
  pub struct ODESolution<S>
73
75
  where
74
76
  S: ODEState,
@@ -27,7 +27,9 @@ use thiserror::Error;
27
27
 
28
28
  use nalgebra as na;
29
29
 
30
- #[derive(Debug)]
30
+ use serde::{Deserialize, Serialize};
31
+
32
+ #[derive(Debug, Serialize, Deserialize, Clone)]
31
33
  pub struct PropagationResult<const T: usize> {
32
34
  pub time_start: AstroTime,
33
35
  pub state_start: Matrix<6, T>,
@@ -112,16 +112,6 @@ fn frametransform(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
112
112
  Ok(())
113
113
  }
114
114
 
115
- #[pymodule]
116
- fn satprop(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
117
- m.add_class::<PyPropSettings>()?;
118
- m.add_class::<pysatproperties::PySatProperties>()?;
119
- m.add_function(wrap_pyfunction!(pypropagate::propagate, m)?)
120
- .unwrap();
121
-
122
- Ok(())
123
- }
124
-
125
115
  #[pymodule]
126
116
  pub fn satkit(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
127
117
  m.add_class::<PyAstroTime>()?;
@@ -153,12 +143,18 @@ pub fn satkit(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
153
143
  m.add_class::<PyKepler>()?;
154
144
  m.add_class::<PySatState>()?;
155
145
 
146
+ m.add_class::<PyPropSettings>()?;
147
+ m.add_class::<pysatproperties::PySatProperties>()?;
148
+ m.add_class::<pypropresult::PyPropResult>()?;
149
+ m.add_class::<pypropresult::PyPropStats>()?;
150
+ m.add_function(wrap_pyfunction!(pypropagate::propagate, m)?)
151
+ .unwrap();
152
+
156
153
  m.add_wrapped(wrap_pymodule!(frametransform))?;
157
154
  m.add_wrapped(wrap_pymodule!(jplephem))?;
158
155
  m.add_wrapped(wrap_pymodule!(sun))?;
159
156
  m.add_wrapped(wrap_pymodule!(moon))?;
160
157
  m.add_wrapped(wrap_pymodule!(planets))?;
161
- m.add_wrapped(wrap_pymodule!(satprop))?;
162
158
 
163
159
  m.add_wrapped(wrap_pymodule!(mod_utils::utils))?;
164
160
  m.add_wrapped(wrap_pymodule!(pydensity::density))?;
@@ -3,11 +3,18 @@ use pyo3::prelude::*;
3
3
  use super::pyastrotime::PyAstroTime;
4
4
  use super::pyutils::*;
5
5
 
6
+ use pyo3::types::{PyBytes, PyDict, PyTuple};
7
+
6
8
  use numpy::PyArrayMethods;
7
9
  use numpy::{self as np, ToPyArray};
8
10
 
9
11
  use crate::orbitprop::PropagationResult;
12
+ use crate::types::*;
13
+ use crate::AstroTime;
14
+
15
+ use serde::{Deserialize, Serialize};
10
16
 
17
+ #[derive(Serialize, Deserialize, Debug, Clone)]
11
18
  pub enum PyPropResultType {
12
19
  R1(PropagationResult<1>),
13
20
  R7(PropagationResult<7>),
@@ -32,6 +39,7 @@ impl PyPropStats {
32
39
  }
33
40
 
34
41
  #[pyclass(name = "propresult", module = "satkit")]
42
+ #[derive(Debug, Clone)]
35
43
  pub struct PyPropResult {
36
44
  pub inner: PyPropResultType,
37
45
  }
@@ -68,6 +76,23 @@ fn to_string<const T: usize>(r: &PropagationResult<T>) -> String {
68
76
 
69
77
  #[pymethods]
70
78
  impl PyPropResult {
79
+ #[new]
80
+ /// This should never be called and is here only for pickle support
81
+ pub fn new() -> Self {
82
+ PyPropResult {
83
+ inner: PyPropResultType::R1(PropagationResult::<1> {
84
+ time_start: AstroTime::new(),
85
+ state_start: Vector::<6>::zeros(),
86
+ time_end: AstroTime::new(),
87
+ state_end: Vector::<6>::zeros(),
88
+ num_eval: 0,
89
+ accepted_steps: 0,
90
+ rejected_steps: 0,
91
+ odesol: None,
92
+ }),
93
+ }
94
+ }
95
+
71
96
  // Get start time
72
97
  #[getter]
73
98
  fn time_start(&self) -> PyAstroTime {
@@ -185,6 +210,29 @@ impl PyPropResult {
185
210
  }
186
211
  }
187
212
 
213
+ fn __getnewargs_ex__<'a>(&self, py: Python<'a>) -> (Bound<'a, PyTuple>, Bound<'a, PyDict>) {
214
+ let d = PyDict::new_bound(py);
215
+ let tp = PyTuple::empty_bound(py);
216
+ (tp, d)
217
+ }
218
+
219
+ fn __setstate__(&mut self, py: Python, state: PyObject) -> PyResult<()> {
220
+ match state.extract::<&pyo3::types::PyBytes>(py) {
221
+ Ok(s) => {
222
+ self.inner =
223
+ serde_pickle::from_slice(s.as_bytes(), serde_pickle::DeOptions::default())
224
+ .unwrap();
225
+ Ok(())
226
+ }
227
+ Err(e) => Err(e),
228
+ }
229
+ }
230
+
231
+ fn __getstate__(&mut self, py: Python) -> PyResult<PyObject> {
232
+ let p = serde_pickle::to_vec(&self.inner, serde_pickle::SerOptions::default()).unwrap();
233
+ Ok(PyBytes::new_bound(py, p.as_slice()).to_object(py))
234
+ }
235
+
188
236
  #[pyo3(signature=(time, output_phi=false))]
189
237
  fn interp(&self, time: PyAstroTime, output_phi: bool) -> PyResult<PyObject> {
190
238
  match &self.inner {
@@ -215,3 +263,21 @@ impl PyPropResult {
215
263
  }
216
264
  }
217
265
  }
266
+
267
+ #[cfg(test)]
268
+ mod test {
269
+ use super::*;
270
+
271
+ #[test]
272
+ fn test_ser() {
273
+ let sol = PyPropResult::new();
274
+ print!("sol = {:?}\n", sol);
275
+ let v = serde_pickle::to_vec(&sol.inner, serde_pickle::SerOptions::default()).unwrap();
276
+ //print!("v = {:?}", v);
277
+ let sol2 = PyPropResult {
278
+ inner: serde_pickle::from_slice(v.as_slice(), serde_pickle::DeOptions::default())
279
+ .unwrap(),
280
+ };
281
+ print!("sol2 = {:?}", sol2);
282
+ }
283
+ }
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