1 Introduction

Laser absorption spectroscopy has been widely employed to monitor the concentration of various gaseous species with both practical/engineering [1, 2] and scientific [3] applications. In addition to direct absorption, more sophisticated measurement schemes incorporating active signal processing strategies can be employed such as the wavelength modulation spectroscopy (WMS). WMS consists of applying a high-frequency sinusoidal signal to the injection current of a laser diode. This enables generation of absorption-dependent harmonics in the transmitted signal which can be specifically amplified to increase the signal-to-noise ratio (SNR) such that lower detection limits can be achieved [4,5,6,7]. With the technical and cost efficiency advancements of tunable laser diodes, the WMS has been extensively employed over the past 20 years, and applied to a number of technical or scientific subjects including food packaging and aging [8], fuel cell monitoring [9], industrial safety [10], fundamental experimental spectroscopy [11], theoretical spectroscopy [12], atmospheric chemical sensing [13, 14], sensor design and optimization [15], and many combustion relevant situations [16,17,18,19,20,21,22,23,24,25,26,27,28]. The present paper is concerned more specifically with the process of extracting the harmonic signals from the detected laser signal, i.e. the demodulation process. While analog lock-in amplifiers have been historically employed to extract these harmonic signals, the use of digital lock-in has been widely adopted following the pioneering work of Rieker et al. [29]. However, as will be detailed later in this article, while presenting significant improvements over the analog approach in terms of hardware simplification, using digital lock-in can also introduce a number of complications such as finite impulse response (FIR) filter design and bandwidth optimization. An alternative method relying on wavelet transform (WT) has been proposed to extract the harmonic signal [30, 31]. WT has been widely employed in a number of scientific and engineering fields to analyze time-series data [32,33,34,35]. As underlined by Farge [35], wavelet transform enables to unfold a signal into both space/time and scale/frequency domain by employing analyzing functions, i.e. the wavelet, which are localized in both domains. A detailed description of the WT basic aspects is provided in the next section. While WT has been employed in many WMS studies, the large majority of these have used it for denoising the WMS signal after demodulation with either an analog or digital lock-in amplifier [36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]. These studies have demonstrated that wavelet denoising is a powerful approach to post-process the second-harmonic (2f) WMS signal and enables to increase the SNR, improve the detection limit, and improve the long-term stability of the sensor. To the best of our knowledge, only two studies have employed WT to extract the harmonic signal. Duan et al. [30] measured ammonia using the WMS technique and employ the harmonic waveletFootnote 1 (see Newland [51]), to extract the first- (1f), second- (2f), and third- and fourth-harmonic (3f–4f) signals. They compared these nf signals with the analytical Fourier coefficients \(\text{H}_{{1}}\), \(\text{H}_{{2}}\), and \(\text{H}_{{3}}\). A good agreement was found which demonstrated that the harmonic wavelet could be used to effectively extract the harmonic signals. A brief comparison was also made between the shape of the 2f signal extracted using an analog lock-in amplifier and with the wavelet approach. The authors noted the higher “purity” of the 2f signal extracted using harmonic wavelet. Zhou and Jin [31] also used the harmonic wavelet to demodulate the WMS signal of water vapor. Their comparison of the 2f signals obtained using a lock-in amplifier and the wavelet approach showed that the signal extracted with the latter method was smoother. They concluded that the harmonic wavelet approach could improve the WMS technique.

From this bibliographic review, we conclude that, although the potential of the wavelet approach as a denoising method for nf signal post-processing has been well established, only very limited study has been performed to evaluate its potential as a method for demodulating the WMS signal. While the possibility of applying one particular type of wavelet to WMS demodulation has been explored by existing studies, detailed comparison with the well-established lock-in approach remains an interesting but uncharted subject. The goals of the present paper are (i) to perform a comprehensive analysis of WMS signal using Fourier and wavelet transforms; and (ii) to realize a detailed comparison of the performances of digital lock-in-based WMS (DLI-WMS) and WT-WMS. The manuscript is organized as follows: (i) in Sect. 2, the fundamentals of WMS and WT are presented in detail; (ii) in Sect. 3, the experimental set-up is described; (iii) in Sect. 4, the digital lock-in approach is studied in depth using Fourier analysis; (iv) in Sect. 5, the WT approach is examined in detail; (v) in Sect. 6, the advantages and drawbacks of both techniques are discussed; (vi) in the last section, concluding remarks are given.

2 Fundamentals of WMS and wavelet transform

2.1 Wavelength modulation spectroscopy

In the infrared range, most gas molecules, such as \(\text{CO}_2\), \(\text{H}_2\)O, CO, and \(\text{CH}_4\), have characteristic absorption spectra. The origin of such spectra is related to the change of electric dipole moment of the molecule during the vibration of its chemical bonds. When the frequency of the incident light coincides with the frequency of the electric dipole moment change of the molecule, the molecule absorbs energy from the incident light and transitions to a higher energy level. The resulting absorption phenomenon can be described by the Beer–Lambert’s law [52]:

$$\begin{aligned} T_\nu =\left( \frac{I_{t}}{I_{0}}\right) _\nu = \exp (-k_\nu L), \end{aligned}$$
(1)

where \(T_\nu\) is the transmittance at laser frequency \(\nu\); \(I_t\) and \(I_0\) are the transmitted and incident laser intensity, respectively; \(k_\nu\) is the spectral absorption coefficient; L is the absorption path length. For gas species with fingerprint spectral features associated with individual quantum transitions, the spectral absorption coefficient \(k_\nu\) can be further expanded into

