LabOne Imaging: Software Trigger’s new Grid Mode

In LabOne Release 16.04 the Software Trigger receives a powerful extension, Grid Mode, which organises the triggered data in a 2-D matrix allowing image construction direct from LabOne. This blog explains how this new functionality works and describes its most important parameters. For an introduction to manipulating SW Trigger data in Matlab, please seeĀ this previous blog.

An image obtained using SW Trigger's Grid Mode.

An image created using LabOne SW Trigger’s Grid Mode using Dual Frequency Resonance Tracking. Image courtesy of Ehsan Esfahani, University of Washington, Seattle.

What is Grid Mode?

The SW Trigger is popular in scanning probe microscopy (SPM) and other imaging applications where the image data is acquired line-by-line based upon well-defined trigger events. Often the scanner unit outputs a line trigger while the duration and number of pixels per line is set by the user. Grid Mode allows the user to define how many lines his entire image (matrix) consists of, aligns the individual lines precisely by the trigger timestamp and organises the data in a 2-dimensional matrix from which an image can be directly created. Multiple instrument signal sources, e.g., demodulator output, PID error and boxcar output, may be recorded simultaneously. Grid Mode guarantees that the user obtains a matrix of the specified size for each of the instrument signal sources and the pixels are aligned across the matrices by timestamp. This is true, even if dataloss in one of the signal sources occurs.

Data Organisation

SW Trigger’s Grid Mode is an extension of its previous functionality and respects it’s fundamental parameters such as the recording duration (of a signal burst) and the trigger configuration (such as a digital trigger on the instruments DIO port or an analogue trigger on the instrument’s auxiliary signal inputs). After enabling Grid Mode (trigger/0/grid/mode), the key parameter is the number of lines (we use the expressions rows and lines equivalently) the image should consist of (trigger/0/grid/rows). Each row in the grid will consist of data from one recorded SW Trigger burst and the rows are organised in the grid as depicted below.

Individaul SW Trigger signal bursts are inserted as rows into the grid.

Data Alignment and Interpolation

Grid Mode also allows the user to specify the number of columns in the grid (trigger/0/grid/cols), i.e., the number of pixels in each line of the image. This results in a resampling step since the number of recorded samples in each signal trace will not coincide with the desired number of pixels in the image. In addition, the resampling step takes care to align the rows of the grid relative to one another with respect to their “trigger timestamps”, the instrument timestamps indicating when the SW Trigger actually triggered for each row. In general, of course, the centre of one pixel will not correspond to the trigger timestamp, but each row is shifted so that the a line drawn vertically across all rows will correspond to the same point in time in all rows with respect to the trigger timestamp, see the image below.

The recorded data is interpolated onto a new timestamp grid.

In other words, Grid Mode creates a timestamp grid that is defined by the number of columns, the trigger timestamps and the span of the timestamps in the signal bursts (lines) and then interpolates each of the signal sources onto this timestamp grid. The interpolation of the data is either nearest neighbour or linear (specified by trigger/0/grid/mode). Currently, if the data is heavily oversampled (the number of recorded data samples in each signal burst is much greater than the specified number of columns in the grid) many data points will be ignored. Other sampling methods are planned in future releases.

Using Grid Mode from one of the LabOne APIs

LabOne’s Grid Mode may also be used from the LabVIEW, Matlab or Python APIs. As displayed below, intermediate data may be read from the SW Trigger (before all grid rows have been acquired) allowing for intermediate plotting of results. Each of the APIs contain an example for Grid Mode that can be modified to your needs. The LabVIEW and Matlab examples are distributed within the LabOne installer and the Python examples are available in the zhinst.ziPython Module. Both are available from our downloads page. See the LabOne Programming Manual for help locating the examples.

The plot generated from the LabOne Matlab API SW Trigger example.

The plot generated by the LabOne Matlab API Grid Mode example, example_swtrigger_grid_average.m. The example configures the SW Trigger to trigger on a beat generated in demodulator data and demonstrates interactive plotting of image lines as the data is acquired from the instrument.