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

Home » Public Forums » archive » Re: More fun
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: More fun [message #22484 is a reply to message #22481] Mon, 20 November 2000 00:00 Go to previous messageGo to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
"J.D. Smith" <jdsmith@astro.cornell.edu> writes:



> Here's one I just came up against. Suppose you want to rebin a vector
> to some smaller size, an integer factor smaller. E.g. 100 elements to
> 20 elements. Now, rather than the average of those elements in each
> interval, etc., you want merely the average of the first and last member
> of that interval. E.g., you want:

> [(v[0]+v[4])/2, (v[5]+v[9])/2, (v[10]+v[14])/2, ...]

> Rebin by itself can't work, I don't think.

> Takers?

> JD

> P.S. No for loops please. Bonus points if you don't build an explicit
> index list.

If the number of elements in the array is evenly divisible by the rebin factor
(such as 100 is evenly divisible by 5), then the following should work

TEMP = REFORM(ARRAY, M, N_ELEMENTS(ARRAY)/M)
RESULT = REFORM(TEMP(0,*) + TEMP(M-1,*)) / 2.

William Thompson
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL under PPCLinux?
Next Topic: Re: Distance calculation

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

Current Time: Sun Oct 12 02:38:06 PDT 2025

Total time taken to generate the page: 0.35788 seconds