Membership Function-Weighted Non-Linear Fitting Method for Optical-Sensing Modeling and Reconstruction

Imprecise measurements present universally due to variability in the measurement error. We devised a very simple membership function to evaluate fuzzily the quality of optical sensing with a small dataset, where a normal distribution cannot be assumed. The proposed membership function was further used as a weighting function for non-linear curve fitting under expected mathematical model constraints, namely the membership function-weighted Levenberg–Marquardt (MFW-LM) algorithm. The robustness and effectiveness of the MFW-LM algorithm were demonstrated by an optical-sensing simulation and two practical applications. (1) In laser-absorption spectroscopy, molecular spectral line modeling was greatly improved by the method. The measurement uncertainty of temperature and pressure were reduced dramatically, by 53.3% and 43.5%, respectively, compared with the original method. (2) In imaging, a laser beam-profile reconstruction from heavy distorted observations was improved by the method. As the dynamic range of the infrared camera increased from 256 to 415, the detailed resolution of the laser-beam profiles increased by an amazing 360%, achieving high dynamic-range imaging to capture optical signal details. Therefore, the MFW-LM algorithm provides a robust and effective tool for fitting a proper physical model and precision parameters from low-quality data.


Introduction
Curve fitting is one of the most powerful and most widely used analysis tools to pre-and post-process data [1,2], to remove outliers [3,4], to compare candidate models [5], and to examine the relationship between one or more predictors [6][7][8].The parameterization of curve fitting is usually realized by minimizing linear or non-linear least-squares residuals [9,10], in which the Levenberg-Marquardt (LM) algorithm, also known as the damped least-squares method, is popular for fast convergence [11].Whether the LM fitting results can reflect physical meaning is highly dependent on the quality of measured signal.Improving the LM algorithm's robustness from outliers and reducing its dependence on the quality of the measured signal are desired.
The LM algorithm for curve fitting was first proposed by Levenberg [12] in 1943 and optimized by Marquardt [13] in 1963.The idea of weighted fitting was demonstrated in 1959.Asadi et al. [14] proposed a hybrid intelligent model combination of genetic algorithms and the LM algorithm for stock-exchange index prediction to cope with the fluctuations of stock-market values.Nawi et al. [15] proposed an algorithm in which a cuckoo search algorithm was used to provide optimal weights for the LM algorithm to obtain better results in training feed-forward artificial neural networks.Zhang et al. [16] proposed a finite-element analysis-based LM algorithm to extract the features of the Brillouin-scattering spectrum with different linewidths and signal-to-noise ratios (SNRs).The weighted LM algorithm had attracted much attention for potentially reducing the effect of outliers.
Outliers present universally due to variability in measurement error, including a transient malfunction of apparatuses, errors in data transmission or transcription, changes in system behavior, operation error, instrument error or through natural deviations, and a flaw in the assumed theory.These outliers always lower the goodness of fit and the precision of fitted parameters.There is no rigid mathematical definition of what constitutes an outlier; determining whether or not an observation is an outlier is ultimately a subjective exercise.Outlier detection methods, e.g., Chauvenet's criterion [17], Grubbs' test [18], Dixon's Q test [19], and Peirce's criterion [20], are usually graphically or model-based.Deletion of outliers is a controversial practice frowned upon by scientists because the deletion process does not make the practice more scientifically or methodologically sound, especially in small sets or where a normal distribution cannot be assumed.Furthermore, when non-linear fitting is performed from small numbers of replicated observations, the results of an analysis can be very badly and unpredictably affected.
Optical sensing is often performed in situ or in online applications, where small datasets are common for the variability of working conditions or fast response time.These results in outliers buried in observations being more difficult to distinguish from low-quality data distorted by non-linear transmission, interference, electrical noise, dark current fluctuation (DCF), and dark-current non-uniformity and photoresponse non-uniformity between pixels for optical image sensors [21][22][23].Outliers and distorted signal can be both overly influenced the accuracy of in situ optical sensing and modeling.There is not any universal or robust algorithm to improve the goodness of fit and the precision of fitted parameters for outliers-contained optical sensing with small datasets.
In the work described in this paper, we considered the outliers and distorted signal of optical sensing together as imprecise measurements.Taking the idea of fuzzy logic for the first time, we devised a membership function for optical-sensing data to evaluate the observations' fidelity.
Furthermore, we used the membership function as the weighting function of fitting for signal modeling and reconstruction under expected mathematical model constraints, i.e., a membership-function-weighted Levenberg-Marquardt (MFW-LM) algorithm.We demonstrated the MFW-LM algorithm by an optical-sensing simulation and two experiments: (1) laser-absorption-spectroscopy analysis and (2) laser-beam-profile measurement.

