Extracting complex refractive indices from THz-TDS data with artificial neural networks

. Terahertz time-domain spectroscopy (THz-TDS) benefits from high signal-to-noise ratios (SNR), however extraction of material parameters involves a number of steps which can introduce errors into the final result. We present the use of artificial neural networks (ANN) as the first step to achieve a comprehensive approach for the extraction of the complex refractive index from THz-TDS data. The ANN shows performance superior to approximation methods and has a more straightforward implementation than root finding methods. Deep and convolutional neural networks are demonstrated to accept an entire frequency range at once, providing a tool for fitting where SNR is low, producing a more stable result.


Introduction
By measuring the amplitude of the electric field of a broadband pulse, a terahertz time-domain spectrometer (THz-TDS) is able to retain the phase information of the radiation propagating through a sample when a Fourier transform is performed and gives us the possibility to extract the complex refractive index of a material.However, obtaining a material's frequency dependent complex refractive index in THz-TDS requires multiple analysis steps, each of which can introduce errors into the calculations.Along with difference in experimental procedures, the data analysis contributes to a concerning amount of variability in results between research groups around the world [1].An artificial neural networks (ANN) of even a modest architecture has enough flexibility to be able to approximate any function [2], but unlike an analytical description of a function, these networks are trained to converge on the correct and accurate mapping as long as enough training data is provided and an appropriate training algorithm is used.It follows that such a network could analyse THz-TDS data and output the associated material's refractive index, with the accuracy being limited only by the size of the data set and number of neurons in the hidden layer.Here we show how ANNs of varying complexity can extract material parameters as a step to reduce the variability of data analysis in THz-TDS and help its adoption in industrial settings.

Frequency point wise extraction
The theoretical transfer function Htheo (ω) describes the mapping of a reference pulse propagating through air onto a pulse that is transmitted through a material, is given by * e-mail: n.t.klokkou@soton.ac.uk where the refractive index of the material is ñ(ω) = n(ω) + ik(ω), d is its thickness, c is the speed of light and ω is the angular frequency.The relation is only solvable analytically if the imaginary component of the refractive index is much smaller than the real part, otherwise, a rootfinding method must be used.bate with a windowing function applied to remove internal reflections for equation 1 to hold.The Fast Fourier Transform (FFT) of the signals are shown in the inset.The phase of the FFT is wrapped between 0 and 2π so reconstruction is required before division including offsetting in the y-axis, the result of which is shown in Figure 1(b).
Training sets were generated by simulating the propagation of a THz pulse through a slab material with a random complex refractive index and random thickness.The range of these were selected to encompass the values for most material samples measured with THz spectroscopy (2<n<8, 0<k<0.3)while the thickness was kept between 100 µm and 1 mm.In total, the data set used for training contains 10 5 random materials each contributing one training entry selected at a random frequency.Each training entry has: (a) an input that contains the frequency, the corresponding value of the complex transfer function and the thickness of the sample, and (b) an output containing the real and imaginary refractive indices at this frequency.

Deep and Convolutional Neural Nets
The training of neural network architectures containing multiple hidden layers with different connections allows the recognition of features and trends that involve multiple inference steps.Two architectures were trialled, a fully connected deep neural network (DNN) of 512 and 128 neurons as hidden layers as well as a convolutional neural network (CNN) including a 200 neuron hidden layer.The networks accept a complete frequency range of the complex transfer function at 32 equally spaced points forming a 2x32 matrix.The thickness is fixed 500 microns and a noise floor is also simulated.
Figure 3 shows the extracted refractive index of the lithium niobate sample with the amplitude of the sample's FFT included as an indication of signal strength.The results of the CNN show a more stable result at low SNR in the low frequency range.Often, values at these frequencies are omitted, where their inaccuracies can results from the phase extraction.We aim to use CNNs to expand the usable frequency range further into this domain.

Conclusion
Terahertz time-domain data retains phase information in a way that simplifies parameter extraction as compared to other techniques.However considerable errors can arise in some steps of the extraction algorithms used by the community.Artificial neural networks have been shown to be used in place of traditional fitting functions with excellent accuracy, whilst also benefiting from fast runtime and straightforward implementation.Furthermore, deeper, more generalised networks can replace more steps of the extraction process, automating data analysis and increasing consistency.Advancing the sophistication of the networks will lead to more generalised models that can potentially improve on current methods, such as dynamically optimising the windowing process, all while retaining rapid run-times.

Figure 1 .
Figure 1.THz-TDS measurements of an air reference and a lithium niobate sample.The time-domain traces are windowed (a) with their spectra shown in the inset.The division of the sample and reference spectra give an experimental transfer function with both phase (b) and magnitude (c).

Figure 1 (
Figure1(a) shows a time-domain measurement reference (air) and a 500 micron thick sample of lithium nio-

Figure 2 .
Figure 2. Examples showing the performance of different extraction methods for the real and imaginary refractive index of a measured sample of lithium niobate (a,b) and a simulated example of n = 5 (c), and k = 0.15, (d) published in [3].The fractional difference across the entire parameter space of is shown underneath for each method.

Figure 3 .
Figure 3.The first generation of DNNs and CNNs used to extract the real (top) and imaginary (middle) components of the refractive index of a lithium niobate sample.The CNN produces a more stable result, even where signal strength of the spectra of the sample measurement is low (bottom).