The TU Delft Astrodynamics Toolbox in Python, or Tudatpy, is a library that primarily exposes a powerful set of C++
libraries aiming at accelerating the implementation of simulations, real-data processing and analysis, and quality education in the field of Astrodynamics.
See the documentation for more.
For nominal usage, the use of our distributed conda package is recommended. For more details on the project, please refer to the project website and the project's Github page.
The Tudatpy
repository contains both the source code and the binding code, together with the respective documentation and examples folders.
The next steps outline how to get to a working version of Tudatpy. First we list some prerequisites, and then we show how to set it up.
- [Windows Users] Windows Subsystem for Linux (WSL)
- All procedures, including the following prerequisite, assume the use of WSL. Power users who wish to do otherwise, must do so at their own risk, with reduced support from the team.
- Note that WSL is a, partially separated, Ubuntu terminal environment for Windows. Anaconda/Miniconda, Python and any other dependencies you require while executing code from the
Tudatpy
repository, must be installed in its Linux version via the Ubuntu terminal. This does not apply to PyCharm/CLion however, which can be configured to compile and/or run Python code through the WSL. - Note that, to access files and folders of WSL directly in Windows explorer, one can type
\\wsl$
orLinux
in the Windows explorer access bar, then press enter. - At the opposite, please follow this guide to access Windows file trough WSL.
- This guide from Microsoft contains more information on the possibilities given trough WSL.
- In the Ubuntu terminal environment under WSL, run the command
sudo apt-get install build-essential
to install the necessary compilation tools
- Anaconda/Miniconda installation (Installing Anaconda)
- CMake installation
- Inside the Ubuntu terminal, install CMake by calling
sudo apt install cmake
.
- Inside the Ubuntu terminal, install CMake by calling
- Clone the repository and enter directory
git clone https://github.com/tudat-team/tudatpy
cd tudatpy
- Clone the
examples/tudatpy
submodule:
git submodule update --init --recursive
Note
Submodules "allow you to keep a Git repository as a subdirectory of another Git repository" (from the Git guide). In particular, This "sub-repository" has its own branches and functions separately fromTudatpy
. This is why the previous step is needed.
- Switch
Tudatpy
to a new or an already existing branch using:
git checkout develop
Note
Although you could virtually choose any branch, we recommend working with thedevelop
branch, as it receives frequent updates and are the ones used to build the Conda packages.
- Install the contained
environment.yaml
file to satisfy dependencies, then activate it:
conda env create -f environment.yaml
conda activate tudatpy-dev
Note
It is possible that the creation of the environment will 'time out'. A likely reason for this is that the packages required cannot be found by the current channel,conda-forge
. It is then advisable to add the channelanaconda
to ensure a proper creation of the environment.
- Build TudatPy
python build.py -h # Show help and available flags
python build.py -j <number-of-cores> # Compile Tudatpy
python build.py --tests # [optional] To verify with ctest (see below)
This script compiles Tudatpy. It will take some time to execute, but you can speed up the process by increasing the number of cores used with the -j
flag. If you wish to verify your installation with ctest
(see below), add the --tests
flag.
Once the project is built, all the build output is dumped by default in a directory called build
, which is not tracked by Git.
- Install
python install.py -h # Show help and available flags
python install.py -e # Install in "editable mode"
Note
This script installs Tudatpy in your active conda environment. If you install with the-e
flag, you will not have to re-install every time you update the source code of the library. And that's it! The next step shows you what to do if you want to uninstall the libraries.
- Uninstall
python uninstall.py -h # Show help and available flags
python uninstall.py # Uninstall Tudatpy
Note
This script will remove Tudatpy from your Conda environment, but it will not delete the build directory.
- Within the
tudatpy
directory, runpytest
(packaged with CMake)
pytest
Desired result:
=========================================== 6 passed in 1.78s ============================================
- Enter the
tudatpy/build
directory and run the tests usingctest
cd build
ctest
Desired result:
..
100% tests passed, 0 tests failed out of 224
Total Test time (real) = 490.77 sec
Note
To speed up the tests, you can optionally use multiple cores as follows:
ctest -j <number_of_cores>