Fourier smoothing and Savitzky-Golay filtering

  • Context: Undergrad 
  • Thread starter Thread starter roam
  • Start date Start date
  • Tags Tags
    Fourier
Click For Summary

Discussion Overview

The discussion centers on methods for recovering a laser beam profile from data obtained through a knife-edge scan, specifically comparing Fourier smoothing and Savitzky-Golay filtering techniques. Participants explore the implications of numerical differentiation and noise in the data, as well as the effectiveness of various smoothing methods.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant discusses using the 4th order Savitzky-Golay method for smoothing and questions how to identify the noise band in the frequency spectrum of the derivative.
  • Another participant suggests that differentiation acts as a high-pass filter, potentially removing useful information and recommends curve fitting followed by symbolic differentiation instead.
  • Some participants express skepticism about the effectiveness of curve fitting, noting that numerical differentiation has been commonly used in academic papers despite its limitations.
  • There is mention of a paper by R.W. Schafer that discusses the Savitzky-Golay filter but does not directly compare it with Fourier filtering.
  • Participants debate the choice of coefficients to exclude in Fourier filtering and the interpretation of the frequency response of the Savitzky-Golay filter.
  • One participant shares their experience of discarding harmonics above the 5th in the Fourier spectrum and questions the rationale behind this choice and the potential for oversmoothing.
  • Another participant suggests that the decision to discard harmonics could be based on the relative amplitudes observed in the Fourier spectrum.

Areas of Agreement / Disagreement

Participants express differing opinions on the effectiveness of numerical differentiation versus curve fitting, as well as the best approach to smoothing the data. There is no consensus on the optimal method for distinguishing noise from the signal in the Fourier spectrum or on the criteria for selecting harmonics to discard.

Contextual Notes

Participants note limitations related to the measurement precision and the challenge of identifying noise in the presence of instrumental constraints. The discussion reflects varying assumptions about the underlying functions describing the laser beam profile.

roam
Messages
1,265
Reaction score
12
I am trying to recover a laser beam profile using numerical differentiation of the data obtained from a "knife-edge scan". I am trying to select between two different methods to smooth out the numerical noise.

Here is my raw data and the derivative:

4PcV49l.png


Here, I arbitrarily chose the 13 points, 4th order Savitzky-Golay method.

And here is the frequency spectrum of the derivative:

sfrJ03T.png


I have read that high frequencies caused purely by noise can be identified and removed in Fourier space, while the noise contamination of the low order components cannot be eliminated. So, in my spectrum how do we tell where the noise band starts?

Due to instrumental limitations, I am restricted to 2 decimal places when making measurements. If we had data with more significant figures, would that make the noise band more discernable?

In general, how does the Fourier smoothing compare to the Savitzky-Golay method?
 

Attachments

  • 4PcV49l.png
    4PcV49l.png
    29 KB · Views: 2,090
  • sfrJ03T.png
    sfrJ03T.png
    6.5 KB · Views: 1,237
Physics news on Phys.org
Differentiation of a set of measurements is equivalent to a "high-pass" filter, you remove the basic information and are left with the noise. If you really want the derivative of a measurement data set, I suggest you do a curve fitting of some sort and and do a symbolic differentiation of the fitted curve.
 
roam said:
In general, how does the Fourier smoothing compare to the Savitzky-Golay method?

There’s a nice “Lecture Notes” article by R.W. Schafer, “What Is a Savitzky-Golay Filter,” in IEEE Signal Processing Magazine, July 2011, that discusses this very topic!
 
Svein said:
Differentiation of a set of measurements is equivalent to a "high-pass" filter, you remove the basic information and are left with the noise. If you really want the derivative of a measurement data set, I suggest you do a curve fitting of some sort and and do a symbolic differentiation of the fitted curve.

All academic papers that I have seen use numerical differentiation. I tried what you suggested in another thread dealing with a similar problem. It doesn't work, because a linear fit shows a very good r2 value — yet you can't obtain the laser beam profile by differentiating it. The derivative of a quadratic and a cubic also show no resemblance to the actual laser beam.

The laser beam I am working with is similar to the Fresnel pattern you would get from a rectangular source field. But it has aberrations due to imperfections in manufacturing and the optics that are involved. So we don't know the underlying function describing the beam.

