Skip to content

Commit

Permalink
Merge pull request #35 from esa/pl2pl
Browse files Browse the repository at this point in the history
Pl2pl
  • Loading branch information
darioizzo authored Jul 8, 2024
2 parents 0291a30 + 2b0821e commit cac378f
Show file tree
Hide file tree
Showing 14 changed files with 909 additions and 520 deletions.
324 changes: 217 additions & 107 deletions benchmark/notebooks/sf_gradient.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/notebooks/interface_to_spice.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
634 changes: 280 additions & 354 deletions doc/notebooks/udp_pl2pl.ipynb

Large diffs are not rendered by default.

78 changes: 44 additions & 34 deletions doc/notebooks/udp_point2point.ipynb

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions doc/trajopt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ Direct
.. autoclass:: direct_point2point
:members: pretty, plot

.. autoclass:: direct_pl2pl
:members: pretty, plot


4 changes: 2 additions & 2 deletions pykep/expose_udplas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ void expose_all_udplas(py::module &udpla_module, py::class_<kep3::planet> &plane
keplerian_udpla
.def(py::init<const kep3::epoch &, const std::array<double, 6> &, double, std::string, std::array<double, 3>,
kep3::elements_type>(),
py::arg("ep"), py::arg("elem"), py::arg("mu_central_body"), py::arg("name") = "unknown",
py::arg("when"), py::arg("elem"), py::arg("mu_central_body"), py::arg("name") = "unknown",
py::arg("added_params") = std::array<double, 3>({-1, -1, -1}),
py::arg("el_type") = kep3::elements_type::KEP_F, pykep::udpla_keplerian_from_elem_docstring().c_str())
.def(py::init<const kep3::epoch &, const std::array<std::array<double, 3>, 2> &, double, std::string,
std::array<double, 3>>(),
py::arg("ep"), py::arg("posvel"), py::arg("mu_central_body"), py::arg("name") = "unknown",
py::arg("when"), py::arg("posvel"), py::arg("mu_central_body"), py::arg("name") = "unknown",
py::arg("added_params") = std::array<double, 3>({-1, -1, -1}),
pykep::udpla_keplerian_from_posvel_docstring().c_str())
// repr().
Expand Down
6 changes: 3 additions & 3 deletions pykep/plot/_sf_leg.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ def add_sf_leg(
dv = _np.linalg.norm(throttles) * c / mass_fwd
# plot it in a color that is proportional to the strength from royalblue to indianred
color = (
0.25 + (0.80 - 0.25) * min(1.0, _np.linalg.norm(throttles)),
0.41 + (0.36 - 0.41) * min(1.0, _np.linalg.norm(throttles)),
0.88 + (0.36 - 0.88) * min(1.0, _np.linalg.norm(throttles)),
0.25 + (1. - 0.25) * min(1.0, _np.linalg.norm(throttles)),
0.41 + (0. - 0.41) * min(1.0, _np.linalg.norm(throttles)),
0.88 + (0. - 0.88) * min(1.0, _np.linalg.norm(throttles)),
)
_pk.plot.add_ballistic_arc(
ax, rv, dt / 2, sf.mu, units=units, N=N, c=color, **kwargs
Expand Down
6 changes: 3 additions & 3 deletions pykep/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class planet_test(_ut.TestCase):
def test_planet_construction(self):
import pykep as pk

udpla_cpp = pk.udpla.keplerian(ep = pk.epoch(0), elem = [1.,0.,0.,0.,0.,0.], mu_central_body = 1.)
udpla_cpp = pk.udpla.keplerian(when = pk.epoch(0), elem = [1.,0.,0.,0.,0.,0.], mu_central_body = 1.)
udpla_py = my_udpla()
pla1 = pk.planet(udpla_cpp)
pla2 = pk.planet(udpla_py)
Expand All @@ -130,7 +130,7 @@ def test_planet_construction(self):
def test_udpla_extraction(self):
import pykep as pk

udpla_cpp = pk.udpla.keplerian(ep = pk.epoch(0), elem = [1.,0.,0.,0.,0.,0.], mu_central_body = 1.)
udpla_cpp = pk.udpla.keplerian(when = pk.epoch(0), elem = [1.,0.,0.,0.,0.,0.], mu_central_body = 1.)
udpla_py = my_udpla()
pla1 = pk.planet(udpla_cpp)
pla2 = pk.planet(udpla_py)
Expand All @@ -146,7 +146,7 @@ def test_udpla_extraction(self):
def test_udpla_getters(self):
import pykep as pk

udpla_cpp = pk.udpla.keplerian(ep = pk.epoch(0), elem = [1.,0.,0.,0.,0.,0.], mu_central_body = 1.56, added_params=[3., 2., 2.1])
udpla_cpp = pk.udpla.keplerian(when = pk.epoch(0), elem = [1.,0.,0.,0.,0.,0.], mu_central_body = 1.56, added_params=[3., 2., 2.1])
udpla_py = my_udpla()
pla1 = pk.planet(udpla_cpp)
pla2 = pk.planet(udpla_py)
Expand Down
2 changes: 1 addition & 1 deletion pykep/trajopt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set(PYKEP_TRAJOPT_PYTHON_FILES __init__.py _point2point.py)
set(PYKEP_TRAJOPT_PYTHON_FILES __init__.py _direct_point2point.py _direct_pl2pl.py)
install(FILES ${PYKEP_TRAJOPT_PYTHON_FILES} DESTINATION ${_PYKEP_INSTALL_DIR}/trajopt)
3 changes: 2 additions & 1 deletion pykep/trajopt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
"""

# Direct methods
from ._point2point import direct_point2point
from ._direct_point2point import direct_point2point
from ._direct_pl2pl import direct_pl2pl
Loading

0 comments on commit cac378f

Please sign in to comment.