Optical-Sensing Membership Function
We considered the outliers and distorted signal of optical sensing together as imprecise measurements, which present universally due to three phenomena: (1) imperfect response of sensing and signal conditioning due to non-linearity, DCF, and performance decline with device aging; (2) interference from stray light and optical fringe [24,25], power-line interference [26], and electromagnetic interference; and (3) electrical noise from electronic devices with various processes, including thermal noise, shot noise, flicker noise, burst noise, and transit-time noise.
Generally, the measurement reliability of optical sensing depends largely on the responsivity of the adopted photosensor and signal conditioning unit.A typical responsivity of a photosensor usually exhibits quite good linearity in the middle region of its response curve, while presenting non-linearity near the two ends of the response curve, as shown in Figure 1a.A slightly different responsivity at the low-input end and a saturated feature at the up-input end are very common for most photosensors.The signal conditioning unit of an optical system is usually used to perform amplification for high resolution and SNR of the input signal, filtering for minor out-band interference, and electrical isolation for isolating possible sources of signal perturbations.Practically, a variety of interference and noise should be reduced to a rather small amount compared with the measured signal.
Therefore, the reliability of measured data is closely related to the signal magnitude for a well-designed optical system.Random noise is statistical noise having a Gaussian distribution.Thus, the measurements corresponding to the middle and upper parts of the response curve are more reliable than those of the two ends of the curve.
We took the idea of fuzzy logic, where a membership function represents the degree of truth as an extension of valuation [27].For an optical-sensing dataset [y i ] (i = 1,2, . . ., n), we devised a membership function, denoted µ(y i ), mapping from [y i ] to the real unit interval [0, 1], for optical-sensing datum y i (i = 1, 2, . . ., n) to quantify its fidelity: where µ(y i ) is the membership degree of an observation y i ; y max and y min are the maximum and the minimum of right observation, respectively; y 1 and y 2 are two critical observations with high confidence, respectively; and n is the number of observations.The criteria for the key parameters in the membership function are closely related to system characteristics.The y max and y min are limited values of a sensor's output range.Any observations beyond y max and y min must be outliers, and we assigned membership degree 0 to them, i.e., their fidelity is none.y 1 and y 2 have fuzzy certainty, which is used to determine the range with the best linearity and make fuzzy optimal selection of observations.These observations between the two critical points y 1 and y 2 have the highest confidence, and we assigned membership degree 1 to them, which comprise the core of the membership function.However, the scope of this area is not strictly defined and can be appropriately adjusted according to different sensor responsivity and experimental purposes.We assigned membership degree 0 to 1 for the other observations based on their measurement value.The functions from y min to y 1 , and from y 2 to y max are specifically designed on the basis of the respective major problems to be solved.The signal in the low amplitude interval is greatly affected by the random noise, so it is necessary to reduce the contribution of the low-SNR observations; while the signal of the high amplitude interval mainly addresses the difficulties of signal distortion and saturation caused by the non-linearity of the sensor's responsivity.A membership function assigned for a typical responsivity of a photosensor (Figure 1a) is shown in Figure 1b.
The membership degree µ(y i ) is closely related with the magnitude of the measurement, similar to the experience using an analog instrument, i.e., one always achieves better accuracy at approximately two-thirds of the full scale of an instrument by properly selecting its scale range [28].Therefore, the interval set by the two critical values y 1 and y 2 of the membership function is usually chosen to be near two-thirds of the observations or sensor's responsivity.A higher membership degree µ(y i ) means a precise measurement, while a smaller µ(y i ) implies the poorer fidelity of observations.The membership function, drawing on the ideology of fuzzy logic, is a novel concept and valuable for quantitative simple evaluation of observations under the premise that the SNR of the observations is within a reliable range.The higher the SNR of the observations, the more objective the fitting result of the MFW-LM algorithm will be.
on the basis of the respective major problems to be solved.The signal in the low amplitude interval is greatly affected by the random noise, so it is necessary to reduce the contribution of the low-SNR observations; while the signal of the high amplitude interval mainly addresses the difficulties of signal distortion and saturation caused by the non-linearity of the sensor's responsivity.A membership function assigned for a typical responsivity of a photosensor (Figure 1a) is shown in Figure 1b.The membership degree μ(yi) is closely related with the magnitude of the measurement, similar to the experience using an analog instrument, i.e., one always achieves better accuracy at approximately two-thirds of the full scale of an instrument by properly selecting its scale range [28].Therefore, the interval set by the two critical values y1 and y2 of the membership function is usually

