Re: What's HISTOGRAM doing now? [message #73086] |
Fri, 22 October 2010 07:21  |
Mrunmayee
Messages: 24 Registered: May 2009
|
Junior Member |
|
|
On Oct 22, 5:12 pm, David Fanning <n...@dfanning.com> wrote:
> Mrunmayee writes:
>> Why are bins different? Output is unchaged for log bins when I am
>> histo-ing alog10(data) with corresponding log bins. Also, instead of
>> using BINSIZE, if I use NBINS in program, things work as they should.
>> So what's histogram upto NOW? Where am I missing something?
>
> The most common reason for histogram to produce
> strange results is a data type mismatch
> between the data and the value you pass in
> for the binsize. The documentation mentions
> they have to be the same data type, but this
> is a strange requirement for IDL users, who
> most of the time could care less about data
> type.
Thanks, David.
In general, I try to pay attention to datatype matching, but I didn't
know this requirement for histogram. In my tester code, though, data
types *are* same. If I put help statement, to just check, I do get
both - data and binsize - as float. So where is the discrepancy? For
the time being I solved my problem using Nbins since it was giving me
what I wanted. But I thought I understood histogram at least to *some*
extent. Apparently, it can still baffle me.
Also, as a sidenote, why is it considered better than for loops? That
is, how is it optimized? Or is it some water that I better not enter?
I keep trying to convince people around me that IDL way is faster but
I don't know whether it is faster than programming in other languages.
Any pointer would be appreciated.
Of course, main question is the title of this topic anyway.
|
|
|