Demodulation#
SNOM relies heavily on lock-in amplifier demodulation of various \(z_{tip}\) -dependent signals at different harmonics, \(n\), of an AFM tip’s tapping frequency.
For this reason snompy features code to simulate lock-in measurements of arbitrary functions.
In most cases, you can ignore this, and rely on versions of the snompy functions that have this functionality built-in.
For example snompy.fdm.eff_pol_n() is a modulated and demodulated version of snompy.fdm.eff_pol(), so you don’t need to worry about simulating the demodulation in your own code.
This section describes how lock-in measurements are simulated in snompy, and also how you can use the demodulation functionality on arbitrary functions that aren’t included in the package.
Lock-in amplifier simulation#
A lock-in amplifier extracts a periodic signal with a known frequency from a noisy background. It works by multiplying the input signal by a sinusoidal reference signal of the desired frequency, then using a low-pass filter to remove unwanted high-frequency components. This effectively suppresses all frequency components except for the component which is at the same frequency and in-phase-with the reference signal. In modern lock-ins, two orthogonal reference signals are usually used in order to measure both the amplitude and phase of the desired signal.
To simulate this, we first need to convert a non-periodic function \(g(x)\) into a periodic function \(f(\theta)\). We apply a modulation as:
We can then simulate demodulation of \(f(\theta)\) at different harmonics, \(n\), by multiplying it by a complex sinusoid (\(e^{-i \theta n}\), whose real and imaginary components are orthogonal) then integrating over a single period of the oscillation as:
In snompy this process is implemented by the function snompy.demodulate.demod().
Adapting the process for AFM#
For AFM demodulation we apply a slight variation of the general approach above. To simulate a periodic modulation of \(z_{tip}\) with tapping amplitude \(A_{tip}\), we apply a modulation like:
Note that the cosine term here has been offset so that the oscillation is centred on \(z_{tip}+A_{tip}\), rather than on \(z_{tip}\) itself. This is to ensure that when \(z_{tip}=0\) the lowest part of the oscillation never becomes negative, which would mean intersecting with the sample surface.