Membership Function-Weighted Levenberg-Marquardt (MFW-LM) Algorithm
The LM algorithm is a well-known damped least-squares algorithm [29], so only a brief review is given.For an observed data set [y i ] (i = 1,2, . . ., n), the expected mathematical model f(x, → a ) is often determined based on previous knowledge.The parameter vector → a of the model is approximated within a trustworthy range (denoted k, where |k| < ε and ε is any positive number) near its initial value → a k to seek an optimal parameter vector → a f that minimizes the sum of squared residuals R( → a ).The fitting criteria of the LM algorithm is given by [30,31]: where R( → a ) is the sum of the squared residuals, y i ( → a k + k) is the data when the parameter is estimated as ( → a k + k), and n is the number of fitted points.We promoted the fitting quality of optical sensing by using the aforementioned membership function as a weighting function.The fitting criterion in Equation (3) was weighted by the membership degree of observations described by Equation ( 1), namely the MFW-LM algorithm, which is described as follows: where µ(y i ) is a membership degree used as a regression weight; → a k is the parameter vector of the expected mathematical model.We substituted the optimal parameter vector → a f that meets the improved fitting criteria [Equation ( 4)] into f(x, → a ) to obtain the fitting result that is in better agreement with the physical meaning.
We programmed the entire algorithm in OriginPro and LabView software.First, we predicted the initial values of parameters by the least-squares method or experimental results.Next, we weighted observations by assigning a membership function.The fitting parameters were continuously involved in the iterative process until the sum of squared residuals was minimized.Finally, the optimal parameters were obtained to complete the MFW-LM algorithm.The flowchart of this process is shown in Figure 2.
We programmed the entire algorithm in OriginPro and LabView software.First, we predicted the initial values of parameters by the least-squares method or experimental results.Next, we weighted observations by assigning a membership function.The fitting parameters were continuously involved in the iterative process until the sum of squared residuals was minimized.Finally, the optimal parameters were obtained to complete the MFW-LM algorithm.The flowchart of this process is shown in Figure 2. From the view of weighted curve fitting, the membership function is a rather simple function capable of coping with imprecise measurements.

