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 #73371] Fri, 05 November 2010 08:09 Go to previous message
beardown911 is currently offline  beardown911
Messages: 21
Registered: March 2007
Junior Member
On Nov 5, 8:54 am, Jeremy Bailin <astroco...@gmail.com> wrote:
> On Nov 4, 4:55 pm, Michael Galloy <mgal...@gmail.com> wrote:
>
>
>
>
>
>> On 11/4/10 2:31 PM, go cats wrote:
>
>>> On Nov 4, 1:14 pm, Chris W<cwood1...@gmail.com>  wrote:
>>>> On Nov 4, 12:53 pm, 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
>
>>>> put the data into separate arrays
>>>> then reform them
>
>>>> rw = reform(w, 3, n_elements(w)/3) ; make sure w has a multiple of 3
>>>> length
>>>> rd = reform(d, 3, n_elements(d)/3)
>
>>>> get the mean across the 1st dimension for the average
>>>> result_d = mean(rd,dimension = 1)
>>>> get the minimum across the wavelengths
>>>> result_w = min(rw, dimension = 1)
>
>>>> Chris- Hide quoted text -
>
>>>> - Show quoted text -
>
>>> Hi Chris,
>
>>> The "dimension" flag may not be used in the "mean" function.
>>> wavelength sorting was successful, but only one (total) mean value was
>>> calculated.
>>> I am digging out what I did wrong.
>
>>> Thanks,
>>> Kim
>
>> IDL 8.0 added the DIMENSION keyword for MEAN.
>
>> Mike
>> --www.michaelgalloy.com
>> Research Mathematician
>> Tech-X Corporation
>
> If you're on pre-8, you can use the modifications of the intrinsic
> routines here:
>
> http://web.astroconst.org/jbiu/#MOMENTDIMEN
>
> -Jeremy.- Hide quoted text -
>
> - Show quoted text -

Hi all,

Thank you all for your invaulable tips and code examples.

Kim
[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: Wed Oct 08 17:03:02 PDT 2025

Total time taken to generate the page: 0.00557 seconds