Scripting Resources for DigitalMicrograph™

banner

Dave Mitchell's DigitalMicrograph™ Scripting Website

Home | Scripts | Examples | Functions | Recent Updates | Tutorials | Resources | Publications | Consulting | Projects | Contact & Bio |PyJEM| Search

 

Average Energy Loss
Function
Computes the average energy loss from the front-most EELS spectrum (zero loss).
Version
version:20041012, v1.0
Author
D. R. G. Mitchell
Acknowledgements
-
Comments
Use in conjunction with the 'Beam Heating Calculator' script.
System Requirements
Should be compatible with all recent versions of DigitalMicrograph.
Known Issues
-
Supported
Yes
Included Files
Main script file.
Source Code

// Script to determine the average energy loss in a spectrum

// Designed to generate the value needed for the Beam Heating Calculator script

// Note this spectrum must be a zero loss spectrum of the region of interest.

// D. R. G. Mitchell, adminnospam@dmscripting.com (remove the nospam to make this email address work)

// version:20041012

// v 1.0, Oct. 2004

 

// version:20041007

 

image front:=getfrontimage()

number xsize, ysize, averagevalue,sumtot, sumcounts, origin, scale

string units

getsize(front, xsize, ysize)

 

if(ysize>1)

{

beep()

okdialog("This script only works on EELS spectra!")

exit(0)

}

 

 

imagegetdimensioncalibration(front,0, origin, scale,units,0)

showimage(front)

sumcounts=sum(front)

 

image temp

temp=front*(origin+(icol*scale))

sumtot=sum(temp)

averagevalue=sumtot/sumcounts

 

result("\nAverage value = "+averagevalue+" eV\n")

okdialog("Average value = "+averagevalue+" eV")