Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63385] |
Thu, 06 November 2008 13:40 |
Chris[6]
Messages: 84 Registered: July 2008
|
Member |
|
|
On Nov 6, 11:20 am, Griffons <griffon...@gmail.com> wrote:
> On 6 nov, 14:53, Chris <beaum...@ifa.hawaii.edu> wrote:
>
>
>
>> On Nov 6, 9:38 am, Griffons <griffon...@gmail.com> wrote:
>
>>> On Nov 6, 2:35 pm, Paolo <pgri...@gmail.com> wrote:
>
>>>> Griffons wrote:
>>>> > On Nov 6, 1:57 pm, David Fanning <n...@dfanning.com> wrote:
>>>> > > Griffons writes:
>>>> > > > Thank you for your help.
>>>> > > > I compiled all the procedures related to readfits and writefits.
>>>> > > > When I run readfits, it gives this error:
>>>> > > > Attempt to call undefined procedure/function: 'READFITS'.
>>>> > > > Execution halted at: $MAIN$
>
>>>> > > > As a result, the files cannot be read when they are called:
>>>> > > > files=3D['test1.fits','test2.fits',...] ; I tried files_search it does
>>>> > > > not work.
>
>>>> > > > writefits work when is run.
>
>>>> > > > What could I do?
>
>>>> > > The next step is to read this article:
>
>>>> > >http://www.catb.org/~esr/faqs/smart-questions.html
>
>>>> > > Especially the part about "don't say program XXX doesn't
>>>> > > work unless you are *absolutely* sure about it."
>
>>>> > > Cheers,
>
>>>> > > David
>>>> > > --
>>>> > > David Fanning, Ph.D.
>>>> > > Fanning Software Consulting, Inc.
>>>> > > Coyote's Guide to IDL Programming:http://www.dfanning.com/
>>>> > > Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>>>> > I compiled gettok, mrd_skip, strnumber, sxaddpar, sxdelpar, sxpar,
>>>> > valid_num, and readfits. They all worked. Then I run readfits and it
>>>> > does not work.
>
>>>> How does it fail then?
>
>>>> Paolo- Hide quoted text -
>
>>>> - Show quoted text -
>
>>> Hello Paolo,
>>> how are you?
>
>>> Here is what I get as error message:
>>> It is not able to locate any of the files. I am not sure how to pick/
>>> search for them.
>
>>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>>> \Data_Reduction\code\READFITS_code\readfits.pro"
>>> Compiled module: READFITS.
>>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>>> \Data_Reduction\code\READFITS_code\readfits.pro"
>>> Compiled module: READFITS.
>>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>>> \Data_Reduction\code\READFITS_code\strnumber.pro"
>>> Compiled module: STRNUMBER.
>>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>>> \Data_Reduction\code\READFITS_code\sxaddpar.pro"
>>> Compiled module: SXADDPAR.
>>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>>> \Data_Reduction\code\READFITS_code\sxdelpar.pro"
>>> Compiled module: SXDELPAR.
>>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>>> \Data_Reduction\code\READFITS_code\sxpar.pro"
>>> Compiled module: SXPAR.
>>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>>> \Data_Reduction\code\READFITS_code\tbget.pro"
>>> Compiled module: TBGET.
>>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>>> \Data_Reduction\code\READFITS_code\valid_num.pro"
>>> Compiled module: VALID_NUM.
>>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>>> \Data_Reduction\code\READFITS_code\ftget.pro"
>>> Compiled module: FTGET.
>>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>>> \Data_Reduction\code\READFITS_code\gettok.pro"
>>> Compiled module: GETTOK.
>>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>>> \Data_Reduction\code\READFITS_code\mrd_skip.pro"
>>> Compiled module: MRD_SKIP.
>>> IDL> files=['S_08189493.fit','S_08189494.fit','S_08189495.fit',
>>> 'S_08189496.fit'] ;
>>> IDL> sum = READFITS( files[0], /NOSCALE)
>>> READFITS: ERROR - Unable to locate file S_08189493.fit
>
>> It doesn't know where this file is - probably because it is in a
>> folder IDL doesn't know about. IDL has a list of directories that it
>> looks for whenever trying to read or run anything (this is also how
>> you get around manually compiling all of these files -IDL
>> automatically looks in these folders and will automatically compile
>> the code it needs to if it can find it). I have an older version of
>> IDL, but there should be something like edit->preferences in IDL.
>> Then, find the tab called 'path', choose to add a new directory to the
>> path, and then add in all of the folders where you keep IDL code or
>> files you want IDL to read. Then, things should compile and read much
>> more easily. Note, you should be able to check a box that searches in
>> all of the subdirectories of a given folder as well.
>
>> Once you set up these paths, go ahead and dump the ENTIRE IDL astro
>> library in one of the folders in your path. Then, you never need to
>> worry about compiling them again.
>
>> chris- Ocultar texto de la cita -
>
>> - Mostrar texto de la cita -
>
> Hello Chris,
>
> How do you reverse the process you told me about?
>
> Thank you.
>
> Griffons
Reverse the process of adding files to your path? I would go back to
file->preferences->path, and there should be an entry like 'remove'.
I thought you could set up the path for files to read as well but, as
Paolo suggests, maybe you can't do it this way. Sorry for the
confusion
chris
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63387 is a reply to message #63385] |
Thu, 06 November 2008 13:20  |
Griffons
Messages: 15 Registered: November 2008
|
Junior Member |
|
|
On 6 nov, 14:53, Chris <beaum...@ifa.hawaii.edu> wrote:
> On Nov 6, 9:38 am, Griffons <griffon...@gmail.com> wrote:
>
>
>
>
>
>> On Nov 6, 2:35 pm, Paolo <pgri...@gmail.com> wrote:
>
>>> Griffons wrote:
>>>> On Nov 6, 1:57 pm, David Fanning <n...@dfanning.com> wrote:
>>>> > Griffons writes:
>>>> > > Thank you for your help.
>>>> > > I compiled all the procedures related to readfits and writefits.
>>>> > > When I run readfits, it gives this error:
>>>> > > Attempt to call undefined procedure/function: 'READFITS'.
>>>> > > Execution halted at: $MAIN$
>
>>>> > > As a result, the files cannot be read when they are called:
>>>> > > files=3D['test1.fits','test2.fits',...] ; I tried files_search it does
>>>> > > not work.
>
>>>> > > writefits work when is run.
>
>>>> > > What could I do?
>
>>>> > The next step is to read this article:
>
>>>> >http://www.catb.org/~esr/faqs/smart-questions.html
>
>>>> > Especially the part about "don't say program XXX doesn't
>>>> > work unless you are *absolutely* sure about it."
>
>>>> > Cheers,
>
>>>> > David
>>>> > --
>>>> > David Fanning, Ph.D.
>>>> > Fanning Software Consulting, Inc.
>>>> > Coyote's Guide to IDL Programming:http://www.dfanning.com/
>>>> > Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>>>> I compiled gettok, mrd_skip, strnumber, sxaddpar, sxdelpar, sxpar,
>>>> valid_num, and readfits. They all worked. Then I run readfits and it
>>>> does not work.
>
>>> How does it fail then?
>
>>> Paolo- Hide quoted text -
>
>>> - Show quoted text -
>
>> Hello Paolo,
>> how are you?
>
>> Here is what I get as error message:
>> It is not able to locate any of the files. I am not sure how to pick/
>> search for them.
>
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\readfits.pro"
>> Compiled module: READFITS.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\readfits.pro"
>> Compiled module: READFITS.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\strnumber.pro"
>> Compiled module: STRNUMBER.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\sxaddpar.pro"
>> Compiled module: SXADDPAR.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\sxdelpar.pro"
>> Compiled module: SXDELPAR.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\sxpar.pro"
>> Compiled module: SXPAR.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\tbget.pro"
>> Compiled module: TBGET.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\valid_num.pro"
>> Compiled module: VALID_NUM.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\ftget.pro"
>> Compiled module: FTGET.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\gettok.pro"
>> Compiled module: GETTOK.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\mrd_skip.pro"
>> Compiled module: MRD_SKIP.
>> IDL> files=['S_08189493.fit','S_08189494.fit','S_08189495.fit',
>> 'S_08189496.fit'] ;
>> IDL> sum = READFITS( files[0], /NOSCALE)
>> READFITS: ERROR - Unable to locate file S_08189493.fit
>
> It doesn't know where this file is - probably because it is in a
> folder IDL doesn't know about. IDL has a list of directories that it
> looks for whenever trying to read or run anything (this is also how
> you get around manually compiling all of these files -IDL
> automatically looks in these folders and will automatically compile
> the code it needs to if it can find it). I have an older version of
> IDL, but there should be something like edit->preferences in IDL.
> Then, find the tab called 'path', choose to add a new directory to the
> path, and then add in all of the folders where you keep IDL code or
> files you want IDL to read. Then, things should compile and read much
> more easily. Note, you should be able to check a box that searches in
> all of the subdirectories of a given folder as well.
>
> Once you set up these paths, go ahead and dump the ENTIRE IDL astro
> library in one of the folders in your path. Then, you never need to
> worry about compiling them again.
>
> chris- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -
Hello Chris,
How do you reverse the process you told me about?
Thank you.
Griffons
|
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63390 is a reply to message #63388] |
Thu, 06 November 2008 12:17  |
Griffons
Messages: 15 Registered: November 2008
|
Junior Member |
|
|
On Nov 6, 3:16 pm, Paolo <pgri...@gmail.com> wrote:
> I think you may have been confused by the posts
> about automatically locate files.... these are important for
> IDL source code, but when you are dealing with data,
> you have to spacifiy the full path.
>
> Normally I use something as
> file=dir+filename
> such that when I need to move the files somewhere else
> I only need to change the dir in one place.
>
> Ciao,
> Paolo
>
>
>
> Griffons wrote:
>> On Nov 6, 2:35 pm, Paolo <pgri...@gmail.com> wrote:
>>> Griffons wrote:
>>>> On Nov 6, 1:57 pm, David Fanning <n...@dfanning.com> wrote:
>>>> > Griffons writes:
>>>> > > Thank you for your help.
>>>> > > I compiled all the procedures related to readfits and writefits.
>>>> > > When I run readfits, it gives this error:
>>>> > > Attempt to call undefined procedure/function: 'READFITS'.
>>>> > > Execution halted at: $MAIN$
>
>>>> > > As a result, the files cannot be read when they are called:
>>>> > > files=3D['test1.fits','test2.fits',...] ; I tried files_search it does
>>>> > > not work.
>
>>>> > > writefits work when is run.
>
>>>> > > What could I do?
>
>>>> > The next step is to read this article:
>
>>>> >http://www.catb.org/~esr/faqs/smart-questions.html
>
>>>> > Especially the part about "don't say program XXX doesn't
>>>> > work unless you are *absolutely* sure about it."
>
>>>> > Cheers,
>
>>>> > David
>>>> > --
>>>> > David Fanning, Ph.D.
>>>> > Fanning Software Consulting, Inc.
>>>> > Coyote's Guide to IDL Programming:http://www.dfanning.com/
>>>> > Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>>>> I compiled gettok, mrd_skip, strnumber, sxaddpar, sxdelpar, sxpar,
>>>> valid_num, and readfits. They all worked. Then I run readfits and it
>>>> does not work.
>
>>> How does it fail then?
>
>>> Paolo- Hide quoted text -
>
>>> - Show quoted text -
>
>> Hello Paolo,
>> how are you?
>
>> Here is what I get as error message:
>> It is not able to locate any of the files. I am not sure how to pick/
>> search for them.
>
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\readfits.pro"
>> Compiled module: READFITS.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\readfits.pro"
>> Compiled module: READFITS.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\strnumber.pro"
>> Compiled module: STRNUMBER.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\sxaddpar.pro"
>> Compiled module: SXADDPAR.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\sxdelpar.pro"
>> Compiled module: SXDELPAR.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\sxpar.pro"
>> Compiled module: SXPAR.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\tbget.pro"
>> Compiled module: TBGET.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\valid_num.pro"
>> Compiled module: VALID_NUM.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\ftget.pro"
>> Compiled module: FTGET.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\gettok.pro"
>> Compiled module: GETTOK.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\mrd_skip.pro"
>> Compiled module: MRD_SKIP.
>> IDL> files=['S_08189493.fit','S_08189494.fit','S_08189495.fit',
>> 'S_08189496.fit'] ;
>> IDL> sum = READFITS( files[0], /NOSCALE)
>> READFITS: ERROR - Unable to locate file S_08189493.fit- Hide quoted text -
>
> - Show quoted text -
Hello Paolo,
Thank you for your help.
Griffons
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63391 is a reply to message #63390] |
Thu, 06 November 2008 12:16  |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
I think you may have been confused by the posts
about automatically locate files.... these are important for
IDL source code, but when you are dealing with data,
you have to spacifiy the full path.
Normally I use something as
file=dir+filename
such that when I need to move the files somewhere else
I only need to change the dir in one place.
Ciao,
Paolo
Griffons wrote:
> On Nov 6, 2:35�pm, Paolo <pgri...@gmail.com> wrote:
>> Griffons wrote:
>>> On Nov 6, 1:57 pm, David Fanning <n...@dfanning.com> wrote:
>>>> Griffons writes:
>>>> > Thank you for your help.
>>>> > I compiled all the procedures related to readfits and writefits.
>>>> > When I run readfits, it gives this error:
>>>> > Attempt to call undefined procedure/function: 'READFITS'.
>>>> > Execution halted at: $MAIN$
>>
>>>> > As a result, the files cannot be read when they are called:
>>>> > files=3D['test1.fits','test2.fits',...] ; I tried files_search it does
>>>> > not work.
>>
>>>> > writefits work when is run.
>>
>>>> > What could I do?
>>
>>>> The next step is to read this article:
>>
>>>> http://www.catb.org/~esr/faqs/smart-questions.html
>>
>>>> Especially the part about "don't say program XXX doesn't
>>>> work unless you are *absolutely* sure about it."
>>
>>>> Cheers,
>>
>>>> David
>>>> --
>>>> David Fanning, Ph.D.
>>>> Fanning Software Consulting, Inc.
>>>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>>>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>>
>>> I compiled gettok, mrd_skip, strnumber, sxaddpar, sxdelpar, sxpar,
>>> valid_num, and readfits. �They all worked. Then I run readfits and it
>>> does not work.
>>
>> How does it fail then?
>>
>> Paolo- Hide quoted text -
>>
>> - Show quoted text -
>
> Hello Paolo,
> how are you?
>
> Here is what I get as error message:
> It is not able to locate any of the files. I am not sure how to pick/
> search for them.
>
>
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\readfits.pro"
> Compiled module: READFITS.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\readfits.pro"
> Compiled module: READFITS.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\strnumber.pro"
> Compiled module: STRNUMBER.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\sxaddpar.pro"
> Compiled module: SXADDPAR.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\sxdelpar.pro"
> Compiled module: SXDELPAR.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\sxpar.pro"
> Compiled module: SXPAR.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\tbget.pro"
> Compiled module: TBGET.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\valid_num.pro"
> Compiled module: VALID_NUM.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\ftget.pro"
> Compiled module: FTGET.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\gettok.pro"
> Compiled module: GETTOK.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\mrd_skip.pro"
> Compiled module: MRD_SKIP.
> IDL> files=['S_08189493.fit','S_08189494.fit','S_08189495.fit',
> 'S_08189496.fit'] ;
> IDL> sum = READFITS( files[0], /NOSCALE)
> READFITS: ERROR - Unable to locate file S_08189493.fit
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63392 is a reply to message #63391] |
Thu, 06 November 2008 12:14  |
Griffons
Messages: 15 Registered: November 2008
|
Junior Member |
|
|
On Nov 6, 12:32 pm, Wox <s...@nomail.com> wrote:
> On Thu, 6 Nov 2008 09:14:30 -0800 (PST), Griffons
>
> <griffon...@gmail.com> wrote:
>> 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?
>
> files=['test1.fits','test2.fits',...] ; use e.g. file_search for this
> sum = READFITS( files[0], /NOSCALE)
> for i=1,n_elements(files)-1 do $
> sum += READFITS( files[i], /NOSCALE)
> writefits, 'sum_filename', sum
>
> Both readfits and writefits depend on some other procedures from the
> ASTRO library. Make sure you compiled them too.
Hello Wox,
Thank you very much for your help.
It works well now.
Griffons
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63393 is a reply to message #63392] |
Thu, 06 November 2008 12:13  |
Griffons
Messages: 15 Registered: November 2008
|
Junior Member |
|
|
On Nov 6, 2:50 pm, "R.G. Stockwell" <notha...@noemail.com> wrote:
> "Griffons" <griffon...@gmail.com> wrote in message
>
> news:dd8c46c9-8ac9-435f-8822-b549d7ba118a@d10g2000pra.google groups.com...
> ...
>
>> IDL> files=['S_08189493.fit','S_08189494.fit','S_08189495.fit',
>> 'S_08189496.fit'] ;
>> IDL> sum = READFITS( files[0], /NOSCALE)
>> READFITS: ERROR - Unable to locate file S_08189493.fit
>
> well, if you don't know where your files are, how is
> IDL supposed to know?
>
> This means that the file is not in your current directory.
> Include the full path for the file, and it should work.
>
> Cheers,
> bob
Hi Bob,
Thank you very much.
It works now.
Griffons
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63394 is a reply to message #63393] |
Thu, 06 November 2008 12:12  |
Griffons
Messages: 15 Registered: November 2008
|
Junior Member |
|
|
On Nov 6, 2:53 pm, Chris <beaum...@ifa.hawaii.edu> wrote:
> On Nov 6, 9:38 am, Griffons <griffon...@gmail.com> wrote:
>
>
>
>
>
>> On Nov 6, 2:35 pm, Paolo <pgri...@gmail.com> wrote:
>
>>> Griffons wrote:
>>>> On Nov 6, 1:57 pm, David Fanning <n...@dfanning.com> wrote:
>>>> > Griffons writes:
>>>> > > Thank you for your help.
>>>> > > I compiled all the procedures related to readfits and writefits.
>>>> > > When I run readfits, it gives this error:
>>>> > > Attempt to call undefined procedure/function: 'READFITS'.
>>>> > > Execution halted at: $MAIN$
>
>>>> > > As a result, the files cannot be read when they are called:
>>>> > > files=3D['test1.fits','test2.fits',...] ; I tried files_search it does
>>>> > > not work.
>
>>>> > > writefits work when is run.
>
>>>> > > What could I do?
>
>>>> > The next step is to read this article:
>
>>>> >http://www.catb.org/~esr/faqs/smart-questions.html
>
>>>> > Especially the part about "don't say program XXX doesn't
>>>> > work unless you are *absolutely* sure about it."
>
>>>> > Cheers,
>
>>>> > David
>>>> > --
>>>> > David Fanning, Ph.D.
>>>> > Fanning Software Consulting, Inc.
>>>> > Coyote's Guide to IDL Programming:http://www.dfanning.com/
>>>> > Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>>>> I compiled gettok, mrd_skip, strnumber, sxaddpar, sxdelpar, sxpar,
>>>> valid_num, and readfits. They all worked. Then I run readfits and it
>>>> does not work.
>
>>> How does it fail then?
>
>>> Paolo- Hide quoted text -
>
>>> - Show quoted text -
>
>> Hello Paolo,
>> how are you?
>
>> Here is what I get as error message:
>> It is not able to locate any of the files. I am not sure how to pick/
>> search for them.
>
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\readfits.pro"
>> Compiled module: READFITS.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\readfits.pro"
>> Compiled module: READFITS.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\strnumber.pro"
>> Compiled module: STRNUMBER.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\sxaddpar.pro"
>> Compiled module: SXADDPAR.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\sxdelpar.pro"
>> Compiled module: SXDELPAR.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\sxpar.pro"
>> Compiled module: SXPAR.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\tbget.pro"
>> Compiled module: TBGET.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\valid_num.pro"
>> Compiled module: VALID_NUM.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\ftget.pro"
>> Compiled module: FTGET.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\gettok.pro"
>> Compiled module: GETTOK.
>> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
>> \Data_Reduction\code\READFITS_code\mrd_skip.pro"
>> Compiled module: MRD_SKIP.
>> IDL> files=['S_08189493.fit','S_08189494.fit','S_08189495.fit',
>> 'S_08189496.fit'] ;
>> IDL> sum = READFITS( files[0], /NOSCALE)
>> READFITS: ERROR - Unable to locate file S_08189493.fit
>
> It doesn't know where this file is - probably because it is in a
> folder IDL doesn't know about. IDL has a list of directories that it
> looks for whenever trying to read or run anything (this is also how
> you get around manually compiling all of these files -IDL
> automatically looks in these folders and will automatically compile
> the code it needs to if it can find it). I have an older version of
> IDL, but there should be something like edit->preferences in IDL.
> Then, find the tab called 'path', choose to add a new directory to the
> path, and then add in all of the folders where you keep IDL code or
> files you want IDL to read. Then, things should compile and read much
> more easily. Note, you should be able to check a box that searches in
> all of the subdirectories of a given folder as well.
>
> Once you set up these paths, go ahead and dump the ENTIRE IDL astro
> library in one of the folders in your path. Then, you never need to
> worry about compiling them again.
>
> chris- Hide quoted text -
>
> - Show quoted text -
Hi Chris,
Thank you for your help.
Griffons
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63395 is a reply to message #63394] |
Thu, 06 November 2008 11:53  |
Chris[6]
Messages: 84 Registered: July 2008
|
Member |
|
|
On Nov 6, 9:38 am, Griffons <griffon...@gmail.com> wrote:
> On Nov 6, 2:35 pm, Paolo <pgri...@gmail.com> wrote:
>
>
>
>> Griffons wrote:
>>> On Nov 6, 1:57 pm, David Fanning <n...@dfanning.com> wrote:
>>>> Griffons writes:
>>>> > Thank you for your help.
>>>> > I compiled all the procedures related to readfits and writefits.
>>>> > When I run readfits, it gives this error:
>>>> > Attempt to call undefined procedure/function: 'READFITS'.
>>>> > Execution halted at: $MAIN$
>
>>>> > As a result, the files cannot be read when they are called:
>>>> > files=3D['test1.fits','test2.fits',...] ; I tried files_search it does
>>>> > not work.
>
>>>> > writefits work when is run.
>
>>>> > What could I do?
>
>>>> The next step is to read this article:
>
>>>> http://www.catb.org/~esr/faqs/smart-questions.html
>
>>>> Especially the part about "don't say program XXX doesn't
>>>> work unless you are *absolutely* sure about it."
>
>>>> Cheers,
>
>>>> David
>>>> --
>>>> David Fanning, Ph.D.
>>>> Fanning Software Consulting, Inc.
>>>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>>>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>>> I compiled gettok, mrd_skip, strnumber, sxaddpar, sxdelpar, sxpar,
>>> valid_num, and readfits. They all worked. Then I run readfits and it
>>> does not work.
>
>> How does it fail then?
>
>> Paolo- Hide quoted text -
>
>> - Show quoted text -
>
> Hello Paolo,
> how are you?
>
> Here is what I get as error message:
> It is not able to locate any of the files. I am not sure how to pick/
> search for them.
>
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\readfits.pro"
> Compiled module: READFITS.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\readfits.pro"
> Compiled module: READFITS.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\strnumber.pro"
> Compiled module: STRNUMBER.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\sxaddpar.pro"
> Compiled module: SXADDPAR.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\sxdelpar.pro"
> Compiled module: SXDELPAR.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\sxpar.pro"
> Compiled module: SXPAR.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\tbget.pro"
> Compiled module: TBGET.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\valid_num.pro"
> Compiled module: VALID_NUM.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\ftget.pro"
> Compiled module: FTGET.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\gettok.pro"
> Compiled module: GETTOK.
> IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
> \Data_Reduction\code\READFITS_code\mrd_skip.pro"
> Compiled module: MRD_SKIP.
> IDL> files=['S_08189493.fit','S_08189494.fit','S_08189495.fit',
> 'S_08189496.fit'] ;
> IDL> sum = READFITS( files[0], /NOSCALE)
> READFITS: ERROR - Unable to locate file S_08189493.fit
It doesn't know where this file is - probably because it is in a
folder IDL doesn't know about. IDL has a list of directories that it
looks for whenever trying to read or run anything (this is also how
you get around manually compiling all of these files -IDL
automatically looks in these folders and will automatically compile
the code it needs to if it can find it). I have an older version of
IDL, but there should be something like edit->preferences in IDL.
Then, find the tab called 'path', choose to add a new directory to the
path, and then add in all of the folders where you keep IDL code or
files you want IDL to read. Then, things should compile and read much
more easily. Note, you should be able to check a box that searches in
all of the subdirectories of a given folder as well.
Once you set up these paths, go ahead and dump the ENTIRE IDL astro
library in one of the folders in your path. Then, you never need to
worry about compiling them again.
chris
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63397 is a reply to message #63395] |
Thu, 06 November 2008 11:38  |
Griffons
Messages: 15 Registered: November 2008
|
Junior Member |
|
|
On Nov 6, 2:35 pm, Paolo <pgri...@gmail.com> wrote:
> Griffons wrote:
>> On Nov 6, 1:57 pm, David Fanning <n...@dfanning.com> wrote:
>>> Griffons writes:
>>>> Thank you for your help.
>>>> I compiled all the procedures related to readfits and writefits.
>>>> When I run readfits, it gives this error:
>>>> Attempt to call undefined procedure/function: 'READFITS'.
>>>> Execution halted at: $MAIN$
>
>>>> As a result, the files cannot be read when they are called:
>>>> files=3D['test1.fits','test2.fits',...] ; I tried files_search it does
>>>> not work.
>
>>>> writefits work when is run.
>
>>>> What could I do?
>
>>> The next step is to read this article:
>
>>> http://www.catb.org/~esr/faqs/smart-questions.html
>
>>> Especially the part about "don't say program XXX doesn't
>>> work unless you are *absolutely* sure about it."
>
>>> Cheers,
>
>>> David
>>> --
>>> David Fanning, Ph.D.
>>> Fanning Software Consulting, Inc.
>>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>> I compiled gettok, mrd_skip, strnumber, sxaddpar, sxdelpar, sxpar,
>> valid_num, and readfits. They all worked. Then I run readfits and it
>> does not work.
>
> How does it fail then?
>
> Paolo- Hide quoted text -
>
> - Show quoted text -
Hello Paolo,
how are you?
Here is what I get as error message:
It is not able to locate any of the files. I am not sure how to pick/
search for them.
IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
\Data_Reduction\code\READFITS_code\readfits.pro"
Compiled module: READFITS.
IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
\Data_Reduction\code\READFITS_code\readfits.pro"
Compiled module: READFITS.
IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
\Data_Reduction\code\READFITS_code\strnumber.pro"
Compiled module: STRNUMBER.
IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
\Data_Reduction\code\READFITS_code\sxaddpar.pro"
Compiled module: SXADDPAR.
IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
\Data_Reduction\code\READFITS_code\sxdelpar.pro"
Compiled module: SXDELPAR.
IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
\Data_Reduction\code\READFITS_code\sxpar.pro"
Compiled module: SXPAR.
IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
\Data_Reduction\code\READFITS_code\tbget.pro"
Compiled module: TBGET.
IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
\Data_Reduction\code\READFITS_code\valid_num.pro"
Compiled module: VALID_NUM.
IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
\Data_Reduction\code\READFITS_code\ftget.pro"
Compiled module: FTGET.
IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
\Data_Reduction\code\READFITS_code\gettok.pro"
Compiled module: GETTOK.
IDL> .COMPILE "C:\Documents and Settings\Owner\My Documents
\Data_Reduction\code\READFITS_code\mrd_skip.pro"
Compiled module: MRD_SKIP.
IDL> files=['S_08189493.fit','S_08189494.fit','S_08189495.fit',
'S_08189496.fit'] ;
IDL> sum = READFITS( files[0], /NOSCALE)
READFITS: ERROR - Unable to locate file S_08189493.fit
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63398 is a reply to message #63397] |
Thu, 06 November 2008 11:35  |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
Griffons wrote:
> On Nov 6, 1:57�pm, David Fanning <n...@dfanning.com> wrote:
>> Griffons writes:
>>> Thank you for your help.
>>> I compiled all the procedures related to readfits and writefits.
>>> When I run readfits, it gives this error:
>>> Attempt to call undefined procedure/function: 'READFITS'.
>>> Execution halted at: $MAIN$
>>
>>> As a result, the files cannot be read when they are called:
>>> files=3D['test1.fits','test2.fits',...] ; �I tried files_search it does
>>> not work.
>>
>>> writefits work when is run.
>>
>>> What could I do?
>>
>> The next step is to read this article:
>>
>> � http://www.catb.org/~esr/faqs/smart-questions.html
>>
>> Especially the part about "don't say program XXX doesn't
>> work unless you are *absolutely* sure about it."
>>
>> Cheers,
>>
>> David
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
> I compiled gettok, mrd_skip, strnumber, sxaddpar, sxdelpar, sxpar,
> valid_num, and readfits. They all worked. Then I run readfits and it
> does not work.
How does it fail then?
Paolo
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63399 is a reply to message #63398] |
Thu, 06 November 2008 11:08  |
Griffons
Messages: 15 Registered: November 2008
|
Junior Member |
|
|
On Nov 6, 1:57 pm, David Fanning <n...@dfanning.com> wrote:
> Griffons writes:
>> Thank you for your help.
>> I compiled all the procedures related to readfits and writefits.
>> When I run readfits, it gives this error:
>> Attempt to call undefined procedure/function: 'READFITS'.
>> Execution halted at: $MAIN$
>
>> As a result, the files cannot be read when they are called:
>> files=3D['test1.fits','test2.fits',...] ; I tried files_search it does
>> not work.
>
>> writefits work when is run.
>
>> What could I do?
>
> The next step is to read this article:
>
> http://www.catb.org/~esr/faqs/smart-questions.html
>
> Especially the part about "don't say program XXX doesn't
> work unless you are *absolutely* sure about it."
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
I compiled gettok, mrd_skip, strnumber, sxaddpar, sxdelpar, sxpar,
valid_num, and readfits. They all worked. Then I run readfits and it
does not work.
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63401 is a reply to message #63399] |
Thu, 06 November 2008 10:57  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Griffons writes:
> Thank you for your help.
> I compiled all the procedures related to readfits and writefits.
> When I run readfits, it gives this error:
> Attempt to call undefined procedure/function: 'READFITS'.
> Execution halted at: $MAIN$
>
> As a result, the files cannot be read when they are called:
> files=3D['test1.fits','test2.fits',...] ; I tried files_search it does
> not work.
>
> writefits work when is run.
>
> What could I do?
The next step is to read this article:
http://www.catb.org/~esr/faqs/smart-questions.html
Especially the part about "don't say program XXX doesn't
work unless you are *absolutely* sure about it."
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63402 is a reply to message #63401] |
Thu, 06 November 2008 10:54  |
Griffons
Messages: 15 Registered: November 2008
|
Junior Member |
|
|
On Nov 6, 12:53 pm, Christopher Thom <ct...@oddjob.uchicago.edu>
wrote:
> Quoth Wox:
>
>> On Thu, 6 Nov 2008 09:14:30 -0800 (PST), Griffons
>> <griffon...@gmail.com> wrote:
>
>>> 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?
>
>> files=['test1.fits','test2.fits',...] ; use e.g. file_search for this
>> sum = READFITS( files[0], /NOSCALE)
>> for i=1,n_elements(files)-1 do $
>> sum += READFITS( files[i], /NOSCALE)
>> writefits, 'sum_filename', sum
>
>> Both readfits and writefits depend on some other procedures from the
>> ASTRO library. Make sure you compiled them too.
>
> And a minor point to add...be clear that you really want to specify the
> /NOSCALE option. If the fits images have BSCALE and BZERO set in the
> header, then you may want them scaled appropriately before summing...
>
> cheers
> chris
Thank you for your help Chris.
Griffons
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63403 is a reply to message #63402] |
Thu, 06 November 2008 10:52  |
Griffons
Messages: 15 Registered: November 2008
|
Junior Member |
|
|
On Nov 6, 12:35 pm, David Fanning <n...@dfanning.com> wrote:
> Griffons writes:
>> 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?
>
> Usually, the next step is to read the documentation headers.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Thank you for your help.
Griffons
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63404 is a reply to message #63403] |
Thu, 06 November 2008 10:52  |
Griffons
Messages: 15 Registered: November 2008
|
Junior Member |
|
|
On Nov 6, 12:32 pm, Wox <s...@nomail.com> wrote:
> On Thu, 6 Nov 2008 09:14:30 -0800 (PST), Griffons
>
> <griffon...@gmail.com> wrote:
>> 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?
>
> files=['test1.fits','test2.fits',...] ; use e.g. file_search for this
> sum = READFITS( files[0], /NOSCALE)
> for i=1,n_elements(files)-1 do $
> sum += READFITS( files[i], /NOSCALE)
> writefits, 'sum_filename', sum
>
> Both readfits and writefits depend on some other procedures from the
> ASTRO library. Make sure you compiled them too.
Thank you for your help.
I compiled all the procedures related to readfits and writefits.
When I run readfits, it gives this error:
Attempt to call undefined procedure/function: 'READFITS'.
Execution halted at: $MAIN$
As a result, the files cannot be read when they are called:
files=['test1.fits','test2.fits',...] ; I tried files_search it does
not work.
writefits work when is run.
What could I do?
|
|
|
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
|
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63413 is a reply to message #63411] |
Thu, 06 November 2008 09:32  |
Wout De Nolf
Messages: 194 Registered: October 2008
|
Senior Member |
|
|
On Thu, 6 Nov 2008 09:14:30 -0800 (PST), Griffons
<griffons76@gmail.com> wrote:
> 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?
files=['test1.fits','test2.fits',...] ; use e.g. file_search for this
sum = READFITS( files[0], /NOSCALE)
for i=1,n_elements(files)-1 do $
sum += READFITS( files[i], /NOSCALE)
writefits, 'sum_filename', sum
Both readfits and writefits depend on some other procedures from the
ASTRO library. Make sure you compiled them too.
|
|
|
Re: How to add several *.fit files (matrices) into one output *.fit file? [message #63415 is a reply to message #63413] |
Thu, 06 November 2008 09:14  |
Griffons
Messages: 15 Registered: November 2008
|
Junior Member |
|
|
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?
|
|
|
|