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

Home » Public Forums » archive » IDL save result of procedure to file
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
IDL save result of procedure to file [message #84751] Fri, 07 June 2013 10:18 Go to next message
quincyaflint is currently offline  quincyaflint
Messages: 6
Registered: June 2013
Junior Member
Hello,

I am trying to write and IDL procedure that will compute the difference image of two photographs from FITS files. The procedure will take the name of a folder, then loop through to compute the difference image of consecutive files within that folder. Then I want it to, once it has done the difference imaging, save the resulting image in a new destination of my choice. Currently I am able to make the image pop up in a new window using the tv,xxx command. I am unsure on how to (1) give the procedure a FOLDER that it will go through all the files and (2) I don't know how to save the resulting image in a new destination. I would greatly appreciate any help!

Thanks
Re: IDL save result of procedure to file [message #84754 is a reply to message #84751] Fri, 07 June 2013 11:33 Go to previous messageGo to next message
quincyaflint is currently offline  quincyaflint
Messages: 6
Registered: June 2013
Junior Member
I'm trying to use printf, but I'm not sure in what format this will save my image
Re: IDL save result of procedure to file [message #84755 is a reply to message #84754] Fri, 07 June 2013 11:44 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
quincyaflint@gmail.com writes:

> I'm trying to use printf, but I'm not sure in what format this will save my image

Well, you don't want that one, for sure.:-)

It is a text format. Not at all what you want. What format were you
hoping for?

For your other questions, you want to look up File_Search and
Dialog_Pickfile.

If you are new to programming, I would recommend Ken Bowman's book, An
Introduction to Programming with IDL. It will get you started on these
basic programming concepts.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: IDL save result of procedure to file [message #84756 is a reply to message #84755] Fri, 07 June 2013 11:49 Go to previous messageGo to next message
Andy Sayer is currently offline  Andy Sayer
Messages: 127
Registered: February 2009
Senior Member
You can use the 'save' procedure to save the data to an IDL .sav file.

The printf command will write data to a file in the format you specify. You probably want to be using save rather than printf, if I undertstand your posts correctly. See: http://www.exelisvis.com/docs/SAVE.html

If you're talking about saving an actual plot, rather than the data in it, that's a different question. If you want a jpeg or png then IDL has routines for that, e.g.: http://www.exelisvis.com/docs/WRITE_PNG.html (you'll also need to use tvrd before.)

If you want eps/pdf output then that involves a little more typing but is also pretty straightforward.

As to looping over files, you can do something like:

files=file_search(my_folder+'*.myformat',count=nfiles)

if nfiles gt 0 then begin
for i=0l,nfiles-1 do begin
(do your stuff here)
endfor
endif

Hope this helps,

Andy


On Friday, June 7, 2013 2:44:26 PM UTC-4, David Fanning wrote:
> quincyaflint@gmail.com writes:
>
>
>
>> I'm trying to use printf, but I'm not sure in what format this will save my image
>
>
>
> Well, you don't want that one, for sure.:-)
>
>
>
> It is a text format. Not at all what you want. What format were you
>
> hoping for?
>
>
>
> For your other questions, you want to look up File_Search and
>
> Dialog_Pickfile.
>
>
>
> If you are new to programming, I would recommend Ken Bowman's book, An
>
> Introduction to Programming with IDL. It will get you started on these
>
> basic programming concepts.
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: IDL save result of procedure to file [message #84758 is a reply to message #84755] Fri, 07 June 2013 11:58 Go to previous messageGo to next message
quincyaflint is currently offline  quincyaflint
Messages: 6
Registered: June 2013
Junior Member
Aaah yes,

I used printf and added the proper extension at the end of the file name and that did the trick.

Thanks!
Re: IDL save result of procedure to file [message #84759 is a reply to message #84755] Fri, 07 June 2013 12:00 Go to previous messageGo to next message
quincyaflint is currently offline  quincyaflint
Messages: 6
Registered: June 2013
Junior Member
This is what I ended up doing:

fit1 = '~quincy/Documents/19900103..rpb.vig.fts/19900103.214411.mk3 0.rpb.vig.fts'
fit2 = '~quincy/Documents/19900103..rpb.vig.fts/19900103.213500.mk3 0.rpb.vig.fts'
img1 = LASCO_READFITS(fit1,hr1)
img2 = LASCO_READFITS(fit2,hr2)
diff = img1 - img2
img_diff = bytscl(diff,max=1200,min=-1200)
img_395 = congrid(img_diff,395,395)

openw,1,'qtest19900103.214411.mk30.rpb.vig.fts'
printf,1,img_395
close,1
Re: IDL save result of procedure to file [message #84760 is a reply to message #84755] Fri, 07 June 2013 13:13 Go to previous messageGo to next message
quincyaflint is currently offline  quincyaflint
Messages: 6
Registered: June 2013
Junior Member
Hi Andy,

So I have figured out most of my loop. Is there a way for me to create a new folder within my documents from IDL? I'm wanting to create a folder with the name the files being read in, so I can easily just index the list if I knew a command for creating a file

Thanks
Re: IDL save result of procedure to file [message #84766 is a reply to message #84760] Fri, 07 June 2013 14:31 Go to previous message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
I think you're looking for this:

http://www.exelisvis.com/docs/FILE_MKDIR.html
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: putting file names into lists
Next Topic: Updating FFmpeg libraries on MacOS

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

Current Time: Wed Oct 08 15:14:26 PDT 2025

Total time taken to generate the page: 0.00481 seconds