A Linear Prediction Estimation
of Signal Time REversal

Application to 2D J-resolved
NMR spectroscopy

Last modified: October, 5th 2011

This is Alpestre version 0.1.1


A 2D J-resolved NMR time domain data set, when recorded using standard procedures, is phase-modulated according to t1 and t2. When submitted to 2D Fourier transformation, it yields sums of double absorption and dispersion peaks. The latter present a broad shape that make the resulting spectra not really useful for analytical purpose, even when presented in magnitude mode.

The pseudo echo technique uses an apodization filter (a product of sine arches) that tends to limit the amplitude of the double dispersion contribution to peak shapes, but that significantly reduces the spectrum signal-to-noise ratio.

As explained in:

“Time-Reversal of NMR Signals by Linear Prediction. Application to Phase-Sensitive Homonuclear J-resolved Spectroscopy”
Jean-Marc Nuzillard
Journal of Magnetic Resonance Series A 118, 132-135 (1996),

if signals could be recorded at negative t1 values, it would be possible to preserve both double absorption line shapes and high signal-to-noise ratios. Signal time-reversal can be achieved by a signal processing technique named linear prediction (LP).

The current implementation of Alpestre uses Octave, a free software for numerical calculations.

Octave runs smoothly on Linux, because binary packages exist for most of common distributions. Presently, the only way of running a standalone version of Octave on Windows is provided by OctaveForWindows. Octave is also available for machines that run MacOS X (not tested).

To sum up, what follows is only directly interesting if you want to process 2D J-resolved NMR data that were recorded on an Avance Bruker spectrometer and if Octave can be run on some computer around.

Alpestre can be used in different modes

When run with TopSpin, Alpestre is driven by a Python script named When run from the command line, the alpestre script has to be executed in a unix-type environment, which is easy with Linux. Under Windows, OctoveforWindows comes with a unix environment that can be accessed from the msys program in the MSYS directory.




Alpestre is distributed under the terms of the CeCILL-A license.
Running ‘alpestre’ implies that you have read, understood and accepted the terms of the LICENSE file .

Before any installation, please read the endianity issues section!

Test your Octave installation

Octave is needed to run the ‘alp.m’ script, that does the real Alpestre job.

Alpestre for TopSpin, Linux users

Alpestre for TopSpin, Windows users

Alpestre from the command line, Linux users

Rebuild symjc (only if needed)

symjc is called by alp.m in order to symmetrize the 2D J-spectra. Its implementation in Octave is straightforward but was found to be desperately slow. It was therefore recoded in C. The C code is in symjc.c. Alpestre is provided with a compiled version of symjc. Users who would like to recompile it can do it with the ‘cc symjc.c -o symjc’ command. The ‘cc’ C compiler is generally the ‘gcc’, as provided for Linux and MacOS. Windows user can use the ‘gcc’ that comes with OctaveForWindows (or maybe the one that comes with TopSpin).


Using Alpestre

A demo data set is available.

Data acquisition

As usual (jresqf)

Data processing

Bruker processing parameters

are set so that individual FIDs may all be phase-corrected so that the first one is presented in absorption mode, as usual a for 1D spectrum:

At this point, the FIDs occupy the lower part of the 2D spectrum window, while the upper part (the half, at least) is empty. This empty space will be filled by the Alpestre processing.

Alpestre with TopSpin

All actions are performed on the currently opened and displayed data set.

The path to NMR data files must not contain blanks.

The easiest way to enter the Alpestre processing GUI is to type the ‘xpy alpestre gui’ command in TopSpin. The user may also add an ‘Alpestre’ button in the TopSpin interface, that triggers the ‘xpy alpestre gui’ command for 2D data sets only. The following windows then pops up:

The default parameter values are updated after the user change them and accepts the changes. The initial default parameters are retrieved by the ‘xpy alpestre gui default’ command. The default parameters (but not the initial default parameters) may also be modified from the TopSpin command line: ‘xpy alpestre gui base=5’ initializes the ‘Baseline position’ parameter with ‘5’.

