I have a fits image with many astronomical objects in it. I am trying to create small 4x4 "stamps" (sections/images around the objects) from the objects that interest me. I have already calculated the pixel coordinates for the objects in the original fits file, and created a document that contains the coordinates. I know that the imshow() command is probably the best option, but I am stumped as to how I can use the pixel coordinates to complete the task.
from pylab import *
import numpy as np
import pyfits
import matplotlib.pyplot as plat
coord = loadtxt('/Users/seadr/data/sky_coordinate_selection.txt')
x = coord[:,0]
y = coord[:,1]
data = pyfits.getdata('/Users/seadr/data/sky_bkgdcor_match.fits')
#vimin will calaculate the median of the data that does not equal 0
vmin = median(data[where(data != 0)])
#vmax will calculate the normalized median
vmax = 1.483 * np.median(abs(np.array(data[where(data!= 0)]) - 
np.median(data[where(data!= 0)])))
print vmax, vmin
plt.imshow(data,vmin = vmin,vmax = vmax)
The first imshow() gives me the original fits document.
If I wanted to look at something like a single star in my image, while knowing its pixel coordinates, how would I go about doing that.
My long term goal is to be able to create many "stamps" because I have many different version of the same astronomical image, such that they were taken in different filters. I want to be able to switch out the original fits file, and create a sets of these "stamps" for the same objects in the different filters.
                        
If you'd like to slice the image you're displaying using
imshow, you can simply index data. For example,will display the 10x10 corner cutout of data. It looks like you want to display a region centered on each of your x, y coordinates. You want each of these stamps to be 4 pixels by 4 pixels, so you would do
where xcoord and ycoord are the coordinates of the object you want to be centered on, i.e. x[i] and y[i], where x and y are the arrays you've defined above, and i is some integer index.