Method, system, device and storage medium for background subtraction of spectral data
Through the adaptive peak search and adaptive stepping approximation methods, the target spectral value in the spectral data is determined, which solves the problem of poor deduction effect in the existing spectral background spectral deduction method, and achieves high-precision background deduction and data quality improvement.
Patent Information
- Application Number
- CN202410173740.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-07
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-02-07
AI Technical Summary
The existing spectral background spectrum deduction method has the problem of too high or too low background spectrum deduction, and the program construction is cumbersome and the calculation amount is large, which affects the calculation accuracy.
By acquiring the original spectral data based on laser-induced breakdown spectrum, adaptive peak search determines the peak width of different peak areas in each channel, calculates the average peak width, and determines the target spectral value of each channel using adaptive step approximation, thereby achieving background subtraction of the spectral data.
The background deduction operation is simplified, the calculation amount is reduced, the data quality after background deduction is improved, and the accuracy of subsequent calculations is improved.
Smart Images

Figure CN118015038B_ABST
Abstract
Description
Technical Field
[0001] The present application generally relates to the technical field of background subtraction, and more specifically, to a method, system, device, and computer-readable storage medium for background subtraction of spectral data. Background Art
[0002] In the measurement of spectrum and energy spectrum, the existence of background spectrum / energy spectrum will cause large errors in the subsequent quantitative calculation. Therefore, how to properly subtract the background spectrum is an important issue to improve the accuracy of quantitative calculation. At present, the traditional methods of background spectrum subtraction are mainly the following, namely Lorentz fitting method, segmented feature extraction method, local minimum method, asymmetric least squares method, wavelet transform, optimized wavelet function, decomposition layer number, proportional factor, etc.
[0003] Among them, the Lorentz fitting method is to fit the spectral peak through the Lorentz function, determine the half-height width of the continuous background spectrum and the spectral peak, so as to achieve background subtraction. The segmented feature extraction method is to divide the spectrum of different regions, take the spectral average before and after the spectral peak as the continuous background spectrum together with the spectral peak area for subtraction. The local minimum method is similar to the segmented feature extraction method. By dividing the spectrum into N segments, and then fitting the high-order polynomial of the local minimum value, the function of the background spectrum is obtained for segmented subtraction. The asymmetric least squares method is to add the first-order derivative constraint term on the basis of the second-order derivative smoothing constraint of the asymmetric least squares baseline correction algorithm and iteratively calculate the background spectrum value for subtraction. Wavelet transform uses wavelet coefficients instead of reconstructed spectral signals to perform spectral background subtraction of wavelet transform. However, the existing spectral background spectrum subtraction method has the problem of too high or too low background spectrum subtraction, or requires customized subtraction for each new test spectrum line, which makes the program construction cumbersome, large amount of calculation and poor subtraction effect, thus affecting the subsequent calculation accuracy.
[0004] In view of this, there is an urgent need to provide a solution for background subtraction of spectral data in order to simplify the background subtraction operation, reduce the amount of calculation, and improve the quality of data after background subtraction. Summary of the invention
[0005] In order to at least solve one or more of the technical problems mentioned above, the present application proposes a solution for background subtraction of spectral data in multiple aspects.
[0006] In a first aspect, the present application provides a method for background subtraction of spectral data, comprising: collecting raw spectral data based on laser induced breakdown spectroscopy, wherein the raw spectral data comprises a plurality of channels; performing adaptive peak searching on the raw spectral data to determine the peak width of different peak regions in each of the channels; calculating the average peak width according to the peak width of different peak regions in each of the channels; determining the target spectral value of each of the channels using adaptive step approximation based on the average peak width and the peak width of different peak regions in each of the channels; and subtracting the target spectral value of each of the channels from the raw spectral data to achieve background subtraction of the spectral data.
[0007] In one embodiment, the method further includes: performing an initial spectral subtraction on the original spectral data and calculating the average value of the spectral data after the initial spectral subtraction to obtain target spectral data; determining a target spectral value of each of the channels based on the target spectral data; and subtracting the target spectral value of each of the channels from the target spectral data to achieve background subtraction of the spectral data.
[0008] In another embodiment, initial spectral subtraction is performed on the raw spectral data by the following operations: performing principal component analysis on the raw spectral data to divide the raw spectral data into a first principal component and a second principal component; and performing initial spectral subtraction on the raw spectral data based on the Mahalanobis distance between the spectral data in the first principal component and the spectral data in the second principal component.
[0009] In yet another embodiment, performing initial spectral subtraction on the original spectral data based on the Mahalanobis distance between the spectral data in the first principal component and the spectral data in the second principal component includes: judging spectral data that deviates from a preset value based on the Mahalanobis distance; and removing the spectral data that deviates from the preset value from the original spectral data to perform initial spectral subtraction on the original spectral data.
[0010] In another embodiment, adaptive peak searching is performed on the original spectral data to determine the peak width of different peak regions in each of the channels, including: adaptive peak searching is performed on the original spectral data to obtain an initial peak width of each of the channels; target iteration parameters related to the peak width are determined based on the initial peak width of each of the channels; and the peak width of different peak regions in each of the channels in each iteration are calculated according to the target iteration parameters.
[0011] In another embodiment, determining the target spectral value using adaptive step approximation based on the average peak width and the peak widths of different peak regions in each of the channels includes: comparing the size relationship between the average peak width in the corresponding iteration number and the peak widths of different peak regions in each channel; based on the comparison result, calculating the spectral value of each channel in the corresponding iteration number using adaptive step approximation; calculating the background spectrum in the corresponding iteration number based on the spectral value of each channel in the corresponding iteration number; and determining the target spectral value based on the difference between the background spectrum in the corresponding iteration number and the background spectrum of the previous iteration.
[0012] In yet another embodiment, based on the comparison result, calculating the spectral value of each channel in the corresponding iteration number by using adaptive step approximation includes: calculating the spectral value of each channel in the corresponding iteration number by the following formula:
[0013]
[0014] in, represents the spectral value of each channel of the current iteration, p represents the average peak width, r i Represents the peak width of different peak areas in each channel of the current iteration, i represents the number of channels, and n represents the number of iterations.
[0015] In another embodiment, calculating the background spectrum in the corresponding iteration number based on the spectral value of each channel in the corresponding iteration number includes: respectively calculating the first spectral total value of all channels in the corresponding iteration number and the second spectral total value of all channels in the previous iteration; and performing a weighted sum of the first spectral total value and the second spectral total value to determine the background spectrum in the corresponding iteration number.
[0016] In another embodiment, determining the target spectrum value based on the difference between the background spectrum in the corresponding iteration number and the background spectrum of the previous iteration includes: in response to the difference between the background spectrum in the corresponding iteration number and the background spectrum of the previous iteration being less than or equal to a preset threshold, determining the spectrum value of each channel in the corresponding iteration number as the target spectrum value; or in response to the difference between the background spectrum in the corresponding iteration number and the background spectrum of the previous iteration being greater than a preset threshold, continuing to iterate the spectrum value and the background spectrum of each channel until the difference between the background spectrum in the corresponding iteration number and the background spectrum of the previous iteration is less than or equal to the preset threshold, and determining the spectrum value of each channel in the corresponding iteration number as the target spectrum value.
[0017] In a second aspect, the present application provides a system for performing background subtraction on spectral data, comprising: an acquisition unit, which is used to acquire raw spectral data based on laser induced breakdown spectroscopy, wherein the raw spectral data includes multiple channels; a data processing unit, which is used to: perform adaptive peak searching on the raw spectral data to determine the peak width of different peak regions in each of the channels; calculate the average peak width based on the peak width of different peak regions in each of the channels; determine the target spectral value of each of the channels using adaptive step approximation based on the average peak width and the peak width of different peak regions in each of the channels; and a background subtraction unit, which is used to subtract the target spectral value of each of the channels from the raw spectral data to achieve background subtraction on the spectral data.
[0018] In a third aspect, the present application provides a device for performing background subtraction on spectral data, comprising: a processor; and a memory, in which program instructions for performing background subtraction on spectral data are stored, and when the program instructions are executed by the processor, the device implements multiple embodiments of the aforementioned first aspect.
[0019] In a fourth aspect, the present application provides a computer-readable storage medium having stored thereon computer-readable instructions for performing background subtraction on spectral data, wherein when the computer-readable instructions are executed by one or more processors, multiple embodiments of the aforementioned first aspect are implemented.
[0020] By the scheme for background subtraction of spectral data provided above, the embodiment of the present application determines the peak width of different peak areas in each channel by adaptive peak search, and determines the target spectrum value of the channel by adaptive step approximation method, to realize the background subtraction of spectral data. Based on this, the embodiment of the present application determines the peak width by adaptive peak search, with the spectrum measurement for any element or sample, thereby simplifying the background subtraction operation and reducing the amount of operation. Background subtraction is carried out by adaptive step approximation method, so that the subtraction accuracy is high, the data quality after background subtraction is improved, and it is conducive to improving the accuracy of subsequent calculations. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become easy to understand. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0022] Figure 1 is an exemplary flowchart showing a method for background subtraction of spectral data according to an embodiment of the present application;
[0023] Figure 2is an exemplary flowchart showing the iterative process of determining a target spectrum value by using the spectrum value of each channel and the background spectrum according to an embodiment of the present application;
[0024] Figure 3 is an exemplary flow chart showing an overall process for background subtraction of spectral data according to an embodiment of the present application;
[0025] Figure 4 is an exemplary structural block diagram showing a system for performing background subtraction on spectral data according to an embodiment of the present application;
[0026] Figure 5 It is an exemplary structural block diagram of a device for performing background subtraction on spectral data according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0028] It should be understood that the terms "include" and "comprising" used in the specification and claims of the present application indicate the presence of described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.
[0029] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in this application specification and claims, unless the context clearly indicates otherwise, the singular forms of "a", "an" and "the" are intended to include plural forms. It should also be further understood that the term "and / or" used in this application specification and claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0030] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0031] The specific implementation of the present application is described in detail below with reference to the accompanying drawings.
[0032] Figure 1 FIG. 1 is an exemplary flow chart showing a method 100 for performing background subtraction on spectral data according to an embodiment of the present application. Figure 1 As shown in , at step S101, raw spectral data is collected based on laser induced breakdown spectroscopy, wherein the raw spectral data includes multiple channels. That is, raw spectral data of the alloy is collected based on Laser-Induced Breakdown Spectroscopy (LIBS) technology. The LIBS technology can detect any form of matter (solid, liquid, gas), does not require sample preparation, is simple to operate, can perform online real-time measurement of the test sample, and can detect all elements at the same time, making the technology more and more widely used in the industrial field.
[0033] In an implementation scenario, in the collection of raw spectral data of an alloy based on LIBS technology, a YAG laser, for example, can be used as an excitation light source. By placing, for example, an alloy sample in the middle of a sample stage and adjusting the position of a lifting motor, the laser is focused on the alloy sample and hits the alloy sample to excite the plasma to obtain a spectral signal. Then, the received spectral signal is transmitted to the spectrometer through an optical fiber by a probe to collect the raw spectral data of the alloy. By changing different striking points and striking with a laser multiple times, multiple spectral data of different striking points can be obtained. As an example, under standard atmospheric conditions, 100 points are randomly selected for spectral collection at each alloy sample, and 100 raw spectral data are collected at each point. It can be understood that the multiple channels in the aforementioned raw spectral data represent the positions of corresponding peaks on the horizontal axis. For example, the 10th channel represents the corresponding peak at the 10th point on the horizontal axis.
[0034] Based on the collected raw spectral data, at step S102, the raw spectral data is adaptively peak-searched to determine the peak width of different peak regions in each channel. In one embodiment, the raw spectral data may first be adaptively peak-searched to obtain an initial peak width of each channel, and then a target iteration parameter related to the peak width is determined based on the initial peak width of each channel, so as to calculate the peak width of different peak regions in each channel in each iteration according to the target iteration parameter.
[0035] In an implementation scenario, the initial peak width of each channel can be expressed as r = [0, 0, ..., 0, w1, w1, ..., w1, 0, ..., 0, w2, ..., w2, w2w1, 0, ..., 0, w k ,w k ,…,w k ,0,…,0], whose length is the same as the number of spectral channels, wk represents the width of the k-th peak region. Next, the target iteration parameter related to the peak width can be determined based on the initial peak width of each channel. As an example, assuming that the target iteration parameter is recorded as m, then m = max{w j},j∈[j,k]. It should be understood that the target iteration parameter m strongly affects the shape of the background spectrum after subtraction. If m is small, the background spectrum will be over-subtracted (too high); if m is large, the background spectrum will not be subtracted thoroughly (too low). Therefore, a single m value is not suitable for the entire spectrum. In an embodiment of the present application, the target iteration parameter m can be made to adaptively identify the peak width of the peak region by adopting an adaptive peak width (i.e., adaptive peak search) algorithm.
[0036] However, the determination of peak width depends largely on the peak search and region boundary estimation algorithm. Therefore, a fixed width value w is not suitable for each peak, especially for alloy spectra, whose half-height width varies with wavelength. Based on this, r is rewritten as r i =t*fi i ,m=max{r i Specifically, according to the target iteration parameter m obtained above, the peak width w of different peak areas in each channel in each iteration can be calculated according to w=2m+1.
[0037] Next, at step S103, the average peak width is calculated according to the peak widths of different peak regions in each channel, and at step S104, based on the average peak width and the peak widths of different peak regions in each channel, the target spectrum value of each channel is determined using adaptive step approximation. In one embodiment, the size relationship between the average peak width in the corresponding iteration number and the peak width of different peak regions in each channel is first determined. Next, based on the comparison result, the spectrum value of each channel in the corresponding iteration number is calculated using adaptive step approximation, and the background spectrum in the corresponding iteration number is calculated based on the spectrum value of each channel in the corresponding iteration number, and then the target spectrum value is determined according to the difference between the background spectrum in the corresponding iteration number and the background spectrum of the previous iteration.
[0038] In one implementation scenario, calculating the spectral value of each channel in the corresponding number of iterations using the adaptive step approximation includes: calculating the spectral value of each channel in the corresponding number of iterations using the following formula:
[0039]
[0040] in, represents the spectral value of each channel in the corresponding iteration number, p represents the average peak width, r i It represents the peak width of different peak areas in each channel in the corresponding iteration number, i represents the number of channels, and n represents the number of iterations. represents the spectral value of each channel in the previous iteration, and represents the spectral values of the next channel and the previous channel of channel i in the previous iteration, represents the half-width height, Represents the spectral value of each channel for the next iteration.
[0041] That is, when the average peak width p is less than or equal to the peak width r of different peak regions in each channel in the corresponding number of iterations i When the first target formula in the above formula (1) is used to calculate the spectral value of each channel in the corresponding iteration number, when the average peak width p is greater than the peak width r of different peak areas in each channel in the corresponding iteration number, i When p≤r, the second target formula below in the above formula (1) is used to calculate the spectral value of each channel in the corresponding number of iterations. That is, when p≤r i ,based on Returns the spectral value of each channel in the current iteration. i ,based on Returns the spectral value for each channel for the next iteration.
[0042] In some embodiments, in order to facilitate calculation and compress the dynamic range of channel counts, the spectral value of channel i may be converted using the logarithmic square root before iteration, for example, by Transformation is performed to convert the spectral value of channel i to y i =(exp(exp(z i )-1)-1) 2 -1, and then iterate the spectrum value of each channel based on the above formula (1). Then, the background spectrum in the corresponding iteration number is calculated based on the spectrum value of each channel in the corresponding iteration number. In an implementation scenario, the first spectrum total value of all channels in the corresponding iteration number and the second spectrum total value of all channels in the previous iteration are calculated respectively, and the first spectrum total value and the second spectrum total value are weighted and summed to determine the background spectrum in the corresponding iteration number.
[0043] For example, the total value of the first spectrum of all channels in the corresponding iteration number is recorded as sum(yout i ), the total value of the second spectrum of all channels in the previous iteration is recorded as sum(yin i ), can be obtained by sum(yin i )*w+sum(yout i )*(1-w) to calculate the background spectrum B in the corresponding iteration number n+1 , where w represents a weighting coefficient. Further, the target spectrum value is determined according to the difference between the background spectrum in the corresponding iteration number and the background spectrum in the previous iteration.
[0044] In one embodiment, in response to the difference between the background spectrum in the corresponding iteration number and the background spectrum of the previous iteration being less than or equal to a preset threshold, the total value of the first spectrum of all channels in the corresponding iteration number is determined as the target spectrum value. Alternatively, in response to the difference between the background spectrum in the corresponding iteration number and the background spectrum of the previous iteration being greater than the preset threshold, the spectrum value and the background spectrum of each channel are continuously iterated until the difference between the background spectrum in the corresponding iteration number and the background spectrum of the previous iteration is less than or equal to the preset threshold, and the total value of the first spectrum of all channels in the corresponding iteration number is determined as the target spectrum value. In some embodiments, the aforementioned preset threshold can be, for example, 0.5%.
[0045] As an example, assume that the background spectrum in the corresponding iteration number is denoted by B n+1 , the background spectrum B of the previous iteration n The difference between the background spectrum in the corresponding iteration and the background spectrum of the previous iteration is |B n -B n+1 | / B n+1 . When |B n -B n+1 | / B n+1 When ≤0.5%, the spectral value of each channel in the corresponding iteration number is determined as the target spectral value y. Otherwise, repeat the above process and continue to iterate the spectral value of each channel and the background spectrum until |B n -B n+1 | / B n+1 When the iteration number is less than or equal to 0.5%, the algorithm stops and the spectral value of each channel corresponding to the iteration number is determined as the target spectral value y.
[0046] After obtaining the target spectrum value y, in step S105, the target spectrum value is subtracted from the original spectrum data to achieve background subtraction of the spectrum data. Specifically, the data after background subtraction = original spectrum data - y.
[0047] In one embodiment, before background subtraction is performed, an initial spectral subtraction can be performed on the original spectral data, and the average value of the spectral data after the initial spectral subtraction is calculated to obtain target spectral data, and then the target spectral value of each channel is determined based on the target spectral data, and the target spectral value of each channel is subtracted from the target spectral data to achieve background subtraction of the spectral data.
[0048] In one implementation scenario, principal component analysis can be performed on the original spectral data to divide the original spectral data into a first principal component and a second principal component, and initial spectral subtraction is performed on the original spectral data based on the Mahalanobis distance between the spectral data in the first principal component and the spectral data in the second principal component. In one implementation scenario, spectral data that deviates from a preset value is judged based on the Mahalanobis distance, so that the spectral data that deviates from the preset value is removed from the original spectral data, so as to perform initial spectral subtraction on the original spectral data.
[0049] Specifically, the embodiment of the present application first projects the original spectral data into a new coordinate system by using the principal component analysis method through coordinate transformation, and selects the direction with the largest data change as the first principal component, and the direction with the second largest change as the second principal component. Then, the Mahalanobis distance is used to determine whether the data point deviates from the preset value, the deviated spectral data is eliminated, and the average value of the remaining spectrum is calculated after elimination to obtain the target spectral data. Subsequently, the spectral value and background spectrum of each channel can be iterated based on the current spectral data until the difference between the background spectrum in the corresponding iteration number and the background spectrum of the last iteration is less than or equal to the preset threshold, and the target spectral value y is obtained. Furthermore, the data after background deduction = original target spectral data-y.
[0050] In combination with the above description, it can be known that the embodiment of the present application determines the peak width of different peak areas in each channel by adaptive peak finding, and determines the target spectrum value of the channel by an adaptive step approximation method, and then subtracts the target spectrum value from the original spectrum data to achieve background subtraction of the spectrum data. Based on this, the peak width is determined by adaptive peak finding to measure the spectrum of any element or sample, thereby simplifying the background subtraction operation and reducing the amount of calculation. The background is subtracted by an adaptive step approximation method, so that when the background spectrum of the subtraction is too high or too low, it can be ensured that the difference between the front and back background spectra is within a preset threshold, so that the subtraction accuracy is high, the data quality after the background subtraction is improved, and it is conducive to improving the accuracy of subsequent calculations.
[0051] Figure 2 FIG. 1 is an exemplary flowchart showing the iterative process of determining the target spectrum value by using the spectrum value of each channel and the background spectrum according to an embodiment of the present application. Figure 2 As shown in FIG. 1 , first, in step S201 , it is assumed that the initial background spectrum B 1 =1, the number of iterations n = 0. Then, before the iteration, at step S202, the square root of the logarithm z is used i To represent the initial spectral value y of each channel i . Specifically, Therefore, the spectral value y of channel i i =(exp(exp(z i )-1)-1) 2 -1.
[0052] In step S203, based on the adaptive peak finding method r i =t*f i Determine the target iteration parameter m = max{r i}, then in step S204, the peak width w of different peak regions in each channel in each iteration is calculated based on w=2m+1, and the average peak width p is calculated. Where, f i represents a matrix, t is a constant parameter, and the initial value is set to t = 1 for calculation. After obtaining the average peak width p, the target spectrum value of each channel is determined by adaptive step approximation. Specifically, at step S205, based on To determine the spectral value of each channel in the corresponding number of iterations. As mentioned above, when p≤r i ,based on Returns the spectrum value of each channel in the current iteration. i ,based on Returns the spectral value for each channel for the next iteration.
[0053] Next, the first spectrum total value of all channels in the corresponding iteration number and the second spectrum total value of all channels in the previous iteration are calculated respectively, and at step S206, the total value of the first spectrum of all channels in the previous iteration is calculated by B n+1 =sum(yin i )*w+sum(yout i )*(1-w) to calculate the background spectrum in the corresponding iteration number. Further, in step S207, the difference between the background spectrum in the corresponding iteration number and the background spectrum of the previous iteration is determined. n -B n+1 | / B n+1 Is it less than or equal to a preset threshold (e.g. 0.5%)? n -B n+1 | / B n+1 is less than or equal to 0.5%, in step S208, the spectral value of each channel in the corresponding iteration number is determined as the target spectral value y. n -B n+1 | / B n+1 If it is greater than 0.5%, return to step S202 and repeat the above steps to continue iterating the spectrum value and background spectrum of each channel until |B n -B n+1 | / B n+1 When the value is less than or equal to 0.5%, the spectrum value of each channel in the corresponding iteration number is determined as the target spectrum value y. According to the obtained target spectrum value y, the target spectrum value y is subtracted from the original spectrum data or the target spectrum data to obtain the spectrum data after background subtraction.
[0054] Figure 3 FIG. 1 is an exemplary flow chart showing the overall process of background subtraction for spectral data according to an embodiment of the present application. Figure 3 As shown in , at step S301, raw spectral data is collected based on laser induced breakdown spectroscopy. In some embodiments, a YAG laser can be used as an excitation light source, so that the laser is focused on the alloy sample on the sample stage and hits it to excite plasma to obtain raw spectral data. At step S302, principal component analysis is performed on the raw spectral data to obtain a first principal component and a second principal component, and at step S303, the Mahalanobis distance between the spectral data in the first principal component and the spectral data in the second principal component is calculated to determine the spectral data that deviates from the preset value.
[0055] Next, at step S304, the spectral data that deviates from the preset value is removed from the original spectral data, and the average value of the remaining spectra is calculated to obtain the target spectral data. At step S305, the peak width of different peak regions in each channel is determined using an adaptive peak search method. Specifically, based on r i =t*f i ,m=max{r i}First, determine the target iteration parameter m, then calculate the peak width w of different peak areas in each channel in each iteration based on w=2m+1, and calculate the average peak width p. Then, at step S306, iterate the spectral value and background spectrum of each channel based on the adaptive step approximation method. Among them, the adaptive step approximation method can be expressed based on the above formula (1), and the spectral value of each channel in the corresponding number of iterations can be obtained through this formula (1). Furthermore, the background spectrum B in the corresponding number of iterations can be obtained by the weighted sum of the total value of the first spectrum of all channels in the corresponding number of iterations and the total value of the second spectrum of all channels in the previous iteration. n+1 .
[0056] Further, at step S307, when the background spectrum B in the corresponding iteration number n+1 The background spectrum B of the previous iteration n The difference between |B n -B n+1 | / B n+1 When it is less than or equal to a preset value (eg, 0.5%), at step S308, the spectral value of each channel in the corresponding iteration number is determined as the target spectral value y. For more details about the aforementioned iteration, please refer to the above Figure 1 and Figure 2 Finally, at step S309, the target spectrum value y is subtracted from the target spectrum data to obtain the subtracted spectrum data, so as to perform background subtraction on the spectrum data.
[0057] Figure 4FIG. 4 is an exemplary structural block diagram of a system 400 for performing background subtraction on spectral data according to an embodiment of the present application. Figure 4 As shown in , the system 400 may include an acquisition unit 401, a data processing unit 402, and a background subtraction unit 403. In one embodiment, the acquisition unit 401 may be used to acquire raw spectral data based on laser induced breakdown spectroscopy, wherein the raw spectral data includes multiple channels. In some embodiments, the acquisition unit 401 may include a laser emission source, a probe, a sample placement rack, and a spectrometer. As previously described, by focusing the laser on the alloy sample on the sample placement rack and striking the alloy sample, a plasma is generated to obtain a spectral signal and receive it via the probe. Then, it is transmitted to the spectrometer via an optical fiber to acquire the raw spectral data of the alloy sample.
[0058] In one embodiment, the data processing unit 402 can be used to perform adaptive peak search on the original spectral data to determine the peak width of different peak regions in each channel, calculate the average peak width according to the peak width of different peak regions in each channel, and determine the target spectral value of each channel by adaptive step approximation based on the average peak width and the peak width of different peak regions in each channel. In an implementation scenario, first, the adaptive peak search can be performed. i =t*f i Determine the initial peak width and based on m = max{r i}Determine the target iteration parameter m, thereby obtaining the peak width w of different peak regions in each channel in each iteration, where w=2m+1. Then calculate the average peak width, and determine the target spectrum value by adaptive step approximation (see the above formula (1)). Specifically, when the difference between the background spectrum in the corresponding iteration number and the background spectrum of the previous iteration is |B n -B n+1 | / B n+1 When it is less than or equal to the preset threshold, the spectral value of each channel in the corresponding iteration number is determined as the target spectral value y. For more details on determining the target spectral value, please refer to the above Figure 1-Figure 3 The description of is not repeated here in this application.
[0059] In one embodiment, the background subtraction unit 403 can be used to subtract the target spectrum value of each channel from the original spectrum data to achieve background subtraction of the spectrum data. That is, the data after background subtraction is obtained by subtracting the original spectrum data from the target spectrum value y to achieve background subtraction of the spectrum data. In some embodiments, the original spectrum data can also be initially subjected to initial background subtraction (e.g., data deviating from a preset value is eliminated) to obtain target spectrum data, and the target spectrum value of each channel is subtracted from the target spectrum data to achieve background subtraction of the spectrum data.
[0060] Figure 5FIG. 5 is an exemplary structural block diagram of a device 500 for performing background subtraction on spectral data according to an embodiment of the present application. Figure 5 As shown in , the device 500 of the present application may include a processor 501 and a memory 502, wherein the processor 501 and the memory 502 communicate with each other via a bus. The memory 502 stores program instructions for background subtraction of spectral data. When the program instructions are executed by the processor 501, the method steps described in the above text in combination with the accompanying drawings are implemented: collecting raw spectral data based on laser induced breakdown spectroscopy, wherein the raw spectral data includes multiple channels; performing adaptive peak search on the raw spectral data to determine the peak width of different peak regions in each channel; calculating the average peak width based on the peak width of different peak regions in each channel; based on the average peak width and the peak width of different peak regions in each channel, using adaptive step approximation to determine the target spectral value of each channel and subtract the target spectral value of each channel from the raw spectral data, so as to achieve background subtraction of the spectral data.
[0061] According to the above description in combination with the accompanying drawings, those skilled in the art can also understand that the embodiments of the present application can also be implemented by a software program. Therefore, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores computer-readable instructions for background subtraction of spectral data. When the computer-readable instructions are executed by one or more processors, the present application in combination with the accompanying drawings can be implemented. Figure 1 Described is the method used to perform background subtraction on spectral data.
[0062] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0063] It should be noted that although the operations of the method of the present application are described in a specific order in the accompanying drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flow chart can be performed in a different order. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.
[0064] It should be understood that when the terms "first", "second", "third" and "fourth" are used in the claims, the specification and the drawings of the present application, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the specification and claims of the present application indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections.
[0065] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in this application specification and claims, unless the context clearly indicates otherwise, the singular forms of "a", "an" and "the" are intended to include plural forms. It should also be further understood that the term "and / or" used in this application specification and claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0066] Although the implementation methods of the present application are as above, the contents described are only examples adopted to facilitate the understanding of the present application, and are not intended to limit the scope and application scenarios of the present application. Any technician in the technical field described in the present application can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present application, but the scope of patent protection of the present application shall still be subject to the scope defined in the attached claims.
Claims
1. A method for background subtraction of spectral data, comprising: Collecting raw spectral data based on laser induced breakdown spectroscopy, including: placing an alloy sample in the middle of a sample stage and adjusting the position of a lifting motor so that a laser is focused on the alloy sample and strikes the alloy sample, so as to excite plasma to obtain spectral signals to detect all elements, and striking the sample with the laser multiple times by changing different striking points; and transmitting the received spectral signal to a spectrometer through an optical fiber via a probe to collect raw spectral data of the alloy sample, wherein the raw spectral data includes multiple channels; Performing principal component analysis on the original spectral data to divide the original spectral data into a first principal component and a second principal component; Determining spectral data deviating from a preset value based on a Mahalanobis distance between spectral data in the first principal component and spectral data in the second principal component; Eliminating the spectral data deviating from the preset value from the original spectral data, so as to perform initial spectral subtraction on the original spectral data; Calculate the average value of the spectral data after the initial spectrum is deducted to obtain the target spectral data; Adaptively searching the target spectral data for peaks to determine the peak widths of different peak regions in each of the channels; Calculating the average peak width based on the peak widths of different peak regions in each of the channels; Determining a target spectral value using adaptive step approximation based on the average peak width and the peak widths of different peak regions in each of the channels; and The target spectrum value is subtracted from the original spectrum data to achieve background subtraction of the spectrum data.
2. The method according to claim 1, wherein the step of adaptively searching the target spectral data for peaks to determine the peak widths of different peak regions in each of the channels comprises: Performing adaptive peak searching on the raw spectral data to obtain an initial peak width of each channel; determining a target iteration parameter related to peak width based on an initial peak width of each of the channels; as well as The peak width of different peak regions in each of the channels in each iteration is calculated according to the target iteration parameters.
3. The method according to claim 2, wherein determining the target spectrum value by using adaptive step approximation based on the average peak width and the peak width of different peak regions in each of the channels comprises: Compare the size relationship between the average peak width in the corresponding iteration number and the peak width of different peak areas in each channel; Based on the comparison results, the spectral value of each channel in the corresponding iteration number is calculated using adaptive step approximation; Calculate the background spectrum in the corresponding iteration number based on the spectrum value of each channel in the corresponding iteration number; as well as The target spectrum value is determined according to the difference between the background spectrum in the corresponding iteration number and the background spectrum in the previous iteration.
4. The method according to claim 3, wherein based on the comparison result, calculating the spectrum value of each channel in the corresponding number of iterations using adaptive step approximation comprises: The spectral value of each channel in the corresponding iteration number is calculated by the following formula: in, represents the spectral value of each channel in the corresponding iteration number, p represents the average peak width, r i Represents the peak width of different peak areas in each channel of the current iteration, i represents the number of channels, and n represents the number of iterations.
5. The method according to claim 4, wherein calculating the background spectrum in the corresponding iteration number based on the spectrum value of each channel in the corresponding iteration number comprises: Calculate the total value of the first spectrum of all channels in the corresponding iteration number and the total value of the second spectrum of all channels in the previous iteration respectively; as well as A weighted sum is performed on the first spectrum total value and the second spectrum total value to determine a background spectrum in a corresponding number of iterations.
6. The method according to claim 5, wherein determining the target spectrum value according to the difference between the background spectrum in the corresponding iteration number and the background spectrum in the previous iteration comprises: In response to the difference between the background spectrum in the corresponding iteration number and the background spectrum in the previous iteration being less than or equal to a preset threshold, determining the spectrum value of each channel in the corresponding iteration number as the target spectrum value; or In response to the difference between the background spectrum in the corresponding iteration number and the background spectrum of the previous iteration being greater than a preset threshold, the spectral value and the background spectrum of each channel continue to be iterated until the difference between the background spectrum in the corresponding iteration number and the background spectrum of the previous iteration is less than or equal to the preset threshold, and the spectral value of each channel in the corresponding iteration number is determined as the target spectral value.
7. A system for background subtraction of spectral data, comprising: The acquisition unit is used to acquire original spectral data based on laser induced breakdown spectroscopy, including: placing the alloy sample in the middle of the sample stage and adjusting the position of the lifting motor so that the laser is focused on the alloy sample and hits the alloy sample to excite plasma to obtain spectral signals to detect all elements, and by changing different hitting points, using the laser to hit multiple times; and transmitting the received spectral signal to the spectrometer through the optical fiber through the probe to acquire the original spectral data of the alloy sample, wherein the original spectral data includes multiple channels; A data processing unit for: Performing principal component analysis on the original spectral data to divide the original spectral data into a first principal component and a second principal component; Determining spectral data deviating from a preset value based on a Mahalanobis distance between spectral data in the first principal component and spectral data in the second principal component; Eliminating the spectral data deviating from the preset value from the original spectral data, so as to perform initial spectral subtraction on the original spectral data; Calculate the average value of the spectral data after the initial spectrum is deducted to obtain the target spectral data; Adaptively searching the target spectral data for peaks to determine the peak widths of different peak regions in each of the channels; Calculating the average peak width based on the peak widths of different peak regions in each of the channels; Determining a target spectral value of each of the channels using adaptive step approximation based on the average peak width and the peak widths of different peak regions in each of the channels; and The background subtraction unit is used to subtract the target spectrum value of each channel from the original spectrum data to achieve background subtraction of the spectrum data.
8. A device for background subtraction of spectral data, comprising: processor; as well as A memory storing program instructions for performing background subtraction on spectral data, wherein when the program instructions are executed by the processor, the device implements the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having stored thereon computer-readable instructions for performing background subtraction on spectral data, wherein when the computer-readable instructions are executed by one or more processors, the method according to any one of claims 1 to 6 is implemented.