Adaptive baseline calibration method and system for icp emission spectroscopy of water body metal detection

CN122330091BActive Publication Date: 2026-10-27DONGGUAN NORWAY TESTING CERTIFICATION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610643770.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-05-11
Publication Date
2026-10-27
Estimated Expiration
2046-05-11

AI Technical Summary

Technical Problem

[0004]本申请提供水体金属检测的ICP发射光谱自适应基线校准方法及系统,旨在解决上述背景技术中提到的现有技术存在的问题或问题之一

Benefits of technology

(1)通过构建基于微分熵演化规律的轻量化动态判识机制,有效克服了传统基线校准方法对经验阈值设定、外部参比信号或历史漂移对照表的高度依赖问题,在无须引入多模态传感融合、物理参比注入或多通道同步采集的前提下,实现了对光谱基线漂移状态的高灵敏度自主感知。该机制从原始光谱信号的一阶微分序列出发,结合滑动子窗内的概率分布建模与香农熵计算,精准捕捉信号局部复杂度的时序变化特征,进而生成具备物理可解释性的微分熵时间序列;通过对该序列提取均值、标准差及斜率变化率构成三维熵流状态向量,显著增强了系统对缓慢趋势性漂移与突发噪声干扰之间的区分能力,避免了因单一指标误判导致的频繁重校准或漏检问题,从而在保障校准可靠性的同时大幅降低虚警率和误调风险。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122330091B_ABST
    Figure CN122330091B_ABST
Patent Text Reader

Abstract

The present application relates to the ICP emission spectrum adaptive baseline calibration method and system of water body metal detection, aims at improving the adaptive calibration ability of baseline drift in the continuous scanning period of inductively coupled plasma emission spectrometer. Through point-by-point differentiation and noise suppression of the original spectrum intensity sequence, the standardized differential spectrum sequence is generated and the Shannon entropy is divided into sub-windows to calculate the differential entropy time sequence reflecting the local chaos degree, the mean, standard deviation and slope change rate are extracted to form a three-dimensional entropy flow state vector, and the spectrum signal anomaly detection and baseline fitting parameter freezing are realized by combining the incremental update isolated forest algorithm. Then, the limited step gradient descent fine tuning is carried out in the local window, the dynamic calibration parameter group is generated and the baseline compensation is completed. The method effectively suppresses the baseline drift and parameter oscillation caused by environmental and sample changes, improves the stability of the spectrum calibration data, and provides a reliable data basis for subsequent metal characteristic peak detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automatic calibration and environmental adaptability testing technology for spectrometers, and in particular to an adaptive baseline calibration method and system for ICP emission spectra in water metal detection. Background Technology

[0002] In the detection of trace metals in water, to overcome baseline drift interference caused by sample complexity and dynamic environmental disturbances, existing ICP emission spectroscopy analysis systems generally employ automatic baseline calibration methods to improve analytical accuracy. Current mainstream technical solutions include: baseline removal based on moving average or polynomial fitting; introducing physical external reference channels for differential correction; constructing endmember dictionaries and historical drift templates for auxiliary identification; utilizing temperature-controlled stable zone segmentation or preprocessing of the sampling front-end waveform; and combining morphological filtering / wavelet transform component extraction, among other calibration and compensation techniques. The development trends of these methods are prominently reflected in the introduction of intelligent discrimination indicators, the expansion of parameter adaptive fitting windows, improved low-power embedded real-time deployment capabilities, and enhanced accuracy of multi-source information fusion.

[0003] Existing methods generally suffer from the following major limitations: First, they have limited ability to identify drift trends. Traditional methods often use static thresholds / intervals for judgment, which are difficult to deal with periodic or sudden drift behaviors caused by time-varying noise and abnormal disturbances, resulting in frequent baseline compensation lag or overcorrection. Second, they have weak model adaptability. Schemes that rely on endmember dictionaries and historical drift comparisons often fail to identify drifts when faced with unknown types of water samples or extreme environmental changes due to library mismatch or data sparsity, and cannot guarantee the continuous consistency of self-calibration results. Third, they lack lightweight automated solutions for online real-time scenarios. Complex signal processing or deep learning methods are highly dependent on computational resources, resulting in most of them being used in laboratory environments or offline batch data analysis, and are difficult to directly transfer to field rapid detection instruments. Summary of the Invention

[0004] This application provides an adaptive baseline calibration method and system for ICP emission spectrum in water metal detection, which aims to solve one of the problems or issues of the prior art mentioned in the background.

[0005] The adaptive baseline calibration method for ICP emission spectra in water metal detection provided in this application specifically includes: S1: Obtain the original spectral intensity sequence output by the inductively coupled plasma atomic emission spectrometer in the continuous scanning cycle under the scenario of metal detection in water, and perform point-by-point first-order differential operation on the original spectral intensity sequence to generate a differential spectral sequence characterizing the instantaneous rate of change of the spectral signal.

[0006] S2: Divide the differential spectral sequence into several non-overlapping sliding sub-windows with a fixed length, normalize the data in each non-overlapping sliding sub-window and construct a probability distribution histogram to calculate the sub-window Shannon entropy value that characterizes the local signal disorder.

[0007] S3: Construct a differential entropy time series based on the continuous Shannon entropy values ​​of the sub-windows, and perform sliding window statistical analysis on the differential entropy time series to extract three features: mean, standard deviation, and slope change rate, thereby synthesizing a three-dimensional entropy flow state vector that characterizes the dynamic evolution trend of baseline drift.

[0008] S4: Initialize the isolated forest algorithm with a small number of initial drift-free samples to form an online anomaly detector, and input the three-dimensional entropy flow state vector into the online anomaly detector to determine in real time whether the current spectral signal has experienced an entropy flow mutation event that exceeds the stability boundary.

[0009] S5: If the online anomaly detector determines that the entropy flow mutation event has occurred, it immediately triggers the parameter freezing action, locks the best baseline fitting parameter set obtained through multiple rounds of iterative optimization in the previous stable period as the current calibration benchmark, and generates a frozen baseline fitting parameter set and parameter freezing mark.

[0010] S6: Based on the frozen baseline fitting parameter set as initial values, perform a fast gradient descent fine-tuning operation with a limited step size within a local window composed of the most recent several frames of spectral data to generate a dynamic calibration parameter set that can respond to the real drift trend and suppress parameter oscillations.

[0011] S7: Perform baseline compensation calculation on the original spectral intensity sequence using the dynamic calibration parameter set to output calibrated spectral data that eliminates baseline drift interference.

[0012] S8: Synchronously write the three-dimensional entropy flow state vector and the parameter freeze flag that identifies the parameter freeze action into the operation log to form a historical drift state record.

[0013] This application also provides an ICP emission spectrum adaptive baseline calibration system for water metal detection, characterized in that the original spectral intensity sequence is baseline calibrated using an ICP emission spectrum adaptive baseline calibration method for water metal detection.

[0014] The adaptive baseline calibration method and system for ICP emission spectrum in water metal detection provided in this application have the following advantages: (1) By constructing a lightweight dynamic identification mechanism based on the evolution law of differential entropy, the traditional baseline calibration method is effectively overcome by overcoming the high dependence on empirical threshold setting, external reference signal or historical drift comparison table. Without the need to introduce multimodal sensor fusion, physical reference injection or multi-channel synchronous acquisition, it realizes highly sensitive autonomous perception of the spectral baseline drift state. Starting from the first-order differential sequence of the original spectral signal, the mechanism combines probability distribution modeling within the sliding sub-window with Shannon entropy calculation to accurately capture the temporal change characteristics of the signal's local complexity, thereby generating a differential entropy time series with physical interpretability. By extracting the mean, standard deviation and slope change rate of the sequence to form a three-dimensional entropy flow state vector, the system's ability to distinguish between slow trend drift and sudden noise interference is significantly enhanced, avoiding frequent recalibration or missed detection caused by misjudgment of a single index. Thus, while ensuring calibration reliability, the false alarm rate and misadjustment risk are greatly reduced.

[0015] (2) The incremental isolated forest online anomaly detector adopted has low resource consumption and continuous learning capabilities. It only requires a small number of initial drift-free samples to complete the initialization and can dynamically update its internal structure during operation to adapt to long-term environmental changes without manual intervention or periodic retraining. This solves the technical bottleneck of poor adaptability and weak generalization ability of traditional static models when facing complex field conditions. When a sudden change in entropy flow state is detected, the system triggers the "parameter freeze-local fine-tuning" collaborative strategy: on the one hand, it locks the best baseline fitting parameters obtained by fully optimization in the previous stable period as the benchmark to prevent parameter oscillation caused by instantaneous noise; on the other hand, it starts the fast gradient descent retraining mechanism with limited step size to achieve agile response to the real drift trend within a small data window, taking into account both calibration stability and dynamic adaptability. This two-stage mechanism effectively avoids the high computational overhead caused by full parameter retraining and also avoids the accumulation of lag errors in the fixed parameter mode, significantly improving the baseline tracking accuracy and timeliness. It is especially suitable for field water quality monitoring tasks with limited resources but high real-time requirements in embedded deployment environments.

[0016] (3) The overall technical path completely departs from the high-complexity algorithm frameworks such as wavelet decomposition, morphological filtering, endmember dictionary matching, and deep neural networks. It does not rely on temperature control compensation modeling or multi-sensor data fusion, and has the advantages of simple structure, high computational efficiency, and easy engineering implementation. It can run stably in low-power edge devices. At the same time, the system synchronously records the entropy flow state vector and parameter freeze marker in each calibration process to the operation log, providing reliable data support for subsequent cloud-based quality traceability, fault diagnosis, and federated model iteration, forming a closed-loop feedback system from local real-time calibration to remote intelligent optimization. This design not only improves the autonomous operation and maintenance capability and long-term operational robustness of the ICP spectral analysis system, but also provides key technical support for the development of high-precision, low-maintenance, and sustainably evolving intelligent detection equipment in the online monitoring of heavy metals in water. It is particularly suitable for application environments that require long-term unattended monitoring, such as water areas around campuses and drainage outlets in industrial parks, and achieves synergistic optimization of detection result accuracy, system response sensitivity, and deployment economy.

[0017] In summary, this solution, by deeply integrating information entropy theory and lightweight machine learning, constructs an intelligent baseline calibration system with self-sensing, self-decision-making, and self-adaptive capabilities. Without requiring additional hardware investment or complex parameter tuning, it achieves efficient, stable, and low-latency dynamic correction of ICP emission spectrum baseline drift, which is significantly better than traditional methods that rely on prior knowledge or external assistance. It has good scalability and industrialization prospects. Attached Figure Description

[0018] Figure 1 This is the main flowchart of the ICP emission spectrum adaptive baseline calibration method for water metal detection.

[0019] Figure 2 This is a sub-flowchart of the ICP emission spectrum adaptive baseline calibration method for metal detection in water.

[0020] Figure 3 This is another sub-flowchart of the ICP emission spectrum adaptive baseline calibration method for water metal detection. Detailed Implementation

[0021] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0022] The following disclosure provides many different embodiments or examples for implementing different structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. Of course, these are merely examples and are not intended to limit the invention. Furthermore, reference numerals and / or letters may be repeated in different examples; such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0023] like Figure 1 As shown, this application provides an adaptive baseline calibration method for ICP emission spectra in water metal detection, specifically including: S1: Obtain the original spectral intensity sequence output by the inductively coupled plasma atomic emission spectrometer in the continuous scanning cycle under the scenario of metal detection in water, and perform point-by-point first-order differential operation on the original spectral intensity sequence to generate a differential spectral sequence characterizing the instantaneous rate of change of the spectral signal.

[0024] S2: Divide the differential spectral sequence into several non-overlapping sliding sub-windows with a fixed length, normalize the data in each non-overlapping sliding sub-window and construct a probability distribution histogram to calculate the sub-window Shannon entropy value that characterizes the local signal disorder.

[0025] S3: Construct a differential entropy time series based on the continuous Shannon entropy values ​​of the sub-windows, and perform sliding window statistical analysis on the differential entropy time series to extract three features: mean, standard deviation, and slope change rate, thereby synthesizing a three-dimensional entropy flow state vector that characterizes the dynamic evolution trend of baseline drift.

[0026] S4: Initialize the isolated forest algorithm with a small number of initial drift-free samples to form an online anomaly detector, and input the three-dimensional entropy flow state vector into the online anomaly detector to determine in real time whether the current spectral signal has experienced an entropy flow mutation event that exceeds the stability boundary.

[0027] S5: If the online anomaly detector determines that the entropy flow mutation event has occurred, it immediately triggers the parameter freezing action, locks the best baseline fitting parameter set obtained through multiple rounds of iterative optimization in the previous stable period as the current calibration benchmark, and generates a frozen baseline fitting parameter set and parameter freezing mark.

[0028] S6: Based on the frozen baseline fitting parameter set as initial values, perform a fast gradient descent fine-tuning operation with a limited step size within a local window composed of the most recent several frames of spectral data to generate a dynamic calibration parameter set that can respond to the real drift trend and suppress parameter oscillations.

[0029] S7: Perform baseline compensation calculation on the original spectral intensity sequence using the dynamic calibration parameter set to output calibrated spectral data that eliminates baseline drift interference.

[0030] S8: Synchronously write the three-dimensional entropy flow state vector and the parameter freeze flag that identifies the parameter freeze action into the operation log to form a historical drift state record.

[0031] This application also provides an ICP emission spectrum adaptive baseline calibration system for water metal detection, characterized in that the original spectral intensity sequence is baseline calibrated using an ICP emission spectrum adaptive baseline calibration method for water metal detection.

[0032] Step S1: Obtain the original spectral intensity sequence output by the inductively coupled plasma atomic emission spectrometer (ICP-AES) within a continuous scanning period in a water metal detection scenario, and perform point-by-point first-order differential operations on the original spectral intensity sequence to generate a differential spectral sequence characterizing the instantaneous rate of change of the spectral signal. Specifically, this includes: S1.1: The original photoelectric signal output by the inductively coupled plasma atomic emission spectrometer in the continuous scanning cycle of the water metal detection scenario is subjected to analog-to-digital conversion and wavelength alignment processing to generate an original spectral intensity sequence with fixed wavelength intervals and quantized intensity values, which serves as the basic input data for subsequent differential operations.

[0033] The signal acquisition and access operation is performed on the raw photoelectric signal of the continuous scanning cycle output by the detector of the inductively coupled plasma atomic emission spectrometer in the scenario of metal detection in water, and the analog voltage value data stream arranged in time series is obtained.

[0034] The analog voltage data stream is sent to a high-precision analog-to-digital converter module, and analog-to-digital conversion is performed according to a preset sampling frequency and quantization bit width to generate a digitized spectral signal intensity sample sequence.

[0035] The digital spectral signal intensity sample sequence is processed by wavelength scale mapping, and the index value of each sampling point is converted into the corresponding physical wavelength position using the instrument’s built-in wavelength calibration table.

[0036] Based on the wavelength scale mapping results, wavelength alignment calculations are performed, and irregular sampling wavelength positions are corrected to a uniform fixed wavelength interval structure through interpolation algorithms, thereby achieving equidistant arrangement of wavelength points across the entire spectrum.

[0037] The intensity data of the wavelength-aligned digital spectral signal is quantized, and the intensity values ​​are mapped to a specified quantization level using a fixed bit format to form the original spectral intensity sequence that can be used for subsequent discrete difference calculations.

[0038] By using the analog-to-digital conversion and wavelength alignment methods described above, the analog photoelectric signal result from the previous step is transformed into a raw spectral intensity sequence with fixed wavelength intervals and quantized intensity values. This achieves standardization of the raw data in both the time and wavelength domains, providing a unified data input basis for subsequent differential operations.

[0039] For example, in a certain environmental monitoring water quality analysis system, the signal collected by the inductively coupled plasma atomic emission spectrometer (ICP-AES) detector is output within a 2-second scan period. The analog voltage signal ranges from 0 to 5 volts, the sampling frequency is set to 1000 Hz, the analog-to-digital conversion bit width is 16 bits, and the minimum intensity resolution corresponding to the quantization level is 0.01 units. The wavelength calibration table covers the 200 nm to 800 nm band. The wavelength position corresponding to the original sampling point has an error of ±0.05 nm. Cubic spline interpolation is used to align the wavelengths to a fixed interval of 0.1 nm per step. After alignment, the total number of data points is 6000. After quantization, the intensity values ​​are uniformly compressed to the integer range of 0 to 65535. In this configuration, the first point of the original spectral intensity sequence corresponds to a wavelength of 200.0 nm and a quantization intensity value of 11235, and the second point corresponds to a wavelength of 200.1 nm and a quantization intensity value of 11480. After reordering and quantization, the sequence meets the requirements of fixed wavelength interval and unified quantization standard. It has been verified that when performing discrete difference calculations on this sequence, the numerical stability of the instantaneous rate of change is significantly improved, the noise suppression effect is good, and the accuracy of baseline drift identification is greatly improved.

[0040] S1.2: Perform discrete difference calculation based on the intensity difference between adjacent wavelength points in the generated original spectral intensity sequence to obtain an initial differential intensity sequence that characterizes the local slope change of the spectral signal in the frequency domain, thereby initially extracting the instantaneous change characteristics of the signal.

[0041] The original spectral intensity sequence with fixed wavelength intervals and quantized intensity values ​​obtained by processing S1.1 is subjected to a pairing index scan of adjacent wavelength points in a two-dimensional vector space to determine the intensity value difference of each pair of adjacent wavelength points.

[0042] The intensity differences are arranged sequentially according to the wavelength dimension to form a difference dataset with a length equal to one less element than the original spectral intensity sequence.

[0043] Sign preservation and amplitude pass-through are performed on the generated difference dataset to ensure that the difference output retains both the direction and magnitude of change.

[0044] Threshold reduction is performed on extreme peak points in the differential dataset. A dynamic threshold determination mechanism that depends on the global mean and standard deviation of the original spectral signal is used to compress excessive amplitude values ​​to a specified limit range, so as to reduce the interference of local anomalies on subsequent instantaneous feature extraction.

[0045] Through the discrete difference calculation and amplitude limiting processing described above, the original spectral intensity sequence output by S1.1 is transformed into an initial differential intensity sequence that characterizes the local slope change of the spectral signal in the frequency domain, thus realizing the preliminary extraction of instantaneous change features.

[0046] S1.3: Apply moving average filtering to the obtained initial difference intensity sequence to suppress noise and generate a smoothed difference intensity sequence. This effectively removes the interference of high-frequency random noise on the calculation of instantaneous rate of change and ensures the stability of the differential result.

[0047] A sliding window of a preset number of samples is constructed to cover the entire sequence data sequentially for the initial difference intensity sequence obtained by discrete difference calculation, thereby realizing the segmented extraction of difference intensity values ​​within the window.

[0048] The arithmetic mean of the differential intensity values ​​is calculated within the sliding window. The sum of all differential intensity samples within the window is divided by the number of samples in the window to obtain the corresponding local average value, which is used as the central estimation index for noise suppression processing.

[0049] The local average value calculated by the window is assigned to the differential intensity point at the center of the window, and the window is moved sequentially to cover the next position, forming a smooth differential intensity sequence of the same length as the original initial differential intensity sequence.

[0050] The setting of the sliding window width is constrained by the spectral characteristics of the target signal and the system sampling rate, so that the window can contain enough periodic components of the signal while suppressing the influence of high-frequency random noise, thereby optimizing the stability of the instantaneous rate of change calculation.

[0051] By employing this moving average filtering method, the initial differential intensity sequence generated in the previous step is transformed into a smoothed differential intensity sequence, which effectively reduces high-frequency random noise interference and maintains the integrity of the instantaneous rate of change characteristics of the signal, forming a stable input for subsequent normalization scaling operations.

[0052] S1.4: Normalization scaling is performed using the smoothed differential intensity sequence and the system sampling time interval constant to generate a standardized differential spectral sequence, which maps the physical intensity change rate to a dimensionless instantaneous change rate index.

[0053] S1.5: Based on the generated standardized differential spectral sequence, perform zero-mean centering correction to output the final differential spectral sequence characterizing the instantaneous rate of change of the spectral signal, completely eliminate residual DC bias and establish the reference zero point for subsequent Shannon entropy calculation of sub-windows.

[0054] Step S2: Divide the differential spectral sequence into several non-overlapping sliding sub-windows of fixed length, normalize the data within each non-overlapping sliding sub-window, and construct a probability distribution histogram to calculate the Shannon entropy value of the sub-window, which characterizes the local signal disorder. Specifically, this includes: S2.1: Perform a fixed-length non-overlapping sliding segmentation operation on the differential spectral sequence that characterizes the instantaneous rate of change of the spectral signal to generate several non-overlapping sliding sub-windows with a unified data dimension, thereby discretizing the continuous time-series differential data into independent local analysis units.

[0055] The differential spectral sequence, which characterizes the instantaneous rate of change of the spectral signal, is input to the sub-window partitioning processing module. Based on the preset fixed length parameter L, the segmentation and positioning operation is performed with the data index sequence as a reference. The starting point of the full-length differential spectral sequence is sequentially positioned to the starting point of each sub-window according to the index step size L.

[0056] For each segmented location starting point, use the index range [starting point, starting point + L] 1] Data is extracted to form a subsequence containing L instantaneous rate of change data points, ensuring the consistency of each subsequence in terms of data dimensions.

[0057] Perform an intersection operation on the index range of the current subsequence and the index range of the previous subsequence. If the intersection is determined to be an empty set, mark the subsequence as a non-overlapping sub-window and remove the data segments with intersection to ensure that there is no overlapping data between sub-windows.

[0058] The marked non-overlapping sub-windows are numbered and indexed in the order of generation to form a structured sub-window data list for subsequent normalization and probability distribution construction.

[0059] The structured sub-window data list is written to the local analysis buffer, completing the conversion of continuous time-series differential data into independent local analysis units.

[0060] By using a fixed-length, non-overlapping sliding segmentation method, the results of the previous step are transformed into local differential data sub-windows with a unified dimension and no overlap, achieving the expected technical effects of local analysis unitization and data structure standardization.

[0061] For example, in the scenario of metal detection in water, the length of the differential spectral sequence is 2048 points, and the fixed length parameter L is set to 256 points. The segmentation and localization operation uses 0, 256, 512... as starting indices to locate each sub-window, forming a subsequence containing 256 instantaneous rate-of-change data points by truncating the index interval. After confirming that adjacent subsequences have no overlapping areas, they are marked as non-overlapping sub-windows and assigned indexes 0 to 7, forming a list of 8 structured sub-window data. The data of each sub-window is written to a local buffer to provide input for subsequent extreme value normalization operations. This embodiment ensures that the data dimension of each sub-window is consistent in actual operation, facilitating the subsequent construction of the probability distribution histogram. Verification results show that this method significantly improves the stability and processing efficiency of local entropy value calculation and avoids statistical bias caused by overlapping data.

[0062] S2.2: Perform extreme value normalization processing on the original differential intensity data within the generated non-overlapping sliding sub-windows to map the data of each sub-window to the standard probability space interval, thereby eliminating the dimensional differences between different spectral bands and generating a normalized differential intensity sequence.

[0063] S2.3: Perform frequency statistics operations on equal-width intervals using the normalized differential intensity sequence to construct a probability distribution histogram that characterizes the local signal amplitude distribution density, thereby transforming the continuous numerical sequence into a discrete set of probability quality distributions.

[0064] S2.4: Perform a weighted summation of Shannon entropy values ​​based on the set of discrete probability quality distributions in the probability distribution histogram to calculate the Shannon entropy value of the sub-window that represents the level of signal disorder within the current non-overlapping sliding sub-window, thereby completing the quantization conversion from spatial distribution characteristics to a single information entropy scalar.

[0065] Set the required input conditions for the Shannon entropy calculation formula for the set of discrete probability mass distributions in the constructed probability distribution histogram, treat each probability value as an independent statistical factor and retain the mapping index of the corresponding wavelength interval.

[0066] Perform the natural logarithm operation on each probability value in the set of discrete probability mass distributions to form a logarithmic probability sequence, ensuring that the basis of the logarithmic operation is a mathematical constant e, in order to be compatible with the domain requirement of the subsequent information entropy weighted summation.

[0067] The original probability values ​​are paired one by one with the corresponding log probability values, and a sequence of probability log product is generated by the pairwise product operation. The sign constraint in the product direction is negative according to the Shannon entropy definition to ensure that the entropy value is a positive measure.

[0068] The above probability logarithmic product sequence is summed and aggregated to obtain the Shannon entropy scalar value, which represents the disorder of the signal within the current non-overlapping sliding sub-window. The value is controlled within a specified decimal place using floating-point precision to prevent the influence of numerical rounding on the subsequent construction of the differential entropy time series.

[0069] The Shannon entropy scalar value is appended to the index position of the corresponding sub-window to form the Shannon entropy vector of the sub-window, realizing the quantization conversion from spatial distribution features to a single information entropy scalar.

[0070] The above Shannon entropy weighted summation operation is performed using the following formula: Where H is the Shannon entropy value of the current sub-window, p i Let be the i-th probability mass distribution value, and ln be the natural logarithm function, with sign . According to Shannon's definition of entropy, the value is negative to ensure that the entropy value is non-negative.

[0071] By using the Shannon entropy weighted summation method, the probability distribution histogram result from the previous step is transformed into a quantified local signal disorder index, achieving a unified measurement of the signal complexity of different sub-windows and providing standardized numerical input for subsequent differential entropy time series analysis and baseline drift trend extraction.

[0072] For example, the normalized data range within a non-overlapping sliding sub-window obtained by dividing the differential spectral sequence is 0 to 1. After constructing a histogram through frequency statistics, the probability quality distribution set is obtained as [0.1, 0.2, 0.4, 0.3]. The natural logarithm is calculated for each probability value. For example, the logarithm for 0.1 is -2.302585, the logarithm for 0.2 is -1.609438, and so on. Each probability value is multiplied by its corresponding logarithm and the negative is taken, resulting in a product sequence of [0.2302585, 0.3218876, 0.3665163, 0.3611918]. The summation of this product sequence yields a Shannon entropy value of approximately 1.2798542. This value is recorded as a scalar of signal disorder within the current sub-window in the sub-window Shannon entropy value vector. In this scenario, the entropy value is used to construct a continuous differential entropy time series, and the stability and accuracy of baseline drift dynamic evolution trend identification are significantly improved through sliding window statistical analysis.

[0073] like Figure 2 As shown, step S3 involves constructing a differential entropy time series based on the continuous Shannon entropy values ​​of the sub-windows, and performing sliding window statistical analysis on the differential entropy time series to extract three features: mean, standard deviation, and slope change rate, thereby synthesizing a three-dimensional entropy flow state vector characterizing the baseline drift dynamic evolution trend. Specifically, this includes: S3.1: Based on the continuous sub-window Shannon entropy values, the time sequence is arranged to generate a differential entropy time series that characterizes the continuous evolution of the local disorder of the spectral signal over time.

[0074] Based on the continuous sub-window Shannon entropy values ​​calculated in step S2 as input data, a time-series arrangement processing mechanism is established to transform them into a differential entropy time series characterizing the evolution of local disorder of the spectral signal over time. The sub-window Shannon entropy values ​​are indexed and sorted according to the timestamp order of the spectral scanning cycle, strictly arranging each entropy value in the order of acquisition to maintain the causal relationship in the time domain. The arranged entropy value sequence undergoes index integrity verification, eliminating missing or duplicate points caused by acquisition anomalies to ensure continuity and monotonicity. The index-verified entropy value sequence undergoes a timestamp-sequence value pairing and binding operation to generate a time-series data pair set containing a two-element structure. This data pair set is input into a unified sequence caching module, where the sequence is resampled at fixed sampling intervals to ensure the sequence meets the uniform time step requirement for subsequent sliding window truncation. Through the above processing method, the output of S2 is transformed into a stable differential entropy time series that can be directly used for statistical analysis, realizing the continuous input features required for baseline drift dynamic trend extraction.

[0075] S3.2: Perform a fixed-length sliding window truncation operation on the differential entropy time series to generate a local entropy stream data window containing information of the current time and historical time.

[0076] When performing a fixed-length sliding window truncation operation on the differential entropy time series characterizing the continuous evolution of local disorder of the spectral signal over time, the time series is used as the input data source, and the truncation control logic is established based on the preset window length parameter L.

[0077] In the interception control logic, the starting position of the window is determined based on the current time index, and L consecutive entropy data points are selected with the window length L as the step size to form a local entropy stream data set containing information about the current time and its previous historical time.

[0078] The entropy sequence within the window is stored in an independent buffer, and its temporal order is maintained in the buffer to ensure the complete correlation with the baseline drift trend during subsequent statistical analysis.

[0079] Boundary data processing is performed on the data inside the window. When the window length is less than L, zero padding or mirror expansion strategies are introduced to fill in the structure of the sequence and avoid inconsistent lengths during the calculation of statistical features.

[0080] During window movement, an update mechanism with zero window overlap rate is established, and each truncation covers a new time series data segment to ensure the independence of statistical feature extraction and its independence from the processed data.

[0081] By using a fixed-length sliding window truncation operation, the differential entropy time series is transformed into a local entropy stream data window with time continuity constraints, thus providing a time-domain consistent and length-uniform data foundation for subsequent calculations of characteristic quantities such as mean, standard deviation, and slope change rate.

[0082] For example, in a water metal detection scenario, if the sliding window length parameter L is set to 30 and the sampling frequency is 10Hz, then each window covers a 3-second differential entropy time series. For the current time t=300ms, the corresponding window start index is the data point at 270ms, and 30 entropy data points are truncated to form a local entropy flow data window. When the window length is less than 30, mirror expansion is used to fill the required length with mirrored data at the end. After truncation, the temporal order of the entropy value sequence within the window remains unchanged, ensuring the temporal consistency of the calculation of corresponding feature quantities such as mean and standard deviation. Under this configuration, the feature values ​​calculated based on the 30 entropy data points within the window can significantly improve the robustness of baseline drift rate change trend identification, while effectively reducing the interference of environmental noise on the dynamic entropy flow state vector.

[0083] S3.3: Perform arithmetic mean calculation based on the numerical distribution within the local entropy flow data window to extract the differential entropy mean feature quantity that characterizes the overall offset level of baseline drift.

[0084] S3.4: Perform standard deviation calculation processing using the numerical fluctuation amplitude within the local entropy stream data window to extract the differential entropy standard deviation feature quantity that characterizes the intensity of baseline drift noise interference.

[0085] Amplitude calculation processing is performed on the numerical distribution in the local entropy stream data window generated by S3.2 to obtain the absolute value sequence of the deviation of each differential entropy value from the local mean within the window.

[0086] The amplitude deviation sequence is squared to generate a squared deviation sequence, which enhances the contribution weight of large fluctuations to statistical indicators and eliminates the influence of positive and negative signs.

[0087] Perform an arithmetic summation operation on the sequence of squared deviations to obtain the total sum of squared deviations, which is used to characterize the cumulative value of the overall fluctuation energy within the window.

[0088] By combining the number of samples in the local entropy stream data window, the sum of squared deviations is normalized by division to form a scalar variance value.

[0089] The square root operation is performed on the square difference scalar to generate the standard deviation scalar, which serves as the differential entropy standard deviation characteristic quantity reflecting the intensity of noise interference in the current local entropy flow.

[0090] By using the above processing method, the numerical fluctuations of the local entropy flow data window are transformed into a quantifiable noise interference intensity index, thereby achieving an independent characterization of the baseline drift noise component.

[0091] For example, in a water metal detection scenario, the local entropy flow data window length is set to 50 scan cycles, with the differential entropy value within the window ranging from 1.2 to 2.5, and the mean feature value calculated to be 1.85. For each entropy value x, the difference between it and the mean of 1.85 is calculated, squared, and summed, resulting in a total squared deviation of 31.25. With a window sample size n of 50, the sum divided by the sample size yields a variance of 0.625. The square root of this variance yields a standard deviation of 0.79. This standard deviation feature value is input into the subsequent entropy flow state vector construction module. Verification results show that in simulated spectra containing high-frequency noise interference, this standard deviation feature value is significantly higher than that in low-noise environments, thus effectively distinguishing different noise interference intensities and improving the sensitivity and anti-interference capability of baseline drift state identification.

[0092] S3.5: Perform linear regression slope calculation processing based on the change trajectory of the mean value feature of differential entropy within the local entropy flow data window to extract the feature of differential entropy slope change rate, which characterizes the trend of baseline drift rate change. Then, fuse the mean value feature of differential entropy, the standard deviation feature of differential entropy, and the feature of differential entropy slope change rate to construct a three-dimensional entropy flow state vector.

[0093] Linear regression is performed based on the time variation trajectory of the mean characteristic of differential entropy within the local entropy flow data window. The time index is used as the independent variable and the mean characteristic sequence is used as the dependent variable to construct a first-order regression model.

[0094] The regression coefficients of the first-order regression model are calculated by using the least squares method to solve for the slope of the fitted line within a local window, thus forming the rate change index of the mean characteristic quantity of the differential entropy.

[0095] The calculated slope change rate characteristic is normalized to map the rate index under different period lengths to the standard analysis range for feature fusion.

[0096] The normalized slope change rate feature is combined with the mean differential entropy feature extracted from the preceding sub-step S3.3 and the standard deviation differential entropy feature extracted from S3.4 in a fixed order, and a three-dimensional entropy flow state vector structure is generated by vector concatenation.

[0097] By constructing a three-dimensional entropy flow state vector, the offset level of local disorder, the intensity of noise disturbance, and the rate change trend are comprehensively encapsulated into a single data interface, enabling the quantifiable transmission of the dynamic baseline drift evolution trend.

[0098] like Figure 3 As shown, step S4 involves initializing and constructing an incrementally updatable isolated forest algorithm using a small number of initial drift-free samples to form an online anomaly detector. The three-dimensional entropy flow state vector is then input into the online anomaly detector to determine in real time whether the current spectral signal has experienced an entropy flow abrupt event exceeding the stability boundary. Specifically, this includes: S4.1: Obtain a sequence of three-dimensional entropy flow state vectors corresponding to a small number of initial drift-free samples, and perform an isolation tree construction operation on the three-dimensional entropy flow state vector sequence to generate an initial isolated forest model structure containing root nodes and leaf nodes.

[0099] The 3D entropy flow state vector sequence output from the previous main step is used as input. The corresponding state vectors all originate from the dataset after feature fusion processing of mean, standard deviation, and slope change rate. This dataset is limited to a small subset of initial drift-free samples, serving as the baseline for constructing the anomaly detection model. Based on this drift-free state vector sequence, data dimensions and feature domain boundaries are defined, and the generation rules for the random hyperplane required for isolated forest construction are determined. Uniformly distributed random variables are introduced in each dimension according to the feature space range to determine the hyperplane's location information. The random hyperplane is used to perform isolation tree hierarchical structure partitioning. The 3D entropy flow state vector sequence is sequentially input into the isolation tree nodes, and the sequence is progressively partitioned to leaf nodes through a recursive partitioning mechanism, ensuring that the amount of data in each leaf node meets the forest initialization requirements. For each partitioning operation, the hyperplane parameters and node hierarchy relationships are recorded, forming a node index table for path length calculation. This table is stored in a tree structure for subsequent real-time detection. Multiple isolated trees are constructed and merged to generate an initial isolated forest model structure containing root nodes, branch nodes, and leaf nodes. By initializing the model, the result of the previous step is transformed into an initial structure for an online anomaly detector with no drift reference, thus achieving a robust benchmark for subsequent entropy flow mutation judgment.

[0100] For example, in an environmental monitoring water quality analysis scenario, the entropy flow state vectors within nearly 50 consecutive scanning cycles are selected as initial drift-free samples. The input features include a mean component ranging from 0.02 to 0.05, a standard deviation component ranging from 0.005 to 0.015, and a slope change rate component ranging from... The threshold values ​​range from 0.001 to 0.001. During isolation tree construction, randomly generated hyperplane parameters are used in the 3D feature space. For example, a threshold of 0.035 is generated along the mean component dimension, 0.010 along the standard deviation component dimension, and 0.0005 along the slope change rate dimension. Each node segmentation operation determines the left and right sub-branches based on these parameters until the leaf nodes contain only one or two vector samples. This process is repeated to construct 100 isolation trees. After model initialization, in subsequent runs, the path length of newly input entropy flow state vectors can be calculated and compared with the baseline state, significantly improving the stability and anti-interference ability of mutation identification in field validation.

[0101] S4.2: Based on the initial isolated forest model structure, perform path length calculation processing on the continuously input current frame three-dimensional entropy flow state vector to obtain the average path length value that characterizes the difficulty of isolating the current data point.

[0102] Based on the initial isolated forest model structure constructed using S4.1, the system receives continuously input 3D entropy flow state vectors of the current frame as target data points for calculating the path length of the isolated trees. The current frame's 3D entropy flow state vector is sequentially input into the root node of each isolated tree in the isolated forest. Segmentation is performed according to the random splitting hyperplane parameters stored in the node. If the data point meets the segmentation condition, it enters the corresponding child node; otherwise, it moves to another child node. For each isolated tree, the path depth value is recorded when the data point first falls into a leaf node, and this path depth value is accumulated in the path length sum register. The value in the path length accumulation register is called, and combined with the total number of isolated trees in the isolated forest model structure, the average path length is calculated. Through this processing method, the isolation characteristics of the 3D entropy flow state vector in the isolated forest structure are transformed into an average path length value representing the ease with which the current data point is isolated, thus achieving a quantitative characterization of the anomaly tendency of the spectral signal.

[0103] For example, in a water body metal detection scenario, the initial isolated forest model contains 50 isolated trees, each with a maximum depth of 15. The segmentation features are the mean, standard deviation, and slope change rate in the 3D entropy flow state vector. The current frame's 3D entropy flow state vector has a mean of 0.35, a standard deviation of 0.12, and a slope change rate of 0.07. After random hyperplane segmentation of each isolated tree, the path depth values ​​vary between 8 and 12, with a total path length of 520. Substituting this total with the total number of isolated trees (50) yields an average path length of 10.4. This average path length is significantly higher than the normal baseline value of 7.5 for drift-free samples. Outputting this value for S4.3 bias comparison calculation significantly improves the accuracy of entropy flow mutation detection and demonstrates stable anomaly detection performance under complex water body background noise.

[0104] S4.3: The deviation is compared with the average path length value and the preset normal sample expected path length benchmark value to calculate the abnormal score scalar that reflects the degree of deviation of the current spectral signal from the normal distribution.

[0105] In the anomaly score calculation stage of the online anomaly detector, the inputs are the average path length calculated from the path length of the isolated forest and the baseline value of the expected path length of normal samples established during the initialization phase. Both originate from the preceding incremental isolated forest model construction and path length evaluation process. The input average path length and the baseline value of the expected path length of normal samples are subtracted to form a raw deviation quantity representing the degree of isolation of the current data points from the normal distribution. This raw deviation quantity is then processed to ensure that the deviation index is not affected by positive or negative differences. The absolute deviation quantity is then proportionalized to the baseline value of the normal sample path length to obtain a dimensionless relative deviation ratio. This relative deviation ratio is input into an exponential mapping compression function, which uses nonlinear transformation to suppress the impact of extreme deviation values ​​on the score calculation and improve the resolution of the low-to-medium deviation range. The compressed ratio is then multiplied by the maximum anomaly sensitivity coefficient set internally by the model to obtain the final anomaly score scalar. This score scalar directly represents the strength of the deviation of the current three-dimensional entropy flow state vector from the initial normal distribution. By using the above processing method, the path length result of the previous step is transformed into a robust anomaly score scalar, achieving the expected technical effect of real-time quantification of the degree to which the spectral signal deviates from the normal distribution.

[0106] For example, in a water metal detection scenario, the average path length corresponding to the current frame's 3D entropy flow state vector is obtained as 5.4, and the baseline value for the expected path length of normal samples is initialized to 6.0. The difference operation yields the original deviation of -0.6, which is then processed to obtain 0.6. A proportional operation is performed between 0.6 and the baseline value of 6.0, resulting in a ratio of 0.1. An exponential mapping compression function is then used. Where x is 0.1 and the sensitivity coefficient k is 2.0, the calculated compression ratio is approximately 0.181. Multiplying this compression ratio by the maximum anomaly sensitivity coefficient of 2.5 yields an anomaly score scalar of approximately 0.452. The above calculation results demonstrate high sensitivity to slight baseline drift during system validation, while maintaining score stability even under conditions of significant environmental interference, significantly improving the accuracy and robustness of anomaly detection.

[0107] S4.4: Perform a logical judgment operation based on the abnormal score scalar and the dynamically updated stability boundary threshold to generate a binary mutation judgment flag that identifies whether the current spectral signal has experienced an entropy flow mutation event.

[0108] The anomaly score scalar, calculated by comparing the path length with the deviation of the current frame's 3D entropy flow state vector, forms the input comparison condition with the dynamically updated stability boundary threshold. The anomaly score scalar is input to the logic decision unit, and the stability boundary threshold is introduced as a reference standard to construct the decision operation link. The comparison operation module performs difference calculation and sign analysis on the anomaly score scalar and the stability boundary threshold, and the absolute value of the difference is input to the overflow decision module as an overflow index. A threshold trigger mechanism is adopted: when the overflow index is greater than zero, a high-level trigger signal is generated, indicating that an entropy flow mutation has occurred; conversely, a low-level signal is generated, indicating that the system is in a stable state. The high and low level signals are binarized and mapped to logical values ​​"1" or "0," forming the original data for the binarized mutation decision flag. The digital signal shaping module performs glitch filtering and pulse width normalization on this original data to ensure the stability of the decision flag over multiple sampling periods, thereby outputting the final binarized mutation decision flag. Through this logical link, the abnormal score quantization result of the previous step is transformed into a stable and reliable binary judgment signal, realizing real-time identification and status marking of entropy flow mutation events.

[0109] S4.5: Based on the result status of the binary mutation determination flag, perform incremental node update or parameter reset processing on the initial isolated forest model structure to generate an online anomaly detector instance with continuous adaptability for use in the next cycle.

[0110] Based on the result state determined by the binary mutation determination flag, the 3D entropy flow state vector input to the initial isolated forest model structure in the current period is matched and compared with the stored node information of the model to determine the range and category of the isolated tree nodes to be updated. For cases determined to be in a stable state, incremental node update operations are performed, adding new branch nodes under the existing leaf nodes and constructing a random splitting hyperplane based on the latest input vector to supplement the model's ability to recognize new distribution patterns. For cases determined to be in a mutation state, parameter reset processing is performed, recalculating the splitting threshold of each isolated tree using the node distribution statistics of the stable period before the mutation event, and removing abnormal leaf nodes formed during the mutation period to restore the model's training baseline. The updated or reset isolated tree set is reassembled into an isolated forest structure, and cross-tree consistency checks are performed to ensure that the number of layers, splitting rules, and path length calculation logic of each tree remain consistent. By writing the updated isolated forest structure into the running instance storage area of ​​the online anomaly detector and binding it with the current period number and state flag, the detector continues to have the ability to adapt to dynamic baseline drift trends in the next period. By using incremental node supplementation and parameter threshold reset, the judgment result of the previous step is transformed into an online anomaly detector model with long-term adaptability and stability, achieving the expected technical effect of improved accuracy and robustness in baseline drift dynamic identification.

[0111] For example, in a water metal detection scenario, the online anomaly detector uses an isolated forest model composed of three isolated trees, with each tree having a maximum depth of 15 layers. The initial segmentation threshold is constructed based on 50 drift-free samples. The current cycle's input 3D entropy flow state vector has a mean of 0.35, a standard deviation of 0.12, and a slope change rate of 0.08. The average path length calculated is 6.4, and the difference from the stability benchmark value results in an anomaly score of 3.2. When the anomaly score exceeds the dynamic threshold of 2.8, a mutation state is triggered, parameters are reset, the segmentation threshold is reset to the median of the benchmark statistics, and the 6 leaf nodes added during the mutation are removed. In another scenario, when the anomaly score is below the dynamic threshold, incremental node updates are performed, adding a node at the 7th layer of the second isolated tree, and the segmentation hyperplane is set with a threshold of 0.37 based on the first component of the normalized state vector. After both processes are completed, the three isolated trees are reconstructed into an isolated forest, and consistency checks confirm that the number of layers in each tree remains at 15, and the path length calculation formula remains consistent. The formula is: Where L is the average path length, n is the number of samples, h is the current node depth, and c is the segmentation threshold. After calculation and consistency verification, the detector successfully adapted to the signal patterns of 29 new samples in the next cycle, significantly improving the accuracy of entropy flow mutation identification and enhancing the stability of baseline drift determination.

[0112] Step S5: If the online anomaly detector determines that the entropy flow mutation event has occurred, it immediately triggers a parameter freezing action, locking the optimal baseline fitting parameter set obtained through multiple rounds of iterative optimization in the previous stable period as the current calibration benchmark, thereby generating a frozen baseline fitting parameter set and a parameter freezing marker. Specifically, this includes: S5.1: Obtain the entropy flow mutation event judgment result and the current system timestamp output by the online anomaly detector, and trigger the parameter freeze control command based on the entropy flow mutation event judgment result to generate a parameter freeze trigger signal containing freeze trigger time information.

[0113] Obtain the entropy flow mutation event judgment result and the current system timestamp output by the online anomaly detector, establish a logical decision module for triggering the freeze action based on the judgment result, and map the judgment result to the freeze control state value.

[0114] The freeze control status value is encoded and converted into a structured freeze control instruction containing an event type field.

[0115] The current system timestamp and freeze control command are merged into a time-series extended command data packet that records the freeze trigger time information.

[0116] Perform checksum bit generation and appending operations on timing extension instruction data packets to ensure the integrity and verifiability of freeze trigger signals during cross-module transmission.

[0117] The timing extension instruction data packet with additional check bits is injected into the internal control bus of the system, marked as a parameter freeze trigger signal, and output to the main control processing unit.

[0118] Through the above chain processing method, the entropy flow mutation judgment result is transformed into a verifiable control signal containing information on the freezing trigger time, so as to realize the instantaneous response and precise time marking of the freezing action.

[0119] For example, in a water body metal detection site, the online anomaly detector performs a judgment operation on the continuously input three-dimensional entropy flow state vector, outputting a sudden event flag of 1, a system timestamp of 1689350423 seconds, and a freeze control state value set to 01h. In the logic decision module, 01h is encoded as the event type field 0xF1, and the timestamp and event type are binary-merged to obtain a 32-bit timestamp + 8-bit event type instruction data packet, whose hexadecimal representation is 0x64C21E07F1. This data packet is checked by CRC-16 to generate 0x5A3C as a check bit, which is appended to the end of the data packet, forming a complete 6-byte timing extended instruction data packet. This data packet is injected into the main control processing unit via the high-speed SPI bus and is recognized as a parameter freeze trigger signal in the main control processing unit, immediately initiating the freeze operation and locking the baseline fitting parameter set of the previous stable cycle. In actual testing, this embodiment shows that the freeze trigger delay is less than 2 milliseconds, and the consistency error between the timestamp and the system global clock does not exceed 1 microsecond, ensuring the immediacy and traceability of the freeze action.

[0120] S5.2: In response to the parameter freeze trigger signal, read the best baseline fitting parameter set obtained through multiple rounds of iterative optimization in the previous stable period from the historical state cache area of ​​the system running memory, so as to obtain the historical best baseline fitting parameter set containing polynomial order, window width and weight decay coefficient.

[0121] In response to the entropy flow mutation event judgment result and parameter freeze trigger signal output by the online anomaly detector, a targeted indexing operation is performed on the historical state cache area in the system's running memory to lock the cache time segment corresponding to the previous stable cycle. Within this time segment, multiple rounds of iterative optimization record retrieval are performed to select the baseline fitting parameter record with the smallest convergence value of the fitting error function and a convergence rate that meets the stability threshold requirements. The retrieved parameter records are structured and parsed, and the three core elements of polynomial order, window width, and weight decay coefficient are independently extracted and mapped to the parameter set structure. During the extraction process, data integrity verification is performed, including verification of the validity of the polynomial order, the boundary constraint verification of the window width, and the non-negativity verification of the weight decay coefficient, to ensure that the parameter set does not contain null values, illegal values, or out-of-bounds values. After the verification is passed, the parameter set is marked as the historical best baseline fitting parameter set and provides standardized input for subsequent freeze storage.

[0122] By employing the aforementioned historical state cache retrieval, optimized record filtering, parameter structure parsing, and integrity verification processing methods, the freeze trigger signal from the previous step is transformed into a standardized set of historical best baseline fitting parameters containing polynomial order, window width, and weight decay coefficient. This provides reliable and traceable initial data input for subsequent deep cloning replication and physical isolation storage.

[0123] S5.3: Perform a deep clone copy operation on the set of historical best baseline fitting parameters, and use memory isolation technology to write the copied parameter data into an independent read-only calibration benchmark register to generate an initial frozen baseline fitting parameter copy that is physically isolated from the real-time update process.

[0124] A deep cloning process is performed on the historical best baseline fitting parameter set, which includes polynomial order, window width, and weight decay coefficients. A bit-level precise copying mechanism is used to generate an independent copy of each parameter value in the memory address mapping table. A hierarchical traversal is implemented for the multidimensional parameter structures involved in the copying process, copying basic data units and nested structure members level by level. A memory check hash is added during the cloning process to ensure that the copying results are identical at the byte level. A memory isolation partitioning allocation strategy is applied to the generated cloned copies, storing them in an independent buffer disconnected from the physical address space of the real-time update process, preventing the gradient update thread of the dynamic calibration module from accessing this area. A one-time write-to-read-only calibration baseline register is performed on the isolated stored copy, binding the register address to the isolation buffer to achieve physically immutable storage properties. Through the above isolation register mechanism, the deep-cloned parameter copy is established as the initial frozen baseline fitting parameter copy, achieving a secure lock on the historical best baseline fitting parameters.

[0125] By employing bit-level precise copying, hierarchical traversal of structures, memory isolation partitioning, and read-only register mapping, the historical best baseline fitting parameter set from the previous step is transformed into independent and physically isolated frozen parameter data, achieving a secure storage effect resistant to external interference.

[0126] For example, in an on-site ICP emission spectroscopy analysis system for water metal detection, the historical best baseline fitting parameter set includes a polynomial of order 3, a window width of 256 sampling points, and a weight attenuation coefficient of 0.85. During deep cloning, the binary representation of each coefficient is completely transferred to a new memory block through bit copying, and a CRC32 checksum is calculated to ensure data integrity. The isolation partition capacity is set to 64KB, and the physical address is at least 4KB away from the main process address space to avoid cache line sharing. After the read-only register is mapped, register address 0x1F20 is bound to the starting address of the isolation zone, and the register control flag is set to 1 to prohibit writing. Under this configuration, any gradient update request from the calibration module is intercepted at the hardware access layer, and the frozen parameter copy remains stable throughout the calibration cycle. Verification results show that under the influence of random noise interference, the fluctuation amplitude of the baseline fitting curve is significantly reduced, and the corresponding metal detection peak area integral value remains within a stable range.

