AWP - Astrodynamics with Python
The GitHub repository corresponding to the YouTube channel (https://www.youtube.com/AlfonsoGonzalezSpaceEngineering), which contains the following video series:
- Space Engineering Podcast
- Orbital Mechanics with Python
- Fundamentals of Orbital Mechanics
- Mecánica Orbital con Python
- Spacecraft Attitude Control with Python
- Numerical Methods with Python
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
PYTHONPATH
and AWP
Environment Variables
Setting the In order to use this repository path independently (can run any script from any directory), one must set the PYTHONPATH
and AWP
variables as the following:
PYTHONPATH
: Absolute path to your python_tools directory
# Two examples of how to set the PYTHONPATH variable
$ export PYTHONPATH=$PYTHONPATH:/home/alfonso/AWP/src/python_tools
# or
$ export PYTHONPATH=$PYTHONPATH:~/AWP/src/python_tools
AWP
: Absolute path to the base of this repository
# Two examples of how to set the AWP variable
$ export AWP=/home/alfonso/AWP
# or
$ export AWP=~/AWP
For convenience, these commands can be placed in a .bashrc file and thus will be automatically set anytime a new terminal session is begun.
Running Example Usages
Once the dependencies are installed and environment variables are 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
Running Unit Tests
Again, once dependencies are installed and environment variables 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