Detailed Description
The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic views illustrating only the basic structure of the present invention in a schematic manner, and thus show only the constitution related to the present invention.
As shown in fig. 1, the nuclear-simulated signal generation system of the present invention obtains values of each point of the energy spectrum curve (i.e., energy levels of the nuclear energy spectrum and counting rates of each energy level) by curve-identifying an actual nuclear energy spectrum curve and digitizing the energy spectrum curve, then randomly and directly samples the set of values by a monte carlo method to obtain random numbers related to each nuclear energy level, thereby simulating randomness of a nuclear decay process, and finally statistically processing the random numbers to obtain a simulated energy spectrum curve, and determining reliability and accuracy of the nuclear-simulated signal generation system by comparing the simulated energy spectrum curve and the actual energy spectrum curve by inversion.
Specific embodiments of the present invention are shown in examples 1 and 2 below.
Example 1
As shown in fig. 2, the present invention provides a nuclear-simulated signal generating system, including: the device comprises a processing unit and an energy spectrum curve image data acquisition unit connected with the processing unit, wherein the output end of the processing unit is connected with a detector through an analog energy spectrum curve data output unit.
Wherein the processing unit comprises: the device comprises a display controller, a curve data processing module and a data storage control module; the energy spectrum curve image data acquisition unit comprises: the device comprises a camera, a storage module, a display module, a spectral line drawing module and an image processing module connected with the camera; the image processing module is connected with the display module through the display controller so as to display an image of an actual nuclear energy spectrum curve graph shot by the camera through the display module, and the image is used for collecting data points on an energy spectrum curve to the curve data processing module through the spectral line drawing module; the curve data processing module is suitable for copying each key point of the nuclear power spectrum curve according to the displayed actual power spectrum curve graph to obtain power spectrum curve data, and the power spectrum curve data is sent to the storage module through the data storage control module to establish a power spectrum curve database.
And the energy spectrum curve image data acquisition unit further comprises: the image storage tool is connected with the storage module and used for storing the images of the actual nuclear energy spectrum graphs obtained by the image storage tool; the storage module is also connected with the image processing module, namely, the image processing module is used for filtering, denoising pretreatment, curve identification, curve characteristic extraction and interpolation treatment on the image of each actual nuclear energy spectrum curve graph obtained by the image storage tool so as to perfect and repair each point data of the missing energy spectrum curve, so that an energy spectrum curve database is established. Wherein the image saving tool is such as but not limited to an image capturing tool of a mobile phone or a PC.
The processing unit further comprises a random number generation subunit, the random number generation subunit is connected with the curve data processing module, and the random number generation subunit comprises: the nuclear signal time statistical characteristic simulation module is suitable for realizing nuclear signal time statistical characteristic simulation through random numbers subjected to exponential distribution, the random numbers subjected to exponential distribution are obtained through conversion of random numbers subjected to (0,1) uniform distribution through an inverse function method, the random numbers subjected to exponential distribution (0,1) uniform distribution are suitable for being obtained through a linear congruence method, the nuclear signal amplitude statistical characteristic simulation module is suitable for obtaining amplitude values and counting rates of various energy levels through identification and digitization of an actual nuclear energy spectrum curve, the random numbers are directly sampled and output through a Monte Carlo method to simulate the randomness of a nuclear decay process, and then the random numbers are subjected to statistical processing to obtain the simulated energy spectrum curve.
The nuclear signal time statistical characteristic simulation module and the nuclear signal amplitude statistical characteristic simulation module meet the statistical characteristics of the actual nuclear decay process on time interval and amplitude.
The specific implementation of the random number generating subunit will be described in detail in example 2.
Optionally, the nuclear signal time statistical characteristic simulation module and the nuclear signal amplitude statistical characteristic simulation module are further connected to a first DAC data and control module, and the first DAC data and control module is adapted to send analog energy spectrum curve data to the detector through corresponding digital-to-analog conversion circuits.
Further, the imitation nucleus signal generation system further comprises: the device comprises a background noise generation module and a multi-channel analysis acquisition unit; the other input end of the analog energy spectrum curve data output unit is also connected with the output end of the background noise generation module, and the analog energy spectrum curve data is sent to the detector after being superimposed with noise through a signal superposition module in the analog energy spectrum curve data output unit;
specifically, the background noise generator is connected with the signal superposition module through the second DAC data and control module and a corresponding digital-to-analog conversion circuit.
The first DAC data and the second DAC data and control module are used for digital quantity transmission and controlling a subsequent digital-to-analog conversion circuit.
The multichannel analysis and acquisition unit is suitable for acquiring the statistical data of the nuclear pulse and sending the statistical data to a data analysis and spectral line data processing module in the processing unit, and the data analysis and spectral line data processing module is connected with the random number generation subunit.
As an alternative embodiment of the multi-channel analysis acquisition unit, the multi-channel analysis acquisition unit includes: the output end of the preamplifier is respectively connected with the input ends of the sampling and holding circuit and the energy level detection circuit; the output end of the sampling and holding circuit is connected with the data analysis and spectral line data processing module through an ADC (analog to digital converter) and an ADC data and control module in the processing unit so as to obtain a real energy spectrum of the nuclear signal and realize calibration and calibration of the analog energy spectrum curve data; the output end of the energy level detection circuit is connected with the input end of a peak detection and control module in the processing unit, and two control output ends of the peak detection and control module are respectively connected with the control input end of the sampling and holding circuit and the control input end of the ADC data and control module.
And the other output end of the data analysis and spectral line data processing module is connected with the display controller and is connected with the data storage control module through the display controller. The output end of the energy level detection circuit is connected with the input end of the peak detection and control module, and the two control output ends of the peak detection and control module are respectively connected with the control input end of the sampling and holding circuit and the control input end of the ADC data and control module.
The ADC data and control module is used for analog quantity transmission and controlling the analog-digital conversion circuit.
The background noise generation module is suitable for superposing the nuclear signals and the Gaussian noise to achieve the purpose of simulating real nuclear signals, and finally, the nuclear signals are captured by the nuclear detector and analyzed by the multi-channel analysis acquisition unit to verify the reliability of the system.
The specific algorithm for generating noise by the background noise generation module is as follows:
assuming that (X, Y) is a set of random variables that are independent of each other and obey a normal distribution, the two-dimensional joint density function is expressed as:
the polar coordinate transformation formula can be used for obtaining: where R is 0 ≦ R, and θ is 0 ≦ 2 π, dxdy ≦ RdRd θ, so that the distribution function for R can be calculated as:
Thereby calculating F
-1 R(X) obtaining
If the random number X obeys a uniform distribution of (0,1), then 1-X also obeys a uniform distribution, and so the following substitutions may be made
U, V is random (0,1) uniformly distributed random number.
Thus, a gaussian distribution random number can be obtained from two uniformly distributed random numbers U, V transformed by equation (5) or equation (6). The normal distribution can be derived from the standard normal distribution by transformation for different parameters.
If X is N (0,1), then
σX+ε~N(ε,σ2) (7)
And, the imitation nuclear signal generating system further comprises: the feedback circuit unit is connected with the output end of the signal superposition module, and transmits feedback data to the random number generation subunit after being inverted by the feedback and calibration module in the processing unit; and/or sending a feedback signal to the input of the preamplifier (via an analog control switch).
Optionally, the feedback circuit unit includes: the gain module is connected with the output end of the signal superposition module, the ADC module is connected with the gain module, and the ADC module inverts data through the feedback and calibration module and then transmits the inverted data to the random number generation subunit.
The specific implementation process comprises the following steps:
the gain G of the superposed signal of the kernel signal and the noise signal is 1 time through a feedback circuit, the superposed signal is output to a random number generating system through A/D conversion and is resampled to obtain DfeedbackAnd transmitted to a multi-channel analyzer to obtain Dinput. The error coefficient k can be obtained by comparing the energy spectrum curve data obtained by the two modes:
k=Dinput/Dfeedback (8)
when the system is running, the final output signal actual value is:
Doutput=k*Dinitial (9)
and the output end of the gain module is also communicated to the input end of the preamplifier through an analog control switch, and is suitable for introducing a feedback signal into the multi-channel analysis and acquisition unit, and the analog control switch is responsible for switching on or switching off the feedback signal and can realize high and low levels.
Each functional module and subunit in the processing unit can be realized by adopting an FPGA.
And the processing unit is also provided with a USB interface which is connected with the random number generation subunit so as to facilitate the data debugging of the PC.
Example 2
As shown in fig. 3, on the basis of embodiment 1, the present invention further provides a working method of the artificial nucleus signal generation system, which includes the following steps:
step S1, acquiring an actual nuclear energy spectrum curve graph through an energy spectrum curve image data acquisition unit; and
step S2, the actual nuclear power spectrum curve is processed by the random number generation subunit to obtain a simulated power spectrum curve.
Optionally, the artificial nucleus signal generating system further includes:
and step S3, comparing the simulated energy spectrum curve with the actual energy spectrum curve through inversion of a multi-channel analysis acquisition unit to obtain the error between the simulated energy spectrum curve and the actual energy spectrum curve.
Further, as shown in fig. 4, the method for processing the actual nuclear spectrum graph by the random number generation subunit in step S2 to obtain the simulated spectrum curve includes:
step S21, carrying out curve identification on the actual nuclear spectrum curve graph and digitizing the energy spectrum curve to obtain the numerical value of each point of the energy spectrum curve; step S22, directly sampling the group of values randomly by a Monte Carlo method to obtain random numbers about each nuclear energy level so as to simulate the randomness of the nuclear decay process; and step S23, carrying out statistical processing on the random number to obtain the simulated energy spectrum curve.
Specifically, the method for performing curve identification on the actual nuclear power spectrum curve graph and digitizing the power spectrum curve to obtain the numerical value of each point of the power spectrum curve in step S21 includes:
filtering and denoising an image of each spectrum curve graph of the actual nuclear energy, displaying the actual spectrum curve graph, copying each key point of the nuclear energy spectrum curve according to the displayed actual spectrum curve graph to obtain energy spectrum curve data so as to establish an energy spectrum curve database; or filtering the image of each spectrum curve graph of the actual nuclear energy, carrying out noise reduction pretreatment, curve identification, curve characteristic extraction and interpolation treatment to perfect and repair each point data of the missing energy spectrum curve so as to establish an energy spectrum curve database.
Wherein, the method for randomly and directly sampling the group of values by the monte carlo method in step S22 to obtain random numbers about each nuclear energy level to simulate the randomness of the nuclear decay process comprises: and simulating the time statistical characteristic of the nuclear signal and the amplitude statistical characteristic of the nuclear signal.
The method for simulating the time statistical characteristics of the nuclear signals comprises the following steps: the kernel signal time statistical characteristic simulation is realized by random numbers which obey exponential distribution, wherein the exponential distribution random numbers are obtained by converting (0,1) uniformly distributed random numbers through an inverse function method, and the (0,1) uniformly distributed random numbers are suitable for being obtained through a linear congruence method.
Specifically, the method for obtaining (0,1) uniformly distributed random numbers by the linear congruence method is as follows:
the recursion formula of the linear congruence method is as follows:
xi+1≡λxi+c(mod M) (10)
wherein λ, c are constants. Selected initial x1Called as seeds, has certain influence on the generation quality of random numbers, and the values are respectively 1-21665535. For use on a computer, it is common to take
M=2SWhere S is the maximum possible significand of the binary in the computer.
FIG. 5 shows the distribution of 10000 (0,1) random numbers
The method for generating the exponential distribution random number, namely the exponential distribution random number can be realized by an inverse function method, and the specific process is as follows:
let the distribution function of the random variable X obey an exponential distribution:
F(x)=1-e-ax,x≥0 (12)
where a is a time constant and e is a natural base.
From the above formula, F (x) E [0, 1) is monotonically decreased in the domain of definition, so that the function F (x) must have an inverse function between 0 and + ∞, and the inverse function is calculated as:
since 0 < 1-F (x) is less than or equal to 1, the above formula can be simplified to
From equation (14), it can be known that the exponential distribution-compliant random number x is obtained from the random number samples uniformly distributed in accordance with (0, 1).
Get
The distribution diagram of the exponentially distributed random numbers generated by the above unit-average distributed random numbers through the inverse function method is shown in fig. 6. The value ranges of the exponential distribution random numbers are evenly divided into 1000 group moments and are counted, and a final statistical graph is shown in fig. 7.
The method for simulating the amplitude statistical characteristic of the nuclear signal comprises the following steps: identifying and digitizing the actual nuclear energy spectrum curve to obtain the amplitude value and the counting rate of each energy level, and directly sampling and outputting the random number by a Monte Carlo method; wherein the process of identifying and digitizing the actual nuclear spectrum curve comprises:
step S221, filtering and denoising the actual energy spectrum curve graph; step S222, calculating a threshold value by a maximum inter-class segmentation method, carrying out binarization processing on an energy spectrum curve graph, and extracting the numerical value, namely the coordinate, of each point on the energy spectrum curve by a pixel point scanning method; step S223, repairing and digitizing the spectrum curve.
Specifically, the method for directly sampling and outputting the random number by the monte carlo method is to directly sample the energy spectrum curve and each point value on the curve by the monte carlo method to obtain a series of random numbers, so as to simulate the randomness of the nuclear decay process.
In the step S221, the method for filtering the actual energy spectrum curve graph is to perform wiener filtering on the actual energy spectrum curve graph to filter gaussian noise in the energy spectrum curve graph, so as to reduce interference caused by the noise as much as possible.
The specific implementation process of the method for simulating the amplitude statistical characteristic of the nuclear signal is as follows:
the specific implementation steps of filtering and denoising the actual energy spectrum curve graph in the step S221 are as follows:
and filtering and denoising the actual energy spectrum curve graph through wiener filtering, namely the wiener filter is a linear filter and is also an optimal estimator for a stationary process based on a minimum mean square error criterion.
Let the wiener filter input signal be s (t), and superimpose the noise n (t). The output signal x (t) is obtained by the following convolution operation through the filter g (t):
x(t)=g(t)*(s(t)+n(t)) (15)
for the estimated signal x (t), it is expected to be equivalent to s (t).
The error is as follows: e (t) ═ s (t + d) -x (t) (16)
The variance is: e.g. of the type2(t)=s2(t+d)-2s(t+d)x(t)+x2(t) (17)
Where s (t + d) is the desired filter output.
Writing x (t) as convolution integral, i.e.
The squared error can be calculated as:
wherein R issIs the autocorrelation function of s (t), RxIs the autocorrelation function of x (t), RxsIs the autocorrelation function of x (t) and s (t). The final goal of wiener filtering is to optimize g (t) such that E (E)2) And minimum.
In step S222, a threshold value is obtained by a maximum inter-class segmentation method, a power spectrum curve graph is subjected to binarization processing, and a pixel point scanning method is used to extract a numerical value, i.e., a coordinate, of each point on the power spectrum curve;
the specific algorithm process of the maximum inter-class variance method is as follows:
setting the gray value of an image as 1-m, wherein the number of pixel points with the gray value of i is n
iAnd N represents the total number of image pixels, so that the probability of the occurrence of a gray value i is as follows:
let the gray value be greater than the threshold k and be C1The set, i.e., C1 is [1 to k ], and the gray value greater than the threshold k is C2Group C2K +1 to m, then C1And C2The probabilities of occurrence are:
calculating to obtain C1And C2The mean gray level of (d) is:
wherein the content of the first and second substances,
then it is obtained:
μr=ω1·μ1+ω2·μ2 (25)
from this, the variance σ between the two groups can be calculated2Comprises the following steps: sigma2(k)=ω1(μ1-μr)2+ω2(μ2-μr)2 (26)
Substitution of formula (25) for formula (26) can give: sigma2(k)=ω1ω2(μ2-μ1)2
Then the optimum threshold T*=Arg max{σ2(k)},0≤k<m-1 (27)
Finding a segmentation threshold T*=0.6353。
The concrete steps of repairing and digitizing the spectrum curve in the step S223 are as follows:
after filtering, denoising and binarization are carried out on an actual nuclear energy spectrum curve graph, numerical values, namely coordinates, of all points on the nuclear energy spectrum curve are extracted, energy spectrum curve characteristics need to be extracted, and the curve is digitized. The specific process is as follows:
firstly, identifying straight lines, namely, scanning rows and columns of a binary image of a nuclear energy spectrum curve to identify straight lines in a nuclear energy spectrum;
secondly, at a fixed point, judging the horizontal coordinates and the vertical coordinates of a coordinate system where the energy spectrum curve is located according to the identified straight lines, positioning an original point, generally scanning from top to bottom and from left to right, and identifying the first straight line as the horizontal coordinates and the vertical coordinates;
thirdly, extracting the characteristic of the energy spectrum curve. In order to reduce the influence of the frame and the coordinates in the image on the curve, the frame needs to be filtered. After the frame is filtered, the pixel point scanning method scans the point with the pixel point being 0 line by line or line by line (black is 0 and white is 1 in the binary image).
Finally, the curve is digitized. After the curve is extracted, the position of the pixel point in the graph is determined by calculating the distance between the horizontal line and the vertical line from the scanned effective point of the energy spectrum curve to the scanning original point, and finally the coordinate value of the pixel point is obtained by multiplying the coordinate value by a scale factor for enlarging the coordinate.
The effect of the final extraction of the energy spectrum curve features is shown in fig. 8.
And the effect of the preliminary simulation of the power spectrum curve is shown in fig. 9.
Further, as can be seen from fig. 8 and 9, the resulting simulated energy spectrum plot has data missing at some points compared to the original energy spectrum plot. In order to reflect the actual energy spectrum curve characteristics as truly as possible, the missing data needs to be filled and repaired.
Specifically, missing data points in the process of energy spectrum curve feature extraction are filled by a cubic spline interpolation method, and numerical values of each point on an energy spectrum curve graph are obtained by proportional extension of coordinates, so that missing data are effectively filled and repaired.
The specific algorithm for filling the missing data points in the process of extracting the energy spectrum curve features by the cubic spline interpolation method is as follows:
defining a piecewise function S (x) over the interval [ a, b ], if:
(x) in each subinterval [ xi,xi+1]The above is a cubic polynomial function;
(x) there is a continuous second derivative over the whole interval [ a, b ].
S (x) is the interval [ a, b ]]Above for a ═ x0<x1<…<xnB is a cubic spline function. The cubic spline interpolation problem is thus: n +1 nodes x for a given function g (x)0,x1,...,xnGet the function y0,y1,...,ynA cubic spline function s (x) is calculated so as to satisfy:
S(xj)=yj,j=0,1,...,n (28)
wherein the function S (x) is referred to as cubic spline interpolation function of g (x).
If S (x) is the cubic spline interpolation function of f (x), then the following condition must be satisfied:
interpolation conditions, i.e.
S(xj)=yj,j=0,1,...n-1
Continuity conditions, i.e.
Continuous condition of first derivative, i.e.
Second derivative continuous condition, i.e.
As shown in fig. 10, the data point after cubic spline interpolation is smoother and closer to the actual value as can be seen from the enlarged partial view of the effect diagram after cubic spline interpolation.
The actual nuclear energy spectrum curve simulation effect, that is, the energy spectrum curve simulation effect graph obtained by processing the actual nuclear energy spectrum curve through the image processing is shown in fig. 11.
Specifically, the energy spectrum curve and each point value on the curve are directly sampled by a Monte Carlo method to obtain a series of random numbers, so as to simulate the randomness of the nuclear decay process.
FIG. 12 shows an effect diagram of a process of simulating the random occurrence of a nuclear signal;
FIG. 13 shows the final effect plot of direct sampling using the Monte Carlo method (this plot is digitized from the actual energy spectrum plot to obtain an array of energy levels and count rates, then randomly sampled and counted.
The digital image processing process obtains a simulated energy spectrum curve and numerical values of each point on the curve (the abscissa is Channel and the ordinate is Count rate), and then the data is directly sampled by a Monte Carlo method to obtain a series of random energy level random numbers (the energy level is obtained by quantization of a multichannel analyzer, for example, but not limited to, the energy level is obtained by quantization of the multichannel analyzer, and the Channel is obtained by quantization of energy released in the nuclear decay process), so that the randomness of the nuclear decay process is simulated. And finally, counting the random number to obtain a simulated energy spectrum curve graph, so that the reliability and the accuracy of the system can be verified on one hand, and on the other hand, the system can be inverted to a multi-channel analyzer to calibrate the accuracy of the multi-channel analyzer.
The method is characterized in that a Monte Carlo method is adopted to carry out simulation calculation on the probability P (A) ═ p (unknown) of occurrence of a certain event A, and the specific calculation method comprises the following steps:
(1) performing N times of repeated independent sampling tests, and calculating the occurrence frequency of the event A to be NA。
Introducing a random variable XiIndicates the number of occurrences of event A in the ith test, order
(2) Calculating the occurrence frequency f of the event A in N repeated independent sampling testsNIs a
(3) When N is sufficiently large, with a probability f
NAs an estimate of the probability P (A) ═ p
Is composed of
(4) Request estimation value
Unbiased estimation of the probability P (A) ═ p, i.e.
And direct sampling, i.e. the characteristics of the nuclear signal in time and amplitude are modeled as two sets of random numbers obeying different distributions, while the random numbers are discrete and discontinuous. For discrete random sequence sampling, the direct sampling method is ideal.
The discrete distribution direct sampling method comprises the following specific sampling processes:
setting the value range of the discrete random variable XEnclose as X
i(i ═ 0,1,2,3 …) with a probability distribution P (X ═ X)
i)=P
i(i ═ 0,1,2,3 … …). Wherein P is
i≥0,
(1) Generating random numbers r uniformly distributed on the (0,1) interval;
(2) obtaining a positive integer n equal to 0,1,2 so that r satisfies
(3) Extracting a sample value of a discrete random variable X as X ═ Xn. And when 0<r≤P0When X is equal to X0;
(4) And (4) repeating the steps (1), (2) and (3) until n sample values are extracted.
If the random number r is in the interval due to the generation of (0,1) uniform distribution
Has a probability of
Namely an event
The probability of occurrence is equivalent to the event X ═ X
nThe probability of occurrence.
And because the random number r obeys a uniform distribution over (0,1), its probability density function is
The distribution function is as follows:
so the generated random number r is taken as the middle sample value X ═ XnHas a probability of
From this, it can be seen that (X ═ X) is extracted by the direct sampling methodn) Is equivalent to a random number XnIn a random number sequence X1,X2,...XnThe frequency of occurrence.
The reliability for the direct sampling method can be demonstrated by:
let X be a discrete random variable with a probability distribution of P
i=P{X=X
iWhere i is 1,2, …. X is independently P
iObtaining X
iThen, then
Event | X-E (X) | ≧ ε indicates that random variable X gets all inequalities | X that satisfy
iPossible values X of E (X) | ≧ ε
iThen, then
Since the event X ═ Xi(i-0, 1,2, … N)Probability of birth is pi(0<pi<1) If X is not equal to XiHas a probability of 1-piAnd each time X is equal to XiThe probability of occurrence is constant and each sampling result is independent of the other sampling results. Thus X ═ XiA single event is a bernoulli test, then sampling n times is an n-fold bernoulli test. Let event a (X ═ X)i) The number of occurrences is nAI.e. nAB (n, p). Due to X1,X2,…,XnAre n random variables which are independent of one another and follow a distribution of 0 to 1 with the parameter p, and
is provided with
Given an arbitrary ε > 0, then
Can be derived from the formula (4.31)
Thus can be pushed to
Is simple and easy to obtain
That is, the larger the number of times n of sampling, the closer the frequency ratio of the number of times of occurrence of the event a after sampling to the total number of samples is to the probability of occurrence of the event a.
The error of the direct sampling random number is:
order to
Thus, it is possible to provide
Namely, it is
Is an unbiased estimate of p and,
i.e. the greater the number of samples n, the estimated value
The closer to the theoretical value p.
In light of the foregoing description of the preferred embodiment of the present invention, many modifications and variations will be apparent to those skilled in the art without departing from the spirit and scope of the invention. The technical scope of the present invention is not limited to the content of the specification, and must be determined according to the scope of the claims.