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

Home » Public Forums » archive » Re: How to average every nth data?
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: How to average every nth data? [message #73383 is a reply to message #73378] Thu, 04 November 2010 16:23 Go to previous messageGo to previous message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
On 4 Nov., 18:53, go cats <beardown...@gmail.com> wrote:
> Dear Gurus,
>
> Hope someone will help me how to figure this out.
> I've been keep trying to do some spectral resampling (just simple
> average) with ASD data.
> ASD data is a two dimensional array;
>
> wavelength    data
> 350             0.001146
> 351             0.001176
> 352             0.001147
>   .                      .
>   .                      .
>   .                      .
> 2500           0.0004311
>
> What I've been trying to do is averaging every nth data values and
> rewrite into a new array.
> For example, if I want to average every 3rd data values, the resulting
> array will be
>
> 350            0.001150
> 353            0.001147
> and so on.
>
> MS excel seems to be able to handle it, but it wouldn't be a good idea
> for processing several hundres files.
>
> I really appreciate if someone could give me tip(s).
>
> Thanks,
> Kim
Hi Kim,
you could also use this:

range=3
new_w = total(reform(w,range,n_elements(w)/range),1)/range

or if you have missing values:

missing=0
new_w = total(((rr=reform(w,range,n_elements(w)/range),1)))/total(rr
ne missing,1)

Cheers

CR
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: SPAWN and strings
Next Topic: Re: SPAWN and strings

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

Current Time: Fri Oct 10 09:32:35 PDT 2025

Total time taken to generate the page: 0.72587 seconds