Title :LIMIT Keywords :EELS,EDX,AEM,CTEM,STEM,DETECTION LIMITS,STATISTICS Computer :DEC LSI-11/73 Operating System :RSX-11M-PLUS Programming Language :DEC-FORTRAN IV Hardware Requirements :None Author(s) :Dr. Pierre TREBBIA Correspondence Address :Laboratoire de Physique des Solides :Bat. 510, F91405 ORSAY CEDEX FRANCE Abstract: When one tries to detect an element with a very small SIGNAL/NOISE ratio, one has to face with two main risks : FIRST KIND RISK : state the element is present when actually it is absent. SECOND KIND RISK : state the element is absent when actually it is present. This program gives for two first kind risks (0.05 and 0.01) and four second kind risks (0.25, 0.10, 0.05 and 0.01) the resulting 8 possible values of minimum SIGNAL and SIGNAL/NOISE ratio. A complete description of the algorithm is given in "Unbiased Method for Signal Estimation in Electron Energy Loss Spectroscopy...", P. TREBBIA, Ultramicroscopy (1988). Title :LIMIT Keywords :EELS,EDX,AEM,CTEM,STEM,DETECTION LIMITS,STATISTICS Computer :DEC LSI-11/73 Operating System :RSX-11M-PLUS Programming Language :DEC-FORTRAN IV Hardware Requirements :None Author(s) :Dr. Pierre TREBBIA Correspondence Address :Laboratoire de Physique des Solides :Bat. 510, F91405 ORSAY CEDEX FRANCE Description : see comments line in the source code text References : see comments line in the source code text Compilation procedure : compile the program LIMIT Linking procedure : Link the resulting object file Test data : LIMIT.DAT is the output that LIMIT should give if the appropriate parameters are entered. General comments : If the compiler is not a DEC-FORTRAN IV compiler, do check the source code : for example, the ! sign in a line means that the remaining text is comments, or the LOG function is implicitely changed to DLOG if the variable is double precision. Title :LIMIT Keywords :EELS,EDX,AEM,CTEM,STEM,DETECTION LIMITS,STATISTICS Computer :DEC LSI-11/73 Operating System :RSX-11M-PLUS Programming Language :DEC-FORTRAN IV Hardware Requirements :None Author(s) :Dr. Pierre TREBBIA Correspondence Address :Laboratoire de Physique des Solides :Bat. 510, F91405 ORSAY CEDEX FRANCE PROGRAM LIMIT c c LAST VERSION : 15-JUL-1987 09:17:58 c c purpose c ------- c estimates the minimum signal, knowing the underlying background, c for specified first-kind (alpha) and second-kind (beta) risks. c c subroutines and function subprograms required c --------------------------------------------- c none c c comments c -------- c 1) Use data from table 25 in " Biometrika Tables for Statisticians " c Volume II, Eds. E.S. Pearson & H.O. Hartley, Cambridge University c Press, 1972. c 2) Need as input : c a) Background value c b) h = 1. + [Variance(Background)]/Background c Note : h = 2. if Background obeys a Poisson distribution c 3) Type CTRL Z for exit c c author : c -------- c Pierre TREBBIA c US 41 : "Microscopie Electronique Analytique Quantitative" c Laboratoire de Physique des Solides, Bat. 510 c Universite Paris-Sud, F91405 ORSAY Cedex c Phone : (33-1) 69 41 53 68 c dimension x(8),ival(8),snr(8) logical pr pr=.true. ! enable record of data c c Put in x array the selected values from the lambda table c -------------------------------------------------------- c Estimations are made for alpha = 0.05 (i=1,4) and 0.01 (i=5,8) c and for beta = 0.25, 0.10, 0.05, 0.01. c x(1)=6.94 x(2)=10.507 x(3)=12.995 x(4)=18.372 x(5)=10.565 x(6)=14.879 x(7)=17.814 x(8)=24.031 c c Results storage ? c ----------------- c type 2 2 format(' Do you want a report ? [default : Y] ? ',$) read(5,1010,end=800) rep if ((rep.eq.'n').or.(rep.eq.'N')) pr=.false. if(pr) then open(4,name='LIMIT.DAT',status='new') type *,' ** Your report is in the file LIMIT.DAT **' endif c c Ask for input values c -------------------- c 5 write(5,10) 10 format(' Background = ',$) read (5,*,end=800) back 15 write(5,20) 20 format(' h = ',$) read(5,*,end=800) h if(h.lt.1.) go to 15 c c Estimations of minimum signal c ----------------------------- c do 100 i=1,8 val1=x(i)*x(i)/4.+(h*back*x(i)) val2=(x(i)/2.)+sqrt(val1) ival(i)=1+ifix(val2) ! rounding to next integer snr(i)=sqrt(x(i)) 100 continue c c Output c ------ c write(5,200) ival(1),snr(1),ival(2),snr(2),ival(3),snr(3), & ival(4),snr(4),ival(5),snr(5),ival(6),snr(6), & ival(7),snr(7),ival(8),snr(8) if(pr) then write(4,150) back,h 150 format(3x,'Estimation of minimum signal :',/, & 3x,'------------------------------',//, & ' Background = ',f10.0,' h = ',f8.3) write(4,200) ival(1),snr(1),ival(2),snr(2),ival(3),snr(3), & ival(4),snr(4),ival(5),snr(5),ival(6),snr(6), & ival(7),snr(7),ival(8),snr(8) endif 200 format(' Alpha = 0.05 Beta = 0.25 Signal = ',i6, & ' SNR = ',f8.2,/, & ' Alpha = 0.05 Beta = 0.10 Signal = ',i6,' SNR = ',f8.2,/, & ' Alpha = 0.05 Beta = 0.05 Signal = ',i6,' SNR = ',f8.2,/, & ' Alpha = 0.05 Beta = 0.01 Signal = ',i6,' SNR = ',f8.2,/, & ' Alpha = 0.01 Beta = 0.25 Signal = ',i6,' SNR = ',f8.2,/, & ' Alpha = 0.01 Beta = 0.10 Signal = ',i6,' SNR = ',f8.2,/, & ' Alpha = 0.01 Beta = 0.05 Signal = ',i6,' SNR = ',f8.2,/, & ' Alpha = 0.01 Beta = 0.01 Signal = ',i6,' SNR = ',f8.2,//, & ' **********************************************************',/) c c Run again c --------- type *,' Start again. Input new data. Enter CTRL Z for exit' go to 5 c c Program exit c ------------ c 800 if(pr) then close(5) open(5,status='new') write(5,805) 805 format(10x,'Do you want your report to be printed ? ', & '[default : N] ',$) read(5,1010,end=1000) pri if((pri.eq.'y').or.(pri.eq.'Y')) then close(4,dispose='print') type *,'Don''t forget your report !' endif endif 1000 stop 1010 format(a1) end DEMONSTRATION OF PROGRAM LIMIT Estimation of minimum signal : ------------------------------ Background = 663668. h = 4.320 Alpha = 0.05 Beta = 0.25 Signal = 4465 SNR = 2.63 Alpha = 0.05 Beta = 0.10 Signal = 5494 SNR = 3.24 Alpha = 0.05 Beta = 0.05 Signal = 6111 SNR = 3.60 Alpha = 0.05 Beta = 0.01 Signal = 7267 SNR = 4.29 Alpha = 0.01 Beta = 0.25 Signal = 5509 SNR = 3.25 Alpha = 0.01 Beta = 0.10 Signal = 6539 SNR = 3.86 Alpha = 0.01 Beta = 0.05 Signal = 7156 SNR = 4.22 Alpha = 0.01 Beta = 0.01 Signal = 8313 SNR = 4.90 **********************************************************