Direkt zum Inhalt
Search

Principles of Boxcar Averaging

Principles of Boxcar Averaging

Introduction

Capturing low-duty-cycle pulsed signals with high quality and real-time feedback are crucial requirements in many applications in optics and photonics, nanotechnology and materials science, quantum technologies, scanning probe microscopy, and sensing. Boxcar averagers are attractive tools to achieve a high signal-to-noise ratio (SNR) in a minimal amount of measurement time when working with low-duty-cycle signals. Such signals contain relevant information only in a fraction of each period; outside of that short interval only noise is present. A boxcar averager captures the signal from a well-defined temporal window in each period, meaning that all signal components outside of that window are rejected.

Unlike a digitizer or an oscilloscope, the measurement results are immediately available in the digital domain and as analog signals with a user-defined offset and scaling factor. Moreover, integrated PID controllers can process the results to create feedback loops and a lock-in amplifier unit can perform demodulation on the boxcar results if an additional modulation is present.

In this white paper, we illustrate the working principle of a digital boxcar averager, elucidate the relevant measurement parameters, present the state of the art, and provide guidelines for the best choice of measurement technique when working with periodic signals.

Basic Working Principle

In a typical periodic pulsed signal the information is contained in a short pulse of duration Tp, with a significant waiting time between individual pulses, as shown in Figure 1 (a). The signal can be characterized by its duty cycle d = Tp/Trep, where Trep = 1/frep is the inverse of the repetition rate frep of the pulses. If the duty cycle is low, measuring continuously in time results in a low SNR, as the time intervals between individual pulses contribute to the captured noise but not to the signal.

With a boxcar averager it is possible to acquire the signal only during the pulse duration, ignoring the time intervals between pulses. This corresponds to a multiplication of the input signal with a boxcar function, which is a rectangular pulse train as shown in Figure 1 (b). By matching the period of the boxcar function Trep, the boxcar window width Tbox, and its position with respect to the signal pulses, the noise between signal pulses can be discarded as illustrated in Figure 1 (c). The signal is then integrated over the duration of Tbox. Finally, the integrated signal is averaged over N periods as indicated in Figure 1 (d).

Basic working principle of boxcar averaging

Figure 1: Working principle of a boxcar averager. (a) Typical input signal from a pulsed experiment, where Tp is the pulse width and Trep is the repetition period. (b) Schematic illustration of a boxcar function, also known as rectangular pulse train, with a pulse width Tbox. (c) Resulting signal after the multiplication of the input signal with a boxcar function. Noise contributions outside of the boxcar window are rejected. (d) The signal is integrated during each boxcar window, and finally, the result is averaged over N periods.

Boxcar Parameters and Their Effects

Boxcar window

While the repetition rate of the boxcar averager is determined by the repetition rate of the input signal, the boxcar window and the number of averaging periods can be adjusted to optimize the SNR.

The width of the boxcar window Tbox and its position with respect to the signal pulses are important parameters when optimizing the SNR. Assuming white noise, the ideal boxcar window width can be calculated for a known pulse shape and repetition rate. In Figure 2 (a) we show one period of a periodic signal with Gaussian pulses given by p(t) = A exp(-0.5t22), where σ = 0.04Trep is the root mean square width. We can now calculate the fraction of the signal sbox captured when the signal is integrated over a boxcar window of width Tbox. For a rectangular boxcar window centered at the Gaussian pulse, sbox is given by

\[\mathrm{s_{box}=\int_{-T_{box}/2}^{T_{box}/2}p(t)dt}\]

(1)

and increases with Tbox until the full pulse is captured. However, the captured noise also increases with Tbox. In the case of white noise, the captured noise nbox increases proportionally to the square root of the boxcar window width, namely nbox \(\mathrm{\propto}\) √Tbox.

Figure 2 (b) shows examples of sbox, nbox, and SNR = sbox/nbox as functions of Tbox. Here, the noise was scaled such that SNR = 0.6 if the whole period is captured, i.e., when Tbox = Trep . One can observe that the captured signal increases with the boxcar window width until it approaches an amplitude of 1 when the full pulse is captured by the boxcar window. Once the signal is completely captured, the SNR scales with √(Trep/Tbox) due to the rejection of noise outside of the boxcar window. The maximum SNR can be achieved by choosing a boxcar window that does not capture the full pulse. In this example, the SNR is maximized when 84% of the signal is captured, which corresponds to Tbox ≈ 2.8σ ≈ 0.11Trep as illustrated in Figure 2 (a).

In a real measurement, it is convenient to optimize the SNR by starting with a large boxcar window and then reduce its width until the SNR peaks.

Boxcar window optimization

Figure 2: Boxcar window optimization. (a) Gaussian pulse with standard deviation σ = 0.04Trep and a boxcar window with ideal width. (b) Signal, noise and SNR for the Gaussian pulse as functions of the boxcar width σ. Measuring the full period results in SNR = 0.6. With an ideal boxcar window width of Tbox ≈ 2.8σ ≈ 0.11Trep, SNR ≈ 1.5 can be achieved.

Averaging periods

After discarding the noise contributions between pulses, the signal is integrated over the duration of each boxcar window and then averaged over multiple periods using a moving average filter. Instead of defining an averaging time Tavg, it is convenient to define the number of boxcar periods N = Tavg/Trep over which the signal is averaged. Assuming a white noise floor and an ideal boxcar window, the captured signal increases linearly with N, whereas the noise contribution increases as the square root of the sum of the squares of the captured noise. For N boxcar periods, the resulting SNR is therefore given by

\[\mathrm{SNR = \frac{\sum_{i=1}^{N}s_{box}}{\sqrt{\sum_{i=1}^{N}{n^2_{box}}}}=\frac{Ns_{box}}{\sqrt{N{n^2_{box}}}}=\frac{s_{box}}{n_{box}}\sqrt{N}}\]

(2)

where we assume that the signal sbox and noise nbox are the same in each period.

Spectral response

The output of the boxcar averager Outbox can be calculated in the time and the frequency domains using the Plancherel theorem [1]:

\[\mathrm{Out_{box}}=\int_{\mathrm{-NT_{rep}/2}}^{\mathrm{NT_{rep}/2}}\mathrm{B(t)S(t)dt}=\int_{\mathrm{-\infty}}^{\mathrm{\infty}}\hat{\mathrm{B}}\mathrm{_{N}(\omega)}\hat{\mathrm{S}}\mathrm{(\omega)d\omega}\]
(3)

where B(t) and S(t) are the boxcar function and the input signal in the time domain, respectively, and \(\hat{\mathrm{B}}\mathrm{(\omega)}\) and \(\hat{\mathrm{S}}\mathrm{(\omega)}\) are their Fourier transforms. To account for the finite number of averaging periods, we introduced \(\hat{\mathrm{B}}\mathrm{_{N}(\omega)}\) as the Fourier transform of a boxcar function with N pulses. To understand the spectral response of a boxcar averager, we discuss B(t), \(\hat{\mathrm{B}}\mathrm{(\omega)}\), and \(\hat{\mathrm{B}}\mathrm{_{N}(\omega)}\) in more detail.

We start by considering an infinite number of averaging periods and use the Fourier theorem stating that a periodic function can be expressed as a sum of sine and cosine terms. The boxcar function B(t) can thus be expressed as

\[\mathrm{B(t)=a_0 + }\sum_{\mathrm{m=1}}^{\mathrm{\infty}}\mathrm{a_m \cos(m\omega_0t)}\]

(4)

where the sine terms are zero because B(t) is an even function.

The fundamental frequency ω0 = 2π frep is determined by the repetition rate of the pulses. The coefficient a0 = d = Tbox/Trep corresponds to the duty cycle, and the coefficients am are given by

\[\mathrm{a_m=\frac{2}{m\,\pi}\sin\left(\frac{m\,\pi\, T_{\mathrm{Box}}}{T_{\mathrm{rep}}}\right)}.\]
(5)

Hence the Fourier transform of a boxcar function corresponds to a series of delta peaks at the harmonics of the fundamental frequency frep, weighted by the coefficients am. Equation 3 elucidates that a boxcar averager captures the signal - and the noise - contained in the harmonics, and it efficiently rejects other frequency components.

