Choosing the Right Tool to Acquire Lock-in Data

February 20, 2020 by Kıvanç Esat

A crucial part of setting up an experiment is to integrate proper instrumentation to collect and save data. It is important not only to have correct results but also to ensure an efficient workflow. This blog post and related video will help you to answer the question: what is the most suited data acquisition tool to acquire lock-in data for your application?

To get a quick overview, I recommend that you first watch the video and then continue with this blog post for further details. This is essentially a guide on different data acquisition tools for lock-in measurements which the LabOne® software offers with its graphical interface and application programming interfaces (APIs). You will learn about the purposes and limitations of each tool; if you seek more in-depth information on a specific tool, I suggest that you take a look at the additional information at the end of each section.

A note tp those who already use LabOne: I will be mainly talking about the Numeric, Plotter, and DAQ tools. These tools are included in our MF, HF2, and UHF lock-in amplifier platforms.  

The Data Transfer Concept of LabOne

Each data point contains information about the measured value together with its timestamp. The optimal way to transfer these data points from the instrument to the computer can vary significantly depending on several parameters such as the type of device connection (USB, Ethernet, etc.) and its available bandwidth. Poorly managed data transfers can be a bottleneck for demanding measurements, leading to the risk of data loss. The purpose of LabOne is to take this burden from you and make the acquisition of lock-in data efficient, convenient, and correct. Let’s have a look at its data transfer concept:

LabOne organizes data in a hierarchical structure referred to as the node tree (see Figure 1). Lock-in data includes demodulated data in Cartesian (X, Y) and polar (R, θ) coordinates, as well as frequency, auxiliary inputs, and trigger channels, all sharing the same timestamp.  This specific data structure is also referred to as the demodulator sample. The LabOne Data Server is the software that manages the transfer of this data from the instrument to your computer. Data can be accessed using either the browser-based graphical interface (which runs on a software referred to as the LabOne Web Server) or the application programming interfaces (in Python, MATLAB, C, .NET, and LabVIEW).

NodeTree_V0.png

Figure 1: The node tree, showing the demodulator sample of the UHFLI.

The data transfer from the instrument to the Data Server can be enabled directly from the user interface for the required demodulator (in the Lock-in Tab) or with the subscribe command for a defined node in the APIs. In the latter case, the selected node will be transferred to the Data Server with a specified data transfer rate. The Data Server can be pictured as a pipeline where the subscribed data stream nodes are buffered and can be polled. This data streaming concept can achieve transfer rates up to 2 MSa/s (UHF platform with 1 GbE connection) directly to the computer.

  • Streaming nodes other than the demodulator samples also exist, including Impedance samples and PID streaming nodes (depending on the installed options).
  • If a communication error or a data corruption issue occurs, the COM indicator in the status panel of the user interface turns to red.

For further information look at the LabOne programming manual, Instrument communication chapter.

A Single Data Point at a Time

The simplest method to get data is to monitor a numeric display and acquire a single data point at a time. In the past, this was achieved thanks to analog or digital displays embedded in a lock-in amplifier. Typically, a specific measurement channel is monitored after a change in an experimental parameter, and the value is recorded once the lock-in measurement has settled. The LabOne graphical interface offers a more modern approach to this type of measurement with its Numeric tab.

Numeric_V01.png

Figure 2: LabOne’s Numeric tab makes it possible to simultaneously monitor a larger number of channels in real time.

The Numeric tab is optimized to show values in real time for the selected and available nodes. To select a node to display, you can choose from a preset list (as shown in Figure 2 ) or make a manual selection using the node tree selector sub-tab. The available nodes depend on the instrument and on the installed options; however, the demodulator samples are always included. A graphical indicator placed below each numeric display shows the distribution of the values in time: the scaling of this indicator and the label of the desired channels can be set and modified from the settings sub-tab.

Since it is optimized for monitoring values in real time, the Numeric tab does not save the displayed values in the current LabOne release. To save a single value at a given time, use the getSample command in the API. This command captures the last demodulator sample transferred to the Data Server.

  • Beware that the getSample command is not to be called in a fast loop to retrieve a time trace, because it is not implemented and optimized for fast data streams. To retrieve a fast time trace of your data, use the methods discussed in the next sections.

For further information, take a look at this video and at the LabOne programming manual, Low-level LabOne API commands section.

Time Trace of the Signal

Monitoring a data stream in real time by plotting it as a time series is perhaps more convenient and easier to process than capturing a single value at a time. For this purpose, LabOne provides the Plotter tool, with which the temporal evolution of the required nodes can be displayed in a graph. While the X-axis is always the elapsed time with a specified window length, the Y-axis scale depends on the chosen signal(s). For multiple signals, vertical axis groups provide a robust method for comparison. A quantitative comparison is possible for signals with the same unit grouped together. Signals that have different units, which are naturally grouped separately, can still be overlayed on the same graph, but the Y-axis unit and ticks match only the highlighted group. For documenting purposes, you can save the displayed figure as an image in SVG, JPG or PNG formats with the buttons under the graph. CSV and HDF5 formats are also available.

Like all graphs in LabOne, the Plotter also features 2 X-axis and 2 Y-axis cursors. Each cursor displays the value at which it is placed as well as the difference between its pair. The graph also features math tools for data analysis:

  • Compute the histogram of the time series to see the distribution of values.
  • Capture the statistics of the data stream, including its mean value, standard deviation, minimum and maximum values, for the entire time window or for the region of interest determined by the X-axis cursors.
  • Find peaks and throughs in the time series.

The statistical data provided by the math tool can be saved too. Besides monitoring the time series of selected nodes, a common use case for this tool is parameter adjustment when setting up an experiment. For example, in the case of a PID controller, monitor the error signal in real time and minimize it by adjusting the control parameters.