Verification of MFW-LM Algorithm
We verified the MFW-LM algorithm by simulating optical-sensing signals, which were accompanied by random noise, sensor non-linearity, and data distortion.We compared the fitting results of the proposed MFW-LM algorithm with that of an outliers-excluded LM (OE-LM).
We assumed a laser beam featuring a Gaussian function based on a large number of previous studies [32][33][34][35], which was described by Equation ( 5) and is shown in Figure 3a: where I 0 can be seen as background light; η is a constant; w is the radius at which the intensity value falls to 1/e 2 of the maximum intensity; x c is the offset of the maximum intensity relative to the horizontal axis; x is the radial distance from the center axis of the beam; all parameters were randomly generated (in Table 1).The laser beam was measured by image sensors with four different response characteristics as shown in Figure 3c and with random noise shown in Figure 3b.Taking the simulated SNR = 25, calculated by the amplitude of the simulated signal and the random noise, as an example, we simulated the measurements.The measured laser beams with four image sensors are shown in Figure 3d, in which we intended a bigger input to bring about a saturated signal, seriously distorted data, or outliers, to verify the proposed MFW-LM algorithm.
We fitted measurement I (in Figure 3d) with the MFW-and OE-LM algorithms separately.The fitted curves and preset Gaussian function are shown in the upper panel of Figure 3e and their deviation in the lower panel of Figure 3e.We then changed the response of image sensors to curves II-IV (in Figure 3c), which is more non-linear owing to device aging, and fitted the curves I-IV in Figure 3c with MFW-LM algorithm to verify its universality, as shown in Figure 3g.We simulated 100 signals at different SNRs by adjusting the amplitude of random noise and the sensor's non-linearity, Sensors 2018, 18, 3762 6 of 14 and averaged them to obtain the relative normalized root-mean-square deviation (NRMSD), described in Equation ( 6), of the fitted and preset values, as shown in Figure 3f,h, respectively.
We fitted measurement I (in Figure 3d) with the MFW-and OE-LM algorithms separately.The fitted curves and preset Gaussian function are shown in the upper panel of Figure 3e and their deviation in the lower panel of Figure 3e.We then changed the response of image sensors to curves II-IV (in Figure 3c), which is more non-linear owing to device aging, and fitted the curves I-IV in Figure 3c with MFW-LM algorithm to verify its universality, as shown in Figure 3g.We simulated 100 signals at different SNRs by adjusting the amplitude of random noise and the sensor's nonlinearity, and averaged them to obtain the relative normalized root-mean-square deviation (NRMSD), described in Equation ( 6), of the fitted and preset values, as shown in Figures 3f,h, respectively.According to measurements I-IV, we set the parameters of the membership function (in Table 2) for MFW-LM fitting based on the response curves I-IV in Figure 3c.The y max and y min are limited values of the sensor's responsivity.y 1 and y 2 are the two-thirds of the sensor's responsivity.The parameter vector → a = (I 0 , η, w, x c ) was obtained by LM fitting and was used as the initial parameter vector of the MFW-LM algorithm.After iteration, the final iteration obtained the optimal parameter vector, which can minimize the sum of squared residuals R( → a ).Substituting it into the Gaussian function yielded the fitted laser beam profile.We compared the deviation between the reconstructed signal and the preset laser-beam profile, which was quantified by the NRMSD of the relative residuals as follows: where y i and y * i are the fitted data and the preset value, respectively; y max is the maximum of y i ; and n is the number of fitted points.The sensor's non-linearity δ was expressed by Equation (7) and demonstrated in Figure 1a: where y n is the non-linear response data, y l the linear response data, and Y the range of linear response.
The result of the single simulation (Figure 3e) indicates that the relative NRMSD of the OE-LM and the MFW-LM algorithms were 4.5% and 1.1%, respectively.Multiple simulations at different SNRs found that the NRMSD of the MFW-LM algorithm was improved by 66.0%-89.7%compared to the OE-LM algorithm, and that it is always within 5% for different response characteristics when the SNR is not less than 2.5 or the sensor's non-linearity is not greater than 31.32.
Therefore, the MFW-LM algorithm is extremely robust and effective in minimizing the contribution of outliers and distorted signals and accurately reconstructs the laser-beam profile when dealing with optical sensing with small datasets; that is, the proposed MFW-LM algorithm is suitable for curve fitting that requires high-precision measurement.