For a large number of averaging periods, \(\hat{\mathrm{B}}\mathrm{_{N}(\omega)}\) approaches \(\hat{\mathrm{B}}\mathrm{(\omega)}\). Figure 3 (a) shows an example of \(\hat{\mathrm{B}}\mathrm{_{N}(\omega)}\) for N = 200 with almost delta-like peaks at the harmonics. The envelope of the Fourier transform, i.e., the weighting of the peaks given by am, can be identified as the normalized sinc function sinc(x) = sin(π x)/(π x), with zero points given by f/frep = 1/d. To illustrate the effect of the duty cycle, we show Equation 5 for three different values of duty cycle: d = 0.05, d = 0.1 and d = 0.2 (see Figure 3 (b)). It can be observed that a lower duty cycle puts more relative weight on contributions from higher harmonics.

For a finite number of averaging periods, each peak of \(\hat{\mathrm{B}}\mathrm{_{N}(\omega)}\) turns into a sinc functions itself, with a distance between zeros given by frep/N. Figure 3 (c) provides an example of \(\hat{\mathrm{B}}\mathrm{_{N}(\omega)}\) with N = 5 periods. The signal is captured at the harmonics, but the side lobes of the sinc function can result in leakage of noise components into the measured signal. Adjusting the number of averaging periods is therefore crucial for the SNR. Without any averaging, i.e., for N = 1, the sum of sinc functions becomes a single sinc function corresponding to the envelope plotted in Figure 3 (b).

The measurement bandwidth f3dB is defined as the frequency where the signal is attenuated by 3 dB, corresponding to approximately 0.71 of the amplitude. For a boxcar averager, f3dB can be calculated from the amplitude decrease of the sinc function centered at zero frequency:

\[\mathrm{sinc\left(\frac{N}{f_{rep}} f_{3dB}\right)} = \mathrm{\sqrt{10^{-3/10}} \approx 0.71},\]

(6)

which gives

\[\mathrm{ f_{3dB}}= \mathrm{c\,\frac{f_{rep}}{N}}\]

(7)

with c = sinc-1(√(10-3/10)) ≈ 0.44. The measurement bandwidth depends linearly on the averaging periods N and the repetition rate frep.

Spectral and temporal response of a boxcar averager

Figure 3: Spectral and temporal response. (a) Fourier transform of a signal with a duty cycle of d = 0.1 and N = 200 periods. (b) Envelope functions of the Fourier transform. The coefficients am are shown as a function of frequency for three different values of duty cycle: d = 0.05, d = 0.1 and d = 0.2. (c) Fourier transform of a signal with a duty cycle of d = 0.1 and N = 5 periods. (d) Temporal response. Due to the moving average over N periods, the response of the boxcar averager is linear in time and reaches the new value after N periods.

Temporal response

The temporal response of a boxcar averager is determined by the calculation of the average over N periods. For a moving average filter, the temporal response is linear in time, with a slope determined by N as illustrated in Figure 3 (d). After a change in the signal, 100% settling is obtained after N pulses. For imaging applications, zero cross-talk between pixels can be achieved by choosing a measurement time equal or larger than NTrep per pixel. A digital implementation enables to monitor the signal continuously by providing intermediate results during the calculation of the moving average over N periods.

Summary of boxcar parameters and their effects

  • Boxcar window: The window width Tbox and its position determines the captured signal and noise. Assuming white noise, the SNR increases approximately with √(Trep/Tbox). The SNR is often maximized for a window width smaller compared to the full width of the input signal pulse.
  • Averaging periods N: The integrated signal is averaged over N periods using a moving average filter. Assuming white noise, the SNR increases proportionally to √N.
  • Spectral response: A short boxcar window Tbox puts more relative weight on contributions from higher harmonics. The number of averaging periods N determines the width of the sinc function peaks at the harmonics.
  • The measurement bandwidth f3dB scales linearly with frep/N.
  • Temporal response: The response of a boxcar averager is linear in time with a slope determined by the number of averaging periods N and the repetition period Trep.

State of the Art

The first analog boxcar averagers were built following the principle of boxcar averaging described by Blume and collaborators in 1961 [2]. More recently, the development of analog-to-digital converters with high speed, resolution and linearity has enabled the realization of digital instruments where all calculations are carried out numerically by digital signal processing on a fast field-programmable gate array (FPGA). The Zurich Instruments UHF-BOX Boxcar Averager shown in Figure 4 (a) is the only digital boxcar averager on the market today. It enables dead-time-free operation up to a repetition rate of 450 MHz, and offers additional features such as a periodic waveform analyzer (PWA) and the possibility for baseline suppression. Control and readout of all instrument settings and measurement parameters are achieved thanks to the LabOne® user interface shown in Figure 4 (b) or through application programming interfaces (APIs).

 

