tudat-team / tudatpy-examples

Collection of examples showcasing Tudatpy functionalities. They can be run on mybinder.org as well.
https://tudat-space.readthedocs.io/en/latest/
4 stars 17 forks source link
example mybinder

Tudatpy examples

Welcome to the repository showcasing example applications set up with Tudatpy!

If you want to know more about Tudatpy, please visit the Tudat website. The website also holds the examples rendered as notebooks. Any update to the examples in this repository will automatically update the website repository via the Sync tudat-space submodule action.

Content

The examples are organized in different categories.

Estimation

Examples related to state estimation.

Mission Design

Examples related to mission design.

Propagation

Examples related to state propagation.

Introductory examples:

Advanced examples:

Pygmo

Examples showing how to optimize a problem modelled with Tudatpy via algorithms provided by Pygmo.

Format

The examples are available as both Jupyter Notebooks and raw .py scripts. The Python scripts are auto-generated from the Jupyter notebooks to ensure consistency.

Jupyter Notebook

To run these examples, first create the tudat-space conda environment to install tudatpy and its required dependencies, as described here.

Then, make sure that the tudat-space environment is activated:

conda activate tudat-space

Two packages then need to be added to this environment. First, the notebook package is needed to run the Jupyter notebooks:

conda install notebook

Then, if you wish to be able to run the Pygmo examples, this package also need to be installed:

conda install pygmo

The tudat-space environment has to be added to the Jupyter kernel, running the following:

python -m ipykernel install --user --name=tudat-space

Finally, run the following command to start the Jupyter notebooks:

jupyter notebook

Static code

To run the examples as regular Python files, you can clone this repository, open the examples on your favorite IDE, and install the tudat-space conda environment, as described here.

All of the examples, provided as .py files, can then be run and edited as you see fit.

Please note that these .py files were generated from the Jupyter Notebooks.

MyBinder

We set up a repository on MyBinder: this way, you can explore and run the examples online, without having to set up a development environment or installing the tudatpy conda environment. Click on the button below to launch the examples on mybinder:

Binder

Contribute

Contributions to this repository are always welcome. It is recommended to use the tudat-examples conda environment for the development of example applications, as it contains all dependencies for the creation and maintenance of example applications, such as ipython, nbconvert in addition to pygmo. Simply install the environment using

conda env create -f environment.yaml

and then activate it:

conda activate tudat-examples

The following guidelines should be followed when creating a new example application.

  1. Any modification or addition to this set of examples should be made in a personal fork of the current repository. No changes are to be done directly on a local clone of this repo.
  2. The example should be written directly on a Jupyter notebook (.ipynb file). Then, the following command can be run from the CLI to create a .py file with the same code as the notebook file: jupyter nbconvert --to python mynotebook.ipynb. Make sure to change mynotebook to the name of the notebook file.
  3. The markdown blocks are not optimally converted. Thus, once the .py file is created as described above, the script create_scripts.py is to be executed. This file reformats the markdown blocks in the .py files into a more readable look. Sometimes this cleanup is not perfect, so manually check the .py file to make sure everything is fine and correct anything that is not.
  4. At this point, the example is complete. You are ready to create a pull request from your personal fork to the current repository, and the admins will take it from there.