The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Message from discussion Simple question in IDL, looking for solution, thank you

From:
To:
Cc:
Followup To:
Subject:
 Validation: For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon.

More options Oct 23 2012, 6:20 pm
Newsgroups: comp.lang.idl-pvwave
From: Heinz Stege <public.215....@arcor.de>
Date: Wed, 24 Oct 2012 00:21:26 +0200
Local: Tues, Oct 23 2012 6:21 pm
Subject: Re: Simple question in IDL, looking for solution, thank you

On Tue, 23 Oct 2012 15:57:20 -0400, Jeremy Bailin wrote:
>A couple of notes:

>JBIU has a weighted histogram function:
>http://astroconst.org/jbiu/jbiu-doc/math/histogram_weight.html

This is really great. I have learned something new again. Thank you,
Jeremy.

For the documentation: Jeremy's way of "chunk indexing" goes the
following way:

h=histogram(arr,min=0,reverse_indices=ri)
sum=lonarr(size(h,/dimensions))
for i=0l,n_elements(h)-1 do \$
if h[i] gt 0 then sum[i]=total(bcg[ri[ri[i]:ri[i+1]-1]],/integer)
print,sum[1:*]

Small code, very fast, and low memory consumption. This is perfect.

Cheers, Heinz

>Regarding reverse_indices using lots of memory on sparse histograms: use
>VALUE_LOCATE!
>http://www.idlcoyote.com/code_tips/valuelocate.html

>-Jeremy.