First Last - Fitting Data


In [ ]:
%matplotlib inline
import matplotlib.pyplot as plt

import numpy as np
from astropy.table import QTable

from scipy.optimize import curve_fit

Power on the Moon

The Apollo lunar mission deployed a series of experiments on the Moon, The experiment package was called the Apollo Lunar Surface Experiments Package (ALSEP). The ALSEP was powered by a radioisotope thermoelectric generator (RTG).

An RTG is basically a fist-sized slug of Pu-238 wrapped in a material that generates electric power when heated. Since the RTG is powered by a radioisotope, the output power decreases over time as the radioisotope decays.

Read in the datafile

The data file Apollo_RTG.csv contains the power output of the Apollo 12 RTG as a function of time.

The data colunms are

  • [Day] - Days on the Moon
  • [Power] - RTG power output in Watts

In [ ]:

Can you charge your phone with the Apollo RTG?

  • Plot the data: Day vs. Power
  • Use the OO interface to matplotlib
  • Fit the function with a polynomial (you choose the degree).
  • Plot the fit with the data
  • Output size w:11in, h:8.5in
  • Make the plot look nice (including clear labels)

In [ ]:

What was the power output on Day 0?


In [ ]:

How many years after landing could you still power a 60 W lightbulb?


In [ ]:

How many years after landing could you still power a 5 W USB device?


In [ ]:

How many years after landing until the power output is 0 W?


In [ ]:


Fitting data to a function

  • The datafile 'FitMe.dat' contains two columns of data (x,y)
  • Use the OO interface to matplotlib
  • Plot the data x,y
  • Fit the function below to the data
  • Find the values of a,b,c that best fit the data
  • Output size w:11in, h:8.5in
  • Make the plot look nice (including clear labels)
$$\Large f(x) = a \sin(bx) \ e^{-cx} $$

In [ ]:

Due Tue Nov 07 - 5pm

  • Make sure to change the filename to your name!
  • Make sure to change the Title to your name!
  • File -> Download as -> HTML (.html)
  • upload your .html and .ipynb file to the class Canvas page