A680 HW6: FITS Image Processing via Python
Before outlining the code, we note, in the hopes of not belaboring the point, that image processing is only possible if we are granted the images. Besides the science images we need the biases and flats. We collected the images at Maunt Laguna Observatory on September 29, 2015. Below is our Python code to process them. In other words, to extract the science, to hopefully toss away the noise and the telescope imperfections which are manifest in the raw science images.
First, we import the necessary methods and create the lists which we will populate and manipulate. What follows below are the functions and their brief explanations.
from glob import glob
from array import array
biaslist = 
flatlist_r = 
flatlist_h_al = 
path = '/Users/compphysadmin/Desktop/SDSU_Fall_2015/A680/HW6/150929.mlo40/'
files = path + 'a*.fit'
fnames = glob(files)
fnames = sorted(fnames)
def remove_overscan(fnames = fnames):
for i, fname in enumerate(fnames):
hdu = pyfits.open(fname)
image = hdu.data
header = hdu.header
if header['OBJECT'] != 'focus':
overscan = numpy.mean(image[:,2068:2200], axis=1)
newimage = (image.transpose() - overscan).transpose()
newimage = newimage[:,0:2067]
hdu = pyfits.PrimaryHDU(newimage,header)