finite accuracy and perfect tuning¶
Due to the finite precision of numeric representation, and due to algorithm-specific limitations, there are many subtleties to the creation of ‘perfect’ tuning when using digital electronics and discrete math. Each measurement time window is ultimately defined by a number of samples performed by the AD-converter , where the sampling frequency is is fixed by the MLA™ internal clock (but can be adjusted within limits by a software command). The MLA™ will generate pure tones at the ‘exact’ frequencies , only when is a power of 2. In other words, perfect tuning is achieved only when the measurement bandwidth and the sampling frequency satisfy , where is an integer. If this condition is fulfilled we call it ‘perfect’ tuning because the algorithms for modulation and demodulation are not a source of error, and the theoretical error is at the limit determined by the finite precision of the digital numbers used in calculating the Fourier sums. This theoretical limit is almost always very far below the noise level, or experimental error in an actual measurement.
Perfect tuning is achieved with the function
lockin.Lockin.tune2(), which enforces the integer-power-of-two restriction on the number of samples in the time window.
Unfortunately, this restriction also has the effect of significantly limiting the number of possible frequencies available for modulation and demodulation.
Therefore, other algorithms have been developed that achieve very close to perfect tuning and in nearly all experimental situations they are indistinguishable from perfect tuning.
The user can apply the function
lockin.Lockin.tune1(), or devise their own tuning algorithm that maintains the constraint on the bandwidth and frequencies ( , a set of integers) and apply the function
lockin.Lockin.set_frequencies_by_n_and_df(). Note that when using the later, it is best to first tune the bandwidth with the help of a tuning function (see tuning frequency combs).
When the tuning is imperfect it is desirable to apply a correction at the end of each time window which resets the phase counter, to avoid a very slow drift of the phase.
This reset will not be noticeable since it corresponds to a tiny correction of phase between each measurement time window.
In other words, the theoretical error resulting from this reset is significantly lower than the measurement noise for any reasonable measurement bandwidth.
Nevertheless, if for whatever reason you need absolute phase-stablity of a drive tone over a long time, this reset action can be turned off by the function
lockin.Lockin.reset_tones_on_new_pixel() with the argument
When the phase reset is turned off and a measurement is running for a long time, a slow drift in the demodulated phase may become noticeable in some circumstances:
The output tone and the demodulation tone drift equally, so the drift will not be noticeable in the measured response of a linear system.
However when measuring nonlinear response in the form of intermodulation between two drive frequencies, a slow phase drift can be observed when the phase reset is turned off.
Another instance where this phase drift can become noticeable are measurements that use signals supplied by external devices, even when these devices are locked to the MLA™ clock.
In this latter case it is recommended that you use the most rigid tuning function
lockin.Lockin.tune2() and turn off the reset action with
The MLA™ has built in functions for performing frequency sweeps. Sweeps can be done in the standard way, with only one frequency applied during each measurement time window. But the MLA™ also has a unique and powerful feature which allows for multiple frequencies to be applied in each time window. Using this multi-tone frequency sweep will dramatically reduce the time needed to sweep over a band at some given frequency resolution, and it can be very useful if you are searching for a very narrow spectral line in a broad band. However, the multi-tone sweep will not give the same result as the standard single-frequency method, if the system under test is nonlinear. The nonlinear system will experience intermodulation between the multiple applied tones, making the principle of superposition no longer valid.
Frequency sweeps are initiated with one command, and the data is read from the MLA™ with a subsequent command. For full documentation of the sweeping functions see the MLA API, subsection mla.lockin,
lockin.Lockin.get_frequency_sweep() and for multifrequency sweeping see
triggered lockin measurement¶
The MLA™ has the ability to trigger lockin measurement. This feature was originally developed to synchronize data acquisition with a the scan of a scanning probe microscope, but it is useful for many other measurements as well. When the MLA™ receives a trigger event, it can set up so that all the phase counters jump to their initial positions (determined by the phase setting of all tones). When this reset happens in the middle of a time window, there will be a glitch in the drive waveform, resulting in a transient in the system under test. This transient may be undesirable, so it is possible to turn off the reset action with
lockin.Lockin.reset_tones_on_trig1(). With this reset action turned off, the receipt of a trigger does not effect the measurement at all.
Receipt of a trigger also increments a trigger counter. There are two trigger counters, one for each of the two trigger ports
TRIG IN 1 and
TRIG IN 2 . These counters are transmitted with every pixel of lockin data in the data stream (see Lockin data packet). When triggered lockin measurement is enabled with
lockin.Lockin.enable_wait_for_trigger() the MLA watches the trigger counter. The
lockin.Lockin.wait_for_trigger() function will block the computer thread until the counter is incremented, and then return with the buffer position of the lockin data packet, during which the trigger was received. The user can then read out data relative to this buffer position, either pre-trigger data or post-trigger data. In scanning applications,
TRIG IN 1 is used for the End Of Line (EOL) and
TRIG IN 2 is used for End of Frame (EOF).
The triggered measurement mode described above is included with a standard shipment of the MLA™. However, with 6 trigger ports and the ability to do real-time logic with the FPGA firmware, there are endless possibilities to do complex triggering by modification of the MLA™ firmware. Contact Intermodulation Products <email@example.com> if you have special triggering needs.
Any real-time reaction to the measured data must be low level-programmed in the MLA™. One example of this is the feedback used in multifrequency atomic force microscopy (AFM): The MLA™ is programed to deliver a frequently-updated voltage to an output port, which is proportional to the response amplitude of one tone. The currently available feedback functions are documented in mla.feeback. There are an infinite number of possible feedback ideas that can be realized by low-level programming of the MLA™ firmware. Consult with Intermodulation Products <firstname.lastname@example.org> if your measurement requires custom feedback.
To optimize the usage of resources for calculating the quadrature response, the internally-generated tones are used both to synthesize the drive waveform, and to demodulate the signal at the input port. Changing the amplitude of a drive tone does not affect demodulation, because demodulation multiplies with a unity-amplitude tone and sums to find the Fourier coefficients. However, when the phase of an internally-generated tone is changed, both the output and the demodulating tone will change phase by the same amount. Thus the response phase (with respect to the drive phase) actually does not change. However, because all tones are generated from the same digital clock, the MLA™ can keep track of the absolute phase of each tone, and rotate the demodulated quadratures so that they are presented with ‘absolute’ phase, or phase with respect to the phase of one reference, the base tone.
If, for what ever reason, you need to have a demodulation phase which is independent of the drive phase, this can easily be done, but it requires that you sacrifice one frequency for analysis. Simply set two of the tones to the same frequency, configuring the drive at one tone to be zero (i.e. measurement only). Some versions of the firmware are designed to work with a different number tones for modulation and demodulation. Consult with Intermodulation Products <email@example.com> if you have special needs in this regard.