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

Home » Public Forums » archive » keyword params in HISTOGRAM
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: keyword params in HISTOGRAM [message #7609 is a reply to message #7546] Tue, 03 December 1996 00:00 Go to previous message
Robert Moss is currently offline  Robert Moss
Messages: 74
Registered: February 1996
Member
Mark Fardal wrote:
>
> Hi,
>
> I'm sure this is a stupid question, but I can't figure it out.
> Normally when you pass keyword parameters, you can pass something
> that's undefined, right? As in this example
>
> pro junk1, a, test=test
> help,test,t
> ;junk2, a, test=test ; either one of
> junk2, a, test=t ; these works
> return
> end
>
> pro junk2, a, test=test
>
> a = 3.
> return
> end
>
> IDL> junk1, a
> TEST UNDEFINED = <Undefined>
> T UNDEFINED = <Undefined>
> IDL>
>
> However, when I try to pass HISTOGRAM a keyword parameter that's
> undefined, I get an error message. The routine here is just a
> wrapper function for HISTOGRAM, so I want to pass a number of
> keyword parameters through to it.
>
> function histomake, array, binsize=binsize, xpoints=xpoints, $
> input=input, min=min, max=max, omin=omin, omax=omax, reverse=reverse
> [...stuff deleted...]
>
> n = histogram(array, binsize=binsize, min=min, max=max, $
> omin=omin, omax=omax, reverse=reverse)
>
> [...stuff deleted...]
> return
> end
>
> IDL> h = histomake(array, bins=10, xpoints=xpoints)
> % HISTOGRAM: Variable is undefined: MAX.
> % Execution halted at: HISTOMAKE 52
> /users1/casa/fardal/comp/idl/histomake.pro
> % $MAIN$
>
> Why is the behavior different here?
>
> Thanks,
> Mark

Your junk example "works" because you are not trying to actually do
anything with the test variable in the junk2 routine... hence no error
occurs.

The HISTOGRAM routine _is_ trying to do something with its keywords, so
you get an error. I see two reasonable solutions:

1) If you are not using the min, max, etc keywords in the histomake
function itself, rather than making them explicit keywords, use keyword
inheritance ( the _EXTRA keyword) to pass them to HISTOGRAM. (See EXTRA
in the online help).

2) Use the CALL_FUNCTION (faster) or EXECUTE (slower) method to call
HISTOGRAM inside your makeohist function so that it is called with only
the relevant and proper keywords.

At a guess, I'd say that solution 1) is the way to go in general...
keyword inheritance is a Good Thing.


--
Robert M. Moss, Ph.D. - mossrm@texaco.com - FAX (713)954-6911
------------------------------------------------------------ -----
This does not necessarily reflect the opinions of Texaco Inc.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: How do people print .ps and .pcl files on windows95
Next Topic: Re: Relative strengths: IDL vs. PV-Wave ?

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

Current Time: Sat Oct 11 08:36:45 PDT 2025

Total time taken to generate the page: 1.60044 seconds