Plotter_cut.png

Figure 3: The Plotter tool displays R values of two separate demodulators. Math tools capture statistical information about the orange curve as well as its histogram.

Real-time data streaming is also possible by executing the poll command at the API level.  For this, you first need to subscribe to the desired node so that the Data Server starts accumulating data. Through repeated poll commands, this buffered data in the Data Server is successfully transferred. For continuous data transfers, it is important to poll frequently before the buffer becomes full to prevent data loss.

The Plotter and the poll command are optimized for transfer speed, and both stream data as equidistant samples in time. Therefore, any communication problem between the instrument and the Data Server may result in data loss. Similarly, data splits may occur between subsequent poll commands. Furthermore, data points collected from different streaming nodes may not be aligned in time. As a result of these issues, substantial post-processing efforts can be required after a fast data stream. To minimize these issues for more demanding data acquisitions, LabOne offers the DAQ module.

For further information, read the instrument user manuals (MF, HF2, UHF), User interface overview and Plotter tab sections, the LabOne programming manual, Data streaming section, and watch this video.

LabOne DAQ Module

The DAQ module is a powerful data acquisition tool that comes with LabOne. The DAQ module is likely to be the best tool for your application if the goal is to:

  • Acquire data on an equidistant temporal grid;
  • Align multiple data streams on a grid to have a consistent data set;
  • Record only meaningful data based on trigger criteria;
  • Capture data not only in the time domain but also in the frequency domain;
  • Generate images; or
  • Perform reproducible measurements.

The DAQ module is built on the data streaming concept described above, but it captures a  defined number of samples from the Data Server continuously or based on given trigger criteria. It essentially parametrizes measurements and allows you to configure the data acquisition precisely according to your needs. The DAQ module is implemented in the user interface and the APIs in a way that makes switching from one to the other straightforward. Note that the initial name of this module is Software Trigger.

If you seek a tutorial on how to use this module, I can recommend this blog post, which includes many practical examples. Let’s go through this tool’s key data acquisition parameters one by one.

DAQ_Settings.png

Figure 4: The sub-tabs of the DAQ module displaying the available settings described in the text.

"Grid Settings" allow you to set the number of samples to be recorded during a single acquisition with its columns parameter. The DAQ module creates an equidistant grid in time, with its total duration calculated according to the data transfer rate. If you need to record multiple data streams simultaneously, these are most likely to not lie on the same temporal grid. Hence, the DAQ module resamples the data to match all streams to the temporal grid of the fastest data stream. In this way, you can acquire a consistent data set while minimizing post-processing efforts. The mode parameter sets up the method for this operation (exact, linear, nearest). You can also look at statistics by adding repetitions and setting up the operations (e.g. average).

Setting rows to more than 1 provides a two-dimensional data set. Activating the 2D button in the Plot Type enables you to create an image. This is a powerful functionality, especially for scanning imaging applications such as dual-frequency resonance tracking, where carrier signals and sidebands are recorded simultaneously and captured as a set of images. For further details on this topic, take a look at the recent blog post by Romain Stomp (DFRT revisited: from feedback optimization to full DAQ acquisition).

"Trigger Settings" allow you to set the acquisition mode. To capture data continuously, choose the continuous trigger type so that the DAQ module captures bursts of data aligned on the preset grid and stacks them as a single time trace. This is the recommended method to record continuous data streams. Data can then be saved either as CSV files from the button below the graph or as HDF5 files from the history sub-tab.

To capture the step response of a device, for example, synchronizing the data acquisition with the step event is crucial. It is possible to pick a trigger setting (edge, pulse, tracking edge, tracking pulse) and choose the trigger channel that fits in the application. The trigger channel can be an external source such as an auxiliary or trigger input (hardware trigger).  The demodulated data can be the trigger source too. You can adjust the trigger level and hysteresis in the same way as you would do on an oscilloscope. More advanced trigger settings are available by using the digital input and output lines (see this blog post for more details).

"Horizontal" sets a time delay relative to the trigger so that you can adjust the position of the time frame relative to the trigger. By setting a hold off time and hold off count, the trigger rearm properties can be adjusted. A unique property of the DAQ module is that it allows you to set the hold off time to be shorter than the acquisition duration so that retriggering is possible. This can be handy if the trigger signal is not periodic or for three-dimensional spectroscopy applications where pixel trigger is required (see this blog post for more details).

vlcsnap-2020-02-11-12h40m56s680.png

Figure 5: The DAQ module acquires a predefined number of data points after a trigger (red) from multiple signals that are aligned on a temporal grid. An image builds up from repeating trigger events.

Among all of its capabilities, perhaps one of the most important features of the DAQ module is that its settings can be saved together with all the other experimental parameters.  Once it is set up, it is always possible to reload the settings file for reproducible measurements.

Keep in mind that the DAQ cross-trigger engine and buffer acquisition is located on the Data Server, not on the instrument itself. Such acquisition is therefore dependent on the data link and on the performance of the local host PC. Even for a hardware trigger, the actual event can only be triggered when reaching the host PC at the rate of the corresponding demodulator speed. If you notice some missed trigger in the acquisition, this may thus be due to a short pulse trigger, typically with a duration below 1 µs. Making use of high and low-level trigger or a flip-flop circuit instead would then be advisable in such cases.

For further information, take a look at these resources:

and at these blog posts with specific tips and tricks on the DAQ module:

Conclusion

I hope this blog post provided a quick overview of the data acquisition capabilities of the Zurich Instruments lock-in amplifiers. I covered from recording a single data point to acquiring images with lock-in data. The DAQ module is arguably the most powerful tool and - like the other LabOne tools - comes with our instruments at no extra cost.