925-456-1020 info@acornnmr.com

Buffers subroutine

NUTS Help

Buffers

There are several methods within NUTS of placing data into a buffer for later use.   Each was created to address a specific need, but they may be useful for other purposes.  An effort has been made here to compare and contrast these tools to enable the user to apply them effectively.

The Add/Subtract buffer (loaded with AL) is used with Dual Display as well as the Add/Subtract subroutine.
The Data-to-Buffer (DB) and Buffer-to-Data (BD) commands were created to facilitate customized apodization functions.
The Combine Buffers commands (B1, B2, B+ and B-) were created for use in processing echo-antiecho 2D data, where pairs of slices must be added and subtracted.
The Buffers subroutine allows several spectra or sections of spectra to be displayed on the same ppm axis even when acquisition parameters such as spectral width, spectrometer frequency and number of data points are not equal.

Buffers subroutine

This subroutine allows comparison of spectra in ways not permitted by the Dual Display, Add/Subtract and Stacked Plot routines (see comments below). Spectra can be displayed together even in cases where spectrometer frequency, sweep width and number of data points are not equal.

The subroutine allows spectra, or sections of spectra, to be placed into a series of buffers, each displayed at a specified vertical position on the screen. The buffer spectra are displayed above the current spectrum such that the ppm scale is the same for all. NUTS will adjust the display of each spectrum to compensate for different parameters.

The Buffers subroutine is entered by typing BU or from the View menu.  The status notation in the gray Status Bar at the bottom of the NUTS window is changed to “BUffer Control”.  As with all subroutines, the Enter key will exit the routine. While in the Buffers subroutine, the displayed region of the displayed region of the current spectrum can be placed into a buffer using the subcommand A (or from the Edit menu).  The buffers are numbered in the order in which they are added.  An option in the View menu allows the buffer contents to be displayed after exiting the Buffers subroutine.

A chosen buffer can be selected, and its properties can be edited with the E command.  By default, the most recently added buffer is the selected buffer.  A different buffer can be selected by moving the mouse over the baseline of the buffer. When this is done, the buffer spectrum will blink and that buffer becomes selected. While the mouse is over that buffer’s baseline, a right click or E command will display a dialog box showing that buffer’s properties, such as amplitude, vertical position, color, pen width and identifying text.

The selected buffer can be moved vertically by pressing and holding the left mouse button. When this is done a red line is displayed and can be moved with the mouse. When the left mouse button is released, the buffer moves to that vertical position.

The selected buffer’s vertical scale can be changed with the “>” and “<” keys.  The Page Up/Down keys and the right-hand scroll bar adjust vertical scaling of all buffer spectra and the current spectrum simultaneously.  Horizontal expansions (defined with the Zoom subroutine) affect the current spectrum and all buffers.

The selected buffer can be deleted with the D command.  All buffers can be cleared with the C command.  Both commands are also available from the Edit menu.

The Math menu allows addition, subtraction and multiplication of the selected buffer with the current spectrum.

The spectrum can be saved with all of the buffer spectra with command S or from the File menu.  When later opened, all buffer spectra will be recalled with their associated properties.  Saving from the NUTS base level (SA command) will not save the buffers.

Using the Buffers subroutine

When the buffers subroutine is entered by typing BU, note that the menus change and the gray status bar at the bottom of the NUTS window shows “Buffer Control”.  The currently displayed spectrum or spectral region can be copied to a buffer with the A command, or from the Edit menu.

The number 1 (because this is the first buffer added) is shown at the left end of the buffer spectrum as an identifier, along with some text.  By default, the comment line for the spectrum being displayed in the buffer is the displayed text, but that can be changed.  The text remains displayed after exiting the BU subroutine, but the buffer number does not.

While display of buffer spectra is enabled, text is also displayed as an identifier for the main spectrum (the current data file) so that all displayed data are labeled.  The label for this spectrum takes the same properties as those of Buffer Spectrum #1.

The font used for the text labels is the same as that used for horizontal integral labels.

To edit a buffer’s properties, move the mouse to the buffer’s baseline and click the right mouse button (or type E on the keyboard).  This dialog box is displayed:

The vertical display (DC) offset and vertical scaling (amplitude) of the buffer can be set, as can the text of the comment line displayed with the buffer spectrum.  The color of the spectrum can be set by entering RGB numbers or by clicking the Color Editing button.  Pen width and style can also be set.

 

The vertical position of a buffer can be adjusted with the mouse.  Place the cursor on the chosen buffer, at the level of its baseline.  Press and hold the left mouse button.  The red line indicates the position of the buffer spectrum.  Move the red line to the desired position, and release the mouse button.  The buffer spectrum will be re-drawn at that position.

 

As additional spectra are added to the buffers, each is assigned a sequential number.

 

http://www.acornnmr.com/content/uploads/bu5.gif (11671 bytes)

If an expanded region of the spectrum is displayed when the buffer is loaded, the buffer will contain only that region.

 