$$\begin{aligned} k_\nu = P\chi _i\sum _{j}^{} S_{j} \phi _{j}, \end{aligned}$$
(2)

where P is the total pressure of the gas, \(\chi _i\) is the mole fraction of the absorbing species, \(S_j\) and \(\phi _j\) are the line strength and line-shape function of the jth absorption, respectively. This allows the species concentration to be measured non-intrusively with the laser diagnostic method.

Based on the molecular absorption principle, WMS is performed using tunable diode lasers (TDL). The output frequency of TDLs can be controlled by the injection current and temperature of the laser cavity. For scanned-WMS, the injection current is usually tuned as

$$\begin{aligned} i_{{\mathrm{c}}}(t) = i_{\text{c-scan}}(t) + i_{{\mathrm{a}}}\cos (\omega t), \end{aligned}$$
(3)

where \(i_{\text{c-scan}}(t)\) is the scan signal, \(\omega\) is the angular frequency of modulation, and \(i_{{\mathrm{a}}}\) is the amplitude of modulation of the injection current. When TDLs are controlled with \(i_{{\mathrm{c}}}(t)\), the laser frequency output, expressed in wavenumber (\(\text{cm}^{-1}\)), varies as

$$\begin{aligned} \nu (t) = \nu _{{\mathrm{scan}}}(t) + a\cos (\omega t), \end{aligned}$$
(4)

where \(\nu _{{\mathrm{scan}}}(t)\) the scanned laser frequency and a the modulation depth, are linearly responding to \(i_{\text{c-scan}}(t)\) and \(i_{{\mathrm{a}}}\), respectively. Along with the frequency modulation (FM), the laser output intensity is simultaneously modulated (IM) with a FM/IM phase shift [5, 16, 53] as

$$\begin{aligned} I_0(t)=\bar{I_{0}}[i_{{\mathrm{scan}}}(t) +i_0 \cos (\omega t+\psi _1 )+ i_{2}\cos (2\omega t+ \psi _2)], \end{aligned}$$
(5)

where \(I_0(t)\) is the temporally varying intensity function of the laser output, \(i_{{\mathrm{scan}}}(t)\) is the scanning laser intensity normalized by \(\bar{I_{0}}\), \(i_0\) and \(i_2\) are the linear (1f) and nonlinear (2f) IM amplitude (normalized by \(\bar{I_{0}}\)), respectively, \(\psi _1\) is the FM/IM phase shift, and \(\psi _2\) is the phase shift of the nonlinear IM [5]. The transmitted laser intensity \(I_t(t)\) in Eq. 1 can be rewritten as

$$\begin{aligned} I_t(t)=\; & {} I_0(t)\exp (-k_\nu L)=I_0(t)\exp (\alpha (\nu )) \\ \simeq \; & {} I_0(t)(1-\alpha (\nu )) = I_0(t)\left( 1+\sum _{k = 0}^{\infty }H_k\cos (k\omega t) \right) , \end{aligned}$$
(6)

where \(\alpha (\nu ) = -k_\nu L\) is the spectral absorbance. It is noted that \(\alpha (\nu )\) is also a function of time in WMS, since the laser frequency is modulated according to Eq. 4. \(H_k\) is the kth order Fourier coefficient of \(-\alpha (\nu )\) and is defined in the work of Li et al. [5]. The targeted gas information such as pressure, species, temperature and concentration can be inferred from \(\alpha (\nu )\) as shown in Eqs. 1 and 2. Through laser absorption, these parameters are recorded in \(I_t(t)\). For WMS, the signal used to infer the gas properties is the n-order harmonic signal, also known as the WMS-nf signal. The most used WMS-nf signals are the WMS-1f and WMS-2f. These low-order harmonics are significantly stronger than the higher-order signals and yet are still effective in noise rejection through the band-pass filtering process. A lock-in amplifier is typically used to extract these harmonic signals and both analog and digital lock-in can be used. With either approach, the extracted WMS-nf signals consists of an X and a Y component, noted as \(X_{\mathrm{nf}}\) and \(Y_{\mathrm{nf}}\). The expressions for \(X_{2{\mathrm{f}}}\) and \(Y_{2{\mathrm{f}}}\) are given by Li et al. [5] as

$$\begin{aligned} X_{2{\mathrm{f}}}= & {} \frac{G\bar{I_{0}}}{2} \left[ H_2+i_0 (H_1+H_3)\cos {\psi _1} \right. \\ &\left. +i_2\left( 1+H_0+\frac{H_4}{2}\right) \cos {\psi _2}\right] , \end{aligned}$$
(7)
$$\begin{aligned} Y_{2{\mathrm{f}}}= & {} -\frac{G\bar{I_{0}}}{2} \left[ \frac{i_0}{2}(H_1-H_3)\sin {\psi _1} \right. \\ &\left. +i_2\left( 1+H_0-\frac{H_4}{2}\right) \sin {\psi _2}\right] , \end{aligned}$$
(8)

where G is the overall electro-optical gain in the signal including the laser power decay caused by windows and particles. This site-dependent factor is typically eliminated through a 1f normalization process, and the normalized, background-subtracted, and phase-insensitive magnitude of the WMS signal can be expressed as [16]

