Credit: Me :D
Daniel Kastinen
Credit: Me :D
Credit: Me :D

Credit: Nathan Myhrvold
Credit: NASA/Johns Hopkins APL
Photo: Torbjörn Lövgren
Credit: SVT
Rosetta OSIRIS - 67P/Churyumov-Gerasimenko
Photo: EISCAT
Shigaraki Middle and Upper Atmosphere (MU) radar, Japan
Credit: AllSky7 @ Umeå University 2024-09-12
This is a WHOLE lot of software development
Lets walk to computer room 2100
Our goals for today:
But first!... lets calculate $\pi$ in a very roundabout way
But first!... lets calculate $\pi$ in a very roundabout way
!pip --version
!pip install numpy matplotlib scipy
But first!... lets calculate $\pi$ in a very roundabout way
import numpy as np
samples = 100
x = np.random.rand(samples)*2 - 1
y = np.random.rand(samples)*2 - 1
r = np.sqrt(x**2 + y**2)
pi = 4*np.sum(r < 1)/samples
print(f"{samples=} gives {pi=} (error {np.pi - pi})")
Try samples = 1_000_000
a = 5 #a is the name of an object of type integer
a = 5.0 #a is now the name of an object of type float
def func(b):
return(b + 5) # b can be anything that "can do" plus(5)
L = [1.9, 3, "h"]
print(f"{L=}")
print(f"{type(L)=}")
print(f"{type(L[0])=}")
B = {"key": int(L[0])}
print(B)
import numpy as np
a = np.random.randn(1)
if a < -1 or a > 1:
print("Outside one sigma!!!")
else:
print("Nothing abnormal to see here")
for i in range(10):
print(f"Hello world number {i}")
with open("my_file.txt", "r") as fh:
for line in fh.readlines():
print(line)
import numpy as np
I_matrix = np.arange(9).reshape((3, 3))
print(I_matrix)
# Slices
print(f"{I_matrix[:, 0]=}")
print(f"{I_matrix[1, :2]=}")
numpy is C-code!
T_ipp variablesnr_db = 10*np.log10(snr))
import matplotlib.pyplot as plt
fig, axes = plt.subplots(3, 1)
axes[0].plot(t, height)
axes[1].plot(t, velocity)
axes[2].plot(t, snr_db)
plt.show()
Since we are running out of time: shortcut
data = np.genfromtxt(fname, comments="#", delimiter=",")
T_ipp = 0.0031
...
import matplotlib.pyplot as plt
fig, axes = plt.subplots(3, 1)
axes[0].plot(t, height)
axes[1].plot(t, velocity)
axes[2].plot(t, snr_db)
plt.show()
Use any method you would like, but beware of outliers!