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

Home » Public Forums » archive » Smooth function question
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: Smooth function question [message #89424 is a reply to message #89421] Wed, 15 October 2014 07:56 Go to previous messageGo to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Wednesday, October 15, 2014 3:37:14 PM UTC+2, zolile...@gmail.com wrote:
> On Wednesday, October 15, 2014 3:11:05 PM UTC+2, zolile...@gmail.com wrote:
>
>> Dear all,
>
>>
>
>> I got a 3D data. I applied a SMOOTH function like smooth(a,3), the plots look fine and when I print the number of elements on the screen are equal as the original data. But when wrote to a file I found that there is a missing element or number is not corresponding with original data. I checked using excel. I am a bit confused, I need some help. Any suggestion is very welcome,
>
>>
>
>> Thanks
>
>>
>
>> Zolile
>
>
>
> openR, Lun, File,/Get_Lun
>
> readf, Lun, str
>
> while~eof(lun) do begin
>
>
>
> readf,lun,date,time,Bx,By,Bz
>
> print,date,time,Bx,By,Bz
>
> Bx_array = [Bx_array, Bx]
>
> By_array = [By_array, By]
>
> Bz_array = [Bz_array, Bz]
>
> endwhile
>
> free_lun,lun
>
> Bx_array=Bx_array[1:*]
>
> By_array=By_array[1:*]
>
> Bz_array=Bz_array[1:*]
>
>
>
>
>
> Nx = n_elements(Bx_array)
>
> time = findgen(Nx)
>
> time = time/225.
>
>
>
> Ny = n_elements(By_array)
>
> time = findgen(Ny)
>
> time = time/225.
>
>
>
> Nz = n_elements(Bz_array)
>
> time = findgen(Nz)
>
> time = time/225.
>
>
>
> Smoothed1 = smooth(Bx_array,3)
>
> Smoothed2 = smooth(By_array,3)
>
> Smoothed3 = smooth(Bz_array,3)
>
>
>
> NN1=n_elements(smoothed1)
>
> NN2=n_elements(smoothed2)
>
> NN3=n_elements(smoothed3)
>
> print, smoothed1
>
>
>
> print, NN1,NN2,NN3
>
>
>
> openw,1,'dataxx.txt'
>
> printf,1,transpose(smoothed1)
>
> close,1

According to your post from before, the number of elements by the print command (monitor output) do not match with those of the text file produced.

I tried replicating your last lines:

IDL> openw,1,'dataxx.txt'
IDL> smoothed = findgen(100)
IDL> printf,1,transpose(smoothed)
IDL> close,1
IDL> print, FILE_LINES('dataxx.txt')
100

So I get 100 lines in the text file. Something like this:
0.000000
1.00000
2.00000
3.00000
4.00000
5.00000
...
95.0000
96.0000
97.0000
98.0000
99.0000

This is the same as if I did
IDL> print, smoothed

So I think there is something missing part in your code or you're mixing up files when checking what has been done.

Maybe try putting a time stamp... something like

IDL> start_t = systime()
IDL> print, 'start : '+start_t
IDL> printf,1,start_t
IDL> printf,1,transpose(smoothed)
IDL> end_t = systime()
IDL> print, 'end : '+end_t
IDL> printf,1,end_t
IDL> close,1

Do the values in the file and on the screen match?
If they match, then you have to have a file with a number of lines equal to the number of elements of smoothed + 2 (for the time stamps!)

Cheers, Helder
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL 8.4?
Next Topic: Re: cgimage - two images on the same window ?

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

Current Time: Mon Dec 01 16:02:54 PST 2025

Total time taken to generate the page: 0.72590 seconds