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

Home » Public Forums » archive » Re: .Reset_Session in a script
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
Re: .Reset_Session in a script [message #48950] Wed, 07 June 2006 16:35
Chris[2] is currently offline  Chris[2]
Messages: 39
Registered: August 2003
Member
Just as an aside, if you're doing this in IDL63, you could use the
IDL_IDLBridge object to run each script in a separate "clean" session of
IDL. This is also useful when you want to build multiple .sav files (with
IDL code) and you need to have a clean IDL session for each .sav file.

So for example,

o=Obj_New('IDL_IDLBridge')
o->Execute, "myscript, 'datafile1' "
Obj_Destroy, o
o=Obj_New('IDL_IDLBridge')
o->Execute, "myscript, 'datafile2' "
Obj_Destroy, o

If you use the /NOWAIT keyword then you could even have them all executing
simultaneously (although then you wouldn't want to destroy the object until
it finished...)

-Chris
ITT Visual Information Solutions


"toddbranch" <branch@lanl.gov> wrote in message
news:1149623443.901074.325330@g10g2000cwb.googlegroups.com.. .
> Hey all,
>
> Sorry to be back for help so soon.
>
> I have written a script to automatically run all of my data sets
> through my program. In my program, I define a few structures. I
> usually run the command .reset_session in between runs of my data
> because IDL gets mad because my code redefines the same structure. IDL
> won't let me run the .reset_session command in my script. Any ideas?
>
> Thanks a lot for the help,
> Branch
>
Re: .Reset_Session in a script [message #48970 is a reply to message #48950] Tue, 06 June 2006 13:31 Go to previous message
toddbranch is currently offline  toddbranch
Messages: 4
Registered: June 2006
Junior Member
Thanks everyone for your quick responses. I was using a script
(@script), but I wanted to use the .reset_session command many times.
Here was a piece of my code:

for i=0, size(int_arr, /n_elements)-1 do begin .reset_session &
map_to_geo & endfor

So, the .reset_session command could be used in the script, just not
within an IDL statement. It would have worked if I only wanted to
reset the session once.

I just realized that all of my structures were named, so this problem
can be solved if I just make all of my structures anonymous.

OK, I made all the structure anonymous and I am running the code right
now.......

And it works!

Thanks for the help everyone,
Branch
Re: .Reset_Session in a script [message #48972 is a reply to message #48970] Tue, 06 June 2006 13:15 Go to previous message
Benjamin Hornberger is currently offline  Benjamin Hornberger
Messages: 258
Registered: March 2004
Senior Member
toddbranch wrote:
> I have written a script to automatically run all of my data sets
> through my program. In my program, I define a few structures. I
> usually run the command .reset_session in between runs of my data
> because IDL gets mad because my code redefines the same structure. IDL
> won't let me run the .reset_session command in my script. Any ideas?

By "script", do you mean a regular procedure? I know that you can do
.reset_session in a batch file (which you run by @filename).

Plus, if you redefine the structure all the time, why use a named
structure? If you use an unnamed structure, you can redefine it as often
as you want.

Happy programming,
Benjamin
Re: .Reset_Session in a script [message #48973 is a reply to message #48972] Tue, 06 June 2006 13:19 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Michael Galloy wrote:
> toddbranch wrote:
>
>> Hey all,
>>
>> Sorry to be back for help so soon.
>>
>> I have written a script to automatically run all of my data sets
>> through my program. In my program, I define a few structures. I
>> usually run the command .reset_session in between runs of my data
>> because IDL gets mad because my code redefines the same structure. IDL
>> won't let me run the .reset_session command in my script. Any ideas?
>>
>> Thanks a lot for the help,
>> Branch
>>
>
> .reset_session is an executive command; executive commands (all of the
> commands that begin with a ".") can only be entered "in response to the
> IDL prompt" according to the docs. You can put an executive command in a
> batch file and call the file from the command line. For example, in the
> file "batch_run.pro" put:
>
> .reset_session
> start_real_run ; call to your existing program
>
> Then,
>
> IDL> @batch_run
>
> And it should work.

True, but I would suggest the OP address the problem (assuming it actually is one) of the
structure redefinition. So, pardon my denseness, but could the OP define what he means by
"redefines the same structure".

paulv

--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
Ph: (301)763-8000 x7748
Fax:(301)763-8545
Re: .Reset_Session in a script [message #48974 is a reply to message #48972] Tue, 06 June 2006 13:16 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
toddbranch wrote:
> Hey all,
>
> Sorry to be back for help so soon.
>
> I have written a script to automatically run all of my data sets
> through my program. In my program, I define a few structures. I
> usually run the command .reset_session in between runs of my data
> because IDL gets mad because my code redefines the same structure. IDL
> won't let me run the .reset_session command in my script. Any ideas?
>
> Thanks a lot for the help,
> Branch
>

.reset_session is an executive command; executive commands (all of the
commands that begin with a ".") can only be entered "in response to the
IDL prompt" according to the docs. You can put an executive command in a
batch file and call the file from the command line. For example, in the
file "batch_run.pro" put:

.reset_session
start_real_run ; call to your existing program

Then,

IDL> @batch_run

And it should work.

Mike
--
www.michaelgalloy.com
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL and the RAM memory
Next Topic: IDLgrLegend and ENABLE_FORMATTING

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

Current Time: Wed Oct 08 15:47:54 PDT 2025

Total time taken to generate the page: 0.00770 seconds