Comparison of Dual Display, Add/Subtract, Stacked Plots and Buffers

Dual Display and Add/Subtract are limited to 2 spectra.  There is no limit for the Buffers routine or for Stacked Plots.

Add/Subtract is the only choice that allows one spectrum to be shifted left and right relative to the other.

The Buffers routine is the only option in cases where the spectra differ in number of data points.

Add/Subtract and Dual Display will display spectra that differ in spectrometer frequency and/or spectral width, but the frequency scale will be nonsensical. This is because the spectra are aligned point by point, without regard to frequency. The Buffers routine is the only way to display spectra differing in spectrometer frequency or spectral width with correct frequency axis for all spectra.

The Stacked Plot routine does not allow independent scaling or vertical repositioning of individual spectra.

Multiple spectra can remain displayed on the screen after exiting the Buffers subroutine (not true of the stacked plot routine). This makes it easier to add annotations (with the Notes subroutine) and otherwise compose a final presentation.

The 2 figures below show simulated spectra of ODCB at 100, 200 and 400 MHz using the buffers and stacked plot routines.

http://www.acornnmr.com/content/uploads/bu6.gif (12537 bytes)

Using Buffers, the spectra are aligned by ppm, even though spectrometer frequencies and sweep widths differ.  The ppm scale is correct for all.

 

http://www.acornnmr.com/content/uploads/bu7.gif (12108 bytes)

Using a stacked plot, the spectra are aligned by points, not frequency, and the axis is correct only for the top spectrum.

For an example of a “creative” use of the Buffers routine, see Tricks with Buffers.


The following 4 commands are used to place data into buffers for later addition or subtraction. Do not confuse this with the Add/Subtract subroutine, which has its own buffer.  This is used in some 2D processing, where pairs of slices must be added and subtracted.  The following 4 commands do not work in Arrayed Mode;  see below.

B1 — Load Buffer 1

Load current data set into buffer 1. Used in conjunction with commands B+ and B-, which add or subtract data loaded into buffers 1 and 2. These commands were added for use in processing gradient data.  The contents of this buffer are not visible.

B2 — Load Buffer 2

Load current data set into buffer 2. Used in conjunction with commands B+ and B-, which add or subtract data loaded into buffers 1 and 2.  The contents of this buffer are not visible.

B+ — Add Buffers

Adds the contents of buffers 1 and 2. Used in conjunction with commands B1 and B2, which load current data into buffers 1 and 2.  The sum becomes the current data.

B- — Subtract Buffers

Subtracts the contents of buffers 1 and 2 (B1 minus B2). Used in conjunction with commands B1 and B2, which load current data into buffers 1 and 2.  The difference becomes the current data.


The next 4 commands work only in Arrayed Mode, and on data sets having an even number of slices.  These commands facilitate processing of echo-antiecho data which must be processed by adding or subtracting pairs of slices. (An example is gradient hsqc data, which uses the C2 command.)  Each command operates on a pair of slices, n and n+1.  The real halves of the 2 slices are either added or subtracted, and the sum becomes the real half of a single processed slice.  The imaginary halves of the 2 slices are either added or subtracted, and the sum becomes the imaginary half of the processed slice.  So, in each case, the processed data has half as many slices as it started out with.  We have yet to encounter data that requires C1, C3 or C4.

C1 — Combine Mode #1

This command adds the reals and imaginaries of even and odd slices and gives back a data set with half the number of slices.

C2 — Combine Mode #2

This command adds the reals and subtracts the imaginaries of even and odd slices and gives back a data set with half the number of slices.

C3 — Combine Mode #3

This command subtracts the reals and adds the imaginaries of even and odd slices and gives back a data set with half the number of slices.

C4 — Combine Mode #4

This command subtracts the reals and subtracts the imaginaries of even and odd slices and gives back a data set with half the number of slices.


The following 2 commands were created to facilitate customized apodization functions, but their description is repeated here for comparison.

DB — Data to Buffer

Copies current data to the convolution filter buffer. This is useful for creating and applying customized apodization functions. (Do not confuse this with the Add/Subtract buffer.)

An apodization function can be created in different ways. One option is to build it within Nuts by first setting the current data points all equal to one with the 21 command. Alternatively, the ASCII import routine could be used to import a function created within a different application.

Once an apodization function is created, it can be copied to the convolution buffer with the DB command. The function is then viewed with the Convolution View (CV) command and applied with the Convolution Apply (CA) command. The latter 2 commands were created originally for use with functions created by the reference deconvolution operation (CF), but are also used for the general case of applying a function to an FID.

The data stays in the convolution buffer until replaced by another file or until Nuts is closed. The data may be copied back to the current data file with the Buffer to Data (BD) command.

BD — Buffer to Data

Copies contents of the convolution filter buffer to the current data set, replacing the current data. The buffer must first have been loaded with the Data to Buffer (DB) command.

Last updated: 1/26/05.