Homework 2 (due April 27 before class)

Finish this homework in the appropriate cells, and copy this file to your home directory on ursa, so I can grab them and inspect them. Please keep the original filename.


In [ ]:
%matplotlib inline

import matplotlib.pyplot as plt
import numpy as np
import math

from astropy.io import fits

from scipy.optimize import curve_fit
import pyspeckit

Data: in this homework we will work with the now familiar NGC 6503 datacube.


In [ ]:
hdu = fits.open('../data/ngc6503.cube.fits')

Q1: What is the maximum value in the cube, and find the coordinate (x,y,z) where this maximum occurs. What are the intensity units of this cube?

A1:


In [ ]:

Q2: Take an average spectrum of a 5 by 5 area around this maximum, and plot it. Bonus if you plot the X coordinate in km/s instead of channels. Try to write the code such that 5 is a parameter, so it's easy to take a 3x3 or 10x10 area...For debugging purposes you might want to print out the 5x5 values in the channel where the maximum occured.

A2:


In [ ]:

Q3: Fit a single gaussian to this spectrum, and overlay the fit to the spectrum. Use any method.

A3:


In [ ]: