Geological sample detection data dynamic correction method and system
By adjusting the variable window width and fitting formula processing for dynamic correction of detection data, the problems of complex algorithms and high resource consumption in the correction process of geological sample detection data in the existing technology are solved, and efficient and accurate detection data correction is achieved.
Patent Information
- Application Number
- CN202510937154.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-08
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2045-07-08
AI Technical Summary
In existing technologies, the algorithm for correcting geological sample testing data involves many input variables, complex procedures, and consumes a lot of computing resources, which affects the accuracy of the testing results.
By adjusting the detection data to dynamically correct the width of the variable window, the signal-to-noise ratio is used to initialize the window width, and the fitting formula is used to fit and denoise the eigenvalues, the input variables are reduced, the correction efficiency is improved, and overfitting is avoided.
It simplifies the calibration method, reduces the computational resource requirements, improves the accuracy and efficiency of the detection data, and is suitable for the detection of geological samples with multiple peak points.
Smart Images

Figure CN120847154A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of element measurement technology, and in particular relates to a method and system for dynamic correction of geological sample detection data. Background Technology
[0002] XRF (X-Ray Fluorescence Spectrometer) can be used to detect the types of metals contained in geological samples. However, the mineral composition and structure of geological samples are complex, and the elemental interactions between different mineral phases can cause XRF fluorescence to deviate from linearity, thus affecting the accuracy of the detection results. In addition, factors such as the aging and zero drift of the XRF instrument itself and electromagnetic noise in the detection environment are also important factors affecting the accuracy of the detection results. Therefore, it is necessary to perform dynamic correction of the detection data.
[0003] Commonly used dynamic calibration methods include the empirical coefficient method (calibrating by establishing mathematical relationships between elements), the internal standard method (introducing internal standard elements for calibration), and the mathematical model calibration method (achieving data calibration by establishing complex mathematical models and adjusting the mathematical model parameters based on experimental data). Among these, the mathematical model calibration method has the highest calibration accuracy and has become the mainstream data calibration method. For example, the paper "Deep learning assisted XRF spectraclassification" uses a mathematical model for data calibration through steps such as spectral data preprocessing, real-time data calibration optimization, and outlier data processing. The real-time data calibration optimization step relies on an LSTM network model to predict instrument state drift trends and adjust calibration parameters in advance, while the outlier data processing step requires an isolated forest algorithm model to automatically identify and remove abnormal spectra. However, the mathematical model calibration method usually requires the establishment of complex mathematical models in conjunction with AI algorithms. The algorithm has many input variables, complex corresponding programs, and requires a large amount of computing resources. Summary of the Invention
[0004] To address the aforementioned problems in the existing technology, this invention proposes a dynamic correction method and system for geological sample testing data, which solves the problems of numerous input variables, complex algorithm programs, and excessive computational resources in the testing data correction process of the existing technology.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: a method for dynamic correction of geological sample detection data, comprising the following steps: Step S1: using a handheld XRF analyzer to detect the geological sample to be tested, obtaining initial energy spectrum detection data of the geological sample to be tested, wherein the initial energy spectrum detection data is energy-count data; Step S2: initializing the width of the dynamic correction variable window of the detection data according to the signal-to-noise ratio of the initial energy spectrum detection data; Step S3: dividing the area corresponding to the width of the dynamic correction variable window of the detection data into N sub-regions, and calculating the feature values of the detection data of each sub-region in the N sub-regions; Step S4: fitting the above feature values to obtain a feature value fitting curve, performing feature value denoising according to the feature value fitting curve, and storing the denoised feature values; Step S5: adjusting the width of the dynamic correction variable window of the detection data, and repeating steps S3-S4; Step S6: stopping the adjustment of the width of the dynamic correction variable window of the detection data when the repetition stop condition is met, and performing the final correction of the detection data of the geological sample to be tested based on the stored denoised feature values.
[0006] Furthermore, in step S2, the dynamic correction variable window width of the detection data is initialized based on the signal-to-noise ratio of the initial energy spectrum detection data. Specifically, when the signal-to-noise ratio of the initial energy spectrum detection data is greater than or equal to the signal-to-noise ratio threshold, the width of the dynamic correction variable window of the detection data is initialized to a first width, and when the signal-to-noise ratio of the initial energy spectrum detection data is less than the signal-to-noise ratio threshold, the dynamic correction variable window of the detection data is initialized to a second width, wherein the first width is greater than the second width.
[0007] Further, in step S3, the feature value of the detection data of each sub-region is calculated. Specifically, the mean of the count data in the sub-region is calculated, and the data whose count value is closest to the mean in the initial energy spectrum detection data is used as the feature value.
[0008] Furthermore, in step S4, the feature values are fitted according to the following fitting formula:
[0009] y = a0 + a1×x + a2×x 2 +a3×x 3 +a4×x 4 ;
[0010] Where y represents the dependent variable of the eigenvalue fitting curve, x represents the independent variable of the fitting curve, and a0, a1, a2, a3, and a4 represent the fitting coefficients, respectively. Eigenvalue denoising is performed based on the eigenvalue fitting curve. Specifically, the Euclidean distance between the eigenvalues in the sub-region and the eigenvalue fitting curve is calculated, and eigenvalues with an Euclidean distance greater than a preset distance threshold are discarded. The remaining eigenvalues are stored as denoised eigenvalues.
[0011] Further, step S5 adjusts the width of the dynamic correction variable window for the detection data, specifically including: Step S51: Count the number of feature values whose Euclidean distance is greater than a preset distance threshold in step S4. When the number is greater than or equal to a first quantity threshold, execute step S52; otherwise, execute step S53; Step S52: Adjust the width of the current dynamic correction variable window for the detection data to the current width plus a preset step width; Step S53: Adjust the width of the current dynamic correction variable window for the detection data to the current width minus the preset step width.
[0012] Furthermore, in step S5, the repetition stop condition is that the number of adjustments is equal to the preset number of adjustments or the width of the dynamic correction variable window of the adjusted detection data is less than or equal to the lower limit or greater than or equal to the upper limit.
[0013] Furthermore, in step S6, the final detection data correction of the geological sample to be tested is performed based on the stored denoised feature values. Specifically, the stored denoised feature values are fitted using a fitting formula to obtain the corrected data, and then the corrected data is subtracted from the initial energy spectrum detection data to complete the final detection data correction of the geological sample to be tested.
[0014] This invention also proposes a dynamic correction system for geological sample testing data, used to execute the aforementioned dynamic correction method for geological sample testing data. The system includes a data acquisition unit, a window width adjustment unit, and a testing data correction unit. The data acquisition unit is connected to the window width adjustment unit, and the window width adjustment unit is connected to the testing data correction unit. The data acquisition unit is used to acquire energy dispersive spectroscopy (EDS) data of the geological sample to be tested. The window width adjustment unit is used to adjust the variable window width for dynamic correction of the testing data. The testing data correction unit is used to perform dynamic correction of the geological sample testing data.
[0015] The beneficial technical effects of this invention compared with the prior art are as follows: (1) After obtaining the initial energy spectrum detection data of the geological sample to be tested, this invention only needs to adjust the width of the dynamic correction variable window of the detection data as the input data for iteration, which reduces the input variables of the correction method or correction algorithm; (2) The width of the dynamic correction variable window of the detection data is initialized by the signal-to-noise ratio of the initial energy spectrum detection data of the geological sample to be tested, matching the data correction and data contamination degree, and improving the correction efficiency; (3) The feature value is fitted by the fitting formula, which is suitable for the dynamic correction method of geological sample detection data with multiple peak points, and is not prone to overfitting problems. Attached Figure Description
[0016] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.
[0017] Figure 1 This is a flowchart of a dynamic correction method for geological sample testing data according to the present invention;
[0018] Figure 2 This is a flowchart illustrating the dynamic correction of the variable window width by adjusting the detection data in this invention. Detailed Implementation
[0019] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0020] The concepts involved in this application will first be described with reference to the accompanying drawings. It should be noted that the following descriptions of various concepts are only for the purpose of making the content of this application easier to understand and do not constitute a limitation on the scope of protection of this application; furthermore, the embodiments and features in the embodiments of this application can be combined with each other unless otherwise specified. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0021] Refer to the instruction manual. Figure 1A dynamic correction method for geological sample detection data includes the following steps: Step S1: Non-destructive detection and analysis of the geological sample to be tested is performed using a handheld XRF with a graphene window detector. The geological sample to be tested is irradiated with the excitation source of the XRF, and then the initial energy spectrum detection data of the geological sample to be tested is obtained using the XRF detection system. The initial energy spectrum detection data is energy-count data, that is, data with energy (keV) as the horizontal axis and count as the vertical axis; Step S2: The width of the dynamic correction variable window for detection data is initialized according to the signal-to-noise ratio (signal to noise ratio) of the initial energy spectrum detection data. The above signal-to-noise ratio can be detected by professional detection tools or by using the ratio of the net peak intensity to the background noise of the initial energy spectrum detection data; The width of the dynamic correction variable window for detection data is initialized as follows: when the signal-to-noise ratio of the initial energy spectrum detection data is greater than or equal to the signal-to-noise ratio threshold, the width of the dynamic correction variable window for detection data is initialized as a first width; when the signal-to-noise ratio of the initial energy spectrum detection data is less than the signal-to-noise ratio threshold, the width of the dynamic correction variable window for detection data is initialized as a second width, and the first width is greater than the second width. It is understandable that the above signal-to-noise ratio threshold can be flexibly set by the testing personnel. In addition, the wider the width of the dynamic correction variable window for the test data, the larger the amount of horizontal axis data initially covered; the narrower the width of the dynamic correction variable window for the test data, the smaller the amount of horizontal axis data initially covered.
[0022] Step S3: Divide the area corresponding to the width of the dynamic correction variable window of the detection data into N sub-regions (that is, divide the horizontal axis into N equal parts within the window width range; in this invention, N is preferably set to 10), and calculate the feature value of the detection data in each of the N sub-regions; specifically, calculate the mean of the count data in the sub-region, find the data in the initial energy spectrum detection data that is closest to the mean, and use it as the feature value (when two or more count values are closest to the mean, one of them can be randomly selected as the feature value).
[0023] Step S4: Fit the above feature values to obtain a feature value fitting curve, such that the feature value fitting curve covers or approximates all feature value data points as much as possible. Then, perform feature value denoising based on the feature value fitting curve and store the denoised feature values. In step S4, the feature values are specifically fitted according to the following fitting formula:
[0024] y = a0 + a1×x + a2×x 2 +a3×x 3 +a4×x 4 ;
[0025] Where y represents the dependent variable of the eigenvalue fitting curve, x represents the independent variable of the fitting curve, and a0, a1, a2, a3, and a4 represent the fitting coefficients, respectively. Eigenvalue denoising is performed based on the eigenvalue fitting curve. Specifically, the Euclidean distance between the eigenvalues within the sub-region and the eigenvalue fitting curve is calculated. Euclidean distances greater than a preset distance threshold are discarded, and the remaining eigenvalues are stored as denoised eigenvalues. Euclidean distance effectively reflects the straight-line distance between data points and the fitting curve in two-dimensional space. Furthermore, its calculation method is simple, which is beneficial for identifying eigenvalues that deviate excessively from the fitting curve and are located above it (these eigenvalues are usually abnormal eigenvalues caused by noise, etc.), and discarding these eigenvalues.
[0026] Step S5: Adjust the width of the dynamic correction variable window for the detection data, and repeat steps S3-S4; further refer to the appendix of the instruction manual. Figure 2 Step S5 adjusts the width of the dynamic correction variable window for the detection data, specifically including: Step S51: Count the number of feature values whose Euclidean distance is greater than a preset distance threshold in step S4. If the number is greater than or equal to a first quantity threshold, proceed to step S52; otherwise, proceed to step S53; Step S52: Adjust the width of the current dynamic correction variable window for the detection data to the current width plus a preset step width; Step S53: Adjust the width of the current dynamic correction variable window for the detection data to the current width minus the preset step width.
[0027] In step S5, the repetition stops when the number of adjustments equals the preset number of adjustments, or when the width of the dynamic correction variable window for the adjusted detection data is less than or equal to the lower limit or greater than or equal to the upper limit. Setting the preset number of adjustments is to further balance the conflict between computing resources and data correction, while setting the upper and lower limits of the width is to facilitate the convergence of the dynamic correction method for detection data and avoid getting stuck in an infinite adjustment loop.
[0028] Step S6: Once the repetition stop condition is met, stop adjusting the variable window width for dynamic correction of the detection data, and perform final correction of the detection data for the geological sample based on the stored denoised feature values. Specifically, the stored denoised feature values are fitted using a fitting formula to obtain corrected data, which is then subtracted from the initial energy spectrum detection data to complete the final correction of the detection data for the geological sample. It is understandable that the corrected data obtained by fitting the stored denoised feature values contains abnormal data caused by environmental noise or instrument zero drift. Removing these abnormal data from the initial energy spectrum detection data ensures that the geological sample detection data is not excessively interfered with by the instrument itself or the external environment, thereby improving the accuracy of the detection.
[0029] This invention also proposes a dynamic correction system for geological sample testing data, used to execute the aforementioned dynamic correction method for geological sample testing data. The system includes a data acquisition unit, a window width adjustment unit, and a testing data correction unit. The data acquisition unit is connected to the window width adjustment unit, which in turn is connected to the testing data correction unit. The data acquisition unit acquires the energy dispersive spectroscopy (EDS) data of the geological sample to be tested. The window width adjustment unit adjusts the variable window width for dynamic correction of the testing data. The testing data correction unit performs dynamic correction of the geological sample testing data. This invention can correct the testing data of 34 standard elements, including Mg, Al, Si, P, S, Ti, V, Cr, Mn, Fe, Co, Ni, Cu, Zn, Se, Zr, Nb, Mo, Rh, Pd, Ag, Cd, Sn, Sb, Hf, Ta, W, Re, Pb, Bi, In, Ge, Ga, and Te. It is applicable to multiple technical fields such as security, pollution control, and soil remediation, and has a wide range of applications.
[0030] The embodiments and / or implementation methods described above are merely preferred embodiments and / or implementation methods for implementing the technology of the present invention, and are not intended to limit the implementation methods of the technology of the present invention in any way. Any person skilled in the art can make some modifications or alterations to other equivalent embodiments without departing from the scope of the technical means disclosed in the content of the present invention, but they should still be regarded as the technology or embodiments that are substantially the same as the present invention.
[0031] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. The above descriptions are only preferred embodiments of this application. It should be noted that due to the limitations of written expression, while there are objectively infinite specific structures, those skilled in the art can make several improvements, modifications, or changes without departing from the principles of this application, and can also combine the above technical features in an appropriate manner. These improvements, modifications, changes, or combinations, or the direct application of the inventive concept and technical solution to other situations without modification, should all be considered within the scope of protection of this application.
Claims
1. A method for dynamic correction of geological sample test data, characterized in that, The steps include: Step S1: Use a handheld XRF analyzer to test the geological sample to obtain the initial energy spectrum detection data of the geological sample. The initial energy spectrum detection data is energy-count data. Step S2: Based on the signal-to-noise ratio of the initial energy spectrum detection data, initialize the width of the dynamic correction variable window for the detection data; Step S3: Divide the area corresponding to the width of the dynamic correction variable window of the detection data into N sub-regions, and calculate the feature value of the detection data in each of the N sub-regions; Step S4: Fit the above feature values to obtain the feature value fitting curve, perform feature value denoising based on the feature value fitting curve, and store the denoised feature values; Step S5: Adjust the width of the variable window for dynamic correction of detection data, and repeat steps S3-S4; Step S6: When the repeated execution stop condition is met, stop the adjustment of the variable window width for dynamic correction of detection data, and perform the final detection data correction of the geological sample to be tested based on the stored denoised feature values.
2. The method for dynamic correction of geological sample test data according to claim 1, characterized in that, In step S2, the dynamic correction variable window width of the detection data is initialized based on the signal-to-noise ratio of the initial energy spectrum detection data. Specifically, when the signal-to-noise ratio of the initial energy spectrum detection data is greater than or equal to the signal-to-noise ratio threshold, the width of the dynamic correction variable window of the detection data is initialized to a first width. When the signal-to-noise ratio of the initial energy spectrum detection data is less than the signal-to-noise ratio threshold, the dynamic correction variable window of the detection data is initialized to a second width, wherein the first width is greater than the second width.
3. The method for dynamic correction of geological sample test data according to claim 1, characterized in that, In step S3, the feature value of the detection data in each sub-region is calculated. Specifically, the mean of the count data in the sub-region is calculated, and the data whose count value is closest to the mean in the initial energy spectrum detection data is used as the feature value.
4. The method for dynamic correction of geological sample test data according to claim 3, characterized in that, In step S4, the feature values are fitted according to the following fitting formula: y=a0+a1×x+a2×x 2 +a3×x 3 +a4×x 4 ; Where y represents the dependent variable of the eigenvalue fitting curve, x represents the independent variable of the fitting curve, and a0, a1, a2, a3, and a4 represent the fitting coefficients, respectively; the eigenvalue denoising based on the eigenvalue fitting curve specifically involves calculating the Euclidean distance between the eigenvalues in the sub-region and the eigenvalue fitting curve, discarding eigenvalues whose Euclidean distance is greater than a preset distance threshold, and storing the remaining eigenvalues as denoised eigenvalues.
5. The method for dynamic correction of geological sample test data according to claim 4, characterized in that, The step S5, adjusting the width of the dynamic correction variable window for the detection data, specifically includes: Step S51: Count the number of feature values whose Euclidean distance is greater than a preset distance threshold in step S4. If the number is greater than or equal to a first number threshold, proceed to step S52; otherwise, proceed to step S53. Step S52: Adjust the width of the current detection data dynamic correction variable window to the current width plus the preset step width; Step S53: Adjust the width of the current detection data dynamic correction variable window to the current width minus the preset step width.
6. The method for dynamic correction of geological sample test data according to claim 5, characterized in that, In step S5, the condition for stopping repeated execution is that the number of adjustments equals the preset number of adjustments or the width of the dynamic correction variable window of the adjusted detection data is less than or equal to the lower limit or greater than or equal to the upper limit.
7. The method for dynamic correction of geological sample test data according to claim 4, characterized in that, In step S6, the final detection data correction of the geological sample to be tested is performed based on the stored denoised feature values. Specifically, the denoised feature values are fitted using the fitting formula to obtain the corrected data, and then the corrected data is subtracted from the initial energy spectrum detection data to complete the final detection data correction of the geological sample to be tested.
8. A dynamic correction system for geological sample testing data, used to execute the dynamic correction method for geological sample testing data as described in any one of claims 1-7, comprising a data acquisition unit, a window width adjustment unit, and a testing data correction unit, wherein the data acquisition unit is connected to the window width adjustment unit, and the window width adjustment unit is connected to the testing data correction unit, characterized in that, The data acquisition unit is used to obtain energy dispersive spectroscopy (EDS) data of the geological sample to be tested. The window width adjustment unit is used to adjust the variable window width for dynamic correction of the detection data. The detection data correction unit is used to perform dynamic correction of the geological sample detection data.
Citation Information
Patent Citations
Raman spectrum peak identification method based on dual-scale correlation operation
CN114166814A
Edible oil detection method based on moving window algorithm and particle swarm grey wolf optimization algorithm
CN116125011A
Rapid traceability method and system for underground water pollution
CN117668685A
Spectral analysis method, sample component analysis method and device, equipment and medium
CN118169110A
Raman spectrum baseline piecewise polynomial fitting method based on sliding window
CN118245732A