Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Mission Analysis in Python (Detailed setup guide)

1 - Setting up git

1.1 - Installing GitHub Desktop

If you are an experienced git user, you can skip this section and go to the next one.

To contribute work to the GitHub repository, we recommend using GitHub Desktop. It has an easy to use graphical interface that allows you to clone, pull, commit, and push to repositories.

Download the installer, follow the instructions, then open the application and log in with your GitHub account.

1.2 - Cloning the repository

In GitHub Desktop, select File --> Clone repository... and select the TOLOSAT/mission-analysis repository. You can place it wherever you want on your machine.

Once the repository is cloned, you can proceed to step 2.

2 - Setting up the Python environment

2.1 - Install Anaconda or Miniforge

If you already have Anaconda installed, you can use it. Otherwise, we recommend installing Miniforge.

2.2 - Install the environment

On Mac, you will use the Terminal. On Windows, you will use Anaconda prompt or Miniforge prompt.

Navigate to the Python folder in the repository

Use the cd command to navigate to the python sub-folder within the mission-analysis repository. Your active directory should look like this:
.../GitHub/mission-analysis/python

Example command:

cd [path_to_repository]/mission-analysis/python

Create the environment

Next, run the following command to create the environment with Python 3.9:

conda create -n tolosat-tudatpy python=3.9
conda activate tolosat-tudatpy

Update the environment with project dependencies

After activating the environment, update it with the project dependencies by running:

conda env update -n tolosat-tudatpy -f environment.yaml

If any conflicts arise during this process, press CTRL+C to cancel the operation and reach out to the team for assistance.

Once the installation is complete, you can proceed to the next step.

3 - Setting up the IDE

3.1 - Install PyCharm

If you already have a Python IDE of preference, you can use it, but you will need to configure the Python interpreter yourself.

We recommend using PyCharm. A professional license is provided for free to students by applying here.

Once installed, proceed to step 3.2.

3.2 - Setting up PyCharm

In PyCharm, select File --> Open... and select the mission-analysis folder. This will open the full project.

In the bottom right corner, you should see a Python interpreter dropdown menu. Follow the next steps:

  • Click on the dropdown menu and select Add New Interpreter
  • Click Add Local Interpreter...
  • In the left panel, select Conda Environment
  • In the Interpreter dropdown menu, select tolosat-tudatpy
  • Click OK

Then, right-click on the python folder and select Mark Directory as --> Sources Root.

4 - Running the example code

In PyCharm, open the python\examples\perturbed_satellite_orbit.py file and run it with right-click --> Run 'perturbed_satellite_orbit'.

If everything is set up correctly, you should see the following output:

State vector contains: 
Vector entries, Vector contents
[0:6], translational state of body Delfi-C3
Dependent variables being saved, output vector contains: 
Vector entry, Vector contents
0, Total acceleration in inertial frame of Delfi-C3
3, Kepler elements of Delfi-C3 w.r.t. Earth
9, Spherical position angle latitude angle of Delfi-C3 w.r.t. Earth
10, Spherical position angle longitude angle of Delfi-C3 w.r.t. Earth
11, Single acceleration norm of type central gravity , acting on Delfi-C3, exerted by Sun
12, Single acceleration norm of type central gravity , acting on Delfi-C3, exerted by Moon
13, Single acceleration norm of type central gravity , acting on Delfi-C3, exerted by Mars
14, Single acceleration norm of type central gravity , acting on Delfi-C3, exerted by Venus
15, Single acceleration norm of type spherical harmonic gravity , acting on Delfi-C3, exerted by Earth
16, Single acceleration norm of type aerodynamic , acting on Delfi-C3, exerted by Earth
17, Single acceleration norm of type cannonball radiation pressure , acting on Delfi-C3, exerted by Sun

Process finished with exit code 0

A total of four plots should also be displayed.

Bonus - Running scripts in the Python console

To run scripts in the Python console, which allows to keep interacting with them after they are run and to see all the variables and their value, you can follow the next steps:

  • In the dropdown menu at the top right of your screen, left of the green Run button, click Edit Configurations...
  • In the Execution category, enable Run in Python Console
  • Click OK

You can now run the script again with the green Run button in the right corner. The script will now run in the Python console and you will see all the variables created along with their type and value.

5 - Possible Errors

  • Exit Code -1066598273 (0xC06D007F): This error is caused by a binary compatibility mismatch with the required TudatPy version. To solve it, activate the environment and downgrade numpy by running the following command: conda install numpy=1.23