$$\begin{aligned} S_{2{\mathrm{f}}/1{\mathrm{f}}} =\sqrt{\left[ \left( \frac{X_{2{\mathrm{f}}}}{R_{1{\mathrm{f}}}} \right) _{{\mathrm{raw}}}-\left( \frac{X_{2{\mathrm{f}}}}{R_{1{\mathrm{f}}}}\right) _{bg} \right] ^2+\left[ \left( \frac{Y_{2{\mathrm{f}}}}{R_{1{\mathrm{f}}}}\right) _{{\mathrm{raw}}} -\left( \frac{Y_{2{\mathrm{f}}}}{R_{1{\mathrm{f}}}}\right) _{bg}\right] ^2}, \end{aligned}$$
(9)

where \(R_{1{\mathrm{f}}} = \sqrt{{X_{1{\mathrm{f}}}}^2+{Y_{1{\mathrm{f}}}}^2}\) is the 1f signal magnitude. The subscript raw corresponds to the signal measured with the target gas, whereas the subscript bg corresponds to the measured background signal, i.e. without the target gas. The scanned-WMS method using a digital lock-in process has been well described by Sun et al. [54]. First, the tuning characteristics of the laser diode is precisely calibrated. Second, the transmitted laser intensity \(I_t(t)\) is collected and the digital lock-in amplifier is applied to extract WMS-nf signals. Good agreements between experimental data and simulation results were reported in their work.

The lock-in amplifier plays an important role in WMS-nf signal extraction. Analog lock-in amplifiers can extract high-quality WMS signals with negligible latency. However, a typical analog lock-in amplifier can extract only one harmonic signal, such as 1f or 2f, at a time. In addition, the analog lock-in amplifier is an expensive piece of equipment compared to the software-based digital lock-in using conventional computers. These disadvantages make the analog alternative less attractive if time sensitive real-time performance is not of the uttermost importance. On the other hand, similar signal extracting performance can be achieved with digital signal processing by carefully configuring the parameters of the digital lock-in. Thus, digital lock-in amplifier has been widely used in WMS studies [1, 4, 54].

2.2 Continuous wavelet transform

Continuous wavelet transform (CWT) is widely applied in geophysical time-series analysis [55]. Unlike Fourier analysis, both time and frequency resolution can be obtained by CWT. This makes it possible to use CWT to extract WMS-nf signals. A CWT method was introduced by Grinsted et al. [55] using the Morlet wavelet.

A wavelet is a function with zero mean and localized in both frequency and time [55]. The widely employed Morlet wavelet function is defined as [32]:

$$\begin{aligned} \Psi _0(\eta ) = \pi ^{-\frac{1}{4}}{\mathrm{e}}^{i\omega _0, \eta }{\mathrm{e}}^{-\frac{\eta ^2}{2}} \end{aligned}$$
(10)

where \(\eta\) is a non-dimensional time parameter, i is the imaginary unit, and \(\omega _0\) is the dimensionless frequency. Wavelet function can be translated and dilated/contracted to generate a series of wavelets described by the following equation

$$\begin{aligned} \Psi _{s,t}(t) = s^{-\frac{1}{2}}\Psi \left( \frac{t-\tau }{s}\right) , \end{aligned}$$
(11)

where s is the scale dilation parameter, and \(\tau\) is the translation parameter. The \(s^{-\frac{1}{2}}\) in Eq. 11 is used to ensure the preservation of the energy unit during the process [56]. The \(\Psi (t)\) is called the mother wavelet whereas the series of \(\Psi _{s,t}(t)\) are called daughter wavelets.

The idea behind the CWT is to apply a series of daughter wavelet as band-pass filters to the time-series [55]. Our study applies the Morlet wavelet as the mother wavelet. The dimensionless frequency \(\omega _0\) in Eq. 10 is selected to be 6. This provides a good balance between time and frequency localization, see Grinsted et al. [55]. The CWT (W) of a function f(t) corresponds to the convolution of f(t) with the daughter wavelet \(\Psi _{s,t}(t)\) which is expressed as [33]

$$\begin{aligned} W(s,t) = \int _{{\mathbb {R}}}^{} f(t)\Psi ^{*}_{s,t}(t) \,{\mathrm{d}}t, \end{aligned}$$
(12)

where \(\Psi ^{*}_{s,t}(t)\) is the complex conjugate of the daughter wavelet. In practice, for a discrete data series, the wavelet transform takes the form [32]

$$\begin{aligned} W_{n}(s) = \sum _{n' = 1}^{N}\left( \frac{\delta \tau }{s}\right) ^{1/2}f(t)\Psi ^{*}_{s,t}\left( \frac{(n' - n)\delta \tau }{s}\right) , \end{aligned}$$
(13)

where n is the discrete time index; N is the number of data points in the time series; and \(\delta \tau\) is the time difference between two consecutive data points.

To apply CWT to the WMS signal, the first step is to calculate a finite daughter wavelet series based on the Morlet wavelet as defined in Eq. 11. The properties of the daughter wavelet series in terms of dilation parameter s depends on three characteristics: (i) the scale resolution “DJ”, (ii) the smallest scale of the wavelet “S0”, and (iii) the total number of scales. The values for these parameters can be either selected by default, which depend on the number of points in the data series, or by the user’s choice. These values will determine the frequency resolution of the wavelet analysis. The \(\delta \tau\) in Eq. 13 is defined by default as twice the time step of the data series and remains constant throughout the analysis. The discrete daughter wavelets are generated in the Fourier domain. Instead of using temporal convolution, the CWT software from Grinsted et al. [55] uses fast Fourier transform (FFT) to calculate CWT, such that convolution in the time domain can be replaced by simple multiplication in the frequency domain. An example of generated daughter wavelet series for the Morlet wavelet as the mother wavelet is shown in Fig. 1. Then, the raw time signal (\(I_t(t)\)) is transformed to frequency domain with FFT. It is noted that zero padding to increase the length of the discrete-time series up to the next higher power of 2 before FFT is recommended to reduce errors at the edges of the wavelet power spectrum by preventing wraparound from the end of the time series to the beginning. It can also speed up the FFT process [55]. The third step multiplies the generated daughter wavelet series with the FFT-converted \(I_t(t)\) data yielding corresponding frequency components of \(I_t(t)\). It is noted that the so-obtained results still remain in the frequency domain. Finally, an inverse-FFT is applied to the result to convert it back to the time domain, allowing all frequency components of \(I_t(t)\) to be separately calculated. The phase-insensitive WMS-nf signals can then be extracted by selecting the nf frequency (\(n \times f_{{\mathrm{mod}}}\)) components in CWT-WMS.

Fig. 1
figure 1

Example of Morlet based daughter wavelet series generated by the CWT software from Grinsted et al. [55]. Each colored curve shows one daughter wavelet. Not all daughter wavelets are shown. This series is generated based on a time series that has 1024 points. The sampling rate for this time series is \(F_s = 3.05\times 10^{5}\) Hz. The corresponding frequency for FFT index can be calculated as \(f = F_s \times \frac{\text{FFT index}(\#)}{1024}\)

3 Experimental setup

A simplified schematic of the experimental setup is shown in Fig. 2. A mid-IR Nanoplus TDL with center wavelength near 2753 nm is used as the light source. The TDL is controlled by a temperature controller (model TED200C) and a current controller (model LDC205C) from Thorlabs. Two sinusoidal signals generated by two SRS function generators (model DS345) are summed-up using an SRS analog summing amplifier (model SIM980) and modulate the injection current fed to the laser diode. This allows the scanning and modulation frequencies to be separately controlled for the scanned-WMS. In all following experiments, the scanning frequency is set at 50 Hz while the modulation frequency is set at 20 kHz. A photo-detector from VIGO (model PVI-3TE-4-1x1) is used to collect the laser signal and is connected to a digital oscilloscope from R&B (model RTB2004) for data acquisition. The gas cell has an optical pathlength equal to 8.45 cm, the optical access is ensured by two \(\text{CaF}_2\) windows located opposite to each other. The windows are both wedged with an angle of 3\(^{\circ }\) to avoid etalon effect.

Fig. 2
figure 2

Schematic of WMS measurement setup

The target gas for demonstration is \(\text{CO}_2\) diluted with ambient air, prepared in the gas cell shown in Fig. 2 using the partial pressure method. The center frequency of the selected infrared laser is near 3635 \(\text{cm}^{-1}\), which can cover a \(\text{CO}_2\) absorption line at 3635.49 \(\text{cm}^{-1}\). The main spectroscopic parameters of the selected line are taken from the HITRAN database [57] and shown in Table 1.

Table 1 Spectroscopic parameters of the \(\text{CO}_2\) absorption line used in present study

4 Digital lock-in scanned-WMS method

4.1 Validation in gas cell

To provide basis for in-depth analysis and further comparison with the wavelet approach, digital lock-in scanned-WMS (DLI-WMS) based on the developed scheme of Sun et al. [54] was performed and validated with static cell experiments.

The laser frequency response at a given modulation frequency was calibrated using a Germanium etalon with FSR equal to 0.01615 \(\text{cm}^{-1}\). The etalon peaks are identified and counted with an in-house MATLAB App [58] and curved fitted to Eq. 4 where \(\nu _{{\mathrm{scan}}}(t)\) is represented by a 4th-order polynomial. Figure 3 shows the fitted laser frequency response for a 20 kHz modulation with 50 Hz scanning frequency.

Fig. 3
figure 3

Fitted laser frequency response and etalon peaks for 20 kHz modulation at 50 Hz scanning frequencies. The center wavelength is near 2753 nm

We considered the WMS-2f signal normalized by WMS-1f as shown in Eq. 9. The simulated WMS-2f/1f signal is calculated using a digital lock-in amplifier and experimentally characterized parameters of the laser tuning characteristics. Figure 4 shows the measured laser intensity transmitted through the gas cell, and an apparent absorption feature can be observed, which is produced by the 2\(\%\) \(\text{CO}_2\) in air (by volume) loaded in the cell at 0.1 MPa and 298 K. A low-pass FIR filter is applied in the digital lock-in amplifier to obtain the WMS-2f and WMS-1f signals. The FIR filter design requires setting up three parameters: (i) the windows function, (ii) the order, (iii) the cutoff frequency. The window function we used is a Nuttall defined four-term Blackman-Harris window with order of 2000 and cutoff frequency of 600 Hz. The experimental signal is extracted according to Eq. 9 and is compared to the simulated profile for validation in Fig. 5. An overall agreement is observed, with a relative residual below 0.5% in the peak region whose values are commonly used for WMS measurement [59].

Fig. 4
figure 4

Measured transmitted laser intensity for WMS measurement. The scanning frequency is 50 Hz and modulation frequency is 20 kHz. Conditions: \(X_{\text{CO}_2} = 0.02\) in air, \(L = 8.45\) cm, \(P = 0.1\) MPa, \(T = 298\) K

Fig. 5
figure 5

Measured (solid line) and simulated (dotted line) WMS-2f/1f signal comparison. Conditions: \(X_{\text{CO}_2} = 0.02\) in air, \(L = 8.45\) cm, \(P = 0.1\) MPa, \(T = 298\) K

4.2 Fourier analysis of WMS signal

To better picture the lock-in procedure in the frequency domain, the Fourier analysis is applied before (on \(I_t(t)\)), during (on \(I_t(t) \times \cos (2\omega t)\)) and after (on the final \(S_{2{\mathrm{f}}}\) signal) the digital lock-in amplification process. This process can be essentially divided into two steps: (i) to multiply \(I_t(t)\) by a reference signal at \(2f_{{\mathrm{mod}}}\) frequency (\(\cos (2\omega t)\) and \(\sin (2\omega t)\) for in-phase and in-quadrature terms, respectively, where \(\omega = 2 \pi f_{{\mathrm{mod}}}\) and \(f_{{\mathrm{mod}}}\) is the modulation frequency; (ii) to apply a low-pass filter to remove the high frequency portion of the signal resulting from the first step.

The first step shifts the 2f harmonic of the transmitted signal to DC (\(f \simeq 0\)) according to the Fourier transform theorem. To enable Fourier series expansion of the non-periodic function \(I_t(t)\), we divide it into sections of modulation periods \([t_i, t_i + 1/f_{{\mathrm{mod}}}]\) with \(t_i\) the starting time and perform periodic extension of each section. This yields the period function

$$\begin{aligned} {I_t(t)}_i = \left\{ \begin{aligned}&I_t(t), t \subseteq \left( t_i, t_i + \frac{1}{f_{{\mathrm{mod}}}} \right) \\ &I_t \left( t - \frac{n}{f_{{\mathrm{mod}}}} \right) , t \subseteq \left( t_i + \frac{n}{f_{{\mathrm{mod}}}}, t_i + \frac{n+1}{f_{{\mathrm{mod}}}} \right) , n\subseteq {\mathbb {Z}}, n\ne 0 \\ \end{aligned} \right. , \end{aligned}$$
(14)

where \(t \subseteq {\mathbb {R}}\) and whose Fourier series expansion reads

$$\begin{aligned} {I_t(t)}_i= & {} \frac{{a_0}_i}{2} + [{a_2}_i\cos (2\omega t) + {b_2}_i\sin (2\omega t)] \\ &+ \sum _{n = 1, n \ne 2}^{\infty }[{a_n}_i\cos (n\omega t) + {b_n}_i\sin (n\omega t)], \end{aligned}$$
(15)

where \({a_n}_i\) and \({b_n}_i\) are the Fourier coefficients. Then, \({I_t(t)}_i \times \cos (2\omega t)\) can be rewritten as follows,

$$\begin{aligned} {I_t(t)}_i \times \cos (2\omega t)= & {} {a_2}_i\cos (2\omega t)\cos (2\omega t) \\ &+ {b_2}_i\sin (2\omega t)\cos (2\omega t) + {FS}_i(t)\cos (2\omega t), \end{aligned}$$
(16)

where \({FS}_i(t)\) is

$$\begin{aligned} {FS}_i(t) = \frac{{a_0}_i}{2} + \sum _{n = 1, n \ne 2}^{\infty }[{a_n}_i\cos (n\omega t) + {b_n}_i\sin (n\omega t)]. \end{aligned}$$
(17)

With trigonometric identities, Eq. 16 can be further rewritten as

$$\begin{aligned} {I_t(t)}_i \times \cos (2\omega t)= & {} \frac{{a_2}_i}{2} + \frac{{a_2}_i}{2}\cos (4\omega t) \\ &+ \frac{{b_2}_i}{2}\sin (4\omega t) + {FS}_i(t)\cos (2\omega t). \end{aligned}$$
(18)

Note that \({a_2}_i\) now becomes the coefficient of the constant (DC or zero frequency) term, reflecting the frequency shifting process with the temporal signal multiplication. The \({b_2}_i\) term can be similarly obtained using \({I_t(t)}_i \times \sin (2\omega t)\). The \({a_2}_i\) and \({b_2}_i\) represent the factors of 2nd harmonic of the \({I_t(t)}_i\), which can be considered proportional to the \(X_{2{\mathrm{f}}}\) and \(Y_{2{\mathrm{f}}}\) signal at \(t_i\). This derivation can be applied to all \(t_i \subseteq [t_{{\mathrm{start}}},t_{{\mathrm{end}}}]\), where \(t_{{\mathrm{start}}}\) and \(t_{{\mathrm{end}}}\) are the start and end times of signal \(I_t(t)\), respectively.

Figure 6 shows the FFT of different signal throughout the lock-in process. From Fig. 6, we can see that the first step of lock-in, transforming the blue line into the red and orange lines, modifies the shape of the signal, in particular in the low-frequency part of the original \(I_t(t)\). We have selected a cut frequency (\(F_c\)) of 600 Hz to obtain both clean and accurate signal. If the cut frequency is set too low, part of the 2f signal features can be removed. If the cut frequency is too high, high-frequency noise will be more obvious in the final result. We also notice that signals after either steps of the digital lock-in process (red, orange and purple lines) have weaker intensity in the DC part compare with the original 2f located at 40 kHz in \(I_t(t)\) (blue line). The strength of the final signal is about \(77\%\) that of the original 2f signal. This shows that the 2f signal extracted using a digital lock-in is actually weaker than the original 2f signal. A similar phenomenon is also observed when performing such an analysis for the 1f signal.

Fig. 6
figure 6

FFT of the WMS signal before/during/after the lock-in process. \(I_t(t)\) is the transmitted laser intensity. \(I_t(t)*\cos (2\omega t)\) and \(I_t(t)*\sin (2\omega t)\) are respectively the X and Y components of the 2f signal before the low-pass filter. \(S_{2{\mathrm{f}}}\) is the phase insensitive WMS-2f signal. Both 2f frequency (40 kHz) and 1f frequency (20 kHz) are marked as dash lines. Conditions: \(X_{\text{CO}_2} = 0.02\) in air, \(L = 8.45\) cm, \(P = 0.1\) MPa, \(T = 298\) K

4.3 Limitations of the DLI WMS method

Using digital lock-in amplifier is a widely accepted way of processing WMS signals [54, 59, 60]. However, a number of limitations can be underlined. First, the low-pass filter design plays an important role in optimizing the obtained harmonics shape and SNR. Figure 7 shows the shape of WMS-2f and 1f signal changes with different cutoff frequencies. A compromise between the signal strength and smoothness can be seen when different \(F_c\)’s are used. In practical cases, the optimum filter settings have to be manually selected for different experimental conditions or target gas, which is inconvenient and brings potential uncertainties to the final results.

Fig. 7
figure 7

WMS-2f, -1f signals change with different \(F_c\) of the selected FIR window filter. The original signal is shown in Fig. 4. Conditions: \(X_{\text{CO}_2} = 0.02\) in air, \(L = 8.45\) cm, \(P = 0.1\) MPa, \(T = 298\) K

The second issue also associated with the FIR filter design lies in the time-shifting of the WMS signals with respect to the original \(I_t(t)\) induced by the filtering process. Figure 8 shows such a time-shift, which is about 0.0033 s or \(17\%\) of the scan period, with \(T_{{\mathrm{scan}}} = 0.02\) s. This time-shift is due to the phase response of the FIR filter, which is neither constant over different frequencies nor zero for most low-pass filters [61]. The time-shift can sometimes be so large that the WMS signals get shifted outside of the scanning window, as seen marginally in Fig. 8. Finally, a third issues concerns the signal attenuation due to the filtering process. It is acknowledged that this time-shift can be minimized by applying advanced digital filtering strategies such as: (i) Processing more than one periods of raw WMS signal or (ii) using generated digital filter coefficient with convolution instead of simple MATLAB filter function. Evaluating such complex filtering strategies is beyond the scope of the present. In the next section, an alternative approach based on wavelet transform is presented to extract the WMS signals.

Fig. 8
figure 8

Time-shift in post-filter WMS signals. The \(I_t(t)\) (blue line) corresponds to Y axis on the right. The WMS signals corresponds to Y axis on the left. Conditions: \(X_{\text{CO}_2} = 0.02\) in air, \(L = 8.45\) cm, \(P = 0.1\) MPa, \(T = 298\) K

5 Wavelet transform scanned-WMS method

5.1 Continuous wavelet transform of WMS signal

Unlike discrete Fourier transform, continuous wavelet transform (CWT) allows us to resolve the transmitted light signal both in time and frequency. This feature allows the WMS harmonic signals to be extracted. A continuous wavelet transform MATLAB tool developed by Grinsted et al. [55] was applied to the signal shown in Fig. 4. The Morlet wavelet was employed in all cases because it offers a good compromise between frequency and time localization. It is likely possible to employ other mother wavelets but this aspect is not discussed in the present paper. The CWT results obtained by processing the transmitted signal of Fig. 4 are shown in Fig. 9. The strongest signal is clearly visible near 20 kHz, which corresponds to the modulation frequency. In addition, several bands of lower amplitude can be clearly distinguished near 40 kHz, i.e. twice the modulation frequency. These two features correspond to the first and second WMS harmonic signals. Considering the time axis, a peak is observed near \(t = 0.014\) s in Fig. 9 and is in phase with the absorption peak shown in Fig. 4.

Fig. 9
figure 9

CWT of the experimental transmitted laser intensity. The cone of influence (COI) where edge effects might lead to unreliable values is filled with white color. The scan frequency is 50 Hz and modulation frequency is 20 kHz. Conditions: \(X_{\text{CO}_2} = 0.02\) in air, \(L = 8.45\) cm, \(P = 0.1\) MPa, \(T = 298\) K

To clarify the interpretation of the CWT color map shown in Fig. 9, a three-dimensional representation is provided in Fig. 10 and zooms into the frequency range of 10–50 kHz. In Fig. 10, the WMS-1f and 2f signals are respectively marked in red and blue and will be compared to the simulation results in the next subsection. It is noted that the signals obtained through the CWT analysis are much stronger than the ones obtained using the DLI-WMS method. We attributed this difference to the fact that both the frequency-shift and low-pass filtering employed during the DLI-WMS process reduce the intensity of the harmonic signals, as illustrated in Fig. 6. The maximum signal strength of the CWT-WMS 1f is approximately eight times stronger than the one extracted using the digital lock-in method. However, the CWT-WMS signals also exhibits significantly higher noise levels. In most cases, this noise is very regular and can be easily removed with wavelet noise cancellation. This aspect is discussed in the next subsection.

Fig. 10
figure 10

3-D CWT transform of measured transmitted laser intensity for WMS measurement. The scan frequency is 50 Hz and modulation frequency is 20 kHz. Conditions: \(X_{\text{CO}_2} = 0.02\) in air, \(L = 8.45\) cm, \(P = 0.1\) MPa, \(T = 298\) K

It is noted that Figs. 9 and 10 are different ways of presenting the same data. Each curve in Fig. 10 corresponds to a certain daughter wavelet applied as a band-pass filter to the raw time-series. For simple WMS-nf signal extraction, calculating the full CWT map as in Fig. 10 is unnecessary and inefficient. The daughter wavelet corresponding to the targeted WMS-nf frequencies can be selected separately and only these CWT frequency slices (curves in Fig. 10) would be calculated. In some cases, the WMS-nf frequency cannot be exactly matched with the generated daughter wavelet series. In this case, either the WMS-nf signal can be interpolated using the results of the two closest frequency slices or the parameters controlling the dilation parameters s can be adjusted to provide a better frequency resolution.

5.2 Validation in gas cell

This validation is mainly based on the experimental data presented in Sect. 4.1. When performing a WMS-nf measurement, only the frequency slices that correspond to the frequencies of the WMS-nf of interest are selected to obtain the WMS-nf signals. For our cases, only two frequency slices, around 20 kHz (1f) and 40 kHz (2f) are selected. The final WMS signal is the 1f-normalized 2f signal (\(S_{2{\mathrm{f}}/1{\mathrm{f}}}\)). The results without noise cancellation are shown in Fig. 11. Despite the high noise level, a good qualitative and quantitative agreement between the measured and simulated signal is obtained with the CWT-WMS method. To improve the quality of the measured signal, a wavelet noise-cancellation procedure is applied to the original wavelet WMS signals \(^{[O]}S_{2{\mathrm{f}}}\) and \(^{[O]}S_{1{\mathrm{f}}}\). This noise-cancellation method has two steps. First, the original signal is decomposed into different wavelet coefficients based on the given maximum level. Then, the coefficients at the maximum decomposition level are used to reconstruct the original signal. Only the low-frequency part of the original signal can be reconstructed in this way. This process can be used to remove the high frequency components of the signal, which in our cases corresponds to the noise. The improved experimental signal after noise cancellation is shown in Fig. 12. No significant time-shift is observed in the CWT-WMS signals. As previously underlined, the magnitude of the collected signal is about eight times that of the WMS signal obtained by using the DLI method.

To further validate the CWT method and verify its versatility, we have applied it to another experimental profile, as reported in the work of Wang et al. [62]. These data were measured in a premixed \(\text{CH}_{{4}}\)-air laminar flat-flame burner with a burner center ring of 60 mm in diameter. The measurement was conducted at a height of 7 mm above the burner’s surface with a total air flow rate of 14.4 l/min (equivalence ratio \(\Phi = 1.0\)). A distributed feedback (DFB) laser (NTT Electronics) operating near 1398 nm serves as the single-mode tunable laser source for \(\text{H}_2\)O and temperature sensing. The laser beam traverses the flame three times, resulting in an increased optical path length of 18 cm. The laser wavelength is scanned with a sawtooth function at 100 Hz and modulated with a sinusoidal function at 10 kHz. This laser accesses two \(\text{H}_2\)O transitions near 7153.74 \(\text{cm}^{-1}\) and 7154.35 \(\text{cm}^{-1}\) which have been previously validated for temperature sensing in kerosene-fuelled combustor [63]. The results are shown in Fig. 13. The same CWT parameters were applied to obtain the experimental profiles shown in Figs. 12 and 13. This tend to indicate that the CWT parameters we have selected can be employed to extract WMS signals obtained over a wide range of conditions. In addition, a similar overall agreement is observed between the experimental and the simulated harmonic signals in Figs. 12 and 13. Nevertheless, discrepancies are observed for the features on the left of the plot in Fig. 13. This indicates that the spectroscopic parameters for this specific absorption line might need to be updated. It is noted that the noise cancellation level on different signals has to be adjusted based on the characteristics of the experimental signal. This additional comparison for data obtained for a different species and in a more challenging environment further demonstrates the validity of our method for extracting phase-insensitive WMS signal [5].

Fig. 11
figure 11

Measured (solid line) and simulated (dotted line) CWT WMS-2f/1f signal comparison using original wavelet WMS signal \(^{[O]}S_{2{\mathrm{f}}}\) and \(^{[O]}S_{1{\mathrm{f}}}\) without noise cancellation. Conditions: \(X_{\text{CO}_2} = 0.02\) in air, \(L = 8.45\) cm, \(P = 0.1\) MPa, \(T = 298\) K

Fig. 12
figure 12

Measured (solid line) and simulated (dotted line) CWT WMS-2f/1f signal comparison using CWT WMS signal \(^{[D7]}S_{2{\mathrm{f}}}\) and \(^{[D7]}S_{1{\mathrm{f}}}\) with noise cancellation with level of 7. Conditions: \(X_{\text{CO}_2} = 0.02\) in air, \(L = 8.45\) cm, \(P = 0.1\) MPa, \(T = 298\) K

Fig. 13
figure 13

Measured (solid line) and simulated (dotted line) CWT WMS-2f/1f signal comparison using wavelet WMS signal \(^{[D8]}S_{2{\mathrm{f}}}\) and \(^{[D8]}S_{1{\mathrm{f}}}\) with noise cancellation with level of 8. Data obtained using the same experimental setup as in Wang et al. [62]. Conditions: \(X_{\text{H}_2\text{O}} = 14.11\%\), \(L = 18\) cm, \(P = 0.1\) MPa, \(T = 1840\) K

6 Comparison and discussion

In this section, we further compare the DLI- and CWT-WMS methods and provide discussions of the results.

Fig. 14
figure 14

The schematic of DLI-WMS processes. The WMS-2f/1f signal is shown to represent WMS-nf/1f

Fig. 15
figure 15

The schematic of CWT-WMS processes. The WMS-2f/1f signal is showed to represent WMS-nf/1f

6.1 Computational algorithm and performance

The different steps of the DLI-WMS and CWT-WMS processes are shown in Figs. 14, 15, 16 and 17. Compared with the digital lock-in amplifier algorithm, the CWT-WMS approach uses a more complex method to obtain the WMS signals. The computational performance for both methods were tested on a laptop using MATLAB (version R2021a). The results are shown in Fig. 18 and reflect the average time over 1000 calculations using the same transmitted signal. Concerning the DLI approach, the digital filtering is the most time consuming step, see Fig. 18, despite the efficiency of modern computing tools. Among the steps required to apply the CWT method, generating daughter wavelets and multiplying daughter wavelets and inverse FFT (iFFT) are the most time consuming steps. Despite of the much more complex algorithm, the CWT-WMS method demonstrates comparable performance compared to DLI-WMS. On the other hand, the noise cancellation process corresponds to about \(28\%\) of the total computational time. For applications that only use the peak value of WMS-2f/1f signal, this noise cancellation process may potentially be bypassed since the wavelet signal has much less noise around the peak region. For WMS measurement for a short duration, such as during a shock-tube experiment, the higher computation cost of the CWT method is not prohibitive. However, for real-time, in-situ applications requiring fast response time, the impact of the higher computational time of the CWT method needs to be evaluated in more detail but could be a limitation.

Fig. 16
figure 16

The signal processing diagram for the DLI-WMS method

Fig. 17
figure 17

The signal processing diagram for the CWT-WMS method

Fig. 18
figure 18

Computational performance estimated for DLI-WMS and CWT-WMS methods. This test was performed on a laptop equipped with an Intel Core i5-8257U using MATLAB R2021a. The time results are taken as average of 1000 runs performed with the same WMS signal, as shown in Sect. 4.1

6.2 Versatility of the selected parameters

The strong dependence on filter design parameters of the DLI-WMS has been discussed in Sect. 4.3. For the wavelet approach, no digital filter is applied during the process, as described in Sect. 6.1, and the introduction of a reference signal is not required. In addition, the phase-insensitive signal is directly obtained. For CWT-WMS, there are essentially two parameters that need to be configured in the wavelet software provided by Grinsted et al. [55]: (i) the wavelet family, and (ii) the number of scales in frequency divisions. Concerning the wavelet family, the most commonly used wavelet is the Morlet wavelet, which is the one we employed. The number of scales only affects the frequency resolution. Due to the uncertainty principle of time-frequency analysis [64], higher frequency resolution will limit the corresponding temporal resolution. In our applications, due to the relatively low 2f frequency, no such losses in temporal resolution is observed when the number of scales is increased. It seems that the parameters we have employed for our CWT-WMS analyses could be employed for a wide variety of conditions, regardless of the scanning and modulation frequencies. Thus, we conclude that the CWT-WMS method may present potential for being versatile and satisfyingly applicable even when experimental conditions or target species are changing and unknown within a certain range. It is acknowledged that the selection of the wavelet parameters for the denoising step is more challenging and could require important adjustment depending on the specific experimental conditions. However, as pointed out in the introduction, many studies have been performed on this topic and could greatly facilitate the choice of the wavelet type and parameters for this final step.

6.3 Harmonic signals quality

The signal quality for the different WMS methods we have discussed can be evaluated based on the following criteria: (i) ability of extracting WMS signals with higher SNR; and (ii) ability of reconstructing full temporal signal without losses more easily. The SNR of both method was analyzed based on the method described by Klein et al. [65]. As illustrated in Fig. 19, the noise level was estimated using the base-line signal over 2000 samples. The standard deviation of this part was considered as the noise level (\(\sigma _{{\mathrm{noise}}}\)). The peak value (\(A_{{\mathrm{peak}}}\)) of 2f or 2f/1f signal was used as the signal level. The SNR is then calculated as

$$\begin{aligned} \text{SNR} = \frac{A_{{\mathrm{peak}}}}{\sigma _{{\mathrm{noise}}}}. \end{aligned}$$
(19)

The SNR for both methods are shown in Table 2. In general, the comparison between two final signals (denoised CWT-WMS 2f/1f and DLI-WMS 2f/1f) shows higher SNR for the CWT method. However, if the noise cancellation is removed, the DLI method has a significantly higher SNR than the CWT method.

Fig. 19
figure 19

The signal-to-noise ratio analyses method

Table 2 The SNR analyses results for DLI-WMS and CWT-WMS

As for the second criterion, DLI-WMS requires testing for optimized low-pass filter settings as, described in Sect. 4.3. For the FIR window digital filter we tested, different Fc lead to different signal shapes. Furthermore, complex filtering strategies are required to minimized the time-shift mentioned in Sect. 4.3. Thus, the CWT-WMS is a more straight forward method for WMS application.

7 Conclusion

A CWT analysis-based WMS workflow is described in the present paper. Measurements of \(\text{CO}_{{2}}\) in air in a gas cell were used to compare the widely employed DLI-WMS method and our CWT-WMS approach. In general, both methods perform well in the cases we have selected. Based on the criteria we used to evaluate the two methods, i.e. SNR and temporal coherence, the CWT-WMS method appears more advantageous. In addition, the results obtained for \(\text{CO}_{{2}}\) in a gas cell and for \(\text{H}_{{2}}\)O in a laminar flame tend to indicate that the parameters of the CWT-WMS method could be used for a large variety of experimental conditions and target species without requiring significant adjustments. The impact of the specific wavelet type to use for WMS application should be addressed in future work.