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

Home » Public Forums » archive » Re: HISTOGRAM data type bug?
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: HISTOGRAM data type bug? [message #71344 is a reply to message #71325] Mon, 14 June 2010 05:36 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
FĂ–LDY Lajos writes:

> From the docs:
> ----------
> BINSIZE
> Set this keyword to the size of the bin to use. If this keyword is not
> specified, and NBINS is not set, then a bin size of 1 is used. If NBINS is
> set, the default is BINSIZE = (MAX - MIN) / (NBINS - 1).
>
> Note
> The data type of the value specified for BINSIZE should match the data
> type of the Array argument. Since BINSIZE is converted to the data type of
> Array, specifying mismatched data types may produce undesired results.
> ----------
>
> So, your BINSIZE is 0 (calculated as ULONG). This may cause a 'divide by
> zero' crash. I think IDL forgets to check BINSIZE.

Crashing is only the most extreme of the bad things
that can happen if you don't match the binsize
variable with the data type of the argument. If
you don't believe me, try writing a wrapper for
the Histogram command and make it available on a
public forum. Your phone will soon be ringing off
the hook with people facing inexplicably wrong
results. :-)

It seems to me this is something ITTVIS might be
able to fix, especially in such a high profile
routine like HISTOGRAM. It's pretty disconcerting
to read the Note above after you have spent five
maddening hours trying to figure out why your
program doesn't work.

In the meantime, you might find the Coyote Library
routine Convert_to_Type of interest. It was created
specifically to solve this problem.

http://www.dfanning.com/programs/convert_to_type.pro

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: symbol font not expoting correctly to EPS from iplot in OSX
Next Topic: Re: Locating sequence of bytes within binary file

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

Current Time: Wed Oct 08 18:24:55 PDT 2025

Total time taken to generate the page: 0.00225 seconds