## Igor Pro MEIS Macros

The MEIS data produced from Daresbury MEIS Facility are analysed using a variety of macros written for the Igor Pro software package. I’ve adapted the macros originally written by Paul Bailey of Daresbury, mainly to use different r-factors but also to correct a number of bugs in the exact implementation of what the macros are supposed to do. These are made available here, along with a record of the bug fixes.

These macros have been tested in Igor Pro v3.10, v3.16 and presumably should work in later versions. Note that all macros working with XVEGAS have been modified to correctly load and use second element data. Also all files have been corrected so scaling takes the average of experimental data between the cursors, rather than over the entire loaded set (this is consistent with the calculation of the average simulation). A valuable discussion of various r-factors which may be applicable to MEIS data analysis may be found in T. C. Q. Noakes, P. Bailey & D. P. Woodruff, *Nucl. Instrum. Meth. B* v. **136-138** pg. 1125 (1998) and P. Bailey, T. C. Q. Noakes & D. P. Woodruff, *Surf. Sci.* v. **426** pg. 358 (1999).

### Bug Fixes

Several bugs within the macros have been fixed. These are documented here for reference. All bug fixes have been applied to all appropriate macros hosted on this site.

- The *101.pxp macros, which deal with XVEGAS output, have been modified to correctly handle multiple element data (old behaviour was it was actually reading total scattering yield as the first element and then the first element data as the second element, this didn’t matter so long as there was only one element).
- The scaling of data has been corrected to use the average of the experimental data between the cursors (old behaviour was to take the average of the entire loaded data, which caused problems when there was “junk” on the ends).
- When scaling data the macro was using the previous altered experimental curve to find the average. If the data was skewed it would use the skewed data from the previous comparison, if not then it would use simply the scaled data from the previous comparison. With skewing turned off this resulted in the average oscillating between two (both incorrect) values. With skewing turned on the bug is difficult to spot because skewing also scales (but without the fix still incorrectly). The average is now calculated using the stored, original data, between the cursors (see bug #2).
- Whoops. It seems that in adding y-curve display to the Pendryflip macros, the calculation of the r-factor got broken. This has been fixed.
- Pendryflip macros now update the y-function graphs etc without having to manually change the displayed simulation once the r-factor calculation is complete.
- Related to Bug #2 and Bug #3 The intitial display of the comparison graph was still calculating scaling incorrectly (this doesn’t affect displays once the displayed sim number has been changed). This is now fixed.
- Found an error in the calculation of the IS r-factor (which was the reason the r-factor for the first simulation was always reported as NAN but was actually more sever than that). This is now fixed. R-factors calculated without this correction should be taken as unreliable. Sorry!
- Actually, contrary to my initial report this bug doesn’t affect all the macros, just some. When calculating a r-factor such as chi-squared, the data is rescaled to the experimental yield, in order for the statistics to work correctly. To do this the average value of the
*original*experimental data is needed. It seems that the average of the current, scaled down, data was being used (I think this bug was probably introduced as a result of one of the earlier bug fixes but frankly this code is so messy it’s hard to tell). It doesn’t seem to make a difference to the solution picked for the 2D silicide test data I checked with. The corrected routines are densqr (I don’t think I actually ever had the scaling quite right there), nox, PhD and vegasanalysis.

### Macros

- bulk-28.pxp (68 kB). Correct for analyser offset by fitting bulk data to bulk simulation. As supplied by Paul Bailey.
- match_data27.pxp (24 kB). Match experimental data to the appropriate angular range and angular step size of the simulation, taking into account the offset determined above and the Rutherford cross section. As supplied by Paul Bailey.
- Vegas_analysis95.pxp (120 kB). Chi-squared r-factor, comparision of experimental data to multiple simulations. As supplied by Paul Bailey.
- Vegas_analysis101.pxp (320 kB). Chi-squared r-factor, comparison of experimental data to multiple simulations. Handles simulations in the form produced by XVEGAS.
- nox.pxp (238 kB). This is the same as the tried and tested chi-squared r-factor, but the correction Rutherford scattering cross-section dependence on scattering angle has been removed. nox101.pxp (320 kB) handles simulations in the format produced by XVEGAS.
- densqr.pxp (732 kB) and densqr101.pxp (320 kB). As above, but the denominator in the sum when calculating the r-factor is squared. Therefore similar to IS r-factor below.
- Pendry.pxp (417 kB). Implementation of a Pendry r-factor as used in LEED. The variable voith is given an empirically determined value, which “worked” for the test data. There is also a version, Pendry101.pxp (110 kB), which handles simulations in the format produced by XVEGAS.
- Pendryflip.pxp (1048 kB) and Pendryflip101.pxp (268 kB). The Pendry r-factor deals more naturally with peaks where as the important structural information in MEIS consists of blocking dips. Therefore, in this version the data is first “flipped” to invert it (i.e. peaks become troughs and troughs peaks). The variable
`voith`is then set to 1, based on a rough half width half maximum of the average bocking dip (now peak). This seems to “work”. Includes graphs of the y funtions. Thanks must be given to Chris Bonet for discussion of the Pendry r-factor as used in LEED.

- PhD.pxp (834 kB) and PhD101.pxp (148 kB). This r-factor comes from photoelectron diffraction. A smooth spline is fitted to the data and simulation, and the two compared.
- IS.pxp (319 kB) and IS101.pxp (126 kB). The IS r-factor is implemented.
- mincomp.pxp (703 kB) and mincomp101.pxp (145 kB). Basically compares angular positions of minima in the blocking curves with those in the simulations. Actually works surprisingly well, at least with the 2D silicide data.
- rcont.pxp (153 kB) This is the same as Vegas_analysis95.pxp but displays the percentage contribution of each point to the total r-factor.
- rcontnox.pxp (155 kB) As rcont.pxp but with the Rutherford scattering cross section fall of removed.
- R1Nu.pxp (173 kB) and R1Nu101.pxp (127 kB). Implementation of R=1/(s * Nu)SUM(|Ysim-Yexp|) where s is average standard deviation and Nu is the number of degrees of freedom (=N-#parameters).

## Links

- The Daresbury MEIS Facility, where this group’s MEIS experiments are performed.
- Another major user of the Daresbury facility, Warwick Surface Science Group, and Phil Woodruff’s MEIS page.
- The University of Warwick’s Rob Tanner’s MEIS page. Lot’s of useful links and programmes, including further Igor Pro macros.
- The MEIS facility at The University of Western Ontario.
- IBM’s MEIS facility.
- NTT Basic Research Laboratories MEIS facility.

## Comments and Pings