problems with SAVGOL and POLY_SMOOTH [message #90889] |
Thu, 07 May 2015 14:41  |
Francesca Scipioni
Messages: 6 Registered: August 2014
|
Junior Member |
|
|
Hi!
I'm tryng to apply the savgol algorithm to a spectrum of Cassini VIMS.
The spectrum is defined as a float array and had a dimension of 256.
when I apply the convolution, I obtain an arry of zeros.
I used also with poly_smooth, but the result is the same.
I tryed all possible combination of nleft, nright, order, degree ecc., using very small or very big values, but the result doesn't change.
Any idea about which can be the problem?
Thanks,
Francesca
|
|
|
Re: problems with SAVGOL and POLY_SMOOTH [message #90890 is a reply to message #90889] |
Thu, 07 May 2015 22:10   |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
On Thursday, May 7, 2015 at 4:41:31 PM UTC-5, Francesca Scipioni wrote:
> Hi!
>
> I'm tryng to apply the savgol algorithm to a spectrum of Cassini VIMS.
> The spectrum is defined as a float array and had a dimension of 256.
>
> when I apply the convolution, I obtain an arry of zeros.
>
> I used also with poly_smooth, but the result is the same.
>
> I tryed all possible combination of nleft, nright, order, degree ecc., using very small or very big values, but the result doesn't change.
>
> Any idea about which can be the problem?
>
> Thanks,
> Francesca
Can you show us some specific code?
-Jeremy.
|
|
|
Re: problems with SAVGOL and POLY_SMOOTH [message #90891 is a reply to message #90890] |
Fri, 08 May 2015 06:06   |
Francesca Scipioni
Messages: 6 Registered: August 2014
|
Junior Member |
|
|
On Friday, May 8, 2015 at 12:10:53 AM UTC-5, Jeremy Bailin wrote:
> On Thursday, May 7, 2015 at 4:41:31 PM UTC-5, Francesca Scipioni wrote:
>> Hi!
>>
>> I'm tryng to apply the savgol algorithm to a spectrum of Cassini VIMS.
>> The spectrum is defined as a float array and had a dimension of 256.
>>
>> when I apply the convolution, I obtain an arry of zeros.
>>
>> I used also with poly_smooth, but the result is the same.
>>
>> I tryed all possible combination of nleft, nright, order, degree ecc., using very small or very big values, but the result doesn't change.
>>
>> Any idea about which can be the problem?
>>
>> Thanks,
>> Francesca
>
> Can you show us some specific code?
>
> -Jeremy.
files1 = '/Users/......./......../v1713114512_1_2_17_raw.txt'
Range = 260
Band1 = strarr(256)
Band_num1 = intarr(256)
Minimo1 = fltarr(256)
Massimo1 = fltarr(256)
spettro1 = fltarr(256)
st_dev1 = fltarr(256)
fmt = 'A,I,F,F,F,F'
readcol, files1, format=fmt, Band1, Band_num1, Minimo1, Massimo1, spettro1, st_dev1, SKIPLINE = 4, NUMLINE=260
plot, spettro1
savgolFilter = SAVGOL(2, 2, 0, 4, /double) ; I also tryed other combinations
spettro3 = fltarr(256)
spetrro3 = CONVOL(spettro1, savgolFilter)
; or (with the same result)
; poly_smooth( spettro1, 1, DEGREE=0,NLEFT=1,NRIGHT=1,DERIV_ORDER=0 ) ;
oplot, spettro3, color = 65280
The spettro1 values are
0.944916
0.953161
0.921698
0.954911
0.922925
0.918666
0.934583
0.907393
0.890279
0.885527
0.878185
0.907191
0.913401
0.896080
0.883359
0.918613
0.898005
0.872932
0.858413
0.851442
0.839940
0.818498
0.806320
0.807368
0.807541
0.800929
0.839457
0.827864
0.835938
0.832519
0.820482
0.811595
0.789620
0.759132
0.691918
0.598652
0.489183
0.445673
0.436680
0.436939
0.445523
0.438651
0.481776
0.547756
0.562844
0.564608
0.534664
0.594535
0.605254
0.676105
0.728975
0.748324
0.758822
0.733740
0.736142
0.748694
0.755424
0.768868
0.739329
0.726352
0.696078
0.632748
0.535247
0.434597
0.362188
0.326092
0.300800
0.285309
0.295063
0.266328
0.258386
0.250205
0.279463
0.325751
0.383798
0.451696
0.497129
0.540487
0.601897
0.643704
0.703089
0.709999
0.703514
0.688517
0.648048
0.595995
0.574927
0.554001
0.482696
0.469066
0.454911
0.444607
0.427108
0.451923
0.437827
0.401862
0.384808
0.377747
0.366368
0.351537
0.343991
0.356969
0.362911
0.353184
0.352417
0.328512
0.317759
0.292930
0.253015
0.206487
0.150402
0.106841
0.068634
0.042263
0.028128
0.022334
0.011552
0.001091
0.010740
0.012075
0.013127
0.005055
0.011474
0.014138
0.011764
0.011638
0.012457
0.002001
0.054650
0.008618
0.012289
0.010589
0.010678
0.013499
0.017883
0.021377
0.014646
0.020465
-0.004447
0.014564
0.016018
0.018516
0.030274
0.053877
0.045241
0.057105
0.067577
0.076199
0.087730
0.090628
0.104401
0.118718
0.126779
0.135805
0.149264
0.156811
0.171011
0.167874
0.170038
0.180615
0.177197
0.177835
0.157974
0.181071
0.182442
0.165855
0.177703
0.167839
0.166708
0.153052
0.154515
0.159896
0.139181
0.130814
0.119656
0.105711
0.109424
0.104764
0.093651
0.092645
0.063382
0.079162
0.076415
0.074927
0.071939
0.067798
0.064759
0.055266
0.108703
0.063316
0.057371
0.021088
0.040337
0.049434
0.042531
0.028866
0.022093
0.009693
0.049018
0.040305
0.039561
0.035064
0.033877
0.024407
-0.066850
-0.041002
0.021828
0.034775
-0.001342
0.054239
0.023999
0.064247
0.094230
0.024452
0.014036
0.028097
0.041927
0.045239
0.002342
0.027923
0.030359
0.031697
0.028263
0.029457
0.112607
0.028961
0.298060
0.064623
0.041895
-0.039256
0.031361
0.036728
0.036564
0.043188
-0.055092
0.017969
0.056107
0.044531
0.017920
-0.048235
0.029972
0.035818
0.102898
0.020244
0.058096
0.228025
0.109548
0.260482
0.049248
0.090254
0.005142
-0.000006
0.027815
0.060429
0.043408
0.036377
end
|
|
|
|
Re: problems with SAVGOL and POLY_SMOOTH [message #90893 is a reply to message #90892] |
Fri, 08 May 2015 06:43   |
Francesca Scipioni
Messages: 6 Registered: August 2014
|
Junior Member |
|
|
On Friday, May 8, 2015 at 8:23:43 AM UTC-5, David Fanning wrote:
> Francesca Scipioni writes:
>
>> Any idea about which can be the problem?
>
> I think your filter is too narrow. Try this:
>
> savgolFilter = SAVGOL(8, 8, 0, 4, /double)
>
> This works well with the data you supplied.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Dear David,
the result is the same, a flat, 0 values, array
|
|
|
Re: problems with SAVGOL and POLY_SMOOTH [message #90894 is a reply to message #90893] |
Fri, 08 May 2015 07:08   |
Francesca Scipioni
Messages: 6 Registered: August 2014
|
Junior Member |
|
|
On Friday, May 8, 2015 at 8:43:25 AM UTC-5, Francesca Scipioni wrote:
> On Friday, May 8, 2015 at 8:23:43 AM UTC-5, David Fanning wrote:
>> Francesca Scipioni writes:
>>
>>> Any idea about which can be the problem?
>>
>> I think your filter is too narrow. Try this:
>>
>> savgolFilter = SAVGOL(8, 8, 0, 4, /double)
>>
>> This works well with the data you supplied.
>>
>> Cheers,
>>
>> David
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
>
> Dear David,
>
> the result is the same, a flat, 0 values, array
Using poly_smooth with high degree values the problem i solved!
|
|
|
|
Re: problems with SAVGOL and POLY_SMOOTH [message #90896 is a reply to message #90894] |
Fri, 08 May 2015 07:22   |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
Maybe it's not necessary anymore to comment, but I've tried what David suggested and it works wonderfully...
If you're getting a zerod array out, then there is something doggy going on (you're using other data?).
If you want, I can send you a copy of the plot, but it looks like a savgol filter to me... The first savgol filter you suggested does not do much... you need to make it broader. But I see absolutely always NON-zero values.
Cheers,
Helder
On Friday, May 8, 2015 at 4:08:19 PM UTC+2, Francesca Scipioni wrote:
> On Friday, May 8, 2015 at 8:43:25 AM UTC-5, Francesca Scipioni wrote:
>> On Friday, May 8, 2015 at 8:23:43 AM UTC-5, David Fanning wrote:
>>> Francesca Scipioni writes:
>>>
>>>> Any idea about which can be the problem?
>>>
>>> I think your filter is too narrow. Try this:
>>>
>>> savgolFilter = SAVGOL(8, 8, 0, 4, /double)
>>>
>>> This works well with the data you supplied.
>>>
>>> Cheers,
>>>
>>> David
>>> --
>>> David Fanning, Ph.D.
>>> Fanning Software Consulting, Inc.
>>> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>>> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
>>
>> Dear David,
>>
>> the result is the same, a flat, 0 values, array
>
> Using poly_smooth with high degree values the problem i solved!
|
|
|
Re: problems with SAVGOL and POLY_SMOOTH [message #90897 is a reply to message #90896] |
Fri, 08 May 2015 07:53  |
Francesca Scipioni
Messages: 6 Registered: August 2014
|
Junior Member |
|
|
On Friday, May 8, 2015 at 9:22:02 AM UTC-5, Helder wrote:
> Maybe it's not necessary anymore to comment, but I've tried what David suggested and it works wonderfully...
> If you're getting a zerod array out, then there is something doggy going on (you're using other data?).
>
> If you want, I can send you a copy of the plot, but it looks like a savgol filter to me... The first savgol filter you suggested does not do much... you need to make it broader. But I see absolutely always NON-zero values.
>
> Cheers,
> Helder
>
>
>
> On Friday, May 8, 2015 at 4:08:19 PM UTC+2, Francesca Scipioni wrote:
>> On Friday, May 8, 2015 at 8:43:25 AM UTC-5, Francesca Scipioni wrote:
>>> On Friday, May 8, 2015 at 8:23:43 AM UTC-5, David Fanning wrote:
>>>> Francesca Scipioni writes:
>>>>
>>>> > Any idea about which can be the problem?
>>>>
>>>> I think your filter is too narrow. Try this:
>>>>
>>>> savgolFilter = SAVGOL(8, 8, 0, 4, /double)
>>>>
>>>> This works well with the data you supplied.
>>>>
>>>> Cheers,
>>>>
>>>> David
>>>> --
>>>> David Fanning, Ph.D.
>>>> Fanning Software Consulting, Inc.
>>>> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>>>> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
>>>
>>> Dear David,
>>>
>>> the result is the same, a flat, 0 values, array
>>
>> Using poly_smooth with high degree values the problem i solved!
I didn't tryagain savgol since now poly_smooth is working really good. I verified that the two funcions work in almost the same way using the data taken in the exelis example for savgol.
Thank you for yoyr hellp|
|
|
|