[0127] S5.4: Perform integrity verification and version marking processing based on the initial frozen baseline fitting parameter copy, and generate metadata tags by attaching the current spectral scan cycle number and freezing reason code to form a frozen baseline fitting parameter group to be activated with traceable attributes.

[0128] The input condition is an initial frozen baseline fitting parameter copy that has been deeply cloned and written to a read-only calibration reference register. This copy contains key parameters such as polynomial order coefficients, window width values, and weight attenuation coefficients, and also has physical isolation properties to prevent interference from the real-time update process. The integrity verification module is invoked on the initial frozen baseline fitting parameter copy to check the validity of the numerical range and data type consistency of the polynomial order coefficients, window width values, and weight attenuation coefficients according to preset parameter field verification rules. A parameter field quantity matching verification is also performed to ensure that the copy parameter structure is consistent with the historical best baseline fitting parameter set. A byte-level sequence check is performed on the copy parameter data using the Cyclic Redundancy Check (CRC) algorithm. The generated CRC value is compared one by one with the standard CRC values ​​stored in the historical buffer to confirm that no data bit errors or transmission corruption occurred during the copying process. The version tag generation unit is invoked to combine the current spectral scan cycle number and the freeze reason code into a unique version identifier string, and timestamp information is appended to bind this identifier to the parameter copy to form a metadata tag. According to the metadata tag format specification, the tag embedding operation is performed, and each field of the tag is written to the metadata register address area corresponding to the parameter copy to enhance the traceability attribute of the frozen baseline fitting parameter copy. Through the above verification and tagging process, the initial frozen baseline fitting parameter copy is transformed into a frozen baseline fitting parameter group to be activated with version management and historical traceability capabilities, thereby ensuring the consistency and source legitimacy of parameters in subsequent loading processes.

[0129] For example, in an ICP emission spectroscopy analysis for water metal detection, the initial frozen baseline fitting parameter copy contains a polynomial order coefficient of 3, a window width of 128, and a weight attenuation coefficient of 0.85. The integrity verification module confirms that the order coefficient is within the legal range of 2 to 5, the window width is within the data range of 64 to 256 and is an integer, and the weight attenuation coefficient is within the range of 0.5 to 0.95 and is a floating-point number. The CRC algorithm is used to calculate CRC=0x5A3F on the byte stream of the copy parameters, which is completely consistent with the historical standard CRC value 0x5A3F, verifying that the data is lossless. The version tag generation unit reads the current spectral scan cycle number as 2507 and the freeze reason code as F02, combines them to generate the version identifier string "2507-F02" and adds the current timestamp 2024-06-18 14:32:10. This identifier is written to the specified location in the metadata register to form a frozen baseline fitting parameter group to be activated with traceable attributes. When subsequently loaded into the calibration module, the traceability and integrity of this set of parameters ensured that the calibration process remained stable under environmental fluctuations and random noise interference, and significantly improved the stability index of baseline drift compensation and the accuracy of output spectral data in experimental verification.

[0130] S5.5: Load the set of frozen baseline fitting parameters to be activated into the parameter input port of the calibration module and lock the write permission to block external gradient update requests from modifying the set of parameters, so as to finally output the frozen baseline fitting parameter set for subsequent local retraining initial value setting, and at the same time generate an associated parameter freeze flag and place it in the flag register of the system memory to indicate that a parameter freeze event has occurred in the current period.

[0131] For example, in an on-site ICP emission spectroscopy analysis system for water metal detection, the historical best baseline fitting parameter set includes a polynomial of order 3, a window width of 256 sampling points, and a weight attenuation coefficient of 0.85. During deep cloning, the binary representation of each coefficient is completely transferred to a new memory block through bit copying, and a CRC32 checksum is calculated to ensure data integrity. The isolation partition capacity is set to 64KB, and the physical address is at least 4KB away from the main process address space to avoid cache line sharing. After the read-only register is mapped, the register address 0x1F20 is bound to the starting address of the isolation zone, and the register control flag is set to 1 to indicate that writing is prohibited. Under this configuration, any gradient update request from the calibration module is intercepted at the hardware access layer, and the frozen parameter copy remains stable throughout the calibration cycle. At the same time, the system sets the parameter freeze flag to a logical value of 1 (or status code 0x01) and binds it to the current scan cycle number, storing it in the flag register for subsequent S8 writes to the runtime log. The verification results show that under the influence of random noise interference signals, the fluctuation amplitude of the baseline fitting curve is significantly reduced, and the corresponding metal detection peak area integral value remains in the stable range.

[0132] Step S6: Based on the frozen baseline fitting parameter set as initial values, perform a fast gradient descent fine-tuning operation with a limited step size within a local window composed of the most recent several frames of spectral data to generate a dynamic calibration parameter set that can respond to the actual drift trend and suppress parameter oscillations. Specifically, this includes: S6.1: Obtain the frozen baseline fitting parameter set locked in the previous stable period and the original spectral intensity sequence of the most recent frames. Construct a local error cost function based on the frozen baseline fitting parameter set to quantify the degree of fitting deviation between the current parameter state and the baseline features of the spectral signal within the local window.

[0133] S6.2: Perform partial differential operations on the local error cost function with respect to the polynomial order coefficients, window width, and weight decay coefficients in the frozen baseline fitting parameter set to generate a parameter gradient vector that characterizes the gradient of error change in each parameter direction.

[0134] The input conditions include the set of parameters for fitting the frozen baseline locked in the previous stable period and the deviation quantization model constructed from the original spectral intensity sequences of the most recent frames through the local error cost function. The deviation quantization model defines the optimization objectives for three independent parameter dimensions: polynomial order coefficients, window width, and weight attenuation coefficient.

[0135] Partial differential processing is performed on the coefficients of the polynomial order. The gradient change law of the cost function in the direction of the coefficient is used to extract the numerical increase or decrease trend. By concentrating the wavelength difference information of adjacent data points, a local slope matrix is ​​constructed and the gradient component is calculated to obtain the sensitivity index in this direction.

[0136] Partial differential processing is performed on the window width, and a response curve is established by combining the response of the baseline fitting residual within the local window to changes in the window span. The derivative value is calculated based on this curve to reflect the sensitivity of the convergence speed to changes in the window width, thereby forming the gradient component in this direction.

[0137] Partial differential processing is performed on the weight decay coefficient to analyze the nonlinear response relationship of the local fitting residual as the decay coefficient changes. The residual decay curve is generated by convolving the residual sequence with the exponential decay function, and the derivative of the curve is obtained to obtain the gradient component that reflects the influence of the coefficient change on the local convergence stability.

[0138] The three gradient components are combined in the parameter space to form a parameter gradient vector, and the gradient in each direction is calculated.

[0139] By using partial differential operations and gradient vector synthesis, the cost function result from the previous step is transformed into a quantitative index characterizing the sensitivity to error changes in each parameter direction, thereby enabling the accurate construction of input data for subsequent step size constraint calculations and constrained updates.

[0140] S6.3: Perform dynamic step size constraint calculation based on the magnitude of the gradient vector of the parameter, and introduce a nonlinear saturation mapping mechanism to truncate the original gradient magnitude in order to generate a constrained update step size scalar that meets the convergence stability requirements.

[0141] Based on the magnitude of the parameter gradient vector obtained from the parameter set fitted to the frozen baseline, a dynamic step size constraint calculation is performed to determine the upper limit of the update magnitude.

[0142] The magnitude of the parameter gradient vector is compared with the preset maximum allowable gradient magnitude to construct a normalized scaling factor for nonlinear truncation.

[0143] A nonlinear saturation mapping mechanism is introduced to input the normalized scaling coefficient into the hyperbolic tangent function model to smooth large gradient values, while enhancing the weight of small gradient values ​​in the update.

[0144] The constrained update step size scalar is calculated using the following formula: Where, α max is the preset maximum step size constant, ‖g‖ is the magnitude of the parameter gradient vector, and γ is the gradient magnitude saturation factor.

[0145] The restricted update step size scalar is used as the control variable for iterative update weights to ensure that the gradient descent process maintains convergence stability under high noise conditions.

[0146] By using the above-mentioned nonlinear saturation mapping method, the parameter gradient vector of the previous step is transformed into a constrained update step size scalar that meets the convergence stability requirements and has noise resistance, thereby suppressing parameter oscillations during subsequent iterative updates.

[0147] For example, 50 frames of spectral data were collected on-site for water quality analysis. The magnitude of the gradient vector corresponding to the frozen baseline fitting parameter set was measured to be 2.35, and the preset maximum step size constant α was used. max Set to 0.005, the gradient magnitude saturation factor γ is taken as 1.2. The calculation process for the constrained update step size scalar is as follows: the ratio of gradient magnitude to saturation factor is 2.351.2 = 1.958, the hyperbolic tangent function value is 0.961, multiplied by α. max The restricted step size was obtained as 0.005 × 0.961 = 0.004805. This step size scalar was applied to the local iterative update. The verification results showed that, under the condition of interference with an instantaneous spectral noise amplitude of 8% of the original signal, the parameter update trajectory did not exhibit overshoot, the model baseline fitting accuracy was significantly improved, and the stability remained at a high level.

[0148] S6.4: Perform a weighted product operation using the restricted update step size scalar and the parameter gradient vector, and superimpose the operation result onto the frozen baseline fitting parameter set to complete a single round of parameter iteration update and generate an intermediate transition calibration parameter set.

[0149] Using the constrained update step size scalar and parameter gradient vector generated in the preceding steps as input objects, a product coupling relationship is established in the mathematical operation unit. The step size scalar is broadcast numerically to the operation channels of each component of the gradient vector, realizing the component-to-component mapping between the scalar and the vector. In the product calculation stage, for the three types of variables in the frozen baseline fitting parameter set—polynomial order coefficients, window width parameters, and weight decay coefficients—their corresponding gradient components are taken as right operands to form a binary product expression between the constrained step size scalar and the gradient components.

[0150] For composite parameters such as polynomial order coefficients, the product of each component needs to be arranged into an update vector to ensure synchronous iteration of the parameter set. In the superposition operation, the above update vector is summed with the original parameter vector in the frozen baseline fitting parameter set to form the iterated parameter vector.

