# Deconvolutions in 1D Spectroscopy

A processed NMR spectrum is nothing but an array of points. We prefer interpreting it as a sum of peaks (belonging either to the main compound or to impurities), baseline distortions, artifacts and noise. A few of these components are interesting, the other ones are just causing troubles. In particular, we need to extract two parameters from the good peaks: the frequency and the area (in studies of relaxation the line width is actually more important).
When the spectrum is crowded with peaks, or affected by excessive noise, deconvolution may be the only way to measure the above quantities. Beware that it makes no miracles, it is not a substitute for higher magnetic fields, more abundant samples or prolonged acquisitions. The name “deconvolution” means (more or less): “removing the shape”. The theoretical shape of an NMR peak is given by the Lorentzian equation. Field inhomogeneity and weighting functions can however yield partial Gaussian line-shapes. From a merely graphical (and practical) point of view, they are two complementary shapes, in the sense that most symmetrical peaks can be approximated with suitable combinations of Lorentzian and Gaussian components. For your convenience, iNMR defines a mixed function, for which you can vary at will the percentages of Lorentzian and Gaussian character.

Not only iNMR makes the assumption that all lines can be described as Lorentzian (or Gaussian, or anything in between), it also assumes that peaks are perfectly symmetric (perfectly phase-corrected) and the baseline is flat (completely removed). The principle in action is that, for processing to be effective, you must factorize it in many steps. Deconvolution arrives as the last step, assuming that everything before has been performed correctly. Everything also includes properly shimming the magnet!

To start a deconvolution, first select, with the mouse, a small region of a 1D, processed, spectrum. Ideally the region should contain an isolated peak, or an isolated multiplet, or an isolated ensemble of overlapping peaks. In all cases, the region must contain at least 5 points (more if there are many peaks to approximate). The command “Simulate/Deconvolution” creates a new window, where the selected region has been copied. It is drawn in black. Superimposed are some components (peak shapes) proposed by iNMR, drawn in green. They constitute a starting point; you can add/remove components and change their parameters, either manually or mathematically. The deconvolution window can be expanded and can be as large as the monitor. You cannot, however, use the usual iNMR tools and commands. Think at it like another application, running in its own window, with its own commands. You can create how many deconvolution windows you will and alternate from them to document windows. Note that the latter ones occupy a lower layer and are easily hidden from the deconvolution windows. Let's now examine the elements which you can interact with.

## the plot

The experimental spectrum is drawn in black, while the synthetic spectrum is green. The latter can be displayed in two modes: either decomposed in the individual peaks or as their sum. The toolbar command “toggle” lets you switch between the two modes. In both cases, a single peak is always selected. You can see four square handles around the selected peak. The bottom handle defines the position of the peak along the frequency scale, the top handle defines the height, the side handles define the width. If you drag the handles, the curve changes. With the bottom handle you can also move the plot, vertically, inside the window. To select another peak, click near it. When the individual components are on display, the selected peak is in red. When the total is on display, the red line represents instead the difference between the experimental and the calculated spectrum. The residual error is a synthetic measure of this difference spectrum. You can tell which mode you are in by the presence or the absence of the "residual error" label at the top left. It comes together with the total/difference mode, it disappears with the individual components mode.

## the table

On top of the plot you can see the list of parameters. Each line of the table corresponds to a single peak. To select a peak, click on its line or use the arrow keys (up and down) of the keyboard. If the list is long, a scroll bar appears on the right. Note that the table contains the “area” parameter, not the height of the peak. What it means is clear when you try changing the width: the height will simultaneously change, and the area will remain constant. Compare this behavior to what happens when you drag the width handles. In the latter case, the height remains constant and the area changes. You can change the numerical values either with the keyboard or with the small arrows under the list. Note that not all values are accepted. For example, you cannot enter more than 100 in the percentage field! (Each field has its own set of limits). The check buttons decides which parameters can change when you click the “FIT” icon. If the parameter is not checked, its value is preserved. If no parameter is checked, the FIT command is disabled.
Peaks are constantly sorted by their frequency. You can invert the sorting order by clicking the header of the column with the Hz values. The index that appears at the left has no importance. When you issue the “copy” or the “export” commands, peaks are sorted again and the indeces may change.

## the controls

With the option “same %” all peaks have the same shape and the % of Lorentzian character can be adjusted only manually (= it cannot be checked). The button “check” is a shortcut to check the four boxes on the selected line; “check all” and “uncheck” operates on all parameters of all peaks.

## the toolbar

It's a standard Mac OS X toolbar, therefore you can hide or customize it with standard commands (not detailed here). The meaning of the commands is:

