[AstroPy] Image combine

Erik Tollerud erik.tollerud@gmail....
Tue Mar 6 15:08:42 CST 2012


Fair enough - I just meant many (although certainly not all) of the
imcomb options can be done by converting to numpy arrays, doing the
operation (including masking and the like), and converting back.  But
you're right that some of the more complicated functions in imcombine
would require a lot of work to re-implement.

Tools like this are definitely something that we would definitely like
to see as another major affiliated package for astropy, by the way -
perhaps "imageutils" or similar.  So if you're planning on embarking
on such an adventure at Gemini, It'd be great if you could, at least
in part, implement it in that form!


2012/3/6 Kathleen Labrie <klabrie@gemini.edu>:
> Hi,
>
> I think Jose mostly refer to the rejection, masking, scaling, weighing
> algorithms that iraf imcombine offers.    I agree the arithmetic is easy
> enough to do with numpy and pyfits, even the median.  It's the rest
> of imcombine that can get tricky (and bloated).
>
> For the record, here at Gemini, we will soon embark it that foolish adventure
> of trying to reproduce at least some of the imcombine features (but only
> the ones we need due to time and resource constraints).   We are still
> at the point of defining which features we really need though, so I don't
> think it will help Jose much for now.
>
> I am very interested to hear if someone has written some code for a
> imcombine-like routine.
>
> Cheers,
> Kathleen
>
> On Mar 6, 2012, at 8:52 AM, Erik Tollerud wrote:
>
>> 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@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@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/astropy
>>
>>
>>
>> --
>> Erik Tollerud
>> _______________________________________________
>> AstroPy mailing list
>> AstroPy@scipy.org
>> http://mail.scipy.org/mailman/listinfo/astropy
>



-- 
Erik Tollerud


More information about the AstroPy mailing list