Skip to content

Commit

Permalink
Small changes to two-body docs
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardo-ocampo committed Nov 4, 2024
1 parent 05fba19 commit 166ac03
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PyAstronautics is a Python package designed for astronautical engineers, providi

Ad Astra! 💫

![Test Status](https://img.shields.io/github/actions/workflow/status/eduardo-ocampo/pyastronautics/test-package.yml?branch=main&style=flat-square&logo=github&logoColor=white&label=Pytests&color=00A86B)
![Test Status](https://img.shields.io/github/actions/workflow/status/eduardo-ocampo/pyastronautics/test-package.yml?branch=main&style=flat-square&logo=github&logoColor=white&label=Pytest&color=00A86B)
![Documentation Status](https://img.shields.io/github/actions/workflow/status/eduardo-ocampo/pyastronautics/sphinx-docs.yml?branch=main&style=flat-square&logo=github&logoColor=white&label=Build%20%26%20Deploy%20Documentation&color=00A86B)
![PyPI - Version](https://img.shields.io/pypi/v/PyAstronautics?style=flat-square&logo=python&logoColor=white&color=blue)
![GitHub License](https://custom-icon-badges.demolab.com/github/license/eduardo-ocampo/pyastronautics?style=flat-square&logo=law&logoColor=white&color=blue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ Each particle has a State Vector made up of its position and velocity:
:::{math}
:label: eq:state_vector
\mathbf{x} = \begin{bmatrix}
x_0 \\ y_0 \\ z_0 \\
\dot{x_0} \\ \dot{y_0} \\ \dot{z_0}
x \\ y \\ z \\
\dot{x} \\ \dot{y} \\ \dot{z}
\end{bmatrix}
:::

Expand Down
13 changes: 5 additions & 8 deletions src/pyastronautics/astrodynamics/two_body_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,14 @@ class TwoBodyModel(TwoBodyOrbitalModel):
Absolute tolerance value for numerical analysis, default is 1e-10.
rel_tol : float
Relative tolerance value for numerical analysis, default is 1e-10.
results_file : str
The filename where orbit elements results will be stored.
num_sol_pickle_file : str
The filename for the pickle file to store numerical solution data.
"""

def __init__(self, position: list[float], velocity: list[float]):
"""
Initialize the TwoBodyModel instance with position and velocity vectors.
Initialize the TwoBodyModel instance with initial position and velocity vectors.
Parameters
----------
Expand Down Expand Up @@ -87,15 +85,14 @@ def __init__(self, position: list[float], velocity: list[float]):
super().__init__(position, velocity)

# Numerical Analysis Setup
# --------------------------------------------------------------------------------
# ---------------------------------------
self.initial_state_vector = position + velocity
# Default tolerance values
self.abs_tol = 1e-10
self.rel_tol = 1e-10

# Set File Names
# --------------------------------------------------------------------------------
self.results_file = "orbitElements.txt"
# ---------------------------------------
self.num_sol_pickle_file = "twoBody_trajectory.pickle"

def differential_equations(self, t: float, state: Union[list, np.ndarray]) -> np.ndarray:
Expand Down Expand Up @@ -146,12 +143,12 @@ def differential_equations(self, t: float, state: Union[list, np.ndarray]) -> np
# [x, y, z, vx, vy, vx]
return np.concatenate((vel,accel))

def solve_trajectory(self, save_analysis=False) -> None:
def solve_trajectory(self, save_analysis:bool = False) -> None:
"""
Solve the trajectory of a Two-Body system using the initial value problem (IVP).
This method uses the `scipy.integrate.solve_ivp()` function to numerically integrate the differential equations
governing the motion of the bodies, given the initial conditions specified in `self.initial_value_problem`.
governing the motion of the bodies, given the initial conditions specified in `self.initial_state_vector`.
Before calling this method, ensure that `self.time` is defined as a sequence of time points in seconds
over which the simulation will be evaluated. If `self.time` is not defined, a ValueError will be raised.
Expand Down

0 comments on commit 166ac03

Please sign in to comment.