Skip to content

Commit 37cbbe4

Browse files
Merge pull request #100 from rahil-makadia/dev
python level orbital element partials
2 parents aa6c4fd + 04b328f commit 37cbbe4

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

grss/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.5.0
1+
4.5.1

src/elements.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ void get_elements_partials(const real &epochMjd, const std::vector<real> &elems,
450450
M = std::numeric_limits<real>::quiet_NaN();
451451
}
452452
} else {
453-
throw std::invalid_argument("get_cartesian_partials: invalid conversion "
453+
throw std::invalid_argument("get_elements_partials: invalid conversion "
454454
"type, must be com2cart or kep2cart");
455455
}
456456
const std::vector<real> kep = {a, e, i, om, w, nu};

src/grss.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,35 @@ PYBIND11_MODULE(libgrss, m) {
398398
Cometary state vector.
399399
)mydelimiter");
400400

401+
m.def(
402+
"get_elements_partials",
403+
[](real epochMjd, std::vector<real> elems, std::string conversion, real GM) {
404+
std::vector<std::vector<real>> partials(6, std::vector<real>(6));
405+
get_elements_partials(epochMjd, elems, conversion, partials, GM);
406+
return partials;
407+
},
408+
py::arg("epochMjd"), py::arg("elems"), py::arg("conversion"),
409+
py::arg("GM") = 2.9591220828559115e-4L, R"mydelimiter(
410+
Calculate the partial derivatives of input ecliptic orbital elements with respect to
411+
the corresponding ecliptic Cartesian state vector.
412+
413+
Parameters
414+
----------
415+
epochMjd : real
416+
Epoch in modified Julian date.
417+
elems : list of real
418+
Orbital elements vector (either Keplerian [a,e,i,OM,om,nu] or cometary [e,q,tp,OM,om,i]) with angles in radians.
419+
conversion : str
420+
Conversion type (must be either "kep2cart" or "com2cart").
421+
GM : real, optional
422+
Gravitational parameter of the central body, by default 0.00029591220828559115L.
423+
424+
Returns
425+
-------
426+
partials : list of list of real
427+
Partial derivatives of orbital elements.
428+
)mydelimiter");
429+
401430
m.def(
402431
"matrix_inverse",
403432
[](std::vector<std::vector<real>> mat, const real &tol) {

0 commit comments

Comments
 (0)