Utils
Utility functions for grav_sim API
initialize_c_lib(c_lib)
Initialize C library
Parameters:
Name | Type | Description | Default |
---|---|---|---|
c_lib
|
CDLL
|
C dynamic-link library object |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If any C functions that should be available are not found in the C library |
Source code in grav_sim/utils.py
keplerian_to_cartesian(c_lib, semi_major_axis, eccentricity, inclination, argument_of_periapsis, longitude_of_ascending_node, true_anomaly, total_mass, G)
Convert Keplerian elements to Cartesian coordinates
Parameters:
Name | Type | Description | Default |
---|---|---|---|
semi_major_axis
|
float
|
Semi-major axis |
required |
eccentricity
|
float
|
Eccentricity |
required |
inclination
|
float
|
Inclination |
required |
raan
|
float
|
Right ascension of ascending node |
required |
arg_periapsis
|
float
|
Argument of periapsis |
required |
true_anomaly
|
float
|
True anomaly |
required |
total_mass
|
float
|
Total mass of the two bodies |
required |
G
|
float
|
Gravitational constant |
required |
Returns:
Type | Description |
---|---|
Tuple[ndarray, ndarray]
|
Position and velocity vectors in Cartesian coordinates |
Source code in grav_sim/utils.py
load_c_lib(c_lib_path=None)
Load the C dynamic-link library
Returns:
Name | Type | Description |
---|---|---|
c_lib |
CDLL
|
C dynamic-link library object |
Raises:
Type | Description |
---|---|
OSError
|
If the platform is not supported |
FileNotFoundError
|
If the C library is not found at the path |