When I look at the burn patterns of the laser, its general features agree with the results of the numerical differentiation. It's those smaller wiggles that I think are caused by noise. Some papers use a simple moving average on the derivative, which I think hides useful information by flatting out the curve. One paper uses Savitzky-Golay. I thought about using Fourier filtering, but how would you decide what coefficients to remove?

olivermsun said:
There’s a nice “Lecture Notes” article by R.W. Schafer, “What Is a Savitzky-Golay Filter,” in IEEE Signal Processing Magazine, July 2011, that discusses this very topic!

Could you please explain? I had a cursory look at the paper and it doesn't really compare Fourier filtering with S-G filtering.
 
roam said:
Could you please explain? I had a cursory look at the paper and it doesn't really compare Fourier filtering with S-G filtering.
The paper discusses the frequency (Fourier) domain interpretation of the S-G filter (see Fig. 5).
 
olivermsun said:
The paper discusses the frequency (Fourier) domain interpretation of the S-G filter (see Fig. 5).

But they are comparing to Parks-McClellan algorithm, not the method that I am asking about (which is simply to exclude some of the coefficients from the Fourier spectrum).
 
roam said:
But they are comparing to Parks-McClellan algorithm, not the method that I am asking about (which is simply to exclude some of the coefficients from the Fourier spectrum).
The frequency response of the S-G filter shows you exactly what effect it has on the spectrum. You can compare that to any Fourier filter you like.
 
roam said:
All academic papers that I have seen use numerical differentiation. I tried what you suggested in another thread dealing with a similar problem. It doesn't work, because a linear fit shows a very good r2 value — yet you can't obtain the laser beam profile by differentiating it. The derivative of a quadratic and a cubic also show no resemblance to the actual laser beam.
If you really have to do a numerical differentiation, try using y_{n}'=\frac{y_{n+1}-y_{n-1}}{x_{n+1}-x_{n-1}} instead of y_{n}'=\frac{y_{n+1}-y_{n}}{x_{n+1}-x_{n}}. The former does a better job numerically.
 
Hi Svein,

Svein said:
If you really have to do a numerical differentiation, try using y_{n}'=\frac{y_{n+1}-y_{n-1}}{x_{n+1}-x_{n-1}} instead of y_{n}'=\frac{y_{n+1}-y_{n}}{x_{n+1}-x_{n}}. The former does a better job numerically.

Yes, I have already used the central difference approximation.

Do you think it is possible to distinguish noise from the actual deterministic part of the signal by looking at the Fourier spectrum? :confused: The spectrum of the derivative (calculated using CDA) is shown in my first post...
 
  • #10
roam said:
Do you think it is possible to distinguish noise from the actual deterministic part of the signal by looking at the Fourier spectrum? :confused: The spectrum of the derivative (calculated using CDA) is shown in my first post...
I have done this and it works - sort of. Try throwing away everything above the 5. harmonic and then transfer back.
 
  • Like
Likes   Reactions: roam
  • #11
Svein said:
I have done this and it works - sort of. Try throwing away everything above the 5. harmonic and then transfer back.

Interesting. I tried that, this is what I got:

iibDUJM.png


Is there a reason you chose the 5th harmonic? Is there any way to tell if we are oversmoothing?
 

Attachments

  • iibDUJM.png
    iibDUJM.png
    18.3 KB · Views: 965
  • #12
roam said:
Is there a reason you chose the 5th harmonic? Is there any way to tell if we are oversmoothing?
5. harmonic - I looked at your Fourier spectrum and saw that the amplitude for the 5. harmonic and above were very small compared to the first four. It might have been easier to guess if your Fourier amplitudes had been plotted logarithmically (in dB).

Oversmoothing - I would have tried 5., 7. etc. until the noise started being irritating. There is no hard and fast rule.

BTW: What did the smoothed beam profile tell you?
 
  • Like
Likes   Reactions: roam

Similar threads

  • · Replies 28 ·
Replies
28
Views
6K
Replies
3
Views
3K
Replies
2
Views
5K
  • · Replies 16 ·
Replies
16
Views
5K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K