## Removing spikes and offset jumps

Spectrum Viewer has several functions for getting your spectrum back into shape. Let's look at the following example, taken from the file "Spikes Example.svf" in the TestSpectra folder:

Between X values 900 and 1050 there's some strange behaviour. There are spikes and an offset jump. When you're sure this is a measure error and not actually a legitimate measurement, you can try to correct it with Spectrum Viewer. First, let's zoom in on the affected area: draw a rectangle around it (with click-drag) and right-click.

Select the plot and draw a rectangle around some spikes (selecting is done by double-clicking near the plot). Then press ctrl-del (or via the menu: Edit->Delete data points->Interpolate) and poof! They're gone.

The number of data points doesn't even decrease, because the Y values of the spikes are placed on a line between their surrounding valid data points. But, there's still an ugly offset jump to correct. To correct it, select the affected part, choose in the menu "Smooth->Delete offset jumps". You will be asked for the maximum absolute Y jump, and the width. The smallest Y jump of the offset is on the right-hand side, and it is about 13 (from 60 to 73), so we'll fill in 12. The width is used to calculate a mean value of the jump height around the jumping point. For very clean plots, use 1. For very noisy plots, use a high value, 10 or more. A width of 3 seems to be a good default, and that's what we'll use here. To summarize: Draw rectangle, choose "Delete offset jumps", fill in 12 and 3, and as you can see, the offset jump dissappears:

To do a final clean-up of the plot, we'll smooth it. Press F8, or choose "Smooth->Smooth". You will be asked for the width, once more. When you fill in a value of 3, the Y-value of each data point will be an average of 7 data points: 3 to the left, 3 to the right, and the data point itself. The X-values are left alone, this way the number of data points on your plot stays the same. Experiment with the width-value to get the best results. A low value will not do very much, a high value will alter the plot too much.

As you can see, the value of 50 is a bit too much...

Drawing a rectangle around a part of the plot before smoothing it, will only smooth the part within the rectangle.

Other interesting smoothing options in the smooth menu are:

• downsample, which will decrease the number of data points in your plot. Every data point will be an average of 2 or more others (Y as well as X).

• delete large spikes, which you can use if you have very many spikes on different places that would be too cumbersome to delete by hand.

One final warning though. Spectrum Viewer can be used to make your plots into something they're not. When you clean up a plot you are altering your data. Sometimes unexpected results are just that, unexpected results, and not measuring errors. It's up to you to decide whether or not your plot actually has measuring errors, which may be cleaned up safely. In any case, keep a copy of your original data! You may need to go back to it years from now.

Back to main page