The ‘Baseline position’ parameter sets the ‘base’ parameter in alp.m. Alpestre only processes the columns of the 2D spectrum (after xf2 and abs2 processing) that are declared to be non-empty. The selection of the non-empty columns is based on the first row of the 2D spectrum. If the value of a data point in this 1D spectrum is higher than the product of the minimum value in the first row (must be negative) by -base, then the point index is considered as the index of a non empty-column in the 2D spectrum.

The ‘Interactive base adjust’ parameter value can only be ‘yes’ or ‘no’. If set to ‘yes’, the user will be able to interactively modify the ‘Baseline position’ parameter value.

The other parameters are detailed hereafter but are less critical.

After the ‘OK’ button is clicked, the ‘Baseline position’ may be adjusted if requested and the calculation starts after the program has received the final user agreement. The progress of calculations may be checked (at least in TopSpin 3.0) in the command window TopSpin opens when it starts. The final result should appear in the current TopSpin spectrum window. The command window must show that Alpestre processing terminates with status code 0.

Alpestre without TopSpin

This mode was created to process data on a computer that does not run TopSpin but that can run Octave.

Typically, if the dataset was recorded in directory dir, if its name is name, its experiment number is expno and its processing number is procno, then, the directory dir/name/expno/pdata/expno has 2 files named 2rr and 2ii that contain the currently transformed data values. This directory will be referred to as the procdir. The dir/name/expno directory is the acqudir.

If the Alpestre processing must be carried out on an other computer (mainly when Octave cannot be installed on the one of the NMR spectrometer), just transfer the whole acqudir where suitable (by ftp, ssh, file sharing...). The 2rr and 2ii files are now considered to be in the alpdir (which may be procdir).

The easiest way to perform the Alpestre processing itself is to open a shell window, to change the current directory to alpdir, and to type ‘alpestre’.

Most of times, many columns of the 2D J-resolved spectrum correspond to baseline. The user interactively chooses the threshold above which a column is considered as worth being processed. A first guess of the threshold is proposed and the user may enter either ‘y’ (to accept), or ‘n’ (to be prompted for a new threshold value), or ‘q’ (to dismiss from processing). The user's decision depends on the number of columns that are considered as being not empty.

Once the user accepts a threshold value, ‘alpestre’ creates a file named 2rra in alpdir.

The processing has to be finished by running xf1 in procdir, by copying 2rra from alpdir as 2rr in procdir and by refreshing the display.


Alpestre command line options

Command line options may be:


Endianity issues

2rr and 2ii files contains 4-byte integer values, in binary format. Let us consider the way the number 1 is written in a file. The binary representation of 1 being (00000000 00000000 00000000 00000001), there are three bytes set to 0, the most significant ones, and one set to 1, the least significant one. There are two possibilities to store these bytes in a file: a first one is to send the least significant byte first (the right hand side byte), and a second one is to send the most significant one first (the left hand site byte). Due to Murphy's law, some hardware manufacturers use the first method (hardware is said to be little-endian), and some other ones use the second method (harware is big-endian). This is matter of hardware and not of software because the endianity reflects the way the numbers are internally stored in the processor.

PC are small-endian machines. SGI/MIPS machines (O2, Indy, Indigo...) are big-endian machines.

By default, data are supposed to be recorded on a little-endian machine and data are supposed to be processed at on a little-endian machine as well. You may change that by commenting/uncommenting lines in alp.m, immediately after the ‘Global variables’ section.

If the current settings are incorrect, it is highly likely that the spectra that are displayed will look like anything but an NMR spectrum.

Back to the installation section



I thank the CNRS and the University of Reims (France) for financial support.

I thank Dr. Bruno Guigas (Bruker Biospin, Rheinstetten, Germany) for having given me the solution of a tricky Python programming problem.

Jean-Marc Nuzillard