Invention content
The object of the present invention is to provide a kind of simulation spectrum curve emulation modes, are emulated to nuclear energy spectral line with realizing.
In order to solve the above technical problem, the present invention provides a kind of simulation spectrum curve emulation modes, which is characterized in that
Include the following steps:Step S1 obtains practical nuclear spectrum curve graph;And step S2, at practical nuclear spectrum curve graph
Reason is to obtain simulation spectrum curve.
Further, the simulation spectrum curve emulation mode further includes:Step S3 compares simulation spectrum curve by inverting
With practical spectrum curve, the error between spectrum curve and practical spectrum curve is simulated with acquisition.
Further, practical nuclear spectrum curve graph is handled to obtain the method packet of simulation spectrum curve in step S2
It includes:Step S21 carries out Curves Recognition to practical nuclear spectrum curve graph and spectrum curve quantizes, each to obtain spectrum curve
The numerical value of point;Step S22 is obtained by Monte Carlo method this group of numerical value of random direct sampling about the random of each nuclear level
Number, to simulate the randomness of nuclear decay process;And step S23, statistical disposition is carried out to the random number and obtains the simulation
Spectrum curve.
Further, Curves Recognition is carried out to practical nuclear spectrum curve graph in the step S21 and spectrum curve quantizes
Include in the method for obtaining the numerical value of spectrum curve each point:Practical nuclear energy is respectively set a song to music after the filtered denoising of image of line chart
Practical spectrum curve figure is shown again, and copies each key of the nuclear energy spectral curve according to the practical spectrum curve figure of display
Point obtains spectrum curve data, to establish spectrum curve database;Or by practical nuclear energy respectively set a song to music line chart image it is filtered, drop
Pretreatment, Curves Recognition, curvilinear characteristic extraction, and progress interpolation processing make an uproar to improve and repair each point of missing spectrum curve
Data, to establish spectrum curve database.
Further, it is obtained about each nuclear energy by Monte Carlo method this group of numerical value of random direct sampling in step S22
Grade random number include in the method for simulating the randomness of nuclear decay process:Nuclear signal time statistical property is simulated;And core letter
Number amplitude statistics simulated behavior.
Further, the method for the nuclear signal time statistical property simulation includes:By the random number for obeying exponential distribution
Realize the simulation of nuclear signal time statistical property, wherein
The random number of exponential distribution by (0,1] equally distributed random number converts to obtain by inverse function method, and (0,1]
Even distribution random numbers are suitable for acquiring by linear congruential method.
Further, the method for the nuclear signal amplitude statistics simulated behavior includes:
By to practical nuclear spectrum Curves Recognition and digitizing and obtaining each energy level amplitude and counting rate, then pass through Monte Carlo
Method direct sampling simultaneously exports the random number;Wherein
Identification and digitized process to practical nuclear energy spectral curve include:
Step S221 is filtered practical spectrum curve figure, noise reduction;
Step S222 finds out threshold value by split plot design between maximum kind, and by spectrum curve figure progress binary conversion treatment, then by
Pixel scanning method extracts the numerical value i.e. coordinate of each point on spectrum curve;
Step S223, repairs spectrum curve and is quantized.
Further, described by Monte Carlo method direct sampling and the method that exports the random number, i.e.,
It is a series of random to obtain by each point value on Monte Carlo method direct sampling spectrum curve and curve
Number, to simulate the randomness of nuclear decay process.
Further, the method practical spectrum curve figure being filtered in the step S221, i.e., to practical spectrum curve
Figure carries out Wiener filtering processing, to filter out the Gaussian noise in spectrum curve figure.
Further, the method repaired and quantized to spectrum curve in the step S223 includes:Pass through sample three times
Interpolation method is stretched by the expansion of the ratio of coordinate to obtain to fill up the data point lacked during spectrum curve feature extraction
Obtain the numerical value of each point on spectrum curve figure.
The invention has the advantages that the simulation spectrum curve emulation mode of the present invention passes through to practical nuclear spectrum curve graph
Carry out Curves Recognition simultaneously spectrum curve is quantized, to obtain spectrum curve each point numerical value (i.e. the energy level of nuclear spectrum and respectively
The counting rate of energy level), then by this group of numerical value of the random direct sampling of Monte Carlo method with obtain about each nuclear level with
Machine number finally carries out statistical disposition to the random number again and obtains simulating and can set a song to music to simulate the randomness of nuclear decay process
Line, by inverting comparative simulation spectrum curve and practical spectrum curve to determine the reliability and accurately of imitative nuclear signal generator
Property.
Specific implementation mode
In conjunction with the accompanying drawings, the present invention is further explained in detail.These attached drawings are simplified schematic diagram, only with
Illustration illustrates the basic structure of the present invention, therefore it only shows the composition relevant to the invention.
As shown in Figure 1, the simulation spectrum curve emulation mode of the present invention to practical nuclear spectrum curve graph by carrying out curve
It identifies and spectrum curve quantizes, to obtain numerical value (the i.e. meter of the energy level of nuclear spectrum and each energy level of spectrum curve each point
Digit rate), then by Monte Carlo method this group of numerical value of random direct sampling to obtain the random number about each nuclear level, to
The randomness of nuclear decay process is simulated, finally carrying out statistical disposition to the random number again obtains simulation spectrum curve, by anti-
Comparative simulation spectrum curve is drilled with practical spectrum curve to determine the reliability and accuracy of imitative nuclear signal generator.
The specific implementation mode of the present invention is as illustrated in the examples below.
As shown in Fig. 2, a kind of simulation spectrum curve emulation mode of the present invention, includes the following steps:
Step S1 obtains practical nuclear spectrum curve graph;
Step S2 handles to obtain simulation spectrum curve practical nuclear spectrum curve graph.
Optionally, the simulation spectrum curve emulation mode further includes:
Step S3 compares simulation spectrum curve and practical spectrum curve by inverting, to obtain simulation spectrum curve and reality
Error between the spectrum curve of border.
Further, as shown in figure 3, being handled practical nuclear spectrum curve graph to obtain simulation power spectrum in the step S2
The method of curve includes:
Step S21 carries out Curves Recognition to practical nuclear spectrum curve graph and spectrum curve quantizes, to obtain to set a song to music
The numerical value of line each point;Step S22 is obtained by Monte Carlo method this group of numerical value of random direct sampling about each nuclear level
Random number, to simulate the randomness of nuclear decay process;And step S23, random number progress statistical disposition is obtained described
Simulate spectrum curve.
Specifically, carrying out Curves Recognition to practical nuclear spectrum curve graph in the step S21 and spectrum curve quantizing
Include in the method for obtaining the numerical value of spectrum curve each point:
Practical nuclear energy is respectively set a song to music and is again shown practical spectrum curve figure after the filtered denoising of image of line chart,
And each key point that the nuclear energy spectral curve is copied according to the practical spectrum curve figure of display obtains spectrum curve data, to establish energy
Spectral curve database;Or by practical nuclear energy respectively set a song to music line chart image is filtered, noise reduction pretreatment, Curves Recognition, curvilinear characteristic
Extraction, and interpolation processing is carried out to improve and repair each point data of missing spectrum curve, to establish spectrum curve database.
Wherein, it is obtained about each core by Monte Carlo method this group of numerical value of random direct sampling in the step S22
The random number of energy level includes in the method for simulating the randomness of nuclear decay process:Nuclear signal time statistical property is simulated and nuclear signal
Amplitude statistics simulated behavior.
The method of nuclear signal time statistical property simulation includes:Random number by obeying exponential distribution realizes core letter
The simulation of number time statistical property, the wherein random number of exponential distribution by (0,1] equally distributed random number become by inverse function method
Get in return, and (0,1] uniform random number be suitable for acquired by linear congruential method.
Specifically, acquired by linear congruential method (0,1] method of uniform random number is as follows:
The recurrence formula of linear congruential method is as follows:
xi+1≡λxi+c(mod M) (1)
Wherein λ, c are constant.The initial x chosen1Referred to as seed has certain influence, value to the generation quality of random number
Respectively 1~216It is chosen between=65535.For the ease of using on computers, usually take
M=2S, wherein S is binary maximum possible number of significant digit in computer.
Fig. 4 be take 10000 (0,1] random-number distribution situation
The production method of exponential distribution random number, i.e. exponential distribution random number can be realized that detailed process is such as by inverse function method
Under:
If the distribution function of stochastic variable X obeys exponential distribution:
F (x)=1-e-ax, x >=0 (3)
Wherein, a is a time constant, and e is the nature truth of a matter.
Can be with by above formula, F (x) ∈ [0,1), and the monotone decreasing in domain, therefore function F (x) must have in 0~+∞
Inverse function seeks its inverse function:
Due to 0 < 1-F (x)≤1, above formula can be reduced to
By formula (5) it can be seen that by meet (0,1] equally distributed Random sampling obtains obeying exponential distribution random number x.
It takesThe exponential distribution random-number distribution generated by inverse function method by the equal distribution random numbers of the above unit
Figure such as Fig. 5.1000 group squares are evenly dividing to the above exponential distribution random number value range and are counted, final statistical chart is such as
Shown in Fig. 6.
The method of the nuclear signal amplitude statistics simulated behavior includes:By to practical nuclear spectrum Curves Recognition and digitizing
Each energy level amplitude and counting rate are obtained, then by Monte Carlo method direct sampling and exports the random number;Wherein to reality
The identification of nuclear energy spectral curve and digitized process includes:
Step S221 is filtered practical spectrum curve figure, noise reduction;Step S222 is asked by split plot design between maximum kind
Go out threshold value, and spectrum curve figure is subjected to binary conversion treatment, then extracts the number of each point on spectrum curve by pixel scanning method
Value is coordinate;Step S223, repairs spectrum curve and is quantized.
Specifically, described by Monte Carlo method direct sampling and the method that exports the random number, that is, pass through cover it is special
A series of each point value on Caro method direct sampling spectrum curve and curve, to obtain random random numbers, to mould
The randomness of nucleoid decay process.
The method being filtered to practical spectrum curve figure in the step S221 is tieed up practical spectrum curve figure
It receives and is filtered, to filter out the Gaussian noise in spectrum curve figure, to reduce the interference of grass as far as possible.
The specific implementation process of the method for the nuclear signal amplitude statistics simulated behavior is as follows:
Practical spectrum curve figure is filtered in the step S221, the specific implementation step of noise reduction it is as follows:
Practical spectrum curve figure is filtered by Wiener filtering, noise reduction process, i.e., the described Wiener filter is one kind
Linear filter, and a kind of still optimal estimation device based on minimum mean square error criterion, to stationary process.
Assuming that Wiener filter input signal is s (t), superimposed noise n (t).Output signal x (t) passes through filter g (t)
It is obtained by following convolution algorithm:
X (t)=g (t) * (s (t)+n (t)) (6)
For the signal x (t) estimated, it is expected that being equal to s (t).
Its error is:E (t)=s (t+d)-x (t) (7)
Variance is:e2(t)=s2(t+d)-2s(t+d)x(t)+x2(t) (8)
Wherein s (t+d) is desired filter output.
Write x (t) as convolution integrals, i.e.,
Square error, which can be calculated, is:
Wherein RsIt is the auto-correlation function of s (t), RxIt is the auto-correlation function of x (t), RxsIt is the auto-correlation of x (t) and s (t)
Function.The final purpose of Wiener filtering is exactly to seek optimal g (t) so that E (e2) minimum.
Threshold value is found out by split plot design between maximum kind in the step S222, and spectrum curve figure is carried out at binaryzation
It manages, then extracts the numerical value i.e. coordinate of each point on spectrum curve by pixel scanning method;
The specific algorithm process of maximum variance between clusters is as follows:
If the gray value of piece image is 1~m, the pixel number that wherein gray value is i is ni, N expression image pixels
Point sum, then the probability that gray value is i appearance is:
It is c to enable gray value be more than threshold value k1Group, i.e. c1={ 1~k }, gray value are then c more than threshold value k's2Group, c2={ k+
1~m }, then C1And C2The probability of appearance is respectively:
C is calculated1And C2Gray average be:
μr=ω1·μ1+ω2·μ2 (16)
Thus the variances sigma between two groups can be calculated2For:σ2(k)=ω1(μ1-μr)2+ω2(μ2-μr)2 (17)
Formula (16), which is substituted into formula (17), to be obtained:σ2(k)=ω2ω2(μ2-μ1)2
So optimal threshold T*=Arg max { σ2(k) }, (18) 0≤k < m-1
Acquire segmentation threshold T*=0.6353.
Spectrum curve is repaired and is quantized in the step S223 and is as follows:
It is to extract the numerical value of each point on nuclear energy spectral curve to sit after the filtered denoising of practical nuclear spectrum curve graph, binaryzation
Mark, need to extract spectrum curve feature, and curve is quantized.Detailed process is as follows:
First, Straight Line Identification identifies straight in nuclear energy spectrogram that is, by scanning the row and column of nuclear energy spectral curve binary map
Line;
Secondly, fixed point, cross, the ordinate of coordinate system where judging spectrum curve by the straight line identified, and origin is positioned,
Generally from top to bottom, it scans from left to right, the straight line identified is just horizontal, ordinate;
Third, spectrum curve feature extraction.To reduce the influence of frame and coordinate pair curve in image, frame need to be filtered
It removes.Filter out after frame again by pixel scan method line by line or scan by column point that pixel is 0 (black is 0 in bianry image,
1) white is.
Finally, curve quantizes.After extracting curve, by calculating the spectrum curve available point scanned to scan origin
Row and stringer distance determine position of the pixel in figure, be somebody's turn to do finally by the scale factor for expanding coordinate is multiplied by
The coordinate value of pixel.
Final extraction spectrum curve characteristic effect is as shown in Figure 7.
And spectrum curve Preliminary Simulation effect is as shown in Figure 8.
Further, it can be seen from Fig. 7 and Fig. 8, the spectrum curve figure of obtained simulation is compared with proper energy spectral curve in certain points
Data lack.Truly to reflect practical spectrum curve characteristic as far as possible, need that the data of missing fill up repairing
It is multiple.
Specifically, described fill up the number lacked during spectrum curve feature extraction by cubic spline interpolation
Strong point, and stretched by the expansion of the ratio of coordinate to obtain the numerical value of each point on spectrum curve figure, it is effective to the data of missing to realize
It fills up and repairs in ground.
The cubic spline interpolation fills up the specific of the data point lacked during spectrum curve feature extraction
Algorithm is as follows:
Piecewise function S (x) on interval of definition [a, b], if meeting:
1. S (x) is in each subinterval [xi, xi+1] on be a cubic polynomial function;
2. S (x) has continuous second dervative on entire section [a, b].
Then S (x) is referred to as on section [a, b] about a=x0< x1< ... < xnA cubic spline function of=b.To three
Secondary spline interpolation problem is:The n+1 node x of given function g (x)0, x1..., xnObtain function y0, y1..., yn, ask one three times
Spline function S (x) makes its satisfaction:
S(xj)=yj, j=0,1 ..., n (19)
Wherein, function S (x) is known as the cubic spline functions of g (x).
If S (x) is the sample spline interpolation function three times of f (x), the following conditions are must satisfy:
1. interpolation condition, i.e.,
S(xj)=yj, j=0,1 ..., n-1
2. the condition of continuity, i.e.,
3. the first derivative condition of continuity, i.e.,
4. the second dervative condition of continuity, i.e.,
By the design sketch after cubic spline interpolation, as shown in figure 9, can see by its partial enlarged view, cubic spline
Data point after interpolation is more smooth, more approaches actual value.
Practical nuclear spectrum curve simulation effect finally obtains practical nuclear spectrum curve graph after above-mentioned image procossing
It is as shown in Figure 10 that the spectrum curve simulates design sketch.
Specifically, by each point value on Monte Carlo method direct sampling spectrum curve and curve, to obtain a system
Random random number is arranged, to simulate the randomness of nuclear decay process.
Figure 11 shows the design sketch of the simulation random generating process of nuclear signal;
Figure 12 shows that (this figure is by practical spectrum curve figure numerical value using Monte Carlo method direct sampling final effect figure
After obtaining energy level and counting rate this array after change, what random sampling procedure and counting obtained.This figure is suitable for proving by Meng Teka
The reasonability and accuracy of sieve sampling).
Numerical value (the abscissa of each point on simulation spectrum curve and curve has been obtained by numbers above image processing process
For road location Channel, ordinate is counting rate Count), then can be obtained with this group of data of Monte Carlo method direct sampling
(energy level is such as, but not limited to quantified by multichannel analyzer a series of random energy levels, and the road location refers to nuclear decay
What the energy of process release obtained after multichannel analyzer quantifies) random number, to simulate the randomness of nuclear decay process.Most
The random number is counted again afterwards, simulation spectrum curve figure can be obtained, on the one hand can verify the reliable of system in this way
Property and accuracy, on the other hand can also inverting in multichannel analyzer, to demarcate the accuracy of multichannel analyzer.
Simulation calculating is carried out to probability P (A)=p (unknown) that certain event A occurs using Monte Carlo method, it is specific to count
Calculation method:
(1) n times are carried out and repeat independent sampling experiment, calculating event A frequencies are nA。
Introduce stochastic variable Xi, indicate event A frequencies in ith experiment, enable
(2) occurrence frequency fs of the event A in n times repeat independent sampling experiment is calculatedN, it is
(3) when N is fully big, with probability fNEstimated value as probability P (A)=pFor
(4) estimated value is requiredFor the unbiased esti-mator of probability P (A)=p, i.e.,
And direct sampling, the i.e. characteristic to nuclear signal on time and amplitude are with the random of two groups of obedience different distributions
Number is simulated, and random number be it is discrete, it is discontinuous.Sampling for discrete random sequence, the non-convention of direct sampling method
Think.
The specific sampling process of discrete distribution direct sampling method is as follows:
If the value range of discrete random variable X is Xi(i=0,1,2,3 ...), probability distribution is
P (X=Xi)=Pi(i=0,1,2,3 ...).Wherein Pi>=0,
(1) equally distributed random number r on (0,1) section is generated;
(2) positive integer n=0,1,2... are acquired so that r meets
(3) sample value for extracting discrete random variable X is X=Xn.And when 0<r≤P0When X=X0;
(4) step (1), (2), (3) are repeated until extracting n sample value.
Due to generation (0,1) if equally distributed random number r is in sectionProbability be
That is eventThe probability of appearance is equal to event X=XnThe probability of generation.
Again because random number r obeys being uniformly distributed on (0,1), probability density function is
Its distribution function is as follows:
Therefore it is X=x that the random number r generated, which draws sample value,nProbability be
It follows that being drawn into (X=X by direct sampling methodn) probability be equivalent to random number XnIn random number sequence X1,
X2... XnThe frequency of appearance.
It can be by following proof for direct sampling method reliability:
If X is discrete random variable, probability distribution Pi=P { X=Xi, wherein i=1,2 ....X is respectively with PiIt takes
Obtain Xi, thenEvent | X-E (X) | >=ε indicates that stochastic variable X acquirements are all and meets inequality | Xi- E (X) | >=ε's can
It can value Xi, then
Due to event X=XiThe probability that (i=0,1,2 ... N) occurs is pi(0<pi<1), then X ≠ XiProbability then be 1-
pi, and each X=XiThe probability of generation is constant, and sampling results are unrelated with other each times extraction results every time.Therefore X=Xi
Individual event is a bernoulli experiment, then n times of sampling, then be n again Bernoulli trials.If enabling event A (X=Xi) occur
Number is nA, i.e. nA~B (n, p).Due to X1, X2..., XnIt is n independently of each other and obeys the random of the 0-1 distributions that parameter is p
Variable, and
HaveD (Xi)=p (1-p), i=1,2 ... n.Giving arbitrary ε > 0 then has
It can be derived from by (4.31) formula
Therefore it can be derived from
Abbreviation obtains
I.e. when the frequency n of extraction is bigger, the frequency ratio of event A occurs after sampling number and population of samples is closer to thing
The probability that part A occurs.
By direct sampling extraction random number, its error is:
It enablesTherefore
I.e.It is the unbiased esti-mator of p,
That is the number of sampling n is bigger, estimated valueCloser to theoretical value p.
It is enlightenment with above-mentioned desirable embodiment according to the present invention, through the above description, relevant staff is complete
Various changes and amendments can be carried out without departing from the scope of the technological thought of the present invention' entirely.The technology of this invention
Property range is not limited to the contents of the specification, it is necessary to determine its technical scope according to right.