MAX-PLANCK-GESELLSCHAFT Max-Planck-Institut für Metallforschung | Stuttgart

ScanRead and ScanRead-PRO


Welcome to the Official Home-Page of ScanRead and ScanRead-PRO (Professional Version)!


ScanRead and ScanRead-PRO were developed by Ken Ritley in the Research Group of Prof. Dosch

Max-Planck-Institut fuer Metallforschung, Heisenbergstrasse 3, D-70569 Stuttgart, Germany
Homepage of Prof. Dosch's group



 1. What is ScanRead? and ScanRead-PRO?
 2. Who is using ScanRead?
 3. Where to get ScanRead?
 4. ScanRead is unguaranteed
 5. Known Limitations
 6. Undocumented Features
 7. Modifications or to report bugs
 8. What files come with ScanRead?
 9. More information
10. Recent modifications
11. Request for help!
12. Using ScanRead with Microcal Origin






The software package Spec (Certified Software, Inc.) is the de facto standard for data acquisition in x-ray and neutron scattering experiments. This software is Unix-based, which may present two difficulties:

1. Post-experiment data analysis may be difficult for users who prefer working in the Windows95/NT environment.

2. Real-time data analysis in the Windows95/NT environment is often essential. For example, two dimensional data (e.g., from position sensitive detectors) acquired from each scan must be analyzed immediately and understood before subsequent measurements can be performed.

ScanRead is a Windows95 program to provide quick-and-dirty scientific plots of Spec scans stored in a Spec data file.  It also allows the user to export individual scans to single ASCII files.  It can also plot data contained in ASCII files and Tascom files.  Limited support is provided for PSD (position-sensitive detector data embedded in Spec files).  In addition to scientific plotting, ScanRead performs simple statistical analysis of the data and has capabilities for simple linear fitting (eventually nonlinear fitting will be supported).

Although it can be used alone, ScanRead is also designed to work with - not replace - outstanding, professional,  high-level graphics packages, such as Microcal Origin.  A useful note about how to bind these programs together seamlessly appears in below.

ScanRead-PRO is the powerful granddaughter of ScanRead. It includes professional options such as the ability to automatically export the contents of every scan to an ASCII file. 




ScanRead is now installed at beamlines at most major synchrotron and neutron scattering centers, including APS, ESRF, ILL, and NSLS, as well as in major x-ray and neutron scattering laboratories around the world.  ScanRead has been used at HASYLAB to analyze data collected with the Tascom diffractometer control software.

The latest version of ScanRead can be obtained free of charge from the research group of Prof. Dosch).  It or an earlier version can also be obtained by downloading from a variety of other sites:


The version to download is not always the newest version, in order to ensure that ScanRead remains as stable and bug-free as possible.  Be sure to contact the program author to find out if you are using the latest version.




ScanRead comes with no warranties or guarantees at all, written or implied, neither as to fitness or suitability for a particular purpose. I developed it for myself, for my own purposes, but you may also use it as long as you don't try to sell it or make money with it. It is free software.  Use it at your own risk.  I am a scientist, not a programmer, therefore I cannot guarantee that it won't make your computer explode or make your hard disk soft.  I can only say that it performs fairly well, and it is fairly idiot-proof and error-protected.

ScanRead was written with Microsoft Visual Basic ver. 6.0. To properly work, ScanRead requires that certain DLL files required by the Visual Basic code be installed into whatever directory it is that contains your DLL files.  The install program takes care of all this for you.


