How to Use Pixel Coordinates with the imshow() command in order to make images from specific sections of a fits image in python? -


i have fits image many astronomical objects in it. trying create small 4x4 "stamps" (sections/images around objects) objects interest me. have calculated pixel coordinates objects in original fits file, , created document contains coordinates. know imshow() command best option, stumped how can use pixel coordinates complete task.

from pylab import * import numpy np import pyfits import matplotlib.pyplot 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 calaculate median of data not equal 0 vmin = median(data[where(data != 0)])  #vmax calculate 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 original fits document.

if wanted @ single star in image, while knowing pixel coordinates, how go doing that.

my long term goal able create many "stamps" because have many different version of same astronomical image, such taken in different filters. want able switch out original fits file, , create sets of these "stamps" same objects in different filters.

if you'd slice image you're displaying using imshow, can index data. example,

plt.imshow(data[0:10, 0:10]) 

will display 10x10 corner cutout of data. looks want display region centered on each of x, y coordinates. want each of these stamps 4 pixels 4 pixels,

imwidth = 2 plt.imshow(data[xcoord-imwidth:xcoord+imwidth, ycoord-imwidth:ycoord+imwidth]) 

where xcoord , ycoord coordinates of object want centered on, i.e. x[i] , y[i], x , y arrays you've defined above, , integer index.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -