The Principles of Boxcar Averaging

Capturing low-duty-cycle pulsed signals with high quality is crucial for 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 in a short time interval, while the rest of the period contains only noise. 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.

Principles of Boxcar Averaging

Video credit: Zurich Instruments

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 article, we illustrate the working principle of a digital boxcar averager, discuss the relevant measurement parameters, 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 time interval 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 the signal can be acquired during the pulse duration, while the time intervals between the pulses are ignored. 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).

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.

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. Image Credit: Zurich Instruments AG

Boxcar Parameters and Their Effects

Boxcar Window

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

(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 ∝ √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 maximum SNR is found.

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

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. Image Credit: Zurich Instruments AG

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

(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]:

(3)

 

where B(t) and S(t) are the boxcar function and the input signal in the time domain, respectively, and B̂(ω) and Ŝ(ω) are their Fourier transforms. To account for the finite number of averaging periods, we introduced B̂N(ω) as the Fourier transform of a boxcar function with N pulses. To understand the spectral response of a boxcar averager, we discuss B(t), B̂(ω), and B̂N(ω) 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

(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

(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 amEquation 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, B̂N(ω) approaches B̂(ω). Figure 3 (a) shows an example of B̂N(ω) 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 B̂N(ω) turns into a sinc functions itself, with a distance between zeros given by frep/N. Figure 3 (c) provides an example of B̂N(ω) 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:

(6)

which gives

(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. (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.

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. Image Credit: Zurich Instruments AG

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).

Figure 4.  Zurich Instruments UHF-BOX Boxcar Averager [3]. (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: the 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. Image Credit: Zurich Instruments AG

 

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.

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. 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.

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. Image Credit: Zurich Instruments AG

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.

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. (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.

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. Image Credit: Zurich Instruments AG

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.

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.

This information has been sourced, reviewed and adapted from materials provided by Zurich Instruments AG.

For more information on this source, please visit Zurich Instruments AG.

Citations

Please use one of the following formats to cite this article in your essay, paper or report:

  • APA

    Zurich Instruments AG. (2022, September 19). The Principles of Boxcar Averaging. AZoOptics. Retrieved on October 07, 2022 from https://www.azooptics.com/Article.aspx?ArticleID=2262.

  • MLA

    Zurich Instruments AG. "The Principles of Boxcar Averaging". AZoOptics. 07 October 2022. <https://www.azooptics.com/Article.aspx?ArticleID=2262>.

  • Chicago

    Zurich Instruments AG. "The Principles of Boxcar Averaging". AZoOptics. https://www.azooptics.com/Article.aspx?ArticleID=2262. (accessed October 07, 2022).

  • Harvard

    Zurich Instruments AG. 2022. The Principles of Boxcar Averaging. AZoOptics, viewed 07 October 2022, https://www.azooptics.com/Article.aspx?ArticleID=2262.

Ask A Question

Do you have a question you'd like to ask regarding this article?

Leave your feedback
Your comment type
Submit