Table 1: Comparison between an analog boxcar averager and the digital UHF-BOX Boxcar Averager.
Feature Analog UHF-BOX

Insensitive to trigger jitter

no yes

Rectangular boxcar window

no yes

Intermediate results

no yes

Measure non-periodic signals

yes no

Graphical user interface

no yes

Periodic waveform analyzer

no yes

Flexible reference window

no yes

Max. averaging periods

10000 1 Mio

Max. repetition rate for dead-time-free operation

< 50 kHz 450 MHz
The UHF-BOX Boxcar Averager and the LabOne user interface

Figure 4: Zurich Instruments UHF-BOX Boxcar Averager. (a) The instrument provides two signal input and two signal output channels with 600 MHz bandwidth, as well as multiple trigger and auxiliary channels and a 32-bit DIO port. (b) Screenshot of the LabOne® user interface. The Boxcar Averager tool is shown in the top panel: boxcar window and reference window can be set using the PWA. The bottom panel shows the Plotter tool, where the boxcar result is displayed over a period of 10 s. The math tab of the Plotter tool allows users to calculate relevant information from the visualized result such as average, standard deviation and SNR.

Analog vs digital operation

Analog boxcar averagers are based on a trigger-controlled gate window during which the signal is acquired and integrated, therefore they are often referred to as gated integrators. Controlling the boxcar window with individual trigger pulses has the advantage that both periodic and also non-periodic input signal pulses can be processed. However, the trigger re-arm time - caused by the finite time required to erase the integrator - can be several milliseconds long and constitutes a significant limitation for fast pulse sequences. Additionally, the boxcar window of an analog boxcar averager is not perfectly rectangular due to the rising time of the gate, and the reliance on a trigger signal causes jitter. In the digital UHF-BOX Boxcar Averager, the input signal is digitized using an analog-to-digital converter; the subsequent multiplication with the boxcar function and averaging operation are performed in the digital domain. This process makes it possible to achieve an almost perfect rectangular boxcar window without dead time. In this case, the rise time only depends on the input bandwidth and sampling frequency, and it enables operation at very high repetition rates without signal loss. A simplified block diagram of the UHF-BOX Boxcar Averager is shown in Figure 5 (a). The signal is phase-locked to an internal oscillator so that the boxcar window is defined in terms of the phase. The phase-synchronous data processing of a periodic signal is insensitive to trigger jitter and drift, and is patented by Zurich Instruments [3]. The boxcar averager results can be routed internally to other tools, for example to the lock-in amplifier unit if the duty cycle of the signal is subject to an additional modulation, or to the internal PID controllers for creating feedback loops. Thanks to the digital calculation of the moving average, intermediate results of the boxcar averager output can be obtained and used to implement fast feedback loops.

Table 1 provides a summary of the comparison between analog boxcar averagers and the digital UHF-BOX Boxcar Averager.

Hardware requirements

A boxcar averager captures information from the fundamental frequency and many harmonics. Measuring higher harmonics requires an input bandwidth of the instrument that is at least several multiples of the fundamental frequency, and an even higher sampling rate.

Periodic waveform analyzer

Choosing the width and the position of the boxcar window can be challenging if the signal is buried in noise. The UHF-BOX Boxcar Averager facilitates this process by providing a periodic waveform analyzer (PWA) tool displaying a single period of the input signal. If the SNR is low, the input signal can be averaged over many periods. In Figure 5 (b), the boxcar window is defined with respect to the phase of the reference oscillator. If the pulse cannot be resolved when measuring the full period, the PWA makes it possible to increase the resolution by zooming in and displaying only a fraction of the full period: this is done by referencing the signal input to a higher harmonic of the reference oscillator. With the PWA users can also calculate the Fast Fourier Transform of the input signal and thereby display and analyze the weighting of the harmonics with respect to the fundamental frequency.

Baseline suppression and arithmetic operations

In the UHF-BOX Boxcar Averager, inaccuracies due to DC components and variable offsets can be removed thanks to a reference window in the time interval between pulses. This so-called baseline suppression also enables the rejection of disturbing input signals that are phase-shifted with respect to the signal of interest at the fundamental frequency, such as electronic reflections in the cables. The position of the reference window can be chosen using the PWA, as shown in Figure 5 (b).

