Skip to content

Commit

Permalink
Merging code for Horizons interface
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicDirkx committed Oct 30, 2023
1 parent 58b5770 commit 2fcd53c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/test_time_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test_datetime_conversions():

python_datetime = datetime.fromisoformat('2023-06-20T00:05:23.281765')
tudat_datetime = time_conversion.datetime_to_tudat( python_datetime )
tudat_datetime_string = tudat_datetime.iso_string( False )
tudat_datetime_string = tudat_datetime.iso_string( False, 12 )
python_datetime_reconstructed = time_conversion.datetime_to_python( tudat_datetime )

while (tudat_datetime_string[-1] == '0'):
Expand Down
10 changes: 5 additions & 5 deletions tudatpy/data/horizons.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ def vectors(
aberations: str = "geometric",
) -> astropy.table.Table:
"""Retrieve Horizons Vectors api data in raw astropy format.
For general purposes, use the `.carthesian()` method instead.
For general purposes, use the `.cartesian()` method instead.
Parameters
----------
Expand Down Expand Up @@ -709,12 +709,12 @@ def vectors(

return raw

def carthesian(
def cartesian(
self,
frame_orientation: str = "ECLIPJ2000",
aberations: str = "geometric",
) -> np.ndarray:
"""Retrieve the carthesian state using the Horizons Vector API.
"""Retrieve the cartesian state using the Horizons Vector API.
Parameters
----------
Expand All @@ -737,7 +737,7 @@ def carthesian(
-------
np.ndarray
returns an n by 7 array with the time in seconds since J2000 TDB,
and the carthesian position and velocities.
and the cartesian position and velocities.
"""
raw = self.vectors(frame_orientation=frame_orientation, aberations=aberations)

Expand Down Expand Up @@ -819,7 +819,7 @@ def create_ephemeris_tabulated(
raise ValueError(
"refplane parameter must be one of: " + '"ECLIPJ2000", "J2000"'
)
vector = self.carthesian(
vector = self.cartesian(
frame_orientation=frame_orientation, aberations=aberations
)

Expand Down
1 change: 1 addition & 0 deletions tudatpy/kernel/expose_astro/expose_time_conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ void expose_time_conversion(py::module &m) {
.def("iso_string",
&tba::DateTime::isoString,
py::arg("add_T") = false,
py::arg("number_of_digits_seconds") = 15,
get_docstring("DateTime.iso_string").c_str( ) )
.def("day_of_year",
&tba::DateTime::dayOfYear,
Expand Down

0 comments on commit 2fcd53c

Please sign in to comment.