
Author 
Message 
go cats... 
Posted: Thu Nov 04, 2010 5:53 pm 



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


Back to top 

Chris W... 
Posted: Thu Nov 04, 2010 6:14 pm 



On Nov 4, 12:53 pm, go cats <beardown... at (no spam) gmail.com> wrote:
Quote: 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


Back to top 

Bennett... 
Posted: Thu Nov 04, 2010 7:24 pm 



On Nov 4, 1:53 pm, go cats <beardown... at (no spam) gmail.com> wrote:
Quote: 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
You can also do something like this.
x = indgen(50)
mean_1 = mean(x)
mean_2 = mean(x[0:*:2])
mean_3 = mean(x[0:*:3])
The third element in your indexing indicates a skipping parameter.


Back to top 

go cats... 
Posted: Thu Nov 04, 2010 8:12 pm 



On Nov 4, 1:14 pm, Chris W <cwood1... at (no spam) gmail.com> wrote:
Quote: On Nov 4, 12:53 pm, go cats <beardown... at (no spam) 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 
Thanks Chris,
That works perfectly.
Kim


Back to top 

go cats... 
Posted: Thu Nov 04, 2010 8:13 pm 



On Nov 4, 2:24 pm, Bennett <juggernau... at (no spam) gmail.com> wrote:
Quote: On Nov 4, 1:53 pm, go cats <beardown... at (no spam) 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
You can also do something like this.
x = indgen(50)
mean_1 = mean(x)
mean_2 = mean(x[0:*:2])
mean_3 = mean(x[0:*:3])
The third element in your indexing indicates a skipping parameter. Hide quoted text 
 Show quoted text 
Bennet,
Thanks for the tips.
Kim


Back to top 

go cats... 
Posted: Thu Nov 04, 2010 8:31 pm 



On Nov 4, 1:14 pm, Chris W <cwood1... at (no spam) gmail.com> wrote:
Quote: On Nov 4, 12:53 pm, go cats <beardown... at (no spam) 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


Back to top 

chris... 
Posted: Thu Nov 04, 2010 11:23 pm 



On 4 Nov., 18:53, go cats <beardown... at (no spam) gmail.com> wrote:
Quote: 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


Back to top 

Michael Galloy... 
Posted: Fri Nov 05, 2010 12:55 am 



On 11/4/10 2:31 PM, go cats wrote:
Quote: On Nov 4, 1:14 pm, Chris W<cwood1... at (no spam) gmail.com> wrote:
On Nov 4, 12:53 pm, go cats<beardown... at (no spam) 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
TechX Corporation


Back to top 

go cats... 
Posted: Fri Nov 05, 2010 3:09 pm 



On Nov 5, 8:54 am, Jeremy Bailin <astroco... at (no spam) gmail.com> wrote:
Quote: On Nov 4, 4:55 pm, Michael Galloy <mgal... at (no spam) gmail.com> wrote:
On 11/4/10 2:31 PM, go cats wrote:
On Nov 4, 1:14 pm, Chris W<cwood1... at (no spam) gmail.com> wrote:
On Nov 4, 12:53 pm, go cats<beardown... at (no spam) 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
TechX Corporation
If you're on pre8, 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


Back to top 


All times are GMT
The time now is Fri Aug 01, 2014 3:45 am

