[AstroPy] Image combine

Erik Tollerud erik.tollerud at gmail.com
Tue Mar 6 13:52:02 EST 2012


I'm not aware of a function that does it exactly with the interface of
imcombine, but it can be done pretty easily with pyfits:

import pyfits

f1 = pyfits.open('filename1')
f2 = pyfits.open('filename2')

h1 = f1[0].header
im1 = f1[0].data
im2 = f2[0].data

newimage = im1 + im2

newhdu = pyfits.PrimaryHDU(data=newimage,header=h1)
newhdu.writeto('newfilename')


That example is specific to addition, of course (the im1 + im2 part,
but it should be clear how to generalize it to other arithmetic
operations.


2012/3/6 Jose Miguel Ibáñez <ppmime at gmail.com>:
> Hello everyone,
>
> does anyone know of an implementation of the iraf.imcombine task in
> python+numpy ? (of course, not using pyraf.imcombine call)
>
>
> Thanks !
> Jose
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy



-- 
Erik Tollerud



More information about the AstroPy mailing list