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

Home » Public Forums » archive » Problems on the Savitzky-Golay smoothing filter
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Problems on the Savitzky-Golay smoothing filter [message #66489] Wed, 20 May 2009 03:59 Go to previous message
mengran is currently offline  mengran
Messages: 5
Registered: March 2009
Junior Member
Hi,everybody,
I have got a annoying problem about the implementing the
Savitzky-Golay filter to smooth the time series RS data in the IDL.
Actually, I know the function of the Savitzky-Golay filter in IDL is
SAVGOL.But the question is the result I got is either a horizon line
or the same as the original line(In other words, the filter seems not
to work at all), when I changed the parameters of the SAVGOL function.
(when the DEGREE = NL + NR(PARA OF THE SAVGOL FUNCTION), THE RESULT
IS THE SAME AS THE ORIGINAL, OTHERWISE, THE RUSULT IS A HORISON LINE)
My pro is as follows. The class1 to class9 from txt files are
the samples of the time series RS data.
Is there sth wrong with my code ? Or the RS data that I used
is not appropriate for the Savitzky-Golay filter, and I take a wrong
method to smooth data ? I need your suggestions, thanks a lot !

PRO Savgol_example

;RESTORE, 'C:\WorkSpace\Default\myPlotTemplate.sav'
rootPath = 'C:\WorkSpace\Default\class'

n = 1 & filename = strarr(9)
for i = 0, 8 do begin

filename[i] = strjoin([rootPath, strtrim(n, 2),'.txt'])
n++

endfor
for i = 0,8 do begin

plotTemplate = ASCII_TEMPLATE(filename[1])
y1 = READ_ASCII(filename[1], TEMPLATE = plotTemplate, COUNT =
$ count,NUM_RECORDS = 46 )
x = indgen(46)
iPlot,x,y1.FIELD1, NAME = 'Original Curve', $
COLOR=[255, 0, 0], SYM_INDEX = 4, yrange = [0,+8000], VIEW_TITLE =
strmid(filename[1], 21, 6)
void = ITGETCURRENT(TOOL=oTool)
void = oTool->DoAction('Operations/Insert/Legend')


; savgol
savgolFilter = SAVGOL(2, 2, 0,4)
iPlot,x,CONVOL(y1.FIELD1, savgolFilter), /OVERPLOT, $
COLOR=[0, 0, 255], THICK=2, $
NAME='Savitzky-Golay'
void = oTool->DoAction('Operations/Insert/LegendItem')
;SAVE, plotTemplate, FILENAME='C:\WorkSpace\Default
\myPlotTemplate.sav'

endfor

END
[Message index]
 
Read Message
Read Message
Previous Topic: SPAWN EXIT_STATUS not the same as shell. Ideas?
Next Topic: Screen size factor of two error?!

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

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

Total time taken to generate the page: 0.00462 seconds