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

Home » Public Forums » archive » Re: array index summations
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: array index summations [message #69189] Fri, 18 December 2009 10:48 Go to next message
H. Evans is currently offline  H. Evans
Messages: 18
Registered: December 2009
Junior Member
On Dec 18, 7:35 pm, David Fanning <n...@dfanning.com> wrote:
> H. Evans writes:
>> The difference is that the histogramming functions count the number of
>> points in the bins, i.e. the number of points between x and x+width.
>> Whereas the CONGRID, GRIDDATA, REBIN functions interpolate the data
>> points to an X-Y grid.
>
>> This function performs statistics on the contents of the Z vector,
>> i.e. what is the mean value of the data points in the range x->x+dx,
>> not how many data points are in the range X->x+dx, which the histogram
>> function provides. In other words, it finds the data points that are
>> in the bin, and then sums up the Z values in that bin.
>
>> If the histogram function provided a weighting function to the
>> counting, then this could be used to sum the Z values in the bin.
>
> I'm not following this closely, but I think the point is
> that HIST_ND could tell you which voxels were in each
> XY bin, and you could then perform your own statistics
> or weighting function on those values, however you liked.
>
> This would reduce the complexity of your code significantly.

Hi,

Finding the indices of the data points in a 2d bin is not the hard
part. What I'm trying to avoid is having a FOR loop that iterates over
the bins doing the statistics on the data points that are in a bin.

Ta.
Hugh
Re: array index summations [message #69190 is a reply to message #69189] Fri, 18 December 2009 10:35 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
H. Evans writes:

> The difference is that the histogramming functions count the number of
> points in the bins, i.e. the number of points between x and x+width.
> Whereas the CONGRID, GRIDDATA, REBIN functions interpolate the data
> points to an X-Y grid.
>
> This function performs statistics on the contents of the Z vector,
> i.e. what is the mean value of the data points in the range x->x+dx,
> not how many data points are in the range X->x+dx, which the histogram
> function provides. In other words, it finds the data points that are
> in the bin, and then sums up the Z values in that bin.
>
> If the histogram function provided a weighting function to the
> counting, then this could be used to sum the Z values in the bin.

I'm not following this closely, but I think the point is
that HIST_ND could tell you which voxels were in each
XY bin, and you could then perform your own statistics
or weighting function on those values, however you liked.

This would reduce the complexity of your code significantly.

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.")
Re: array index summations [message #69191 is a reply to message #69190] Fri, 18 December 2009 10:28 Go to previous messageGo to next message
H. Evans is currently offline  H. Evans
Messages: 18
Registered: December 2009
Junior Member
On Dec 18, 6:00 pm, Gianguido Cianci <gianguido.cia...@gmail.com>
wrote:
> On Dec 18, 5:07 am, "H. Evans" <bloggs...@googlemail.com> wrote:
>
>> I have a time-series data set, effectively a 3-vector (x,y,z), where
>> the Z values are to be binned into a 2D array along X/Y.
>
> Isn't this what hist_nd.pro was invented for? or for that matter, the
> inbuilt hist_2d? or am I missing something?
>
> Gianguido

The difference is that the histogramming functions count the number of
points in the bins, i.e. the number of points between x and x+width.
Whereas the CONGRID, GRIDDATA, REBIN functions interpolate the data
points to an X-Y grid.

This function performs statistics on the contents of the Z vector,
i.e. what is the mean value of the data points in the range x->x+dx,
not how many data points are in the range X->x+dx, which the histogram
function provides. In other words, it finds the data points that are
in the bin, and then sums up the Z values in that bin.

If the histogram function provided a weighting function to the
counting, then this could be used to sum the Z values in the bin.

Ta,
Hugh
Re: array index summations [message #69194 is a reply to message #69191] Fri, 18 December 2009 09:00 Go to previous messageGo to next message
cgguido is currently offline  cgguido
Messages: 195
Registered: August 2005
Senior Member
On Dec 18, 5:07 am, "H. Evans" <bloggs...@googlemail.com> wrote:
> I have a time-series data set, effectively a 3-vector (x,y,z), where
> the Z values are to be binned into a 2D array along X/Y.

Isn't this what hist_nd.pro was invented for? or for that matter, the
inbuilt hist_2d? or am I missing something?

Gianguido
Re: array index summations [message #69198 is a reply to message #69194] Fri, 18 December 2009 06:11 Go to previous messageGo to next message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
Hi,
I would try to compute the *self.zsum by using total(z[ii],/
cumulative) and so on.

Hope it helps

CR
Re: array index summations [message #69365 is a reply to message #69189] Tue, 29 December 2009 20:58 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Dec 18, 1:48 pm, "H. Evans" <bloggs...@googlemail.com> wrote:
> On Dec 18, 7:35 pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
>
>
>> H. Evans writes:
>>> The difference is that the histogramming functions count the number of
>>> points in the bins, i.e. the number of points between x and x+width.
>>> Whereas the CONGRID, GRIDDATA, REBIN functions interpolate the data
>>> points to an X-Y grid.
>
>>> This function performs statistics on the contents of the Z vector,
>>> i.e. what is the mean value of the data points in the range x->x+dx,
>>> not how many data points are in the range X->x+dx, which the histogram
>>> function provides. In other words, it finds the data points that are
>>> in the bin, and then sums up the Z values in that bin.
>
>>> If the histogram function provided a weighting function to the
>>> counting, then this could be used to sum the Z values in the bin.
>
>> I'm not following this closely, but I think the point is
>> that HIST_ND could tell you which voxels were in each
>> XY bin, and you could then perform your own statistics
>> or weighting function on those values, however you liked.
>
>> This would reduce the complexity of your code significantly.
>
> Hi,
>
> Finding the indices of the data points in a 2d bin is not the hard
> part. What I'm trying to avoid is having a FOR loop that iterates over
> the bins doing the statistics on the data points that are in a bin.
>
> Ta.
> Hugh

As often seems the case, I think this article might help:

http://www.dfanning.com/code_tips/drizzling.html

-Jeremy.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Convolve a spectrum (from MODTRAN) with a spectral response function
Next Topic: polar contour plot

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

Current Time: Wed Oct 08 13:49:31 PDT 2025

Total time taken to generate the page: 0.00493 seconds