The concept of a reference window is ideal for experiments where the information of interest is only present in every other pulse, as is the case in pump-probe spectroscopy with pump-induced transmission change. By setting two filter windows in the time domain, individual signal components can be successfully isolated.

The UHF-BOX Boxcar Averager offers two independent boxcar units, each with baseline suppression, and a built-in Arithmetic Unit. The Arithmetic Unit can provide real-time results based on a combination of two parallel boxcar measurements with arbitrary scaling factors, for example to capture dI/I on a shot-to-shot basis by normalizing the result with a second boxcar measurement.

Waveform Recovery

For certain applications, it is not only the integrated signal that holds an interest: the shape of the pulse is equally relevant. There exist several tools to recover the waveform of a periodic signal:

  • An oscilloscope or digitizer card together with an averaging operation.
  • A periodic waveform analyzer.
  • A boxcar averager combined with a sweep of the position of the boxcar window with a width much smaller than the pulse width.

If the SNR of the input signal is relatively high and a reliable trigger source is available, an oscilloscope or a digitizer card is generally the tool of choice. The digitized input signal can be averaged over several periods using a trigger signal; alternatively, all raw data can be saved for post-processing. The performance of the measurement depends on the instrument's specifications including sampling rate, voltage resolution, and memory depth. For signals with a low SNR, however, averaging over many periods is necessary and can turn trigger jitter and trigger drift into limiting factors.

For a periodic input signal with a low SNR, the waveform can be reconstructed with a boxcar averager. The UHF-BOX Boxcar Averager offers a variable gain input range amplifier to ensure high sensitivity and low input noise, and it is insensitive to trigger jitter and drifts given that the signal is locked to an internal oscillator. The PWA tool of the UHF-BOX Boxcar Averager, which was introduced above, is the method of choice when speed is more important than time resolution, for instance as a way to choose the boxcar window. However, the time resolution is fixed at 1024 points per period and can become a limitation for measuring wide pulses.

Alternatively, the waveform can be measured by sweeping a short boxcar window across the pulse. For this purpose, the boxcar window width is chosen to be much smaller than the width of the pulse as shown in Figure 5 (c). With this approach, it is possible to increase the SNR of the measurement by rejecting noise components outside of the boxcar window. With the UHF-BOX Boxcar Averager, a boxcar window sweep is easily performed using the built-in Sweeper tool; the ability to measure the integral and the shape of the waveform with the same instrument guarantees a simplified setup. The disadvantage of this strategy is that it is relatively slow and sensitive to signal intensity drifts as large parts of the data from every period are discarded.

Table 2 summarizes the properties of different tools for waveform recovery with a relative qualitative assessment of their performance.

Features of the Zurich Instruments UHF-BOX Boxcar Averager

Figure 5: Features of the Zurich Instruments UHF-BOX Boxcar Averager. (a) Simplified block diagram. The signal is phase-locked to an internal oscillator, which enables to define the boxcar and reference windows in terms of the phase. (b) Periodic waveform analyzer showing one period of the input signal. The boxcar and the reference window are highlighted in grey. (c) Waveform recovery by sweeping the boxcar window. The envelope of the pulse can be reconstructed by choosing a boxcar window which is much shorter than the pulse and sweeping it over the pulse duration.

Table 2: Comparison of the different tools for waveform recovery with a relative qualitative assessment.
  Scope or Digitizer Boxcar Window Sweep Periodic Waveform Analyzer

Measurement SNR

low high medium

Measurement time resolution

high medium medium

Measurement amplitude resolution

medium high high

Measurement speed

fast slow fast

Insensitivity to trigger jitter/drift

no yes yes

Boxcar Averager vs Lock-in Amplifier

Lock-in amplifiers and boxcar averagers use different methods to measure a periodic signal. A boxcar averager captures information from the fundamental frequency of the signal and many harmonics, whereas a lock-in amplifier performs a selective measurement at a single frequency. The latter is achieved by multiplying the input signal with a reference signal that is typically sinusoidal, followed by adjustable low-pass filtering. The spectral response, measurement speed and temporal response depend on the bandwidth and the order of the low-pass filter as described in the lock-in detection white paper.

