CCP14
Tutorials and Examples
Peak Fitting using Xfit-Koalariet (Coelho and Cheary) for Win95/NT
Automation of Repetitive Peak-fitting with XFIT for Win95/NT using a KeyStroke/Macro Recorder-Player for Mass Analysis of Similar Patterns
Use With Care!!!
The CCP14 Homepage is at http://www.ccp14.ac.uk
Disclaimer: Careless use of Macros/keystroke players can cause damage to your files.
Use with Care. You have been warned.
Present page is a "proof of concept" guide using
the shareware Macro Scheduler software.
The Problem
When you have 50 to a couple of thousand very similar files that you wish to
fit, XFIT can become quite repititious to use involving hours/days of drudgery.
A Possible Solution
A kludgy solution solution to this is to use a Windows Macro-keystroke logger/player.
When combined with the (presently a beta version)
PRJ program from Andrew Jupe. This will help you
setup a PRJ file, ready to do some automated peak fitting on. A better solution would
be software that allows for "mass analysis of data" given the improvement in
data collection times, especially in use at Synchrotrons.
Following is a quick guide to hopefully get you going if you are interested in using
a simple macro/keystroke playing based method for automating XFIT under these
circumstances.
The page on "Why does XFIT seem slower than usual?" explains why
you cannot just display 150 patterns on the screen (with peaks inserted ready to go) and
start fitting (all refined parameters are part of the same least squares matrix, even
on separate datasets).
The the trick is to display one plot at a time maximized on the screen, FIT, then display a
new file (toggling either using ~ (or CNTRL TAB) if you want to keep the
screen unsized), then fit; and continually do this.
- For the above example, a following macro would do the job. It would be repeated (or
called) for the number of files you would like to fit. In the case of the example
in the XFIT distribution, 20 times.:
Press ALT
Wait>0.1
Send Character/Text>t
Wait>0.1
Release ALT
Wait>0.1
Send Character/Text>m
Wait>0.1
Press Up
Wait>3 (set this to the max time you know that fitting the pattern takes.
In this case, it is set to 3 seconds for a Pentium 90.
Press Enter
Wait>0.1
Press Enter (The two Enters take into account that the refinement may or
may not have converged by this time).
Wait>0.1
Press ALT
Wait>0.10
Send Character/Text>y
Wait>0.10
Release ALT
Wait>0.1
Press CTRL
Wait>0.1
Press Tab
Release CTRL
Wait>0.1
- This above macro for Macro Scheduler would then be copied and pasted to
match the number of files in a PRJ/Project file you wish to automatically fit (in the following
example, 20 times). Click here for the Macro Scheduler doobry2.scp macro file used
to automatically fit the 20 powder patterns in this example
- One Macro Editor (not the only one) that does a good job is the shareware Macro Scheduler.
It allows you to record macros (including mouse moves), and edit the macros in a text interface (which is
a lot quicker)
- http://www.mjtnet.com/
- If you want to explore for other possible software packages, check out the
various shareware repositories (Winfile, tucows, garbo, etc)
- On an example XFIT project file, record a macro, then edit it to you satisfaction that it then
does the job.
- Save this macro/recorder file then let the good times role. Following is an example of the
"Macro Scheduler" interface which includes a Macro called "doobry2" ready to let the good times role.
-
Example of using the above macro on an XFIT Project.
(in the following example, the above basic macro text was repeated
20 times to match 20 files to be fitted in the project)
Click here for the Macro Scheduler doobry2.scp macro file used
to automatically fit the 20 powder patterns in this example
- Using the save1.prj file provided with the XFIT distribution in the
c:\koalarie\xfit-tut\energyd\silicon directory.
Load this file and use View, Same X Views, followed by zooming to
get the major silicon peak as the only peak on the individual plot screens.
- Maximize one of the plots.
- Run the keystroke player with and make sure the relevent macro is
present, click on the XFIT screen and type the "Hot-Key" you use to
activate the Macro (in my case, [CNTRL] G).
- The macro/keystroke player should then fit all the patterns one after the other.
- It is important to view the results as XFIT uses a Marqardt Algorithm, which
can get into false minima, which should be obvious from visual inspection of the results. XFIT
makes this simple by being able to have all/some of the fitted spectra on the one window.
- Don't forget to save the Project file after you do the automated fitting.