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 #73389 is a reply to message #73383] Thu, 04 November 2010 13:55 Go to previous messageGo to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
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
[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: Thu Oct 09 23:20:40 PDT 2025

Total time taken to generate the page: 0.63816 seconds