***************************************************************
*                   Spec Reader & True Reflectivity           *
*                     Nov 04, 2004 By Zhang Jiang             *
***************************************************************
These two programs are freely-distributed for non-commercial use.

1. Install instructions
Unzip xraylabtool.zip to $matlabroot\toolbox\xraylabtool. Add that
directory and subfolders to the search path of Matlab by File --> 
Set Path --> Add with Subfolders. Update toolbox path by File --> 
General -> Update Toolbox Path Cache.

2. Written in Matlab7. Have not been tested in old Matlab versions.

3. To start
In Matlab command window, type 'specr' to start Spec Reader. 
To start True Reflectivity, click the corresponding menu in specr GUI. Help 
is no provided. Play around with them. To reduce data in matlab command
window, use 'rdspec' and 'mergescan'. Use 'help rdspec' and 'help 
mergescan' for further information.

4. Notice for Spec Reader
1) If the spec file to be loaded is not in a standard format, 
especially that the separators of the columns in #L line are less
than two blankspaces, Spec Reader might not be able to load it.
2) To print without uicontrols (pushbutton, popupmenu ...), go to
Page Setup -> Axes and Figure -> Figure controls, check off box 
Print Uicontols.

5. Notice for True Reflectivity
In order to subtract the longitudinal diffuse scattering from the
measured reflectivity, xdata of all the imported data have to be 
in either Qz space or two theta space. 

6. Notice for bugs
You are very much appreciated if you could report bugs to me at 
zjiang@physics.ucsd.edu

7. Updates
For future update, visit Matlab Central File Exchange -> Chemistry
and Physics at www.mathworks.com

Updates:
11/04/04 Version 3.0
11/11/04 Changes to curvesave.m. Fixed problem that specr could
		not save to directories with space in the path name.
11/12/04 Changes to openspec.m to store the previous open path.
11/13/04 Changes to curvesave.m to store the previous saving 
		path. Changes to truerefimport.m to store the open path, store
        and display the already-open file names. Changes were made to
        truerefcal to fill the missing true reflectivity on the left 
        x-side by measured reflectivity. Version 3.1
11/15/04 Fixed the yerror problem in curvenormalize.m during normalization.
11/20/04 Add footprint correction (reflectivity only). Fix problem that
        if datatipmarker is in present, program could not merge and legend
        properly, and datatipmarker is in the saving list. Version 3.2
11/25/04 curvesave.m: fix error when previous stored save path is removed.
03/02/05 simlify and fix the codes to load and refresh spec scans.
10/17/05 Improve performance.
12/28/05 Version 3.4. Add file monitorscan.m to monitor the current scan 
        spontaneously.
01/13/06 Disable waring messages MATLAB:Axes:NegativeDataInLogAxis and
        MATLAB:DivideByZero.
01/20/06 Add function to specr to do subtraction of constant background 
        from scans.
01/24/06 Add function 'rdspec' and mergescan' to reduce data without GUI.
04/25/06 Fix the problem in 'truerefcal.m' that when positive or negative
        longitudinal diffuse scattering is within a smaller range than 
        reflectivity, the subtraction is not properly done, i.e., the rest 
        range of reflectivity (beyong diffuse range) is the same. After fixing 
        the bug, reflectivity in the rest range is also corrected for back
        ground which is simply a constant of the marginal point in diffuse.
06/13/06 Add the display of figure names in the popup menu of the 'print2figure'
	function.
06/16/06 Add merging options; Gather settings into GUI function settings.m; Trueref
	is now dependent on specr and can not be started independently without specr
	running; Add 'showscan' and 'foldxaxis' functions. Add geometric correction 
	for rocking scans. Version 3.5