KNOWN LI class="gray_li"MITATIONS


 1. Printing is not yet supported.

 2. Only linear least squares fitting is supported.

 3. The Spec data files must have records which are terminated with line breaks.  This means Spec files should be ported to Windows95 with care.  For example, when using FTP, make sure that the ASCII flag is set.  (To repair files improperly transferred, one option is to use Microsoft Word, opening the file as a "Text" file and saving it again as "MS-DOS Text with Line Breaks."

 4. INTERNATIONAL CONVENTION: ScanRead works well when your computer it set up to use the comma (",") as a numerical separator and the period (".") as the numerical decimal indicator, which is the defacto INTERNATIONAL STANDARD.  For example, if your computer represents the number "five-and-a-quarter" as "5,25" then you are likely to run into problems.




ScanRead has no instructions because it is supposed to be simple enough for people to figure out by themselves.

However, there are a few "hidden" key sequences which are available once a file has been opened and a scan has been selected.

  1. CTRL-F allows you to search the stored scans for a specific keyword which appears in the scan description (such as ascan or dscan, etc.)
  2. CTRL-G allows you to repeat the previous search
  3. CTRL-H displays the header portion of the Spec file
  4. CTRL-M displays the motor coordinates of the selected scan
  5. CTRL-B displays the header portion of the selected scan
  6. CTRL-P starts the notepad application with the scan list




ScanRead is easily modified to read, extract and plot data contained in other file formats.  Contact the author for details.  The author is eager to repair bugs.  Contact the author at

ScanRead may or may not complain about a missing DLL file during installation; this seems to have something to do with Microsoft and in no way causes problems for ScanRead.



When the distribution ZIP file is unzipped, the following files will appear: These six files are used to install ScanRead.  Once installed, the program ScanRead.exe can be located
setup.exe anywhere on your harddisk.

scanread.ico This is an icon file,
  for anyone who wants a fancy
  icon for this program.

sr355.exe - Just the exe file, for those who already have the
required DLL's

scanread.htm This file (also serves as the help file)

fullmenu.add Append this to Origin FULLMENU.CNF
scripts.ogs Store this in the Origin directory

test.spc Sample Spec file for testing purposes
testpsd.spc Sample Spec file which contains PSD data.
  (This is an example of the PSD file format
  which ScanRead can currently read.)

datascan.exe Special bonus image analysis program
datascan.ico Special bonus icon for special bonus image analysis program




For more information about ScanRead, contact the author at  For more information about the program Spec, see the official website at  For more information about the Window95/NT program Microcal Origin, see the official website at




July 12, 2000  Thanks to a suggestion by Hans Trenkler, ScanRead now
can spawn a user-defined program, to facilitate data analysis.  Additionally,
the contents of ALL scans can now be automatically dumped to a sequence
of files (file_001, file_002, etc.).

May 22, 2000  Thanks to a suggestion by Matthias Denk, ScanRead now
generates a file (speclist.dat) which contains the contents of the scan list box,
which is handy for keeping tidy lab books and organizing the scan data.

January 3, 2000   Thanks to a vociferous suggestion by Oliver Klein,
ScanRead now allows the user to display the main file header (hit CTRL-H
in scan list) or to display the scan header (hit CTRL-M, for motors, in
scan list).

January 3, 2000   Thanks to a suggestion by Ulrich Gebhart, ScanRead now
no longer has a problem with #I scan lines which come between the #L
descriptor and the start of the scan information.

December 9, 1999   Thanks to a suggestion by Oliver Klein, ScanRead now
allows the user to search for specific scans (hit CTRL-F in scan list)
to to repeat a previous search (hit CTRL-G in scan list).

November 16, 1999   Thanks to a suggestion by Gerry Swislow, ScanRead
now defaults to the first and last columns for ordinate and abscissa
of the scans.

November 14, 1999   Thanks to a suggestion by H. Requart, ScanRead
now uses a configuration file (SCANREAD.INI) in order to specify
some default parameters, such as names of the ASCII output files.

October 5, 1999   Thanks to a suggestion by J. Fossum, ScanRead can
now freeze the plot window, so that multiple plots may be overlaid
in order to compare scans.

October 1, 1999   Thanks to a suggestion by A. Duerr, ScanRead now
can handle scans up to 5000 lines long.

May 21, 1999  Thanks to a suggestion by Reinhard Streitel, ScanRead
now resizes the list boxes when the window is resized, to permit
viewing of long scan lines.

May 18, 1999  Thanks to a suggestion by Baerbel Krause, ScanRead now
provides limited support for extracting PSD
(position-sensitive detector) data which is stored in a
SPEC file.  Contact the author for more information.

May 1, 1999  Thanks to a suggestion by Gerry Swislow, ScanRead now
employs a more user-friendly interface for selecting the columns
of data to plot (i.e., the column labels are used rather than the
numerical column positions).




If you have suggestions for future versions of ScanRead, please send them along to the program author,  Keep in mind the author is a physicist, not a computer programmer.  Therefore, due to constraints of the author's current research workload, it may not be possible to implement all suggestions immediately.

If you have developed Microcal Origin macros for data analysis tasks applicable to x-ray and neutron scattering, or if you have macros which would otherwise be useful for data analysis tasks in general, and if you don't mind having them included in the official ScanRead distribution, please send them along to the author,




ScanRead can be made to function transparently and seamlessly with Microcal Origin, as if it were part of Microcal Origin itself.  This is very convenient for data analysis, since scans can be selected, plot very quickly, then imported into Origin and analyzed with just a few keystrokes.

The default location for scans extracted by ScanRead is c:\spectemp.dat. This makes it easy to write Microcal Origin macros to read and analyze Spec scans.  This section describes how to use ScanRead transparently as a menu option with Microcal Origin.  This can be accomplished in just two easy steps:  

 1. Modify the Origin file called FULLMENU.CNF, to tell Origin to create the new menu entries for ScanRead and for importing the data files.  Usually, appending the sample commands which are provided in this file is sufficient.  Be sure to modify the line which says where and what your version of ScanRead is stored/called.

 2. Add a new macro file called SCRIPTS.OGS to the Origin directory, which contains the special macros to run ScanRead and to import (and format) the Spec scans.  In addition to importing Spec files, this script file provides several macros which are of use in analysing x-ray and neutron scattering data. 
These include the following:
a. Conversion to angle to d-spacing;
b. Normalization of detector channel by monitor channel;
c. Shift a plot vertically or scale a plot vertically - of great use for overlaying reflectivity data;
d. Automatic assignment of axis labels (2theta, Intensity, r.l.u., etc.);
e. Statistics on columns - a bit fancier than those provided with Origin.



Sample code to be appended to FULLMENU.CNF


// Custom X-RAY menu by Ken Ritley

menu -wmg;
menu 14 (&X-Ray)
menu "&Select SPEC file" {
menu "&Import SPEC file" {
menu "&Import Specific SPEC file" {
menu "Import &PSD matrix" {

menu "&Analysis: Diffuse" {};
menu "&Analysis: Specular" {};
menu "&Resolution Correction" {};
menu "&DSpacing" {
menu "&Statistics" {
menu "&Compute INORM" {
menu "&Column Normalization" {
menu "&Scale" {
menu "&Shift" {

menu -l (Useful X-Ray Labels); /* begin submenu to set axis labels */
menu (X: Two-Theta (degrees)) {label -n XB "2\g{q}  (degrees)"};
menu (X: Theta (degrees)) {label -n XB "\g{q}  (degrees)"};
menu (X: Phi (degrees)) {label -n XB "Phi \g{f}  (degrees)"};
menu (X: OOL) {label -n XB "L  (00L)  ( Å\+{01} )"};
menu (X: R.L.U.) {label -n XB "r.l.u."};
menu (Y: Intensity (arb. units)) {label -n YL "Intensity (arb. units)"};
menu (Y: Corrected Intensity) {label -n YL "Corrected Intensity"};
menu (Y: Intensity) {label -n YL "Intensity"};
menu (Y: Raw Intensity) {label -n YL "Raw Intensity"};
menu (Sample Description) {label -q 1 -e "Sample "};
menu -l;  /* terminate submenu to set axis labels */

menu "&About" {


// Ken Ritley
// November 30, 1998
// Max-Planck-Institut fuer Metallforschung
// Abteilung Dosch
// Heisenbergstrasse 1
// D-70569 Stuttgart
// This is a script file which contains the scripts which are bound
// to the XRAY menu items.  See the file FULLMENU.CNF for details.


run -e "c:\origin50\scanread.exe";


//This next line creates a new worksheet
win -T;
open -w c:\spectemp.dat;
   if (%k=="") {}
   else wks.col$(i).name$="%k";
window -ra;

// K. Ritley, 11.3.99 to import a specific ScanRead-extracted
// file


(File) %%A
(Import ScanRead file);

open -w %%A ;
   if (%k=="") {}
   else wks.col$(i).name$="%k";


open -w c:\psdtemp.dat;
//   %k=wks.col$(i).label$;
//   if (%k=="") {}
//   else wks.col$(i).name$="%k";

// Added on March 4, 1999 by K. Ritley.
// This script first assumes the user has selected a column
// which contains the 'two-theta' scattering angles, then
// prompts the user for a x-ray wavelength, and finally
// generates a new column (DSpacing) which is the d-spacing
// which corresponds to the 2-theta value in the selected
// column.  Assumes selected column in degrees, wavelength
// and d-spacing in Angstroms.  Values from Warren.


/* Make sure user has selected a column */

if (wks.sel==0)
 type -b "You must first select a column!";
 break 1;

/* Get desired wavelength from the user */

i=1; j=1; k=0;
%B = "Cu Mo Co W"; /* a drop down list with three entries */
%L = "alpha1 alpha2 <alpha> beta Kedge Lalpha1 LI class="gray_li"IIedge"; /* a drop down list with three entries */
(Anode)  i:B   /* use %B as the list items */
(Spectral Line)  j:L  /* use %B as the list items */
(Other)  k:2s   /*show remaining items only if k = 1 (checked) */
(Wavelength (Å))  wave  /* an ordinary variable */
(Select Wavelength);  /*  end of getnumber */

if (k==0 && i==1 && j==1) {wave=1.54051}; // K-alpha1
if (k==0 && i==1 && j==2) {wave=1.54433}; // K-alpha2
if (k==0 && i==1 && j==3) {wave=1.54178}; // K-alpha-bar
if (k==0 && i==1 && j==4) {wave=1.39217}; // K-beta
if (k==0 && i==1 && j==5) {wave=1.38043}; // K-edge
if (k==0 && i==1 && j==6) {wave=13.357};  // L-alpha1
if (k==0 && i==1 && j==7) {wave=13.2887}; // Liii-edge

if (k==0 && i==2 && j==1) {wave=0.70926};
if (k==0 && i==2 && j==2) {wave=0.713543};
if (k==0 && i==2 && j==3) {wave=0.71069};
if (k==0 && i==2 && j==4) {wave=0.632253};
if (k==0 && i==2 && j==5) {wave=0.61977};
if (k==0 && i==2 && j==6) {wave=5.40625};
if (k==0 && i==2 && j==7) {wave=4.9125};

if (k==0 && i==3 && j==1) {wave=1.78892};
if (k==0 && i==3 && j==2) {wave=1.79278};
if (k==0 && i==3 && j==3) {wave=1.79021};
if (k==0 && i==3 && j==4) {wave=1.62075};
if (k==0 && i==3 && j==5) {wave=1.60811};
if (k==0 && i==3 && j==6) {wave=0.0}; // ?
if (k==0 && i==3 && j==7) {wave=0.0}; // ?

if (k==0 && i==4 && j==1) {wave=0.208992};
if (k==0 && i==4 && j==2) {wave=0.213813};
if (k==0 && i==4 && j==3) {wave=0.0}; // ?
if (k==0 && i==4 && j==4) {wave=0.184363};
if (k==0 && i==4 && j==5) {wave=0.17837};
if (k==0 && i==4 && j==6) {wave=1.47635};
if (k==0 && i==4 && j==7) {wave=1.21546};

if (k==1)
{   type -b "You have selected an alternate wavelength!";
else if (i==1)
{   type -b "Cu" ; ;
    if (j==1) type -b "l=1.54";
    if (j==2) type -b "l=2.54";

/* Create a new column if one does not exist */

   if (%k=="DSpacing") {var=1};
if (var==0) {wks.AddCol(DSpacing)};

/* Calculate the D-Spacings here */



/* Make sure user has selected a column */

if (wks.sel==0)
 type -b "You must first select a column!";
 break 1;


/* Perform the search here */

jmax=col(%a)[1]; jmaxcol=1;
jmin=col(%a)[1]; jmincol=1;
repeat wks.maxrows {
   if (jmax<col(%a)[i]) {jmax=col(%a)[i];jmaxcol=i};
   if (jmin>col(%a)[i]) {jmin=col(%a)[i];jmincol=i};

/* Show the results to the user */

type -b
"The maximum is $(jmax) in row $(jmaxcol)\n
The minimum is $(jmin) in row $(jmincol)";


/* Make sure user has selected a column */

if (wks.sel==0)
 type -b "You must first select a column!";
 break 1;


/* Perform the search here */

jmax=col(%a)[1]; jmaxcol=1;
jmin=col(%a)[1]; jmincol=1;
repeat wks.maxrows {
   if (jmax<col(%a)[i]) {jmax=col(%a)[i];jmaxcol=i};
   if (jmin>col(%a)[i]) {jmin=col(%a)[i];jmincol=i};

/* Show the results to the user */

type -b
"The data have been normalized by the maximum \n
 $(jmax) in row $(jmaxcol)";

/* Create a new column if one does not exist */

   if (%k=="INorm") {var=1};
if (var==0) {wks.AddCol(INorm)};


/* Make sure user has selected a column */

if (wks.sel==0)
 type -b "You must first select a column!";
 break 1;

loop(1,1,30) { getn -s (Scale factor) jmax; col(%a)=col(%a)*jmax; };


/* Make sure user has selected a column */

if (wks.sel==0)
 type -b "You must first select a column!";
 break 1;

loop(1,1,30) { getn -s (Shift factor) jmax; col(%a)=col(%a)+jmax; };


/* Add new column */



type -b
"XRAY is a custom menu which expands the capabilities \n
of Origin.  It is easy to add new features or to bind \n
complicated procedures or scripts to the Origin menu \n
bar.  Examine the files FULLMENU.CNF and SCRIPTS.OGS \n
for further details. \n
For information about X-RAY or to suggest new features \n
contact Ken Ritley at \n"