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

Home » Public Forums » archive » Match Histogram Binsize with Data Type
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Match Histogram Binsize with Data Type [message #83459] Tue, 05 March 2013 08:57 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Folks,

I just spent an uncomfortable and depressing couple of hours either (1)
thinking I was going crazy or (2) convinced the IDL Histogram command
had a bug of such monumental proportions that any thinking person would
..., etc.

Boiled down, it amounted to me using a floating point binsize with
integer data. A BIG no-no when using the Histogram command. (I was
actually using HIST_2D, which provides no such warning in its
documentation.)

I can't stress this enough. You get INCORRECT values if you mismatch the
binsize and the data type. Let me say it again, you get INCORRECT
answers!

I'm just guessing, but it wouldn't surprise me to learn that the
Histogram command produces incorrect values 50% of the time, simply
because people don't realize the consequences of their thoughtless use
of the command. (Guess arrived at by personal experience.)

Wouldn't it be nice if there could be a warning about this somewhere?
Like, say, in the Histogram command itself.

Here is what I mean:

d = Fix(Scale_Vector(RandomU(-3L, 1000), 0, 360))
h1 = Histogram(d, Min=0, Max=360, BINSIZE=22.5)
h2 = Histogram(Float(d), Min=0.0, Max=360.0, BINSIZE=22.5)
cgPlot, h1
cgPlot, h2, Color='red', /overplot

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: cgblendimage without a window? - a bit stuck!
Next Topic: Interpolation and creating profiles from contour maps.

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

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

Total time taken to generate the page: 0.00447 seconds