Using icol function to create peak.
Gaussian peak
I=A*exp((x-mu)^2/(2*sigma^2)
where mu is the peak center
sigma is the divergence of the peak
--
image img=RealImage("peak",4,1024,1)
// peak 1 parameters
// N_K edge
number int1=30
number mu1=300
number sig1=5
// peak 2 parameters
// O_K edge
number int2=150
number mu2=432
number sig2=0.9
number int3=50
number mu3=438
number sig3=2.5
// add noise
number noise=0.5
// EELS signal creation
img=int1*exp(-1*(icol-mu1)**2/(2*sig1**2))
img+=int2*exp(-1*(icol-mu2)**2/(2*sig2**2))
img+=int3*exp(-1*(icol-mu3)**2/(2*sig3**2))
img+=0.05*exp(10-icol/100)+noise*int1*random()
// Write calibration
img.ImageSetDimensionOrigin(0,100)
img.ImageSetDimensionScale(0,1)
img.ImageSetDimensionUnitString(0, "eV" )
img.ImageSetIntensityUnitString( "e-" )
img.setname("Test Spec + " + noise*100 + "% noise")
img.showimage()
--
Result
Gaussian peak
I=A*exp((x-mu)^2/(2*sigma^2)
where mu is the peak center
sigma is the divergence of the peak
--
image img=RealImage("peak",4,1024,1)
// peak 1 parameters
// N_K edge
number int1=30
number mu1=300
number sig1=5
// peak 2 parameters
// O_K edge
number int2=150
number mu2=432
number sig2=0.9
number int3=50
number mu3=438
number sig3=2.5
// add noise
number noise=0.5
// EELS signal creation
img=int1*exp(-1*(icol-mu1)**2/(2*sig1**2))
img+=int2*exp(-1*(icol-mu2)**2/(2*sig2**2))
img+=int3*exp(-1*(icol-mu3)**2/(2*sig3**2))
img+=0.05*exp(10-icol/100)+noise*int1*random()
// Write calibration
img.ImageSetDimensionOrigin(0,100)
img.ImageSetDimensionScale(0,1)
img.ImageSetDimensionUnitString(0, "eV" )
img.ImageSetIntensityUnitString( "e-" )
img.setname("Test Spec + " + noise*100 + "% noise")
img.showimage()
--
Result
Comments
Post a Comment