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

Home » Public Forums » archive » Re: 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
Re: Match Histogram Binsize with Data Type [message #83458 is a reply to message #83456] Tue, 05 March 2013 10:37 Go to previous messageGo to previous message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Hi David,

Regardless of the probably wrong things that have been published and
will be published in the future, I don't see the point of using a .5
binsize with integer data, and I don't think the behaviour of histogram
is defined in this case.

Following code is doing ok for example:

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

Cheers,

Fabien

On 03/05/2013 05:57 PM, David Fanning wrote:
> 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
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: From tvscale to cgImage, puzzling feature in the plot
Next Topic: Majority Filter

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

Current Time: Wed Oct 08 18:13:44 PDT 2025

Total time taken to generate the page: 0.00367 seconds