comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » to read and to save multiple fits format files at a time
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
to read and to save multiple fits format files at a time [message #69988] Thu, 04 March 2010 04:41 Go to next message
sid is currently offline  sid
Messages: 50
Registered: January 1995
Member
HI,
My data is in fits format, I am having 22 fits file and all the 22
files should be subtracted by single fits file individually, and I
should save it separately after subtraction. So please help me how to
read all these 22 files at a single stretch and subtract all the 22
files separately with one fits file and save the subtracted ones.
regards
sid
Re: to read and to save multiple fits format files at a time [message #70064 is a reply to message #69988] Thu, 04 March 2010 23:45 Go to previous message
thoeger is currently offline  thoeger
Messages: 4
Registered: February 2010
Junior Member
On Mar 4, 7:41 am, sid <gunvicsi...@gmail.com> wrote:
> HI,
>    My data is in fits format, I am having 22 fits file and all the 22
> files should be subtracted by single fits file individually, and I
> should save it separately after subtraction. So please help me how to
> read all these 22 files at a single stretch and subtract all the 22
> files separately with one fits file and save the subtracted ones.
> regards
> sid

Yep, I'd do something in the vein of naming the files appropriately so
they can be found in an automated search/filtering quite easily, then:

files = file_search('pattern_to_search_for*.fits')
subtraction_file = 'filename_of_that_file.fits'
subtraction-data = readfits(subtraction_file)
for i = 0, n_elements(files) do begin
imgdata = readfits(files(i), hdr)
imgdata = imgdata-subtraction_data
outputfile = 'output_'+strtrim(i, 2)+'.fits'
writefits, outputfile, data, hdr
endfor


Cheers;

Emil
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Works on Linux, not on MacOS
Next Topic: Re: casting error

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 20:06:35 PDT 2025

Total time taken to generate the page: 0.00503 seconds