[0151] The parameter iteration is completed through computation, and the parameter vector obtained from the iteration is written into the intermediate transition calibration parameter group storage area for use in the next iteration evaluation. Through the above weighted product superposition processing method, the step size constraint and gradient information of the previous step are transformed into stable and convergent parameter update data, realizing the generation of the intermediate transition calibration parameter group, and maintaining the sensitivity of the fitted model to the real drift trend and the ability to suppress noise disturbances within this iteration.

[0152] For example, in a certain water metal detection process, the frozen baseline fitting parameter set includes a polynomial order coefficient of 2.35, a window width parameter of 28, and a weight decay coefficient of 0.85. The gradient vector calculated by the previous steps is [ 0.0042, 1.75, [0.012], the restricted update step size scalar is 0.05. The update vector is obtained by multiplying the step size scalar with each component of the gradient vector. 0.00021, 0.0875, [0.0006], and perform component summation with each component of the frozen parameter set, outputting the intermediate transition calibration parameter set after iteration as [2.34979, 28.0875, 0.8494]. After writing this intermediate transition parameter set into the storage area, iterative evaluation is continued within the local window. The verification results show that the fitting baseline residual is significantly reduced after this round of iterations, and the parameter change amplitude remains within the physical stability domain. The final output intermediate transition calibration parameter set can balance drift response and anti-interference performance.

[0153] S6.5: Based on the intermediate transition calibration parameter set, repeatedly execute the error evaluation and iterative update process within a local window until the preset convergence threshold is met, so as to output a dynamic calibration parameter set that can finally respond to the real drift trend and suppress parameter oscillation.

[0154] Based on the intermediate transition calibration parameter set, the system receives the most recent frames of spectral data and their corresponding baseline drift evaluation results within a local window, constructing real-time iterative control variables to monitor error change trends. After each iteration, the local cost function value is recalculated, and the difference between this value and the previous cost function value is calculated to determine whether the current iteration step has converged. A limited step-size update strategy is used to constrain the parameter adjustment range, ensuring that the direction of parameter change during iteration remains consistent with the actual drift trend, while avoiding overshoot. A termination flag is triggered when the error difference value falls below a preset convergence threshold, and the current iteration parameter set is frozen as the final dynamic calibration parameter set. The following convergence determination formula is used for judgment: Where E is the value of the local error cost function, and k represents the current iteration round. 1 represents the previous iteration, and ΔE is the error difference value. The convergence determination result is compared with a preset threshold ε using logical judgment. The iteration process is considered converged when ΔE ≤ ε. Thus, through the linkage of error evaluation and step-size-limited iteration, the intermediate transitional calibration parameter set is transformed into a final dynamic calibration parameter set that can respond to the actual drift trend and suppress parameter oscillations, achieving stable baseline drift compensation.

[0155] Step S7: Baseline compensation calculation is performed on the original spectral intensity sequence using the dynamic calibration parameter set to output calibrated spectral data that eliminates baseline drift interference. Specifically, this includes: S7.1: Obtain the dynamic calibration parameter set generated by the limited step size fast gradient descent fine-tuning operation and the original spectral intensity sequence output within the continuous scanning period. Based on the polynomial order, window width and weight attenuation coefficient contained in the dynamic calibration parameter set, construct a dynamic baseline fitting function model that characterizes the baseline drift trend at the current moment.

[0156] S7.2: Input the original spectral intensity sequence into the dynamic baseline fitting function model, and calculate the baseline intensity value for each data point in the spectral wavelength dimension according to the local window sliding mechanism and weight decay strategy defined in the model, so as to generate a real-time baseline drift estimation sequence that is strictly aligned with the original signal timestamp.

[0157] The original spectral intensity sequence output within a continuous scanning cycle is loaded into the input interface of a dynamic baseline fitting function model constructed based on a dynamic calibration parameter set. During the data loading process, the ordered mapping of the data structure is completed according to the wavelength index order to ensure the continuity of the computation queue.

[0158] For each data point at a wavelength position, the local window sliding mechanism in the model is invoked, and the position is used as the center of the window. The left and right neighboring data with the window width are introduced to form a local dataset, ensuring that the local fitting contains sufficient background information.

[0159] Polynomial fitting is performed on a local dataset. The fitting order is set according to the order coefficients in the dynamic calibration parameter set. A weight decay strategy is introduced during the calculation to reduce the influence of sampling points far from the center of the window on the fitting results. The form of the weight decay function is specified by the parameter set.

[0160] For the weight coefficients and intensity values ​​within each window, the baseline intensity is calculated using the weighted polynomial coefficient solution formula.

[0161] The calculated baseline intensity values ​​are sequentially written into the baseline drift estimation sequence buffer according to the timestamp order of the original spectral intensity sequence to form a real-time baseline drift estimation sequence that is strictly aligned with the timestamp of the original signal, ensuring the time consistency of subsequent differential compensation operations.

[0162] By combining a local window sliding mechanism with a weight attenuation strategy, the baseline intensity at each wavelength point is accurately calculated point by point. The output of the dynamic baseline fitting model in the previous step is transformed into time-synchronized baseline drift estimation data, thereby realizing the real-time capture and quantification of the original spectral baseline drift trend.

[0163] S7.3: Receive the original spectral intensity sequence and the real-time baseline drift estimation sequence, perform point-by-point difference operation processing, subtract the real-time baseline drift estimation value of the corresponding wavelength point from the original spectral intensity value, so as to remove the low-frequency background noise component caused by the complexity of the water sample and environmental fluctuations, thereby obtaining a preliminary denoised spectral data sequence.

[0164] Receive the real-time baseline drift estimation sequence generated by the dynamic baseline fitting function model and the original spectral intensity sequence of the corresponding wavelength point, and establish a one-to-one time-series matching mapping table to ensure that the timestamps between data points are completely synchronized.

[0165] The original spectral intensity value of each wavelength point in the time-series matching mapping table is paired with the real-time baseline drift estimate as input, and the instantaneous intensity difference after baseline compensation is calculated according to the differential operation rules.

[0166] To address the potential low-frequency background noise residue in the difference results, a low-frequency component removal strategy based on a small amplitude threshold is implemented. Points with absolute difference values ​​below a preset threshold are forced to zero, thereby further eliminating interference components from the complexity of the water sample and environmental fluctuations.

[0167] The differential result sequence after removing low-frequency noise is recombined in time scan order to form a preliminary denoised spectral data sequence, while maintaining the same wavelength index structure as the original data so that it can be directly called in subsequent steps.

[0168] By using differential and threshold processing, the dynamic baseline drift estimation from the previous step is transformed into preliminary denoised spectral data that removes low-frequency background interference, thereby improving the accuracy and robustness of subsequent characteristic peak integration.

[0169] S7.4: Perform non-negativity constraint verification and boundary smoothing on the preliminary denoised spectral data sequence, force the negative artifacts generated by the subtraction operation to zero, and use linear interpolation to repair the breakpoints, so as to generate the final calibrated spectral data that conforms to the physical emission characteristics.

[0170] Step S8: Synchronously write the three-dimensional entropy flow state vector and the parameter freeze marker indicating the parameter freeze action into the operation log to form a historical drift state record. Specifically, this includes: S8.1: Obtain the three-dimensional entropy flow state vector generated in the current scanning cycle and the parameter freeze marker triggered by the online anomaly detector, and perform timestamp alignment processing on the three-dimensional entropy flow state vector and the parameter freeze marker to generate a drift event raw data packet with a unified time sequence index.

[0171] S8.2: Based on the three-dimensional entropy flow state vector in the original data packet of the drift event, extract the mean component, standard deviation component and slope change rate component, and perform floating-point precision compression encoding on each extracted component to generate a lightweight entropy flow feature sequence with optimized storage space.

[0172] S8.3: Construct a key-value pair mapping relationship using the lightweight entropy flow feature sequence and the parameter freeze marker, using the parameter freeze marker as the state index key and the lightweight entropy flow feature sequence as the associated data value, to generate a structured single historical drift state entry.

[0173] An association construction operation is performed on the lightweight entropy flow feature sequence after floating-point precision compression encoding and the corresponding parameter freeze marker. The parameter freeze marker is then used as the state index key and input to the key-value mapping generation module.

[0174] Within the mapping generation module, the key-value pair data structure allocation routine is called to allocate a key-value pair storage unit with a fixed field length and an index hash table pointer. The lightweight entropy stream feature sequence is written as the associated data value into the data field of the storage unit.

[0175] During the write process, index hash calculation is performed, through... Determine the hash address of the state index key, where k is the encoded value of the parameter freeze flag. This indicates a bitwise XOR operation, ensuring the stability of the mapping relationship retrieval and minimizing conflicts.

[0176] The hash address is used to locate the index slot of the structured entry, the associated data value is written in byte sequence order, and field identifiers are attached to define the order of the mean component, standard deviation component and slope change rate component of the entropy flow feature.

[0177] Perform checksum calculation on the generated structured entries, through Generate a cyclic redundancy check value, where Poly is a preset CRC polynomial constant and DataSeq is the data sequence of the entry, to ensure the integrity of historical drift state entries.

[0178] Through the key-value mapping construction and verification process described above, the lightweight entropy flow feature sequence and parameter freeze marker are transformed into a structured single historical drift state entry with unified index retrieval, traceable field definition and data integrity guarantee, thereby enabling efficient appending of subsequent operation logs and enhanced availability of the cloud knowledge base.

[0179] The above data sequence is processed using the CRC16 polynomial constant 0xA001 to generate a check bit, resulting in a check value of 0x7F3C, which is used as the entry integrity verification field.

[0180] After the execution entry is generated, the data is appended to the operation log. The cloud-based quality backtracking system can then directly retrieve the corresponding entry using the index key 1024 and analyze the recent baseline drift trend using three-dimensional feature data, significantly improving the adaptability and stability of the federated update model in complex water environments.

[0181] S8.4: Perform a circular buffer write operation on the structured single historical drift state entry, append the newly generated entry to the end of the running log, and automatically remove the earliest stored historical drift state entry when the log capacity exceeds a preset threshold, so as to form a continuously updated local historical drift state record file.

[0182] When performing a circular buffer write operation on a structured single historical drift state entry, the input object is a structured data entry constructed through key-value mapping and containing parameter freeze markers and lightweight entropy flow feature sequences. The initial conditions are the current runtime log's buffer capacity threshold and the total number of stored entries. Based on the current logical tail pointer position of the buffer, the memory append write mechanism is invoked to sequentially arrange the structured entry in the physical storage space to the position pointed to by the tail pointer, completing the append storage at the end of the entry. Relying on the real-time comparison calculation between the log capacity threshold and the entry counter, when the entry counter value is greater than the capacity threshold, an automatic eviction process is initiated. This process locates the earliest stored historical drift state entry by traversing the index table and releases the storage unit it occupies, achieving a circular overwrite update of the buffer. Combined with the pointer incrementing circular index maintenance mechanism, the tail pointer and head pointer are synchronously adjusted to ensure the timing consistency and data chain continuity of entry appending and eviction actions. After completing the entry eviction and tail append, the file refresh function is called to solidify the current state of the buffer into a local historical drift state record file, forming a continuously updated data set that can be used for subsequent asynchronous uploading and cloud backtracking. By using sequential appending and threshold culling in a circular buffer, the key-value mapping result from the previous step is transformed into a structured local historical drift state record with adaptive capacity updates, thus achieving real-time maintenance and long-term space stability of the runtime log.

[0183] For example, in an ICP emission spectroscopy real-time analysis system deployed at a water quality metal detection site, the size of structured historical drift state entries is set to 512 bytes, the buffer capacity threshold is configured to 2048 entries, and the length of the circular index table is equal to the capacity threshold. When the system runs continuously and generates the 2050th entry, the entry counter value of 2050 is greater than the capacity threshold, triggering a culling process. The index table is traversed to locate entry number 0001 and its storage unit is released. The new entry is appended to the tail pointer position, and the tail pointer is incremented from 2048 to 1, achieving circular coverage. During the file refresh phase, a synchronous write function is called to solidify the buffer state into a log file, recording all structured data from entry numbers 0002 to 2050. This implementation maintains the buffer occupancy within the capacity threshold even after multiple culling triggers, ensuring that the log file remains available and without storage overflow under high-frequency drift event recording. At the same time, the circular index maintenance ensures the temporal continuity of entries, facilitating accurate recovery of the temporal evolution trajectory of drift feature sequences during cloud backtracking.

[0184] S8.5: Based on the latest entry in the local historical drift state record file, trigger an asynchronous network transmission command to upload a statistical summary containing the evolution trend of the three-dimensional entropy flow state vector and the frequency of parameter freezing actions to the cloud server, so as to generate global drift knowledge base data for cloud quality backtracking and model federation updates.

[0185] This application also provides an ICP emission spectrum adaptive baseline calibration system for water metal detection, characterized in that the original spectral intensity sequence is baseline calibrated using an ICP emission spectrum adaptive baseline calibration method for water metal detection.

[0186] For those skilled in the art, various other corresponding changes and modifications can be made based on the technical solutions and concepts described above, and all such changes and modifications should fall within the protection scope of the claims of this invention.

[0187] Unless otherwise defined, the technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this application pertains. The terms “first,” “second,” “third,” and similar terms used in this patent application specification and claims do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Similarly, the terms “an” or “a” and similar terms do not indicate a quantity limitation, but rather indicate the presence of at least one. The terms “comprising” or “including” and similar terms mean that the elements or objects preceding “comprising” or “including” encompass the elements or objects listed following “comprising” or “including” and their equivalents, and do not exclude other elements or objects. The “multiple” mentioned in the embodiments of this application refers to two or more. A and / or B indicate three possibilities: A; B; and A and B.

[0188] The above description is merely an exemplary embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and such modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. An adaptive baseline calibration method for ICP emission spectra in water metal detection, specifically including: S1: Obtain the original spectral intensity sequence output by the inductively coupled plasma atomic emission spectrometer in the continuous scanning cycle under the scenario of metal detection in water, and perform point-by-point first-order differential operation on the original spectral intensity sequence to generate a differential spectral sequence. S2: Divide the differential spectral sequence into several non-overlapping sliding sub-windows with a fixed length, normalize the data in each non-overlapping sliding sub-window and construct a probability distribution histogram, and calculate the Shannon entropy value of the sub-window. S3: Construct a differential entropy time series based on continuous sub-window Shannon entropy values, and perform sliding window statistical analysis on the differential entropy time series to extract three features: mean, standard deviation, and slope change rate, and synthesize a three-dimensional entropy flow state vector; S4: Initialize the isolated forest algorithm with a small number of initial drift-free samples to form an online anomaly detector, and input the three-dimensional entropy flow state vector into the online anomaly detector to determine in real time whether the current spectral signal has experienced an entropy flow mutation event that exceeds the stability boundary; S5: If the online anomaly detector determines that an entropy flow mutation event has occurred, the parameter freezing action is triggered, and the best baseline fitting parameter set obtained through multiple rounds of iterative optimization in the previous stable period is locked as the current calibration benchmark, generating the frozen baseline fitting parameter set and parameter freezing mark. S6: Based on the frozen baseline fitting parameter set as the initial value, perform a fast gradient descent fine-tuning operation with a limited step size within a local window composed of the most recent several frames of spectral data to generate a dynamic calibration parameter set that can respond to the real drift trend and suppress parameter oscillations. S7: Perform baseline compensation calculations on the original spectral intensity sequence using the dynamic calibration parameter set, and output calibrated spectral data with baseline drift interference eliminated.

2. The adaptive baseline calibration method for ICP emission spectrum in water metal detection according to claim 1, characterized in that, The differential spectral sequence characterizes the instantaneous rate of change of the spectral signal.

3. The adaptive baseline calibration method for ICP emission spectrum in water metal detection according to claim 1, characterized in that, The Shannon entropy value of the sub-window represents the local signal disorder.

4. The adaptive baseline calibration method for ICP emission spectrum in water metal detection according to claim 1, characterized in that, The three-dimensional entropy flow state vector characterizes the baseline drift state evolution trend.

5. The adaptive baseline calibration method for ICP emission spectrum in water metal detection according to claim 1, characterized in that, Following S7, the following also includes: S8: Synchronously write the three-dimensional entropy flow state vector and the parameter freeze flag that identifies the parameter freeze action into the runtime log to form a historical drift state record.

6. The adaptive baseline calibration method for ICP emission spectrum in water metal detection according to claim 1, characterized in that, S3 specifically includes: Based on the continuous sub-window Shannon entropy values, the time sequence is arranged to generate a differential entropy time series that characterizes the continuous evolution of the local disorder of the spectral signal over time. Perform a fixed-length sliding window truncation operation on the differential entropy time series to generate a local entropy stream data window containing information from the current time and historical time. The arithmetic mean calculation is performed based on the numerical distribution within the local entropy stream data window to extract the differential entropy mean feature that characterizes the overall offset level of baseline drift. The standard deviation is calculated using the numerical fluctuation amplitude within the local entropy flow data window to extract the differential entropy standard deviation feature that characterizes the intensity of baseline drift noise interference. Based on the change trajectory of the mean differential entropy feature within the local entropy flow data window, linear regression slope calculation is performed to extract the differential entropy slope change rate feature, which characterizes the trend of baseline drift rate change. The mean differential entropy feature, the standard deviation differential entropy feature, and the slope change rate feature are then fused to construct a three-dimensional entropy flow state vector.

7. The adaptive baseline calibration method for ICP emission spectrum in water metal detection according to claim 1, characterized in that, S4 specifically includes: Obtain a sequence of three-dimensional entropy flow state vectors corresponding to a small number of initial drift-free samples, and perform an isolation tree construction operation on the three-dimensional entropy flow state vector sequence to generate an initial isolated forest model structure containing root nodes and leaf nodes; Based on the initial isolated forest model structure, the path length calculation process is performed on the continuously input current frame three-dimensional entropy flow state vector to obtain the average path length value that characterizes the difficulty of isolating the current data point. The deviation is compared with the average path length value and the preset expected path length benchmark value of normal samples to calculate the anomaly score scalar that reflects the degree of deviation of the current spectral signal from the normal distribution. Logical judgment operations are performed based on the anomaly score scalar and the dynamically updated stability boundary threshold to generate a binary mutation judgment flag that identifies whether the current spectral signal has experienced an entropy flow mutation event. Based on the result status of the binary mutation determination marker, incremental node update or parameter reset processing is performed on the initial isolated forest model structure to generate an online anomaly detector instance with continuous adaptability for use in the next cycle.

8. The ICP emission spectrum adaptive baseline calibration method for water metal detection according to claim 1, characterized in that, S5 specifically includes: Obtain the entropy flow mutation event judgment result and the current system timestamp output by the online anomaly detector, and trigger the parameter freeze control command based on the entropy flow mutation event judgment result to generate a parameter freeze trigger signal containing freeze trigger time information; In response to the parameter freeze trigger signal, the best baseline fitting parameter set obtained through multiple rounds of iterative optimization in the previous stable period is read from the historical state cache of the system running memory to obtain the historical best baseline fitting parameter set containing polynomial order, window width and weight decay coefficient. A deep clone operation is performed on the set of historical best baseline fitting parameters. The copied parameter data is written to an independent read-only calibration benchmark register using memory isolation technology to generate an initial frozen baseline fitting parameter copy that is physically isolated from the real-time update process. Integrity verification and version marking are performed on the copy of the initial frozen baseline fitting parameters. Metadata tags are generated by attaching the current spectral scan cycle number and the freezing reason code to form a set of frozen baseline fitting parameters to be activated with traceable attributes. The set of frozen baseline fitting parameters to be activated is loaded into the parameter input port of the calibration module and write access is locked to block external gradient update requests from modifying the set of parameters. The final output is the set of frozen baseline fitting parameters used for setting initial values ​​for subsequent local retraining. At the same time, an associated parameter freeze flag is generated and placed in the flag register in the system memory to indicate that a parameter freeze event has occurred in the current period.

9. An ICP emission spectrum adaptive baseline calibration system for water metal detection, characterized in that, The original spectral intensity sequence was baseline calibrated using the ICP emission spectrum adaptive baseline calibration method for water metal detection as described in claim 1.

Citation Information

Patent Citations

  • Spectral baseline correction method based on DE algorithm and non-uniform B-spline curve

    CN115236062A

  • Multi-band multipurpose spectrum filtering system

    CN119646423A