Point Source Aperture Photometry Test

Here we test point source aperture photometry using SEP against the input model image properties.

Read in python libraries

In [87]:
%matplotlib inline
import numpy as np
import sep
from astropy.io import fits
import matplotlib.pyplot as plt
from scipy import interpolate
from sorting_routines import *

Read in fits image, and set NANs to 0

In [89]:
fname_001 = "sim_cube_F090W_487_001.slp.fits"
fits.info(fname_001)
hdulist = fits.open(fname_001)
data_001 = hdulist[0].data[0]
data_001 = data_001.byteswap().newbyteorder()
print np.size(data_001)
for i in range(2048):
    for j in range(2048):
        if(np.isnan(data_001[i,j])):
            data_001[i,j] = 0
Filename: sim_cube_F090W_487_001.slp.fits
No.    Name         Type      Cards   Dimensions   Format
0    PRIMARY     PrimaryHDU     133   (2048, 2048, 2)   float32   
4194304

Use SEP to create a background image

In [ ]:
bkg = sep.Background(data_001)

Get the zeropoint of the image from the FITS header

In [90]:
#print hdulist[0].header
m_ab_zeropoint = hdulist[0].header['ABMAG']
print m_ab_zeropoint
27.1504

Plot the input image

In [62]:
plt.imshow(np.log10( data_001 - data_001.min() + 1.0e-3*data_001.max() ),origin="lower")
Out[62]:
<matplotlib.image.AxesImage at 0x10a06b550>

Plot the background image

In [91]:
plt.imshow(bkg,origin="lower")
Out[91]:
<matplotlib.image.AxesImage at 0x113306c50>