Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63410 is a reply to message #63404] |
Thu, 06 November 2008 09:37   |
Chris[6]
Messages: 84 Registered: July 2008
|
Member |
|
|
On Nov 6, 7:14 am, Griffons <griffon...@gmail.com> wrote:
> On Nov 6, 11:55 am, Wox <s...@nomail.com> wrote:
>
>> On Thu, 6 Nov 2008 08:46:31 -0800 (PST), Griffons
>
>> <griffon...@gmail.com> wrote:
>>> Hello,
>>> Thank you for your help.
>>> I mean adding as in summation. Let say you have 20 image files in a
>>> folder and want the output to be the sum into one file.
>
>> Well, then it's like Jeremy said, readfits to read all images and
>> writefits to write the sum. I'm not sure what the problem is...
>
> I downloaded readfits, writefits and the other files required.
> I am not sure what to do next. I compiled and ran readfits and
> writefits, but then what to do?
I would do something like this, where files is a string array of the
file names and nfiles is the number of files in that array:
im = mrdfits( files[0], 0, h, /silent)
for i = 1, nfiles - 1, 1 do begin
im += mrdfits(files[i], 0, h, /silent)
endfor
writefits,'outfile', im, h
The caveat to this is that the header of the output file is the header
of the last file only. Use something like file_search to create the
files array.
Chris
|
|
|