Re: Discover the name (at calling level) of passed parameter [message #33972 is a reply to message #33969] |
Wed, 12 February 2003 03:05   |
Kristian Kjaer
Messages: 58 Registered: June 1998
|
Member |
|
|
Well, you asked for it:
<longish_explanation>
I particularly like the "I" of IDL.
I have a function ctasrd() that will read one of my data files and
return a structure containing the data.
IDL> a = ctasrd('dagq1234')
IDL> b = ctasrd('dagq1235')
IDL> c = ctasrd('dagq1236')
This will read the files 'dagq1234.dat' etc. and the resulting
structures, stored in a, b and c, in fact contain a tag with the name
and path of the data file (as Pavel suggests).
Now as I work with a,b,c, and many other data structures I'd have to
either remember which was which, or, to remind myself, do
IDL> print,a.text[0]
I prefer
IDL> dagq1234 = ctasrd('dagq1234')
, except that here I have twice to type the name dagq1234 (that is
meaningfull to me because the log book refers to it.)
But now I can change the syntax so I only need to type the name once:
IDL> tasget,dagq1234
Hooray!
I also like that IDL is command-based and I journal everything so that I
can easily replay commands or extract a useful batch file (or the
sceleton of a new procedure) from the journal file.
Other people like GUIs, and indeed, sometimes GUIs can replace complex
typing.
I (almost) have a GUI, XsetP (widget programming by Frank Bringezu), and
a command-line equivalent, SetP, that will create or modify a fit
parameter structure as used by Craig Markwardt's lsfit machines
mpfit.pro and mpfitfun.pro
Let's say p40 is a fit parameter structure that I want to modify before
letting mpfitfun loose again.
IDL> XSetP ,p40 ; and click and type in the GUI
The trouble with the GUI is that the IDL log window and journal file
will not reflect the changes made inside the GUI. If I want to do the
same thing again the next day I have to click and type similarly in the
GUI, and I don't have a record of what was done.
But now I can make it so that, on exit, XSetP echoes to the log window
and to the journal file the equivalent command:
SetP ,ParName='PkHeight_0' ,Value=2500 ,/unFIXed ,p40 ; , say
, complete with the correct variable name (p40).
Hooray again!
</longish_explanation>
- Kristian
Mark Hadfield wrote:
> Just curious: Why?
> Kristian.Kjaer@Risoe.DK wrote in message
> news:3E48F599.E7B18502@Risoe.DK...
>> I sometimes find myself wanting to know the name of a passed
>> parameter: At the called procedure level I need to know the name
>> that the parameter had at the calling level.
|
|
|