Cutting out postage stamps around given RA & DEC
sa14722 wrote on Aug 06, 2015
Hi,
I have two images of a cluster taken from two different filters. I've ran photometry on the two images and have a list of RA & DEC of objects that are common in both images. I want to cut out small postage stamps of these objects with a user specified dx and dy to match the size of the objects. The images have already been aligned and processed.
Is there anyway for me to feed iraf a list of RA & DEC (text file?) along with the size of the postage stamps so that iraf can then cut them out in both filters? I haven't yet found a function that can do this task.
Mike Fitzpatrick wrote on Aug 11, 2015
We don't (yet) have a a generalized cutout tool, the closest you might find in distribution is the ACECUTOUTS task in the NFEXTERN.ACE package (see the help page for details).
In general, the problem involves converting the RA/DEC coords to image coords and then simply copying out the pixels. This can be done in some cases with a script using tasks like WCSCTRAN and IMCOPY or with a compiled task, but it's starts to get messy depending on whether you need to deal with registration, rotation, image extensions and so on.
sa14722 wrote on Aug 12, 2015
Quote by: fitz
We don't (yet) have a a generalized cutout tool, the closest you might find in distribution is the ACECUTOUTS task in the NFEXTERN.ACE package (see the help page for details).
In general, the problem involves converting the RA/DEC coords to image coords and then simply copying out the pixels. This can be done in some cases with a script using tasks like WCSCTRAN and IMCOPY or with a compiled task, but it's starts to get messy depending on whether you need to deal with registration, rotation, image extensions and so on.
So I've got the X/Y coords of the objects (converted from RA/DEC using the header) and have aligned the frames together with WCS. I'm currently trying a pyraf script to imcopy a 150 by 150 pixel region. Not being very familiar with pyraf or python, so far I've got this simple script:
#! /usr/bin/env python
import sys
from pyraf import iraf
iraf.images()
iraf.imcopy('r_new.fits[4708:4858,4937:5087]')
iraf.imcopy('fuv.fits[4708:4858,4937:5087]')
__
Are there any quick changes/additions you could suggest through which I could feed in a text file containing all the X and Y of the objects and get the regions out? I seem to run into a brick wall when I try to put in a general defined variable within imcopy rather than a number like this:
#! /usr/bin/env python
import sys
from pyraf import iraf
a=4708
b=4858
c=4937
d=5087
iraf.images()
iraf.imcopy('r_new.fits[a:b,c:d]')
iraf.imcopy('fuv.fits[a:b,c:d]')
__
I'm not quite sure why this gives an error even though its essentially doing the same as above. The other issue is that I haven't yet found a way to tell pyraf within the script what to name the output file. It always prompts me to name the file on the terminal after I've run the script. Sorry for the long question and thank you for the help.
Last post on Aug 12, 2015