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

Home » Public Forums » archive » Re: Time series.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Time series. [message #80098] Fri, 04 May 2012 18:08
russell.grew is currently offline  russell.grew
Messages: 74
Registered: February 2005
Member
Hi Dave,

My IDL is a little rusty. The crude example below should give you the
idea behind the reverse indices and how to access the values in your
bins.

Cheers.



z = randomn(7, 100) + findgen(100)/20.

hist = histogram(z, max =5., min = 0., binsize = 1., reverse_indices =
r)

bin1 = r[r[0]:r[1] - 1]
bin2 = r[r[1]:r[2] - 1]
bin3 = r[r[2]:r[3] - 1]
bin4 = r[r[3]:r[4] - 1]
bin5 = r[r[4]:r[5] - 1]

results = fltarr(5)

results(0) = mean(z[bin1])
results(1) = mean(z[bin2])
results(2) = mean(z[bin3])
results(3) = mean(z[bin4])
results(4) = mean(z[bin5])

plot, findgen(100)/20, z
oplot, findgen(5) + 0.5, results, psym = 2
Re: Time series. [message #80106 is a reply to message #80098] Thu, 03 May 2012 22:50 Go to previous message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Wednesday, May 2, 2012 4:54:07 PM UTC+2, Chris Torrence wrote:
> On Wednesday, May 2, 2012 7:39:10 AM UTC-6, dave poreh wrote:
>> On Tuesday, May 1, 2012 8:57:45 PM UTC+2, Chris Torrence wrote:
>>> On Monday, April 30, 2012 3:26:44 AM UTC-6, dave poreh wrote:
>>>> On Monday, April 30, 2012 9:31:59 AM UTC+2, Mats Löfdahl wrote:
>>>> > Den måndagen den 30:e april 2012 kl. 09:15:45 UTC+2 skrev dave poreh:
>>>> > > Folks
>>>> > > hi,
>>>> > > I am doing some Time series analysis and i wish to plot the mean like ( http://imageshack.us/content_round.php?page=done&l=img20 7/6577/screenshotat20120430091.png). I mean i want to plot the *BLUE* points in this graph. i have tryed to do with:
>>>> > > Smooth(y, 33)
>>>> > >
>>>> > > but the result is not what i want. Is there any help on Time series expert please?
>>>> > > Cheers,
>>>> > > Dave
>>>> >
>>>> > I think you want to bin your data and then plot the mean y value within each bin vs the mid x point.
>>>> Thanks. Now i am thinking about: http://idlastro.gsfc.nasa.gov/idl_html_help/TS_SMOOTH.html
>>>>
>>>> Cheers,
>>>> Dave :-)
>>>
>>> Hi Dave,
>>>
>>> At the risk of getting flamed, you can use the undocumented "NSUM" keyword to the PLOT function:
>>>
>>> r = randomn(s,1000) + findgen(1000)/300
>>> void = LINFIT(findgen(1000),r,YFIT=yfit)
>>> p = plot(r, 'or', /SYM_FILLED, SYM_SIZE=0.5, NAME='Red data')
>>> p1 = plot(r, 'ob', /SYM_FILLED, /OVERPLOT, NAME='Smoothed', nsum=20, /undoc)
>>> p2 = plot(yfit, 'g3', /OVERPLOT, NAME='Linear fit')
>>> l = legend(POSITION=[0.8,0.3])
>>>
>>> In this case, setting NSUM=20 just does a simple average of every 20 points and only plots a single point. Here's what it looks like:
>>> http://www.flickr.com/photos/79705059@N06/6986758828/
>>>
>>> Cheers,
>>> Chris
>>> ExelisVIS
>> Dear Chris
>> hi
>> How could i get the *blue* number for the graph?
>> Cheers,
>> Dave
>
> Hi Dave,
> If you mean get the actual averaged numbers back out of the graph, you can't. Hence the reason for Ken's comment. That NSUM is purely used for visual results, although it would be easy to replicate the result using a simple binned average.
> Cheers,
> Chris

Hi Chris
Actually it is working pretty good for my data, but i need also fit line like this:
fit=linfit(x,y,yfit=yfit)
and for random data it is fine, but for GPS data, i have in some points several registered data, and the linfit does not work fine, so i was thinking to get the average data and do the fit on them, but looks like i can't. :-(
Thanks anyway,
Cheers,
Dave
PS. If you give me your email i could send you one of my data to look at them.
Re: Time series. [message #80110 is a reply to message #80106] Wed, 02 May 2012 07:54 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Wednesday, May 2, 2012 7:39:10 AM UTC-6, dave poreh wrote:
> On Tuesday, May 1, 2012 8:57:45 PM UTC+2, Chris Torrence wrote:
>> On Monday, April 30, 2012 3:26:44 AM UTC-6, dave poreh wrote:
>>> On Monday, April 30, 2012 9:31:59 AM UTC+2, Mats Löfdahl wrote:
>>>> Den måndagen den 30:e april 2012 kl. 09:15:45 UTC+2 skrev dave poreh:
>>>> > Folks
>>>> > hi,
>>>> > I am doing some Time series analysis and i wish to plot the mean like ( http://imageshack.us/content_round.php?page=done&l=img20 7/6577/screenshotat20120430091.png). I mean i want to plot the *BLUE* points in this graph. i have tryed to do with:
>>>> > Smooth(y, 33)
>>>> >
>>>> > but the result is not what i want. Is there any help on Time series expert please?
>>>> > Cheers,
>>>> > Dave
>>>>
>>>> I think you want to bin your data and then plot the mean y value within each bin vs the mid x point.
>>> Thanks. Now i am thinking about: http://idlastro.gsfc.nasa.gov/idl_html_help/TS_SMOOTH.html
>>>
>>> Cheers,
>>> Dave :-)
>>
>> Hi Dave,
>>
>> At the risk of getting flamed, you can use the undocumented "NSUM" keyword to the PLOT function:
>>
>> r = randomn(s,1000) + findgen(1000)/300
>> void = LINFIT(findgen(1000),r,YFIT=yfit)
>> p = plot(r, 'or', /SYM_FILLED, SYM_SIZE=0.5, NAME='Red data')
>> p1 = plot(r, 'ob', /SYM_FILLED, /OVERPLOT, NAME='Smoothed', nsum=20, /undoc)
>> p2 = plot(yfit, 'g3', /OVERPLOT, NAME='Linear fit')
>> l = legend(POSITION=[0.8,0.3])
>>
>> In this case, setting NSUM=20 just does a simple average of every 20 points and only plots a single point. Here's what it looks like:
>> http://www.flickr.com/photos/79705059@N06/6986758828/
>>
>> Cheers,
>> Chris
>> ExelisVIS
> Dear Chris
> hi
> How could i get the *blue* number for the graph?
> Cheers,
> Dave

Hi Dave,
If you mean get the actual averaged numbers back out of the graph, you can't. Hence the reason for Ken's comment. That NSUM is purely used for visual results, although it would be easy to replicate the result using a simple binned average.
Cheers,
Chris
Re: Time series. [message #80113 is a reply to message #80110] Wed, 02 May 2012 06:39 Go to previous message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Tuesday, May 1, 2012 8:57:45 PM UTC+2, Chris Torrence wrote:
> On Monday, April 30, 2012 3:26:44 AM UTC-6, dave poreh wrote:
>> On Monday, April 30, 2012 9:31:59 AM UTC+2, Mats Löfdahl wrote:
>>> Den måndagen den 30:e april 2012 kl. 09:15:45 UTC+2 skrev dave poreh:
>>>> Folks
>>>> hi,
>>>> I am doing some Time series analysis and i wish to plot the mean like ( http://imageshack.us/content_round.php?page=done&l=img20 7/6577/screenshotat20120430091.png). I mean i want to plot the *BLUE* points in this graph. i have tryed to do with:
>>>> Smooth(y, 33)
>>>>
>>>> but the result is not what i want. Is there any help on Time series expert please?
>>>> Cheers,
>>>> Dave
>>>
>>> I think you want to bin your data and then plot the mean y value within each bin vs the mid x point.
>> Thanks. Now i am thinking about: http://idlastro.gsfc.nasa.gov/idl_html_help/TS_SMOOTH.html
>>
>> Cheers,
>> Dave :-)
>
> Hi Dave,
>
> At the risk of getting flamed, you can use the undocumented "NSUM" keyword to the PLOT function:
>
> r = randomn(s,1000) + findgen(1000)/300
> void = LINFIT(findgen(1000),r,YFIT=yfit)
> p = plot(r, 'or', /SYM_FILLED, SYM_SIZE=0.5, NAME='Red data')
> p1 = plot(r, 'ob', /SYM_FILLED, /OVERPLOT, NAME='Smoothed', nsum=20, /undoc)
> p2 = plot(yfit, 'g3', /OVERPLOT, NAME='Linear fit')
> l = legend(POSITION=[0.8,0.3])
>
> In this case, setting NSUM=20 just does a simple average of every 20 points and only plots a single point. Here's what it looks like:
> http://www.flickr.com/photos/79705059@N06/6986758828/
>
> Cheers,
> Chris
> ExelisVIS
Dear Chris
hi
How could i get the *blue* number for the graph?
Cheers,
Dave
Re: Time series. [message #80115 is a reply to message #80113] Tue, 01 May 2012 13:33 Go to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article < 11142809.2049.1335898665136.JavaMail.geo-discussion-forums@y njj16 >,
Chris Torrence <gorthmog@gmail.com> wrote:

> At the risk of getting flamed, you can use the undocumented "NSUM" keyword to
> the PLOT function:
>
> p1 = plot(r, 'ob', /SYM_FILLED, /OVERPLOT, NAME='Smoothed', nsum=20, /undoc)

I had better not catch my students hiding analysis operations inside
a PLOT statement! ;-)

Ken
Re: Time series. [message #80118 is a reply to message #80115] Tue, 01 May 2012 11:57 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Monday, April 30, 2012 3:26:44 AM UTC-6, dave poreh wrote:
> On Monday, April 30, 2012 9:31:59 AM UTC+2, Mats Löfdahl wrote:
>> Den måndagen den 30:e april 2012 kl. 09:15:45 UTC+2 skrev dave poreh:
>>> Folks
>>> hi,
>>> I am doing some Time series analysis and i wish to plot the mean like ( http://imageshack.us/content_round.php?page=done&l=img20 7/6577/screenshotat20120430091.png). I mean i want to plot the *BLUE* points in this graph. i have tryed to do with:
>>> Smooth(y, 33)
>>>
>>> but the result is not what i want. Is there any help on Time series expert please?
>>> Cheers,
>>> Dave
>>
>> I think you want to bin your data and then plot the mean y value within each bin vs the mid x point.
> Thanks. Now i am thinking about: http://idlastro.gsfc.nasa.gov/idl_html_help/TS_SMOOTH.html
>
> Cheers,
> Dave :-)

Hi Dave,

At the risk of getting flamed, you can use the undocumented "NSUM" keyword to the PLOT function:

r = randomn(s,1000) + findgen(1000)/300
void = LINFIT(findgen(1000),r,YFIT=yfit)
p = plot(r, 'or', /SYM_FILLED, SYM_SIZE=0.5, NAME='Red data')
p1 = plot(r, 'ob', /SYM_FILLED, /OVERPLOT, NAME='Smoothed', nsum=20, /undoc)
p2 = plot(yfit, 'g3', /OVERPLOT, NAME='Linear fit')
l = legend(POSITION=[0.8,0.3])

In this case, setting NSUM=20 just does a simple average of every 20 points and only plots a single point. Here's what it looks like:
http://www.flickr.com/photos/79705059@N06/6986758828/

Cheers,
Chris
ExelisVIS
Re: Time series. [message #80126 is a reply to message #80118] Mon, 30 April 2012 18:54 Go to previous message
russell.grew is currently offline  russell.grew
Messages: 74
Registered: February 2005
Member
IIRC you can back it out of the histogram command using the reverse indices

http://www.idlcoyote.com/tips/histogram_tutorial.html
Re: Time series. [message #80137 is a reply to message #80126] Mon, 30 April 2012 02:26 Go to previous message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Monday, April 30, 2012 9:31:59 AM UTC+2, Mats Löfdahl wrote:
> Den måndagen den 30:e april 2012 kl. 09:15:45 UTC+2 skrev dave poreh:
>> Folks
>> hi,
>> I am doing some Time series analysis and i wish to plot the mean like ( http://imageshack.us/content_round.php?page=done&l=img20 7/6577/screenshotat20120430091.png). I mean i want to plot the *BLUE* points in this graph. i have tryed to do with:
>> Smooth(y, 33)
>>
>> but the result is not what i want. Is there any help on Time series expert please?
>> Cheers,
>> Dave
>
> I think you want to bin your data and then plot the mean y value within each bin vs the mid x point.
Thanks. Now i am thinking about: http://idlastro.gsfc.nasa.gov/idl_html_help/TS_SMOOTH.html

Cheers,
Dave :-)
Re: Time series. [message #80139 is a reply to message #80137] Mon, 30 April 2012 00:31 Go to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den måndagen den 30:e april 2012 kl. 09:15:45 UTC+2 skrev dave poreh:
> Folks
> hi,
> I am doing some Time series analysis and i wish to plot the mean like ( http://imageshack.us/content_round.php?page=done&l=img20 7/6577/screenshotat20120430091.png). I mean i want to plot the *BLUE* points in this graph. i have tryed to do with:
> Smooth(y, 33)
>
> but the result is not what i want. Is there any help on Time series expert please?
> Cheers,
> Dave

I think you want to bin your data and then plot the mean y value within each bin vs the mid x point.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Color problem.
Next Topic: strange behaviour of bytscl by large arrays

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

Current Time: Wed Oct 08 15:11:08 PDT 2025

Total time taken to generate the page: 0.00799 seconds