Skip to content

Commit

Permalink
Merge pull request #215 from tudat-team/feature/docstrings
Browse files Browse the repository at this point in the history
Feature/docstrings
  • Loading branch information
DominicDirkx authored Jan 27, 2025
2 parents 696a13c + 009f007 commit cbc7e63
Show file tree
Hide file tree
Showing 126 changed files with 39,519 additions and 14,245 deletions.
47 changes: 4 additions & 43 deletions tudatpy/kernel/docstrings.h
Original file line number Diff line number Diff line change
Expand Up @@ -2218,50 +2218,11 @@ In this example, the Modified Julian date `51544.5` ( corresponding to J2000) is



} else if(name == "calendar_date_to_day_of_year" ) {
return R"(

Determine the number of full days that have passed in the year of a given calendar date.


Parameters
----------
calendar_date : datetime.datetime
Datetime object, using the Python datetime library. Both the date and the time (hour, minutes, and seconds), can be specified. Milliseconds are ignored."
Returns
-------
int
Number of full days that have passed in the year at the given calendar date.





Examples
--------
In this example, the number of days that have passed in 2020 when the date is the 2nd of May is computed.

.. code-block:: python

# Define the 2nd of May 2020
date = datetime.datetime(2020, 5, 2)
# Compute the number of full days that have passed in 2020 when at the given date
days_passed = time_conversion.calendar_date_to_day_of_year(date)
# Print the converted output
print(J2000) # prints 122.0


)";



} else if(name == "year_and_days_in_year_to_calendar_date" ) {
return R"(

Create the calendar date from the year and the number of days in the year.

Can be seen as the inverse function of :func:`calendar_date_to_day_of_year`.

Parameters
----------
year : int
Expand All @@ -2270,8 +2231,8 @@ days_in_year : int
Number of days that have passed in the year.
Returns
-------
datetime.datetime
Corresponding calendar date as a datetime object, using the Python datetime library. .
DateTime
Corresponding calendar date as a :class:`DateTime` object. Note: the hours, minutes and seconds in the object are set to 0 when calling this function.



Expand All @@ -2284,9 +2245,9 @@ In this example, the calendar date corresponding to when 122 days have passed in
.. code-block:: python

# Compute the calendar date when 122 days have passed in 2020
date = time_conversion.year_and_days_in_year_to_calendar_date(2020, 122)
currentDate = time_conversion.year_and_days_in_year_to_calendar_date(2020, 122)
# Print the converted output
print(J2000) # prints datetime.datetime(2020, 5, 2, 0, 0)
print(currentDate) # prints (2020, 5, 2, 0, 0)


)";
Expand Down
51 changes: 25 additions & 26 deletions tudatpy/kernel/expose_astro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,46 @@

#include "expose_astro.h"

#include "expose_astro/expose_gravitation.h"
#include <pybind11/pybind11.h>

#include "expose_astro/expose_element_conversion.h"
#include "expose_astro/expose_frame_conversion.h"
#include "expose_astro/expose_time_conversion.h"
#include "expose_astro/expose_two_body_dynamics.h"
#include "expose_astro/expose_fundamentals.h"
#include "expose_astro/expose_gravitation.h"
#include "expose_astro/expose_polyhedron_utilities.h"

#include <pybind11/pybind11.h>
#include "expose_astro/expose_time_conversion.h"
#include "expose_astro/expose_two_body_dynamics.h"

namespace py = pybind11;

namespace tudatpy {

namespace astro {

void expose_astro(py::module &m) {

auto element_conversion = m.def_submodule("element_conversion");
element_conversion::expose_element_conversion(element_conversion);
namespace astro {

auto frame_conversion = m.def_submodule("frame_conversion");
frame_conversion::expose_frame_conversion(frame_conversion);
void expose_astro(py::module &m) {
auto element_conversion = m.def_submodule("element_conversion");
element_conversion::expose_element_conversion(element_conversion);

auto time_conversion = m.def_submodule("time_conversion");
time_conversion::expose_time_conversion(time_conversion);
auto frame_conversion = m.def_submodule("frame_conversion");
frame_conversion::expose_frame_conversion(frame_conversion);

auto two_body_dynamics = m.def_submodule("two_body_dynamics");
two_body_dynamics::expose_two_body_dynamics(two_body_dynamics);
auto time_conversion = m.def_submodule("time_conversion");
time_conversion::expose_time_conversion(time_conversion);

auto gravitation = m.def_submodule("gravitation");
gravitation::expose_gravitation(gravitation);
auto two_body_dynamics = m.def_submodule("two_body_dynamics");
two_body_dynamics::expose_two_body_dynamics(two_body_dynamics);

auto fundamentals = m.def_submodule("fundamentals");
fundamentals::expose_fundamentals(fundamentals);
auto gravitation = m.def_submodule("gravitation");
gravitation::expose_gravitation(gravitation);

auto polyhedron_utilities = m.def_submodule("polyhedron_utilities");
polyhedron_utilities::expose_polyhedron_utilities( polyhedron_utilities );
auto fundamentals = m.def_submodule("fundamentals");
fundamentals::expose_fundamentals(fundamentals);

}
auto polyhedron_utilities = m.def_submodule("polyhedron_utilities");
polyhedron_utilities::expose_polyhedron_utilities(
polyhedron_utilities);
}

} // namespace astro
} // namespace astro

}// namespace tudatpy
} // namespace tudatpy
10 changes: 5 additions & 5 deletions tudatpy/kernel/expose_astro.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
namespace py = pybind11;

namespace tudatpy {
namespace astro {
namespace astro {

void expose_astro(py::module &m);
void expose_astro(py::module &m);

} // namespace astro
}// namespace tudatpy
} // namespace astro
} // namespace tudatpy

#endif// TUDATPY_EXPOSE_ASTRO_H
#endif // TUDATPY_EXPOSE_ASTRO_H
Loading

0 comments on commit cbc7e63

Please sign in to comment.