/AWP

Astrodynamics with Python book, software, and videos. Spacecraft trajectory and attitude modeling and simulation

Primary LanguagePython

AWP - Astrodynamics with Python

prof-pic cosmo-3d-launches groundtracks-earth-img

The GitHub repository corresponding to the YouTube channel (https://www.youtube.com/AlfonsoGonzalezSpaceEngineering), which contains the following video series:

Dependencies

Installing Python dependencies

Python packages can be easily and conviniently installed using pip via the command line like so:

$ python3 -m pip install {package_name}

In the case of AWP, all Python dependencies can be installed in one command using the requirements.txt file as so:

$ python3 -m pip install -r requirements.txt

Setting the PYTHONPATH Environment Variable

In order to use this repository path independently (can run any script from any directory), one must set the PYTHONPATH environment variable to point to the python_tools directory of this repoistory:

  • PYTHONPATH: Absolute path to your python_tools directory
# Two examples of how to set the PYTHONPATH variable for Linux / MacOS

$ export PYTHONPATH=$PYTHONPATH:/home/alfonso/AWP/src/python_tools
# or
$ export PYTHONPATH=$PYTHONPATH:~/AWP/src/python_tools
rem Examples of how to set the PYTHONPATH variable for Windows

$ set PYTHONPATH=C:\Users\alfon\AWP\src\python_tools

For convenience, this command can be placed in a .bash_profile or .bashrc file and thus will be automatically set anytime a new terminal session is begun.

Running Example Usages

Once the dependencies are installed and PYTHONPATH is set, the example usage cases can be run (from the base path of this repository):

# ensure you are in the base path of this repository
$ pwd
/home/alfonso/AWP
# run the example usages
$ python3 example_usage/Spacecraft_hello_world.py
$ python3 example_usage/many_orbits.py
$ python3 example_usage/groundtracks.py

Running Unit Tests

Again, once dependencies are installed and PYTHONPATH is set, the unit tests can be run with the following command (from the base path of this repository):

# ensure you are in the base path of this repository
$ pwd
/home/alfonso/AWP
# run the unit tests using one of the following commands
$ pytest src/python_tools/unit_tests/ -vv
# or
$ python3 -m pytest src/python_tools/unit_tests/ -vv

The only difference between those two commands is that running pytest through the Python interpreter is that python will add your current directory to sys.path