Optical Absorption Spectroscopy Analysis
To improve the accuracy of optical absorption spectroscopy analysis, which is often frustrated by imperfect response, interference, and electronic noise [24, 25,[36][37][38] in signal acquisition and processing, we applied the MFW-LM algorithm to molecular absorption line modeling of H 2 O and compared the measurement uncertainty of the temperature and pressure calculated by the fitting results of the MFW-LM and the LM algorithms.
H 2 O spectral intensity and line shape were used to calculate temperature, and pressure by the LM algorithm based on wavelength-modulation spectroscopy (WMS) [39].The fitted mathematical expression was determined by the center absorption wavenumber ν 0 , integral absorbance A i , and Lorentzian broadening ∆ νL [40].The molecular absorption line modeling M that was used for the fitting is introduced by Equations ( 8)- (10): where M is the molecular absorption line modeling; A is integral absorbance; i 0 = 0.036 and ψ = 1.12π are parameters of the laser; H i is the ith harmonic signal; ϕ v is the Voigt profile; ν = 2.0 × 10 5 GHz is the center frequency of the laser; a = 0.065 cm −1 is the modulation amplitude; θ∈[−π, π]; ν is absorption wavenumber; ν 0 is the center absorption wavenumber; ∆ νL is the Lorentzian broadening; ∆ νG is the Gaussian broadening; ∆ν v is the half width at half maximum (HWHM) of Voigt; c L and c G are weights, which are related to the absorption lineshape [41].Gas temperature T was calculated according to the line-strength ratio R = A i /A j [Equation ( 11)], which is a fourth-order polynomial obtained by fitting the data provided by the HITRAN database [42].Pressure P can be inferred by combining Equations ( 12) to (13): Sensors 2018, 18, 3762 8 of 14 where T is the gas temperature; k 1 , k 2 , k 3 , k 4 , and k 5 are polynomial coefficients (Table 3); R is the line-strength ratio; ∆ νL is Lorentzian broadening; χ H 2 O is the concentration of H 2 O; γ self and γ mix , calculated by γ j (T) = γ j (T 0 )(T 0 /T) n j , are the self-broadening coefficient of H 2 O and the mix-broadening coefficient of H 2 O with other gas compounds, respectively; γ j (T 0 ) is the broadening factor at the reference temperature; n j is the temperature index, which is typically 0.5; A is integral absorbance; S is the line strength; and L is the optical path length.The temperature of the experimental environment measured by a thermocouple was T = 350 K.Then, the pressure calculated according to the ideal gas law was P = 1.18 atm.The temperature and pressure measurement uncertainties obtained by the LM algorithm were 2.6% and 6.8%, respectively.
To weaken the roles of outliers and distorted signals on curve fitting, we used the proposed MFW-LM algorithm to refit the raw observations.The empirical estimates of ν 0 , A i and ∆ νL were regarded as initial parameters.The parameters and weighting functions (the membership functions) were set for the LM fitting program by Labview software.By repeating multiple iterations, once the sum of squared residuals R( → a ) minimizing, the fitting process will converge to the unique solution, the optimal parameters, and the molecular absorption lineshape of H 2 O was obtained by the MFW-LM fit.Based on the robustness of the MFW-LM algorithm, the observed signals obtained by sensors with different responsivity can be fitted.Observations and sensor responsivity are one-to-one corresponding, so the limit values and critical values of the observations can be taken as the key parameters of the membership function (see Table 4), so that the responsivity of the photodetector (PDA10CS-EC, Thorlabs Inc., Newton, NJ, USA) used in the experiment is not needed to be tested or corrected.The parameters of the membership function, following Equation (1), were set based on the molecular absorption lineshape of H 2 O collected by this photodetector as shown in Table 4.The y max and y min are limited values of the observations' amplitude.y 1 and y 2 are the two thirds of the observations' amplitude.The variables of the molecular absorption line modeling of H 2 O are continually updated and iterated until a set of variables is found to minimize the R( → a ) (Equation ( 4)).The molecular absorption lineshape of H 2 O and the fitting results of the LM and the MFW-LM algorithms are shown in Figure 4 and Table 5.The molecular absorption lineshape of H2O and the fitting results of the LM and the MFW-LM algorithms are shown in Figure 4 and Table 5.The integral absorbance ratio (i.e., R) was obtained from the two absorption peaks 1 and 2 of H2O.Substituting it into Equation ( 11), we can calculate the gas temperature T. In Equations ( 12) and ( 13), the parameters other than the pressure P and H2O concentration  H 2 O are constants or the known parameters obtained by the fitting signal.Therefore, the pressure P and H2O concentration  H 2 O can be obtained by combining Equations ( 12) and ( 13).The calculated results and uncertainty analysis of the gas temperature T and pressure P are shown in Table 5.The integral absorbance ratio (i.e., R) was obtained from the two absorption peaks 1 and 2 of H 2 O. Substituting it into Equation (11), we can calculate the gas temperature T. In Equations ( 12) and ( 13), the parameters other than the pressure P and H 2 O concentration χ H 2 O are constants or the known parameters obtained by the fitting signal.Therefore, the pressure P and H 2 O concentration χ H 2 O can be obtained by combining Equations ( 12) and ( 13).The calculated results and uncertainty analysis of the gas temperature T and pressure P are shown in Table 5.
We then took the measurement results from 50 repeated experiments under the same experimental conditions to compare them with the truth values, as shown in Figure 5.  1 Value is the truth value. 2 Value is the calculated value.
We then took the measurement results from 50 repeated experiments under the same experimental conditions to compare them with the truth values, as shown in Figure 5.The relative standard deviation (RSD) was used to represent the calculation error of key parameters: where vi is the calculated value, vb the truth value, and N the number of data points.
It can be seen that while the MFW-LM algorithm resulted in a slightly lower NRMSD of the The relative standard deviation (RSD) was used to represent the calculation error of key parameters: where v i is the calculated value, v b the truth value, and N the number of data points.
It can be seen that while the MFW-LM algorithm resulted in a slightly lower NRMSD of the signal line profile, it reduced the relative error of the gas temperature and pressure calculated from the fitting result by 42.9% and 61.8%, respectively.The RSDs of the temperature and pressure of the 50 repeated experiments calculated by the LM and the MFW-LM algorithms were reduced from 2.4% to 1.1% and from 3.4% to 1.7%, respectively; that is, the measurement uncertainties of temperature and pressure calculated by the MFW-LM algorithm were dramatically reduced by 53.3% and 43.5%, respectively, compared with that calculated by the LM algorithm.

Reconstruction of Laser-Beam Profile
We used the MFW-LM algorithm to reconstruct a laser-beam profile from heavily distorted observations to capture more optical signal details lost in the unsaturated laser-beam profile obtained with a neutral density filter or a beam splitter in front of the image sensors.
Laser-beam profile is usually measured by image sensors to improve detection efficiency.At present, the analog-to-digital converter of an image sensor is mostly 8-or 10-bit, which means that the dynamic range (DNR) of a sensor is only 256 or 1024.In order to avoid image sensor saturation, the usual practice is to pick off a small fraction of the beam with a neutral density filter or a beam splitter in front of the image sensors, resulting in the serious loss of laser-beam profile details and the inaccurate reflection of laser-beam spatial characteristics.For example, due to the pixel resolution of the image sensor, only a few intensity points can be resolved within the dramatically changing range of the laser-beam profile, and the analysis of the laser-beam profile based on a small amount of data is considered to be unreliable.If we do not do this, even if it causes slight saturation on the laser-beam profile, the MFW-LM algorithm has been simulated and verified to accurately reconstruct the laser-beam profile, so that more intensity points of the laser-beam profile can be distinguished, giving us a chance to mine hidden information (as shown in Figure 6).
Sensors 2018, 18, x 10 of 14 of the laser-beam profile, and the analysis of the laser-beam profile based on a small amount of data is considered to be unreliable.If we do not do this, even if it causes slight saturation on the laserbeam profile, the MFW-LM algorithm has been simulated and verified to accurately reconstruct the laser-beam profile, so that more intensity points of the laser-beam profile can be distinguished, giving us a chance to mine hidden information (as shown in Figure 6).When measuring the laser-beam profile, we increased the incident-laser intensity (or the integration time) beyond the DNR but below the damage threshold of the image sensor to reflect the low intensity in details, which inevitably results in saturation and distortion.We then completed a high-precision reconstruction of the laser-beam profile by using the MFW-LM algorithm, which was proved to solve these problems.
The experimental setup was part of the research on mid-infrared laser-transmission characteristics in hollow waveguides (HWGs).The laser beam emitted from an interband cascade laser was collimated with an aspheric lens and coupled into a HWG by an off-axis parabolic mirror.An infrared camera (FLIR ThermoVision A40, Wilsonville, OR, USA) was used to measure the laser- When measuring the laser-beam profile, we increased the incident-laser intensity (or the integration time) beyond the DNR but below the damage threshold of the image sensor to reflect the low intensity in details, which inevitably results in saturation and distortion.We then completed a high-precision reconstruction of the laser-beam profile by using the MFW-LM algorithm, which was proved to solve these problems.
The experimental setup was part of the research on mid-infrared laser-transmission characteristics in hollow waveguides (HWGs).The laser beam emitted from an interband cascade laser was collimated with an aspheric lens and coupled into a HWG by an off-axis parabolic mirror.An infrared camera (FLIR ThermoVision A40, Wilsonville, OR, USA) was used to measure the laser-beam profile near the waist.
To ensure that the laser-beam profile in the experiment could be described by a Gaussian function, we obtained the intact laser-beam profile with a neutral density filter or a beam splitter in front of the infrared camera and described it with two-and three-dimensional images, as shown in Figure 7.In our numerous verification experiments, fitting degrees of the laser-beam profile and Gaussian function were all greater than 95.3%.Therefore, a Gaussian function was used to fit the laser-beam profile.
intensity with usual means and reconstructing saturated laser-beam profiles with the MFW-LM algorithm, which are characterized by black and red curves, respectively.Data falling into the purple area have very low quality, and are represented by smaller points than those used to represent highquality data.The solid curves represent raw signals and the dashed curves represent fitted signals.
When measuring the laser-beam profile, we increased the incident-laser intensity (or the integration time) beyond the DNR but below the damage threshold of the image sensor to reflect the low intensity in details, which inevitably results in saturation and distortion.We then completed a high-precision reconstruction of the laser-beam profile by using the MFW-LM algorithm, which was proved to solve these problems.
The experimental setup was part of the research on mid-infrared laser-transmission characteristics in hollow waveguides (HWGs).The laser beam emitted from an interband cascade laser was collimated with an aspheric lens and coupled into a HWG by an off-axis parabolic mirror.An infrared camera (FLIR ThermoVision A40, Wilsonville, OR, USA) was used to measure the laserbeam profile near the waist.
To ensure that the laser-beam profile in the experiment could be described by a Gaussian function, we obtained the intact laser-beam profile with a neutral density filter or a beam splitter in front of the infrared camera and described it with two-and three-dimensional images, as shown in Figure 7.In our numerous verification experiments, fitting degrees of the laser-beam profile and Gaussian function were all greater than 95.3%.Therefore, a Gaussian function was used to fit the laser-beam profile.We increased the DNR of the infrared camera equivalently by reducing the attenuation of laser intensity via an attenuation device and used the proposed MFW-LM algorithm to fit the observations, as shown in Figure 8.The dotted solid curve in the upper panel of Figure 8 is the raw data and the dashed blue curve is the curve fitted by the MFW-LM algorithm.The parameters of the membership function, following Equation (1), were set as in Table 6.We increased the DNR of the infrared camera equivalently by reducing the attenuation of laser intensity via an attenuation device and used the proposed MFW-LM algorithm to fit the observations, as shown in Figure 8.The dotted solid curve in the upper panel of Figure 8 is the raw data and the dashed blue curve is the curve fitted by the MFW-LM algorithm.The parameters of the membership function, following Equation (1), were set as in Table 6.The bottom panel of Figure 8 shows the fitting residuals.The data in the areas marked by the red rectangles have the highest fidelity.The relative NRMSD of the MFW-LM algorithm in the red rectangular areas was as low as 4.1% [Equation (7)].The laser-beam profiles measured and reconstructed in the case in which the DNR of the infrared camera was increased equivalently were compared using a neutral density filter or a beam splitter in front of the image sensors for signal measuring, as shown in Figure 7.The larger points represent the data with high quality and credibility, while the smaller points indicate that the data had low quality in the purple area.From Figure 6, we note the following clarifications:


After reconstructing the heavily distorted laser-beam profiles, the detected laser intensity at the  The bottom panel of Figure 8 shows the fitting residuals.The data in the areas marked by the red rectangles have the highest fidelity.The relative NRMSD of the MFW-LM algorithm in the red rectangular areas was as low as 4.1% [Equation (7)].
The laser-beam profiles measured and reconstructed in the case in which the DNR of the infrared camera was increased equivalently were compared using a neutral density filter or a beam splitter in front of the image sensors for signal measuring, as shown in Figure 7.The larger points represent the data with high quality and credibility, while the smaller points indicate that the data had low quality in the purple area.From Figure 6, we note the following clarifications:

•
After reconstructing the heavily distorted laser-beam profiles, the detected laser intensity at the edge of the spot was closer to 0, while the detected laser intensity in other areas was significantly increased, resulting in a significant improvement of the data's quality.

•
The number of high-quality points used to study the laser-beam profile increased from 5 (larger points on the black fitted curve) to 23 (larger points on the red fitted curve), making the detail resolution of the laser-beam profile study significantly improved by 360% and the fitting results more accurate, which can provide more extracted information for the study of the spatial characteristics of the laser beam.
As the DNR of the infrared camera increased from 256 to 415 with the proposed MFW-LM algorithm, the detail resolution of the laser-beam profiles increased by an amazing 360%.Moreover, the MFW-LW algorithm ensured that the deviation between the fitting result and the raw data in the most reliable region was as low as 4.1%.Therefore, the MFW-LM algorithm achieved high-precision measurement and high dynamic-range imaging (HDRI) to capture optical signal details.

Conclusions
In the work reported in this paper, we devised a membership function from fuzzy logic for the first time to evaluate the fidelity of optical sensing.The membership function was further used as a weighting function for the Levenberg-Marquardt algorithm.We verified the robustness and effectiveness of the proposed MFW-LM algorithm through simulation and practical sensing applications.The MFW-LM algorithm dramatically improved the NRMSD by 66.0%, more than the OE-LM algorithm for distorted optical sensing.We leveraged the great advantages of the MFW-LM algorithm in optical sensing under expected mathematical model constraints by reducing the effect of outliers and distorted signals: (1) the measurement uncertainty of temperature and pressure calculated by the molecular spectral line modeling was reduced dramatically, by 53.3% and 43.5%, respectively, compared with the LM algorithm; (2) the detailed resolution of the laser-beam profiles increased by an amazing 360% by reconstructing the laser-beam profile with the method, achieving HDRI to capture optical signal details.Therefore, the proposed method is suitable, particularly for in situ and online sensing under expected mathematical model constraints, for cases in which small datasets cannot imply a normal distribution and the deletion of any outliers and distortion would not be practical.The MFW-LM algorithm provides a useful tool for optical processing from outliers and distorted signal and has great potential for processing optical signals without depending on the quality of the measured signal.

Figure 1 .
Figure 1.(a) Typical responsivity of a photosensor; (b) assignment of a membership function.ymax, ymin, y1 and y2 are the maximum, minimum, and two critical observations, respectively.The two small panels in (a) are partial enlargements at the responsivity's ends.

Figure 1 .
Figure 1.(a) Typical responsivity of a photosensor; (b) assignment of a membership function.y max , y min , y 1 and y 2 are the maximum, minimum, and two critical observations, respectively.The two small panels in (a) are partial enlargements at the responsivity's ends.

Figure 3 .
Figure 3. Demonstration of MFW-LM algorithm.(a) Simulated laser-beam profile with Gaussian distribution; (b) random noise; (c) illustration of various response curves; (d) simulated signals corresponding to various response curves in c and random noise in b; (e) comparison between original (a) and fitted values by the MFW-and outliers-excluded (OE)-LM algorithms with response curve I in c; (f) noise-tolerance comparison of MFW-and OE-LM algorithms with response curve I in c; (g) comparison of fitted results with various measurements in d; (h) non-linearity tolerance of MFW-LM algorithm.MFW-LM denotes membership function-weighted Levenberg-Marquardt algorithm; OE-LM denotes outliers-excluded Levenberg-Marquardt algorithm; NRMSD denotes normalized root-mean-square deviation.

Figure 4 .
Figure 4.The raw molecular absorption lineshape of H2O and the fitting results of LM and MFW-LM algorithms.The two absorption peaks 1, 2 analyzed are shown in the figure.

Figure 4 .
Figure 4.The raw molecular absorption lineshape of H 2 O and the fitting results of LM and MFW-LM algorithms.The two absorption peaks 1, 2 analyzed are shown in the figure.

Figure 5 .
Figure 5.Comparison of the key parameters obtained by LM and MFW-LM algorithms with truth values in 50 repeated experiments.Orange and purple horizontal lines are truth values of gas temperature (350 K) and pressure (1.18 atm), respectively.

Figure 5 .
Figure 5.Comparison of the key parameters obtained by LM and MFW-LM algorithms with truth values in 50 repeated experiments.Orange and purple horizontal lines are truth values of gas temperature (350 K) and pressure (1.18 atm), respectively.

Figure 6 .
Figure 6.Comparison of the detail resolution of laser-beam profiles obtained by reducing laser intensity with usual means and reconstructing saturated laser-beam profiles with the MFW-LM algorithm, which are characterized by black and red curves, respectively.Data falling into the purple area have very low quality, and are represented by smaller points than those used to represent highquality data.The solid curves represent raw signals and the dashed curves represent fitted signals.

Figure 6 .
Figure 6.Comparison of the detail resolution of laser-beam profiles obtained by reducing laser intensity with usual means and reconstructing saturated laser-beam profiles with the MFW-LM algorithm, which are characterized by black and red curves, respectively.Data falling into the purple area have very low quality, and are represented by smaller points than those used to represent high-quality data.The solid curves represent raw signals and the dashed curves represent fitted signals.

Figure 8 .
Figure8.Laser-beam profile reconstructed using the MFW-LM algorithm.Data points with different colored dotted solid curves represent the fact that they were given different weights according to the corresponding membership function; dashed blue line is the fitted curve; the bottom panel shows fitting residuals and the most valuable data marked by red rectangles.

Figure 8 .
Figure8.Laser-beam profile reconstructed using the MFW-LM algorithm.Data points with different colored dotted solid curves represent the fact that they were given different weights according to the corresponding membership function; dashed blue line is the fitted curve; the bottom panel shows fitting residuals and the most valuable data marked by red rectangles.

Table 2 .
Membership function parameters for different measured laser beams.

Table 5 .
Comparison of fitting results and measurement uncertainty of gas temperature and pressure from using LM and MFW-LM algorithms.
1Value is the truth value.2Value is the calculated value.

Table 5 .
Comparison of fitting results and measurement uncertainty of gas temperature and pressure from using LM and MFW-LM algorithms.