Understanding Timestamps and Their Importance for Synchronized Measurements
Timing becomes extremely important as soon as an experiment contains more than a single signal or consists of more than one instrument. All Zurich Instruments lock-in amplifiers provide several ways to ensure synchronization and simultaneous analysis of several signals. In this blog post, we will look into the timestamps in more detail and why they are important for synchronized measurements.
There are many applications where several signals need to be captured in parallel, such as an optics experiment where two photo-detectors are used to capture different parts of the signal, or a MEMS/NEMS experiment where the information is contained in several frequencies or harmonics. Zurich Instruments lock-in amplifiers are well-suited for all these experiments because they provide several demodulators which can be used simultaneously.
Analyzing the signals from several demodulators simultaneously is possible because each measurement value contains a timestamp, which is an integer number corresponding to the time since the instrument was powered on in units of 1/(maximum sampling rate), e.g. 1/1.8 GHz in case of the UHFLI Lock-in Amplifier.
Let’s have a look at an example. Figure 1 shows a screenshot of the Lock-in tab in the LabOne User Interface where a signal with a carrier frequency f1 and two sidebands f1 ± f2 are analyzed using the UHF-MF Multi-Frequency and UHF-MOD AM/FM Modulation options. This is a typical scenario in an experiment where a double modulation is used to increase the signal-to-noise ratio or to investigate correlation effects. The carrier frequency is generated with the signal generator of the UHFLI using oscillator 1, while the amplitude modulation frequency is provided to the UHFLI as an external reference and tracked by oscillator 2. The other 6 oscillators are not used. The demodulators are assigned as follows:
| Demodulator | Input Signal | Frequency |
| 1 | Signal Input 1 | f1 |
| 2 | Signal Input 1 | f1 + f2 |
| 3 | Signal Input 1 | f1 - f2 |
| 4 | Signal Input 2 | f1 |
| 5 | Signal Input 2 | 2*f1 |
| 6 | Signal Input 2 | 2*f2 |
| 7 | Signal Input 2 | 27*f1 |
| 8 | Trigger Input 1 | ExtRef |
The data from the first 7 demodulators is streamed to the data server from where it can be visualized and saved. In this case the data transfer rate for the first three demodulators is set to 13.7 kSa/s, while the other demodulator data is only transferred with 1.7 kSa/s (for more information about how to choose the data transfer rate, please refer to this blog post).
The data can be saved to a file using different methods, such as the Data Acquisition tool, the Record functionality in the Device tab, the Plotter tool, or the APIs. A detailed overview of the different data acquisition tools can be found in this blog post. No matter which method you choose, you will get a file with individual samples of each demodulator. Each sample contains a timestamp, the in-phase and quadrature components X and Y, and some additional information (the complete sample structure can be found in the user manual). The file format can be chosen between CSV, MATLAB, and HDF5.
Figure 2 shows an example of a CSV file where the timestamp, X, and Y columns of the first demodulator are shown. The first timestamp is 472770412728, which corresponds to 472770412728/1.8 GHz = 262.65 s after the instrument was started. The difference between the first and the second value corresponds to (472770543800-472770412728)/1.8 GHz = 72.8 μs, which exactly corresponds to the inverse of the data transfer rate of 13.73 kSa/s which was chosen for this demodulator. In addition to the timestamp information provided with the precision of the sampling rate, the information on the date and time, although usually less relevant, is provided for completeness in a separate file called structure.xml.
Similarly, you can record data using the APIs, which are provided in Python, MATLAB, LabView, C and .NET. Figure 3 shows an example Python code, where we first subscribe to the results of the first demodulator, corresponding to the path /demods/0/sample and then poll the results. Then the clockbase is asked from the instrument, and finally the difference between the first two timestamps of the results is calculated. The result of 72.8 μs is again in agreement with data transfer rate of 13.7 kSa/s. For mode code examples, please visit our github repository.
# Subscribe to the demodulator's sample node path.
path = "/%s/demods/0/sample" % device
daq.subscribe(path)
# Poll the subscribed data from the data server. Poll will block and record
# for poll_length seconds.
poll_length = 0.1 # [s]
poll_timeout = 500 # [ms]
poll_flags = 0
poll_return_flat_dict = True
data = daq.poll(poll_length, poll_timeout, poll_flags, poll_return_flat_dict)
# Unsubscribe from all paths.
daq.unsubscribe("*")
# Access the demodulator sample using the node's path.
sample = data[path]
# Get the sampling rate of the device's ADCs, the device clockbase...
clockbase = float(daq.getInt("/%s/clockbase" % device))
#... and use it to convert the timestamps into seconds:
dt_seconds = (sample["timestamp"][1] - sample["timestamp"][0]) / clockbase
print(dt_seconds)
The timestamps are particularly helpful in the case where different data transfer rates are used for the demodulators. The measurement data can be aligned based on the timestamps during post-processing. Alternatively, the Data Acquisition Module can be used to record the data, which already aligns the data from different demodulators on a temporal grid based on the timestamps.
Synchronization of multiple instruments
Finally, we would like to discuss the importance of synchronization when working with multiple instruments. There are several ways to synchronize multiple instruments:
- Clock synchronization: All Zurich Instruments lock-in amplifiers have 10 MHz clock input and output channels, which can be used to drive or read the clock of another instrument. While this enables to synchronize the frequencies of different instruments, the timestamps of the measured data are not related.
- Trigger signals: All Zurich Instruments lock-in amplifiers provide several trigger input and output channels that can be used for synchronization by phase-locked loops or to record triggered events.
- Timestamp synchronization by post-processing: The timestamp difference of several instruments can be measured by performing a calibration measurement at the beginning of the experiment. This information can then be used to align the measurement values based on their timestamps by post-processing.
- Clock and timestamp synchronization: When using several Zurich Instruments lock-in amplifiers of the same series (e.g. two UHFLIs), it is possible to synchronize both the clocks and the timestamps of the instruments using the Multi-Device Synchronization protocol.
An example where the MDS protocol is convenient are Quantum Hall effect measurements. In this case, one needs to measure the transverse voltage (Vxx) and the longitudinal voltage (Vxy) simultaneously. This can be done with very high precision by using two MFLIs as described on our application page.
In conclusion, the timestamps which are saved with each measurement value are extremely important when measuring more than one signal and analyzing their correlated behavior. The timestamps are provided as integer numbers in units of 1/(maximum sampling frequency) of each Zurich Instruments lock-in amplifier, and correspond to the time since the instrument has been powered on.
If you have further questions please get in touch.