Re: recording macros [message #35475 is a reply to message #35473] |
Thu, 19 June 2003 13:39   |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Dear Ben and Liam,
with journal only the call of the routines could be saved but what is if it
is a widget.
For widgets I have in principle a different solution.
I like to explain how it works in the plot_n widget but this is not an
object.
plot_n writes during execute all changes which are done by the widget into
an idl procedure. This is then executed by the widget by call_procedure and
did the resulting plot.
This could be read in again for initialisation of the widget and so on.
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/plot_n_dbase.pro.html
Therefore I am using the arg_present trick. plot_n calls it with output
by reading the stored information. Then only the structure is defined and if
a user would call it by plscript then it runs and makes the plot. See
example plscript.pro
I believe you have a structure which you can save first and later compare
for example by diff_struct
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/diff_struct_dbase.pro.html
IDL> d={file:'',set:1}
IDL> master=d
IDL> d.file='test.nc'
IDL> x=diff_struct(d,master)
IDL> help,x,/str
** Structure <840fc2c>, 1 tags, length=12, data length=12, refs=1:
FILE STRING 'test.nc'
Now you know which things are changed and you have only to setup the makro.
I would suggest to write a procedure as I did. Because then this could be
used without any additional routine to reproduce the result it could be
archived and the users could add idl commands if they like to do it.
PRO plscript, output
file=['ghost.nc']
name=['time','F12']
icgs=icgs_read(file,name)
plotprepare, plot
IF ARG_PRESENT(output) EQ 0 THEN plotinit,plot
plot.color=7
plot.psym=4
plot.x_use_units='UTC'
plot.y_use_units='ppt'
plot.xrange=[-9999.0000,6.0000000]
plot.xtitle='time [UTC]'
plot.yrange=[2.0000000,6.0000000]
plot.ytitle='mixing ratio [ppt]'
IF ARG_PRESENT(output) EQ 0 THEN update_valid_index,icgs,/ignore_quality
IF ARG_PRESENT(output) EQ 0 THEN $
plotxy,plot,x='time',y='F12',icg_struct=icgs
IF ARG_PRESENT(output) EQ 0 THEN plotend,plot
output={file:file,name:name,icgs:icgs,plot:plot}
END
regards
Reimar
Liam Gumley wrote:
> "Ben Tupper" <bentupper@bigelow.org> wrote in message
> news:3EF20160.6030007@bigelow.org...
>> Hi,
>>
>> We have an image processing/analysis package - it implements many of the
>> methods described in the handy "Image Processing in IDL" book - plus
>> other methods/tricks. The package can be run with or without a GUI and
>> it is all object based. We have to process a stack of images (up to
>> 7200 of 'em), but we only have to set up the image processing steps once
>> for each stack.
>>
>> How might I record the steps the user takes in a macro-like way? I want
>> to be able to save the macro to a file for use in later sessions. Has
>> this approach been tried in IDL? Any tips or heads-up appreciated.
>
> If it's run from the command line, could you use journalling, i.e.,
>
> IDL> journal, 'my_commands.pro' ; start journalling
> IDL> (user enters commands)
> IDL> journal ; stop journalling
>
> To replay the session:
>
> IDL> @my_commands.pro
>
> Cheers,
> Liam.
> Practical IDL Programming
> http://www.gumley.com/
--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
|
|
|