Content of the invention
It is an object of the invention to provide a kind of simulation spectrum curve emulation mode, to realize nuclear energy spectral line is carried out
Emulation.
In order to solve above-mentioned technical problem, the invention provides a kind of simulation spectrum curve emulation mode, it is special
Levy and be, comprise the steps:Step S1, obtains actual nuclear spectrum curve chart;And step S2, to reality
Border nuclear spectrum curve chart is processed to obtain simulation spectrum curve.
Further, described simulation spectrum curve emulation mode also includes:Step S3, compares simulation by inverting
Spectrum curve and actual spectrum curve, to obtain the error between simulation spectrum curve and actual spectrum curve.
Further, in step S2, actual nuclear spectrum curve chart is processed to obtain the side of simulation spectrum curve
Method includes:Step S21, carries out Curves Recognition and spectrum curve quantizes to actual nuclear spectrum curve chart, with
Obtain the numerical value of spectrum curve each point;Step S22, by this group number of the random direct sampling of DSMC
It is worth to the random number with regard to each nuclear level, to simulate the randomness of nuclear decay process;And step S23, right
Described random number carries out statistical disposition and obtains described simulation spectrum curve.
Further, in described step S21, actual nuclear spectrum curve chart is carried out with Curves Recognition and by spectrum curve
The method of the numerical value to obtain spectrum curve each point of quantizing includes:Actual nuclear energy is respectively set a song to music the image of line chart
Again actual spectrum curve figure is shown after filtered denoising, and the actual spectrum curve according to display
Each key point that figure copies this nuclear energy spectral curve obtains spectrum curve data, to set up spectrum curve data base;
Or by actual nuclear energy respectively set a song to music line chart image is filtered, noise reduction pretreatment, Curves Recognition, curvilinear characteristic carry
Take, and carry out interpolation processing to improve and to repair each point data of disappearance spectrum curve, can be set a song to music with setting up
Line data base.
Further, in step S22 by this group numerical value of the random direct sampling of DSMC obtain with regard to
The random number of each nuclear level is included with the method simulating the randomness of nuclear decay process:Nuclear signal time statistics is special
Property simulation;And nuclear signal amplitude statistics simulated behavior.
Further, the method for described nuclear signal time statistical property simulation includes:By obeying exponential
Random number realizes the simulation of nuclear signal time statistical property, wherein
The random number of exponential by (0,1] equally distributed random number by inverse function method conversion obtain, and
(0,1] uniform random number is suitable to try to achieve by linear congruential method.
Further, the method for described nuclear signal amplitude statistics simulated behavior includes:
By to actual nuclear spectrum Curves Recognition and digitized obtains each energy level amplitude and counting rate, then by covering
Special Caro method direct sampling simultaneously exports described random number;Wherein
Identification digitized process to actual nuclear energy spectral curve include:
Step S221, is filtered to actual spectrum curve figure, noise reduction;
Step S222, by maximum kind between split-run obtain threshold value, and spectrum curve figure is carried out at binaryzation
Reason, then be coordinate by the numerical value that pixel scanning method extracts each point on spectrum curve;
Step S223, is repaired to spectrum curve and is quantized.
Further, described by DSMC direct sampling and the method that exports described random number, that is,
By each point value on DSMC direct sampling spectrum curve and curve, a series of to obtain
Random number, thus to simulate the randomness of nuclear decay process.
Further, the method in described step S221, actual spectrum curve figure being filtered, that is, to actual energy
Line chart of setting a song to music carries out Wiener filtering process, to filter the Gaussian noise of spectrum curve in figure.
Further, in described step S223, spectrum curve is repaired and the method that quantized is included:Pass through
Cubic spline interpolation filling up during spectrum curve feature extraction the data point of disappearance, and by sitting
Target ratio expands stretches to obtain the numerical value of each point on spectrum curve figure.
The invention has the beneficial effects as follows, the simulation spectrum curve emulation mode of the present invention is by actual nuclear spectrum
Curve chart carries out Curves Recognition and spectrum curve quantizes, thus obtaining the numerical value of spectrum curve each point (i.e.
The energy level of nuclear spectrum and the counting rate of each energy level), then pass through this group number of the random direct sampling of DSMC
Value is to obtain the random number with regard to each nuclear level, thus simulating the randomness of nuclear decay process, finally again to institute
State random number and carry out statistical disposition and obtain simulating spectrum curve, by inverting comparative simulation spectrum curve with actual
Spectrum curve is to determine reliability and the accuracy of imitative nuclear signal generator.
Specific embodiment
In conjunction with the accompanying drawings, the present invention is further detailed explanation.These accompanying drawings are the schematic diagram of simplification,
The basic structure of the present invention is only described in a schematic way, therefore it only shows the composition relevant with the present invention.
As shown in figure 1, the simulation spectrum curve emulation mode of the present invention is by entering to actual nuclear spectrum curve chart
Spectrum curve simultaneously quantizes by row Curves Recognition, thus obtaining numerical value (the i.e. nuclear spectrum of spectrum curve each point
Energy level and the counting rate of each energy level), then obtained by this group numerical value of the random direct sampling of DSMC
With regard to the random number of each nuclear level, thus simulating the randomness of nuclear decay process, finally again to described random number
Carry out statistical disposition to obtain simulating spectrum curve, by inverting comparative simulation spectrum curve and actual spectrum curve
To determine reliability and the accuracy of imitative nuclear signal generator.
The specific embodiment 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, comprise the steps:
Step S1, obtains actual nuclear spectrum curve chart;
Step S2, is processed to actual nuclear spectrum curve chart to obtain simulation spectrum curve.
Optionally, described simulation spectrum curve emulation mode also includes:
Step S3, compares simulation spectrum curve and actual spectrum curve by inverting, can be set a song to music with obtaining simulation
Error between line and actual spectrum curve.
Further, as shown in figure 3, being processed to actual nuclear spectrum curve chart in described step S2 to obtain
The method of simulation spectrum curve includes:
Step S21, carries out Curves Recognition and spectrum curve quantizes, to obtain to actual nuclear spectrum curve chart
The numerical value of spectrum curve each point;Step S22, is obtained by this group numerical value of the random direct sampling of DSMC
To the random number with regard to each nuclear level, to simulate the randomness of nuclear decay process;And step S23, to described
Random number carries out statistical disposition and obtains described simulation spectrum curve.
Specifically, in described step S21, actual nuclear spectrum curve chart is carried out with Curves Recognition and by spectrum curve
The method of the numerical value to obtain spectrum curve each point of quantizing includes:
Actual nuclear energy is respectively set a song to music line chart the filtered denoising of image after actual spectrum curve figure is carried out
Display, and obtain and can set a song to music according to each key point that the actual spectrum curve figure of display copies this nuclear energy spectral curve
Line number evidence, to set up spectrum curve data base;Or by actual nuclear energy respectively set a song to music line chart image filtered, fall
Make an uproar pretreatment, Curves Recognition, curvilinear characteristic extract, and carry out interpolation processing with improve and repair disappearance energy
Each point data of spectral curve, to set up spectrum curve data base.
Wherein, closed by this group numerical value of the random direct sampling of DSMC in described step S22
Random number in each nuclear level is included with the method simulating the randomness of nuclear decay process:The nuclear signal time counts
Simulated behavior and nuclear signal amplitude statistics simulated behavior.
The method of described nuclear signal time statistical property simulation includes:Random number by obedience exponential is real
Existing nuclear signal time statistical property simulation, the wherein random number of exponential by (0,1] equally distributed random
Number is converted by inverse function method and obtains, and (0,1] uniform random number is suitable to try to achieve by linear congruential method.
Specifically, tried to achieve 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 choosing1Referred to as seed, has one to be fixed the generation quality of random number
Ring, its value is respectively 1~216Choose between=65535.For the ease of using on computers, generally 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 random number, that is, exponential random number can be realized by inverse function method, specifically
Process is as follows:
If the distribution function of stochastic variable X obeys exponential:
F (x)=1-e-ax, x >=0 (3)
Wherein, a is a time constant, and e is the nature truth of a matter.
Permissible by above formula, F (x) ∈ [0,1), and monotone decreasing in domain of definition, therefore function F (x) is in 0~+∞
Must there is inverse function, seek its inverse function:
Due to 0 < 1-F (x)≤1, therefore above formula can be reduced to
Can be learnt by meeting by formula (5) (0,1] equally distributed Random sampling obtain obeying exponential with
Machine number x.
TakeThe exponential being produced by inverse function method by the equal distribution random numbers of above unit is random
Number scattergram such as Fig. 5.Above exponential random number span is evenly dividing with 1000 group squares and carries out
Statistics, final cartogram is as shown in Figure 6.
The method of described nuclear signal amplitude statistics simulated behavior includes:By to actual nuclear spectrum Curves Recognition simultaneously
Digitized obtains each energy level amplitude and counting rate, then by DSMC direct sampling and export described with
Machine number;Wherein identification digitized process to actual nuclear energy spectral curve include:
Step S221, is filtered to actual spectrum curve figure, noise reduction;Step S222, by between maximum kind
Split-run obtains threshold value, and spectrum curve figure is carried out binary conversion treatment, then is extracted by pixel scanning method
On spectrum curve, the numerical value of each point is coordinate;Step S223, is repaired to spectrum curve and is quantized.
Specifically, described by DSMC direct sampling and the method that exports described random number, that is, lead to
Cross each point value on DSMC direct sampling spectrum curve and curve, a series of random to obtain
Random number, thus to simulate the randomness of nuclear decay process.
The method in described step S221, actual spectrum curve figure being filtered, that is, to actual spectrum curve figure
Carry out Wiener filtering process, to filter the Gaussian noise of spectrum curve in figure, thus reducing noise as far as possible
The interference bringing.
The specific implementation process of the method for described nuclear signal amplitude statistics simulated behavior is as follows:
In described step S221, actual spectrum curve figure is filtered, the specific implementation step of noise reduction as follows:
By Wiener filtering, actual spectrum curve figure is filtered, noise reduction process, i.e. described Wiener filter
For a kind of linear filter, and also it is a kind of based on minimum mean square error criterion, the optimum to stationary process
Estimator.
Hypothesis Wiener filter input signal is s (t), superimposed noise n (t).Output signal x (t) passes through wave filter g (t)
Obtained by following convolution algorithm:
X (t)=g (t) * (s (t)+n (t)) (6)
For signal x (t) estimating it is desirable to be 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 wave filter output.
X (t) is write as convolution integral, that is,
Square error 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 x (t) and s (t) from phase
Close function.The final purpose of Wiener filtering is exactly to seek optimum g (t) so that E (e2) minimum.
In described step S222 by maximum kind between split-run obtain threshold value, and spectrum curve figure is carried out two-value
Change is processed, then is coordinate by the numerical value that pixel scanning method extracts each point on spectrum curve;
The specific algorithm process of maximum variance between clusters is as follows:
If the gray value of piece image is 1~m, wherein the pixel number for i for the gray value is ni, N represents figure
As pixel sum, then the probability that gray value occurs for i is:
Making gray value be more than threshold value k is c1Group, i.e. c1={ 1~k }, that gray value is more than threshold value k is then c2Group,
c2={ k+1~m }, then C1And C2The probability occurring is respectively:
It is calculated C1And C2Gray average be:
Wherein,So can obtain:
μr=ω1·μ1+ω2·μ2(16)
The variances sigma between two groups thus can be calculated2For:σ2(k)=ω1(μ1-μr)2+ω2(μ2-μr)2(17)
Formula (16) is substituted into formula (17) can obtain:σ2(k)=ω2ω2(μ2-μ1)2
So optimal threshold T*=Arg max { σ2(k) }, 0≤k < m-1 (18)
Try to achieve segmentation threshold T*=0.6353.
That in described step S223, spectrum curve is repaired and quantized comprises the following steps that:
It is the number extracting each point on nuclear energy spectral curve after the filtered denoising of actual nuclear spectrum curve chart, binaryzation
Value is coordinate, need to extract spectrum curve feature, and curve is quantized.Detailed process is as follows:
First, Straight Line Identification, that is, pass through to scan the row and column of nuclear energy spectral curve binary map, identify nuclear spectrum
The straight line of in figure;
Secondly, fixed point, is judged horizontal stroke, the vertical coordinate of spectrum curve place coordinate system by the straight line identifying, and
Positioning initial point, typically from top to bottom, scans from left to right, and the straight line identifying is just horizontal, vertical seat
Mark;
3rd, spectrum curve feature extraction.For reduce image in frame and coordinate pair curve impact, need by
Frame filters.Again the point (two that pixel is 0 line by line or is scanned by column by pixel scan method after filtering frame
In value image, black is 0, and white is 1).
Finally, curve quantizes.After extracting curve, arrived by calculating the spectrum curve available point scanning
The row of scan origin and stringer distance determine that this pixel, in the position of in figure, is sat finally by being multiplied by expand
Target scale factor obtains the coordinate figure of this 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, can be seen that from Fig. 7 and Fig. 8, the spectrum curve figure of the simulation obtaining is than proper energy spectral curve
Lack in the data of some points.For truly reflecting actual spectrum curve characteristic as far as possible, need to scarce
The data lost carries out filling up reparation.
Specifically, described being filled up by cubic spline interpolation is lacked during spectrum curve feature extraction
The data point lost, and the numerical value obtaining each point on spectrum curve figure is stretched by the ratio expansion of coordinate, to realize
The data of disappearance is filled up effectively and repairs.
Described cubic spline interpolation is filling up during spectrum curve feature extraction the data point of disappearance
Specific algorithm is as follows:
Piecewise function S (x) on interval of definition [a, b], if meet:
1. S (x) is in each subinterval [xi, xi+1] on be a cubic polynomial function;
2. S (x) has continuous second dervative on entirely interval [a, b].
Then S (x) is called with regard to a=x on interval [a, b]0< x1< ... < xnOne cubic spline function of=b.
Thus cubic spline interpolation problem is:N+1 node x of given function g (x)0, x1..., xnObtain function
y0, y1..., yn, seek cubic spline function S (x) so as to meet:
S(xj)=yj, j=0,1 ..., n (19)
Wherein, function S (x) is referred to as the cubic spline functions of g (x).
If S (x) is three sample spline interpolation functions of f (x), then must be fulfilled for following condition:
1. interpolation condition, that is,
S(xj)=yj, j=0,1 ..., n-1
2. the condition of continuity, that is,
3. the first derivative condition of continuity, that is,
4. the second dervative condition of continuity, that is,
Design sketch after cubic spline interpolation, as shown in figure 9, can be seen by its partial enlarged drawing,
Data point after cubic spline interpolation is more smooth, more approaches actual value.
Actual nuclear spectrum curve simulation effect, that is, to actual nuclear spectrum curve chart after above-mentioned image procossing,
Obtain this spectrum curve simulation design sketch eventually as shown in Figure 10.
Specifically, by each point value on DSMC direct sampling spectrum curve and curve, to obtain
Obtain a series of random randoms number, thus 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 actual spectrum curve using DSMC direct sampling final effect figure
Figure obtains energy level and this array of counting rate after quantizing after, random sampling procedure counting obtains.This figure
It is suitable to prove by the reasonability of Monte-Carlo step and accuracy).
Obtain simulating the numerical value of each point on spectrum curve and curve by numbers above image processing process
(abscissa is road location Channel, and vertical coordinate is counting rate Count), more directly taken out with DSMC
This group data of sample just can obtain a series of random energy levels, and (energy level such as but not limited to passes through multichannel analyzer
Quantization obtains, and described road location refers to what the energy of nuclear decay process release obtained after multichannel analyzer quantization)
Random number, thus to simulate the randomness of nuclear decay process.Finally more described random number is counted, can
To obtain simulating spectrum curve figure, so on the one hand can be with the reliability of checking system and accuracy, the opposing party
Face can also inverting in multichannel analyzer, in order to demarcate the accuracy of multichannel analyzer.
Using DSMC, probability P (A)=p (unknown) that certain event A is occurred, it is simulated meter
Calculate, circular:
(1) carry out n times and repeat independent sampling test, calculating event A frequency is nA.
Introduce stochastic variable Xi, represent event A frequency in i & lt test, order
Then have
(2) event A that calculates repeats the occurrence frequency f in independent sampling test in n timesN, it is
(3) when N is fully big, with probability fNEstimated value as probability P (A)=pFor
(4) require estimated valueFor the unbiased esti-mator of probability P (A)=p, that is,
And direct sampling, that is, to nuclear signal, the characteristic on time and amplitude is with two groups of obedience different distributions
Random number simulating, and random number is discrete, discontinuous.For the sampling of discrete random sequence,
Direct sampling method is ideal.
The concrete sampling process of discrete distribution direct sampling method is as follows:
If the span of discrete random variable X is Xi(i=0,1,2,3 ...), its probability distribution is
P (X=Xi)=Pi(i=0,1,2,3 ...).Wherein Pi>=0,
(1) produce equally distributed random number r on (0,1) interval;
(2) try to achieve positive integer n=0,1,2... so that r meets
(3) sample value extracting discrete random variable X is X=Xn.And work as 0<r≤P0When X=X0;
(4) repeat step (1), (2), (3) are until extracting n sample value.
Due to producing (0,1) if equally distributed random number r is in intervalProbability be
I.e. eventThe probability occurring is equal to event X=XnThe probability occurring.
Again because random number r obeys being uniformly distributed on (0,1), its probability density function is
Its distribution function is as follows:
Therefore it is X=x that the random number r producing draws sample valuenProbability be
It follows that (X=X is drawn into by direct sampling methodn) probability be equivalent to random number XnIn random number sequence
Row X1, X2... XnThe frequency occurring.
Can be by following proof for direct sampling method reliability:
If X is discontinuous variable, its probability distribution is Pi=P { X=Xi, wherein i=1,2 ....X respectively with
PiObtain Xi, thenEvent | X-E (X) | >=ε represents that stochastic variable X obtains all satisfactions
Inequality | Xi- E (X) | the probable value X of >=εi, then
∵
∴
∴
Due to event X=XiThe probability that (i=0,1,2 ... N) occurs is pi(0<pi<1), then X ≠ XiGeneral
Rate is then 1-pi, and each X=XiThe probability occurring is constant, and each sampling resultses are with other each extractions
Result is unrelated.Therefore X=XiIndividual event is a bernoulli experiment, then sampling n time, then weigh primary for n
Nu Li tests.If making event A (X=Xi) number of times that occurs is nA, i.e. nA~B (n, p).Due to X1, X2...,
XnIt is n stochastic variable that is separate and obeying the 0-1 distribution that parameter is p, and
HaveD (Xi)=p (1-p), i=1,2 ... n.Giving any ε > 0 then has
Be can be derived from by (4.31) formula
And
Therefore can be derived from
Abbreviation obtains
I.e. when the frequency n extracting is bigger, after sampling, the number of times of event A appearance and the frequency ratio of population of samples are got over
The probability occurring close to event A.
Extracting its error of random number by direct sampling is:
OrderTherefore
I.e.It is the unbiased esti-mator of p,
I.e. the number of times of sampling n is bigger, estimated valueCloser to theoretical value p.
With the above-mentioned desirable embodiment according to the present invention for enlightenment, by above-mentioned description, related work
Personnel can carry out various change and modification completely in the range of without departing from this invention technological thought.
The technical scope of this invention is not limited to content in description it is necessary to according to right
To determine its technical scope.