• split: splits the selected peak in two halves; the only way to add a new entry in the list of peaks;
• remove: removes the selected peak;
• undo: restores the old parameters after a manual or automatic fitting;
• Fit: runs the automatic fitting (Levenberg-Marquardt algorithm).
• toggle: toggles between the two display modes (individual components or total and difference).
• smooth: clicked once, restarts the module; the more you click, the more it ignores the details (noise) of the spectrum (less peaks are put into the table);
• paste: imports a list of peaks from another deconvolution window;
• copy: exports the list of peaks in textual form;
• export: creates an iNMR document containing the green plot(s); if there are more components and the display mode is “individual components”, then a pseudo-2D spectrum is created. You can use the result for printing, spectral editing, etc...

## numerical values for the intensities and the residual error

The numerical values of intensities shown by the deconvolution window are comparable with the calculated integrals of the corresponding experimental spectrum and both are normalized in the same way. In practice, when you cut an integral in the experimental spectrum, if there aren't others already defined, that first integral corresponds to the value 1 (the unit of integration). You can redefine the unit value with a double click. When a document is created, or when all integral regions are removed, the normalization factor does not exist. When you create a deconvolution window, it copies the normalization factor, if it exists. If not, the unit is calculated as 1/100 of the area of the selected region. Afterwards there is no connection at all between the two windows. If you redefine the normalization factor in the document, the integrals are not comparable.
In conclusion, you can realize what the best practice is: first complete integration, then start with deconvolutions!

The residual error is expressed in the same unit. It is calculated as the square root of the sum of the squares of all points in the difference spectrum.

residual error = √ Σ (Experimentali - Calculatedi)2.

## automatic constrains

At the end of each fitting run (not during it), iNMR checks if the recalculated values are within normal limits. For example, all intensities must be positive and all percentages within 0 and 100. If they are not, the value is corrected and the check mark removed. It is advisable that the user click another time the “FIT” icon. The residual error should decrease again.
At the beginning of each run, the height of each peak is also checked. If it is too low, that peak is kept constant and non recalculated. All check marks are removed from the corresponding line in the table.
Even during manual fitting, iNMR sets limits to all parameters.

# Strategies

• If you don't know the shape of your peaks, you can let iNMR calculate the Lorentzian percentage. After the first run, if you notice that all percentages are near 100, you'd better set them all at 100, and not recalculate them anymore.
• Generally speaking, all parameters should be recalculated simultaneously. In this way, however, a dilution effect is created. Let's say that all parameters are OK but one. If you adjust that wrong parameter, you can get a 10% improvement in the reconstruction of the corresponding peak and 1% improvement on the whole spectrum. iNMR can conclude that it's not worth to further refine 80 parameters only to get a 1% improvement, and simply stops the fit at the current stage. In this case, you should leave a single check, on the single wrong parameter, and start a new fitting run.
• For the same reason, avoid selecting too wide a region.
• The fitting algorithm implemented is good at finding the nearest minimum, (and it must be really near!), not the absolute minimum. Spend some time in a preliminary manual fit!
• To simulate a shoulder, you need to define an additional (weak) peak. By adding peaks, you can eventually simulate any positive shape!
• Every now and then, copy the list of parameters and save it somewhere. If you get lost, you can always paste it again into the table.

# SCRIPTING the Deconvolution

All the operations described above can also be performed with a script and all with the single command dec(). It has 3 syntactic forms. The simplest one is used to create the module and is equivalent to the menu command “Simulate/Deconvolution”. You invoke the function without parameters and receive a reference to the newly created module. It's necessary to pass the same reference to all the other calls to dec():

`ref = dec()`

As already seen, a single peak and the corresponding row into the table are always selected. To select another peak/row, call dec() with the reference to the module and an integer (from 1 to the number of rows):

`dec( ref, index )`

To check and uncheck the parameters of the selected row, pass a string containing the plus sign where you want a check sign and zero (or dash or space or dot) where you don't want it. For example:

`dec( ref, "-++-" )`

All the other operations correspond to icons and buttons (commands without parameters). You will pass the reference and one of the strings below. Each string must contain at least 4 characters (spaces matters), but the characters after the 4th are ignored. Don't change the case.

 string equivalent to the button: “cut ” split “clear” remove “HELP” help “undo” undo “ok   ” fit “TOGG” toggle “SMOOTH” smooth “paste” paste “copy” copy “Rerr” copy the residual error (if the difference spectrum is shown) “svas” export “SEL1” check “sall” check all “NONE” uncheck “SAME” same % “close” close button

If you only pass the reference to the module, without further parameters, the function returns, in the order, the number of peaks, the selected peak, the maximum number of peaks that can be fitted with the data points selected and the current state of the “smooth” button:

```number_of_peaks, selected_row, max_no, smoothing = dec( ref )
```