When establishing which measurement approach is better suited to a given experiment, some important considerations are:

  • What is the waveform of the input signal? Is it a sine wave, a square wave, a train of periodic pulses, or a more complex waveform?
  • What is the duty cycle of the input signal?
  • How low is the SNR of the input signal? What are the properties of the noise?
  • What are the requirements in terms of acquisition speed and settling time?

For a purely sinusoidal input signal, lock-in detection is generally the method of choice because the experiment can be set up quickly and easily. A boxcar measurement with the same measurement bandwidth can give a slightly higher SNR with an optimized boxcar window and baseline suppression. Optimizing a boxcar measurement requires the control of more parameters compared to setting up a lock-in measurement, however, and boxcar averagers are typically more expensive due to the need for a larger signal input bandwidth to capture higher harmonics.

The higher effort of setting up a boxcar measurement becomes valuable for a square wave or a pulsed signal. The lower the duty cycle of the input signal, the more information is contained in the harmonics. A boxcar averager allows experimenters to capture this information by decreasing the boxcar window width, thereby putting more relative weight on higher harmonics. Capturing the information from higher harmonics also leads to additional noise contributions though. Overall, the true advantage of boxcar averaging over lock-in detection depends on the properties of the noise background.

Figure 6 (a) shows the typical noise floor of an experiment, consisting of white noise and 1/f noise. The spectral response of a 1st-order low-pass filter for a lock-in amplifier is indicated around the fundamental frequency frep. In this example, the noise at the fundamental frequency frep is dominated by 1/f noise. A lock-in amplifier thus captures a significant amount of noise, leading to a small SNR for this measurement. Figure 6 (b) presents the spectral response of a boxcar averager with a duty cycle of d = 0.05 and N = 20 averaging periods with the same noise background: by capturing the information from the harmonics where less noise is present, boxcar averaging results in a significantly higher SNR in this scenario.

Comparison of the spectral response of a lock-in amplifier and a boxcar averager

Figure 6: Comparison of the spectral response of a lock-in amplifier and a boxcar averager. (a) Logarithmic plot of the spectral response of a 1st-order low-pass filter centered at the fundamental frequency. The typical noise floor consisting of white noise and 1/f noise is shown with arbitrary amplitude. (b) Logarithmic plot of the spectral response of a boxcar averager with a duty cycle of d = 0.05 and N = 20 periods with the same noise floor.

Additionally, being able to define a reference window in the time domain offers a very powerful way to avoid systematic measurement errors due to noise sources phase-shifted with respect to the signal of interest, while making it possible to isolate individual signal components as is required when measuring pump-induced effects, for instance.

Finally, the filter function is a critical aspect for measurement speed. Let's consider a signal with frep = 10 MHz. Reaching 99.9% settling with a 5th-order low-pass filter and a filter bandwidth of f3dB = 34 kHz takes approximately 26 us (see the lock-in detection white paper for the calculation). By contrast, a boxcar averager with a bandwidth of 34 kHz (N = 128 averaging periods) reaches 100% settling after NTrep = 12.8 us. In the case of video-rate microscopy, for example, it is therefore easier to avoid cross-talk between pixels with a boxcar averager.

In summary, lock-in measurements are easy to set up and less demanding in terms of input bandwidth and sampling rate. Boxcar averaging requires faster electronics and the optimization of several parameters, but this added complexity becomes valuable for low-duty-cycle pulsed signals where it enables to push the limits in terms of SNR and measurement speed. The best way to settle on a measurement strategy is a one-to-one comparison between a lock-in amplifier and a boxcar averager. Alternatively, users can consider implementing both methods simultaneously: this is possible on the Zurich Instruments UHFLI Lock-in Amplifier with the UHF-BOX Boxcar Averager option.

Sprechen Sie uns an     Angebot anfordern

References 

[1] M. Plancherel and M. Leffler. Contribution à l’étude de la représentation d’une fonction arbitraire par des intégrales définies. Rendiconti del Circolo Matematico di Palermo, 30:289, 1910.
[2] R. J. Blume. Boxcar integrator with long holding times. Review of Scientific Instruments, 32(9):1016, 1961.
[3] Zurich Instruments. Lock-in amplifier with phase-synchronous processing, 2014. Patent US20140218103A1.
Kontaktieren Sie uns