# Python intro

First of all python is free! Then, I think of python as a super cool programming language that is also a super calculator. It allows you to do higher level math calculations but it can also help find cheaper airplane tickets in the Internet (ask me if you’re interested). Here is a short tutorial to get you started with python after you have installed canopy.

Quick start:

2. Open the Canopy editor and create a new file.
3. Read the following mini tutorial and try some commands in the prompt.
4. Type in the given equations from 1 to 6 and check the results with print statements. Don’t forget to hit run (Ctr + R or Cmd + R).

mini tutorial continued …

variables in python

you can basically use any typical variable name in python such as ‘perigee’ or ‘radius_earth’. Try to give descriptive variable names so your code is easily readable by others.

assign numerical values to variables

it’s as easy as you’d expect

perigee = 418.0


important note: in python 2 an integer number (such as ’18’) is treated differently than a floating number (such as ‘18.0’). To do math with floating numbers in python 2 you can’t have integers in the mix. So that’s why I usually initialize my integer variables with a ‘.0’ at the end so I won’t get strange results. You should try to see what I mean.

math calculations in python

To do math in python is also very simple and as expected

Examples:

Rp = perigee + radius_earth
R = a*(1-e**2)/(1+e*cos(nu))


important note: in python the exponent operator is ‘**’ instead of ‘^’ as in other programming languages. Here is a short list of the operators you  can use in python:

http://www.tutorialspoint.com/python/python_basic_operators.htm

The way you print in python 2 is different from python 3. This example is for python 2:

print 'Period = ',P,' min'


last but not the least: numpy

numpy is a python library that helps you do math. You can read more about it here: http://wiki.scipy.org/Tentative_NumPy_Tutorial

For now you just need to import this python library and use it blindly. On the first line of your script type:

from numpy import *


this will import all the functionality of numpy into your python script. For this tutorial it’s specially useful to be able to use the constant ‘pi’ and also for the function ‘cos’. Otherwise you would have to make your own ‘pi’ and ‘cos’.

Here is the source code to make the magic happen:

#iss orbital speed and period
from numpy import *

perigee = 418.0 #km
apogee  = 426.0 #km
mu_earth = 3.986e5 # km^3/s^2

print 'Radius Perigee: ', Rp, 'km'
print 'Radius Apogee : ', Ra, 'km'

# 1) eccentricity
e = (Ra - Rp)/(Ra + Rp)
print 'eccentricity: ', e

# 2) semimajor axis
a = (Ra+Rp)/2.0
print 'a =', a, ' km'

# 3) mechanical energy
epsilon = -mu_earth/(2*a)

# 4) altitude at nu=90deg
nu = 90*pi/180
R = a*(1-e**2)/(1+e*cos(nu))

print 'R =', R, 'km'

# 5) orbital speed
V = sqrt(2*(mu_earth/R + epsilon))
print("V = {:2f} km/s".format(V))

# 6) orbital period
P  = 2*pi*sqrt(a**3/mu_earth)
print("P = {:.2f} sec = {:.2f} min = {:.2f} hr".format(P, P/60, P/60/60))


# Systems Tool Kit (STK) intro

Note 1: STK only works on Windows (sad but true), well to be fair there is actually an old version of STK that technically works on Linx but it’s just the core engine, not really the Graphics version.

Note 2: this tutorial is a follow up of the Astronautics 101 post:
http://www.spacemig.com/astronautics-101/

1. Go to the AGI website and get registered to download the Free version of STK: http://www.agi.com/products/stk/modules/default.aspx/id/stk-free
2. Follow the instructions to install STK
3. Create a new scenario, give it a name and use the defaults start and stop dates
4. insert and STK object: satellite: From standard object database
5. search the name ‘iss (zarya)’ – that is the official designator for the ISS. Select the result and click insert. You should be connected to the internet to allow the software to download the right database for the ISS. Then close all the insert windows untill you’re left with just the main STK views. At this point you should see a 3D window and a 2D window showing the orbit of the ISS
6. Click the blue ‘start’ button on the control toolbar to see the ISS move. Then click pause.
7. Now click the yellow ‘Real-time animation mode’ button and then the ‘play’ button again. Now you are seing the actual position of the ISS at this exact moment. Is it almost over Honolulu? If you look at the time it’s in UTC instead of HST. But it doesn’t matter because it’s the real time.
8. Now right click on the ISS icon on the Object browser on the left and select ‘Report & Graph Manager’. This will bring up a list of different types of reports you can get about the ISS. Explore the list of installed styles.
9. Ok, now let’s double click on the ‘Classic Orbit Elements’ report (not the graph). This will bring up a new window with different columns: Time, Semi-major Axis, etc.
10. Now let’s create a new custom report: click on the 3rd icon in the styles toolbar. Give it a name like ‘me419’
11. Select ‘Classical Elements’ -> ‘J2000’ then double click on
1. Time
2. Apogee Altitude
3. Perigee Altitude
{"ft_lang_label":"__label__en","ft_lang_prob":0.79582316,"math_prob":0.6938156,"size":3206,"snap":"2021-31-2021-39","text_gpt3_token_len":881,"char_repetition_ratio":0.110243596,"word_repetition_ratio":0.0036101083,"special_character_ratio":0.29008108,"punctuation_ratio":0.11480363,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9735978,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-09-17T23:43:09Z\",\"WARC-Record-ID\":\"<urn:uuid:97547eba-967e-4bd3-9efa-48c39e5e4e14>\",\"Content-Length\":\"58367\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:54626b46-8f35-4e68-88ab-f59f1b72cdc5>\",\"WARC-Concurrent-To\":\"<urn:uuid:8dadc508-b9f6-4c20-9bb3-a72ff91c0b84>\",\"WARC-IP-Address\":\"69.163.216.229\",\"WARC-Target-URI\":\"http://www.spacemig.com/2015/02/\",\"WARC-Payload-Digest\":\"sha1:HAO4TU7HDZ7RBI5X6W7FALRAUDPFUU6Y\",\"WARC-Block-Digest\":\"sha1:H6DJXWYPF7ZQU5F5WNSBGI67MO7PGEM5\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-39/CC-MAIN-2021-39_segments_1631780055808.78_warc_CC-MAIN-20210917212307-20210918002307-00607.warc.gz\"}"}