
1 EXAFS
	  DOCUMENTATION FOR EXAFS DATA ANALYSIS PACKAGE 

     The package consists of two main programs named EXAPLT and EXAFIT.  In
addition, utility programs PHASE, MCMAST, CURSRT, PREPRO, PRECRN, and
PREFLR are included.

	EXAPLT	This is the main analysis program that carries out all
	analysis steps from raw data through Fourier transforms
	in preparation for non-linear curve fitting.  It includes
	several special features for analysis of the phase of
	the EXAFS oscillations.  

	EXAFIT	This program carries out the non-linear curve fitting
	to a model EXAFS equation.  Files written by the EXAPLT
	program are taken as input to EXAFIT.

	PHASE	This is a utility program maintain disk
	files that contain tables of reference phase functions
	that are obtained either from theoretical calculations
	or from empirical measurements on reference materials.
	The disk tables are used by both EXAPLT and EXAFIT.

	MCMAST	This is a utility program to set up on the system device 
	the data file MCMSTR.TBL for use by EXAPLT. 

	CURSRT	This is a test program for testing graphic input and output
	operations on the graphic display device.  Graphic terminals
	that can run this program can be expected to work with the
	EXAFS package programs.


1 EXAPLT

             The EXAPLT PROGRAM is a FORTRAN 77 program designed to read
	     in raw EXAFS (Extended X-ray Absorption Fine Structure) data in
	     the OLD or NEW KIRBY SSRL FORMAT, various CHESS FORMATS, as
	     well as NSLS X11 and X18B FORMATS and provide a set of analysis
	     options (SMOOTHLINE, FOURIER TRANSFORM FILTERING, PHASE ANALY-
	     SIS, AND PHASE REMOVAL) which can be performed on the data via
	     graphical interaction.  The resulting output from each analysis
	     option can be saved on disk in a special format for later recall
	     or be used as input for the next option chosen. The EXAPLT program
	     provides flexible graphics so the user can conveniently interact
	     with the data and control the the graphical presentation of the
	     results.


2 STRUCTURE

STRUCTURE:    The EXAPLT PROGRAM is modular in nature, and consists of options
	     that can be thought of as operators that act on a set of data
	     stored in an input space and deliver the results of the operation
	     to an output space.  The input space consists of a pair of storage
	     arrays X and Y, and the output space a pair V and W.  After any
	     operation the contents of V and W are plotted on the screen, but
	     X and Y are left unchanged.  This means that the program user,
	     after viewing the results of an operation, has the choice of
	     stepping back to the results of the previous operation, either
	     to try the operation again with different parameters, to correct
	     errors, or to try another option.  This feature gives the EXAPLT
	     program a powerful flexibility in that the outcome of trying any
	     option can help the user decide how to proceed.  When the outcome
	     of an option is satisfactory, the user can simply proceed to
	     further command options.

	     Selecting PL will restore the arrays to the condition
	     prior to that latest operation and replot the data arrays. 

2 OPERATION

OPERATION:    The EXAPLT program should be run as an installed task in order
	     to not interfere with I/O on the default device.  Four files, in 
	     addition to data files, (CONST.HLD, MCMSTR.TBL, TEOLEE.PHT, and
	     PARAM.PHF) are required for access by EXAPLT during execution of
	     several of the options.  The CONST.HLD file contains current
	     status information about the data being analyzed and, therefore,
	     should be maintained on the system device.  The file, MCMSTR.TBL, 
	     contains tables of McMaster coefficients of X-ray cross sections
	     useful for for computing an energy dependent absorption normaliza-
	     tion which is an option in the smoothline treatment.  In the de-
	     fault treatment, the EXAFS oscillations are normalized to an ener-
	     gy independent absorption step.  The MCMSTR.TBL file should be
	     maintained on the users account, also.  The other two files are
	     phase tables, required as input during phase options, and these
	     can be maintained on the user account or an interchangable de-
	     vice such as floppy disk.  When a prompt symbol >[BELL] occurs on
	     the screen or teletype the program is waiting for an instruction.
	     A list of valid instuctions (two-letter keywords) is given below,
	     with short descriptions for each.  A more detailed description of
	     each instruction is given further on.

2 HARDWARE

HARDWARE:     Hardware requirements for the EXAPLT program call for at least a
	     16 bit PDP,LSI 11 processor with extended memory capability for
	     addressing 128K words.  A Tektronix 4010,14,25 or equivalent
	     graphics terminal, supporting the Tektronix Terminal Control
	     System (TCS) with graphical curser input, is necessary, preferably
	     including a screen hardcopy unit. Digital Terminals supporting the
	     REGIS graphic protocol, and the Visual family of terminals may
	     also be used.   At least 0ne additional hard disk or dual density
	     floppy drive is a prerequisite to installation. A line printer
	     such as VERSATEC 1200, which has optional screen copy hardware,
	     provides a versatile print/plot mode ideal for the fast output of
	     the EXAPLT program. LA100's may also be used with DEC terminals.
	     A floating point unit in the processor is essential.

	     But in actual practice, almost anything can be used to run this
	     package. This version was built to function on a Micro VAX II.

2 INSTRUCTIONS

INSTRUCTIONS: Two-letter EXAPLT options accepted in response to >[BELL] prompt

		DI --- Spawns the DCL Directory utility to display files
		HE --- Spawns the DCL Help utility to display online HELP
			files on EXAFS topics
		EF --- Spawns the EXAFIT program and transfers control to
			this program
		WI -*- Select a Window on the current data displayed
		BC --- Builds the CONST.HLD files for EXAPLT
		BP --- Builds the PHASE and MCMSTR tables for EXAPLT
		EXIT --- Exit from EXAPLT program
		RE *-- Read in raw EXAFS data file, two formats
		OP *-- Options of channels to ratio and logarithm of ratio
		PL --- Plot of current output array with current captions
		EN *-- Converts stepnumber to energy, input beamline specs
		SL **- Remove smoothline background, cubic spline, and
			optional McMaster treatment
		KV --- Converts energy to wave vector representation
		FT **- Computes forward FFT,Magnitude of transform plotted
		BT -*- Computes inverse FFT of a chosen window of data
		KE --- Load current output array and captions into input
			array. Use after EN,ES,SL,KV,DG,FT,BT,PH before
			continuing to next analysis option.
		XP -*- Expand a chosen section of a plot using interactive
			curser. Stores the new plot window in replot stack
			(up to 3 sets maintained in stack).
		RP **- Replots any of the three current plot windows de-
			termined in XP or IS. Cleared when PL or rescale of
			the data occurs.
		IS *-- Terminal input of up to three plot window sets into
			replot stack.
		ES **- Terminal or graphic edge shift calibration
		DG -*- Deglitching of data by pairs
		PT -*- Labels point coordinates via interactive curser.
		WF --- Writes current output arrays into a file on the de-
			fault device with current headings, captions and
			analysis map.  Special format filename depends on 
			current status of output data ( xxxxxx.*xx ) where
			* = R   Raw data ratio file
			* = L   Log of ratio file
			* = A   Absorption vs Energy
			* = X   (XANES) Absorption vs Energy
			* = E   Chi vs Energy
			* = K   Chi vs Wave Vector k
			* = F   Magnitude vs Radius
			* = B   Backtransform k**n Chi vs k
		PR --- Writes above file to line printer instead of to
			default storage device.
		RF *-- Reads in a special format WF file from default
			device and updates all arrays, captions, and 
			parameters.
		CS --- Produces hardcopy image of graphic screen.
		PM --- Writes current file header map, which logs the
			analysis parameters and constants, to the printer.
		LM --- Does the same as PM except writes to the active
			consol screen.
		DF --- Computes differential of input array and plots it.
			Ideal for locating the edge for precise absorption
			edge calibration when using ES.
		PF **- Initiates phase shift comparison and fitting al-
			gorithms.  Can determine R and E0 for a given phase
			function.  The experimental phase can be compared
			to a phase stored in the phase tables.
			Details of other options available in PF decribed
			later 
		PH *-- Prepares an array for subsequent phase removal step
			prior to Fourier transforming. Uses phase tables.
			The phase removal then occurs invisibly in the FT
			routine, however, the imaginary part of the trans-
			form is plotted with the magnitude for this option.
		AF *-- Generates the and plotting of backtransform
			envelopes and the calculation and plotting of the
			log of the ratio of amplitudes vs k**2 after a
			successful BT option.  The reference amplitude for
			this algorithm may be input from terminal, tables,
			or interpolated from disk data file.  Least squares
			fitting to the Ln ratio curve, provides an estimate
			of the relative disorder.
		FC **- An option used on fluorescence spectra from concen-
			trated samples.  An absorption correction factor
			may be applied to the absorption spectrum based on
			the value of the stepheight determined in the SL
			option.
		ED *-- An option to display several near edge spectra and
			difference them if desired.  Up to three edge
			may be read in from disk files to be used in
			differencing or display.		    
		TI *-- An option to interpolate the amplitude or phase
			from the Inverse Fourier Transform and enter the
			interpolated values into the TEOLEE.TBL tables.
			The range of interpolation must be coincident with
			the full TEOLEE range (3.7795-15.1178).

		*--    Alpha-numeric input required
		-*-    Graphic curser input required
		**-    Both required


3 WI

	WI
	   The WI (WINDOW) option is used to physically cut leading and/or
	trailing regions of data out of the analysis. When this option is
	used, the graphical cursor is presented. The user now picks the first
	point of the region to KEEP, then, after this pointed is plotted,
	the last point to keep is selected. The screen is then replotted
	using this window on the data.

	WARNING: Data is destroyed by the use of this procedure. Be very
	sure that this option is what you really want.


3 EXIT

	EX
	   The EX option terminates the execution of the EXAPLT pro-
	 gram, clears the screen and returns to the system monitor.

3 RE

	 RE
	   The RE option reads all columns of data present in the
	 specified raw data file.  Reads both 'old' and 'new' Kirby
	 SSRL formats, 'old' and 'new' CHESS formats, NSLS formats
         and Penny format.  It then displays the format that the data is
	 in and the number of data points, then automatically enters
	 the OP option. An error message is displayed if the specified 
	 file name is not found	on the default device.

	 ERROR -- FILE NOT FOUND, TRY THE DIRECTORY COMMAND

	 RSX-11 file names can be in the format  (DL?:[?,?]xxxxxx.xxx)

3 OP

	OP
	   The OP option allows user to choose the channels to ratio
	 and whether the natural logarithm of the ratio is desired.

	 The selected option is automatically plotted. 



4 EXAMPLE

	 Option sample dialog:
	   
	 *-	OPTIONS FOR THE OUTPUT DATA ARE AS FOLLOWS:
	 *-		<CR> = RETURN TO MAIN PROGRAM
	 *-	 1  = INPUT CHANNEL #1
	 *	  . . .
	 *	  6  = INPUT CHANNEL #6 [unity]
	 -	 -1  = INVERSE OF CHANNEL #1
	 *	RATIO OF CHANNELS I(KOPT)/I(LOPT)
	 *	ENTER (KOPT/LOPT) OPTIONS: 1/2
	  (desired channels 1 and 2 are ratioed)
	 -	ENTER (1 OR -1) OPTION: 1
	  (channel 1 which is already ratioed in 'old' format)
	 *-	DO YOU WANT TO TAKE THE LOG? (Y/N) :  Y

	- Old format dialog
	* New format dialog

3 PL

	PL
	   The PL option copies the X,Y data arrays to V,W and
	plots V,W  on calculated scaling. Current captions and
	labelling is controlled automatically.

3 EN

	EN
	   The EN option converts stepnumber to an energy scale which
  	 is 0. at the X-ray energy of the absorption edge.
	 The data is rescaled and plotted on the energy scale de-
	 termined by the beam line parameters above.

	 Note: Data already in energy units only receives the prompt
	 for energy correction. CHESS and NSLS X18B formated data automatically
	 enter the OP option after the channels are chosen.



4 EXAMPLE

	Energy sample dialog:
	 
	 PRESENT MONOCHROMETER STEPS/DEG. :   2000.0
	 PRESENT CRYSTAL LATTICE SPACING : 1.9200
	 STEP NUMBER OFFSET : 0.0
	 EDGE ENERGY (EV'S) : 8978.2
	 ANY CHANGES ? (Y/N) : Y
	 (inputs are expected as real numbers with decimal points;
	 default is just )
	 PRESENT MONOCHROMETER STEPS/DEG. : 
	 PRESENT CRYSTAL LATTICE SPACING : 
	 STEP NUMBER OFFSET : 
	 EDGE ENERGY (EV'S) : 8978.8
	 ANY CHANGES ? (Y/N) : N

	 (this example changed the value of the edge energy only)
	 The data is rescaled and plotted on the energy scale de-
	 termined by the beam line parameters above.


3 HE

	HE
	   The HE option is used to access the on-line help files
	that are maintained in DL0:[1,2]DCLEXAFS.HLP.  The command
	causes the screen to be cleared, and automatic KE to be
	performed, and the query message to be displayed:

 	   Help on Which EXAPLT topic?
	
	The user is then free to enter any valid EXAFS help option.
	(i.e., The program prefices all input with the string
	'HELP EXAFS '. After the Help files are displayed, a prompt
	is generated to return to EXAPLT. The screen is then reploted.

	Note: If HE is selected before anything other action in the
	program has taken place, an infinite loop will occur since
	a return from the HELP routine attempts to replot the screen.
	If no data is available, the program gets stuck.

	Note: for the VAX versions, online help is not currently
	supported even though the help files are provided to be linked
	into the system help facility. This problem will shortly be
	resolved.
 
3 EF

	EF
	  The EF option instructs EXAPLT to SPAWN the EXAFIT program.
	A message stating this fact is displayed, then the EXAPLT
	program 'sleeps' until the EXAFIT program terminates. When control
	is returned, EXAPLT is exactly at the same point that it was when
	the EF option was chosen. A RF command will be required to used
	the output from EXAFIT.

3 DI

	DI
	The DI option SPAWNS the DCL Directory command. Control is passed
	to this utility until the directory information requested is
	displayed, then control returns to EXAPLT. Note: the graphics
	screen is not erased.
	
3 SL

	SL
	   The SL option calculates a smoothline background to be
	 subtracted from the absorption data. The result is rescaled
	 and plotted.  The smoothline divides the data between chosen
	 endpoints into multiple regions (3 is default) and a poly-
	 nomial spline is fit into each region with continuity of
	 derivatives at the endpoints of the regions. 6 is the max-
	 imum allowable number regions the user can chose.  



4 PROMPTS

	Responses to the first SL graphical curser prompt are:

	   (1)  N   end points chosen are NOT stored for
	  	  later use.  The normal default of
		  reponding with ANY CHARACTER will
		  store the endpoint parameters and the
		  step height values for later use
		  with the response 'P'(previous).

	  (2)  R   The number of smoothline regions can
		  be input if the default of 3 regions
		  is not desired.  The graphic curser is
		  returned for input of a number between
		  2 and 9 inclusive then .  The 
		  curser is returned again for end point
		  selection.

	  (3)  P   This response is appropriate only for
		  the first time the graphic curser ap-
		  pears. It obtains previously stored
		  end point values and the step minimum
		  from disk file automatically and pro-
		  cedes directly through the computation
		  and plotting of the smoothline back-
		  ground removal.

	  (4)  L   This response requires positioning of
		  of the graphic curser to locate the
		  first end point. The response 'L' as-
		  sumes the last data point as the other
		  end point and begins immediate compu-
		  tation of the smoothline.

	  (5)  (any char.)  position curser and respond
		  with any character except N,R,P,L and
		  a cross appears at the chosen point.
		  The curser is then returned for the
		  selection of the other end point.
		  SL parameters and endpoints are stored
		  on disk file for later recall.

	   Except for the 'P' response, the curser will be returned for
	 selection of the pre-edge minimum in the data for extrapo-
	 lation of the step height.  At this point the user may re-
	 spond to the graphic curser with any character, however, an
	 optional MCMASTER TREATMENT of the step height normalization
	 may be obtained by responding with 'M'.  The MCMASTER coef-
	 ficients will then be obtained from the MCMSTR.TBL file af-
	 ter the next curser is responded to.  For all responses, the
	 step height is printed on the plot.  After the step height
	 selection, another graphic curser will appear allowing the
	 user to make a hardcopy of the screen containing all of the
	 smoothline information.   A response of 'E' to this final
	 curser will terminate the graphic smoothline steps. A 
	 response of 'X' will also terminate the graphic steps but
	 output of the smoothline option will be a normalized 
	 XANES plot rather than a CHI vs ENERGY plot. Any other
	 response to this final curser will cause the sequence of
	 steps for the selection of STEP MINIMUM, MCMASTER, and XANES
	 to be repeated.

	(6)  M  is the reponse to the step height cur-
	     ser after locating the pre-edge min-
	     imum to initiate a MCMASTER TREATMENT
	     of the step height determination. 
	     After response to the final curser
	     the screen will clear and a dialog
	     prompting for the Mcmaster coef-
	     ficients will appear (see sample 
	     dailog below).

	(7)  E  is the response to the graphic curser
	     which is returned after the step
	     height calculation. This response
	     ends the smoothline step unless the
	     MCMASTER TREATMENT is specified by
	     'M' response to the previous curser.
	     In which case, this 'E' response
	     begins the dialog for obtaining the
	     MCMASTER coefficients.

	(8) X   is the response to the final SL curser
	     which will envoke the display of the
	     normalized edge spectra or XANES
	     rather than the display of the CHI
	     vs ENERGY plot.  The XANES may be
	     further treated as an ABSORPTION
	     vs ENERGY data file but with a 
	     xxxxxx.Xxx extension name instead
	     of a xxxxxx.Axx extension name.
	     Any other response returns the cursers
	     again for a repeat of the step height
	     determination sequence.

	(1) and (3) must be used prior all other responses if the
	number of smoothline regions desired is other than 3.


4 MCMASTER

	A sample dialog for the MCMASTER TREATMENT is given here:

	    FOR MCMASTER TREATMENT, YOU MUST SPECIFY THE MCMASTER
	    COEFFICIENTS OF THE ABSORBER EDGE AND THE BACKGROUND EDGE.
	    TYPE ATOMIC NO. OF ABSORBING ELEMENT AND EDGE NO.
	    (11-103),(K=0,L=1,M=2,N=3) AND RETURN
	    NATOM,NEDGE ? 78,1
	    THE MCMASTER COEFFICIENTS FOR THE
	    PT L EDGE ARE: 17.3636   -2.2111     -.0731     0.0000
	    OK? Y
	    TYPE ATOMIC NO. OF BACKGROUND ELEMENT AND EDGE NO.
	    (11-103),(K=0,L=1,M=2,N=3) AND RETURN
	    NATOM,NEDGE ? 78,2
	    THE MCMASTER COEFFICIENTS FOR THE 
		ARE:  0.0000    0.0000     0.0000     0.0000
	    OK? N
	    MCMASTER TABLE ENTRY NOT SPECIFIED OR REQUIRES CHANGE
	    ENTER NAME SPECIFYING THE X-RAY ABSORPTION EDGE : 
	    PT M EDGE
	    TYPE COEFFICIENT CHANGES WITH SEPARATING COMMAS
	    16.7024,-2.71631,0.,0.
	    THE MCMASTER COEFFICIENTS FOR THE
	    PT M EDGE ARE: 16.7024   -2.7163     0.0000     0.0000  
	    OK? Y

	    In this case the McMaster coefficients were obtained for 
	    a normalization of a Pt L edge.  The Pt L edge Mcmaster
	    coefficients were located in the MCMSTR TABLE on disk and
	    displayed for verification.  The coefficients for the back-
	    ground Pt M edge were not previously entered into the table
	    so the user must input the entry name and table values.
	    The typed coefficients are again displayed for verification
	    prior to the computation of the step height normalization.
	    A reponse of 'N' allows the user to modify the coefficients
	    for that table entry.

3 KV

	     KV
		 The KV option makes the conversion of energy to photo-
	    electron wave vector representation (Reciprocal Angstroms).
	    The result is plotted with current headings and captions.

3 FT

	     FT
		 The FT option computes a forward FFT of a desired re-
	    gion of data in k-space.  The routine also interpolates
	    the data on an even grid of 96./(N) where N is chosen by
	    the user to be 2048, 4096, or 8192 prior to the transform.
	    If the phase removal option is in effect, a set of ins-
	    structions, invisible to the user, removes the effect of
	    a complicated phase shift. The transform magnitude as a
	    function of the radial harmonics is plotted.  Also, when the
	    phase removal option is in effect, the imaginary part of the
	    transformed data is plotted along with the magnitude. A
	    choice of windowing factor (% Hanning Window) and weighting
	    factor k**n are input by the user.


4 EXAMPLE

	    FT Sample dialog :

	    (graphic curser is presented for selection of transform
	    range in k-space, acceptable responses are:)

	    N	 Endpoints and input parameters will not be
			 stored for later use. The default is save.
			 Curser returns for selection of other end-
			 point.

	    P	 Previously saved endpoints and parameters
			 are used for the transform.

	    (any char)   Locate curser and respond with any charac-
			 ter except N and P to choose endpoints.

	    (After endpoint selection the terminal prompts for % window-
	    ing, k weighting and the number of points to be transformed)

	    %  10
	    K**  1
	    #  4096	NOTE: just a  at this prompt causes
			  the default of 4096 to be chosen.
			  a <1> at this point let you repeat 
			  the dialog and reselect the 
			  endpoints.	  

	    (This example sets up a forward transform of 4096 points
	    with the outside 10% of the data windowed by a Cosine
	    Hanning Window)
	    The resulting radial transform scaled and plotted.

3 BT

	     BT
		 The BT option performs a an inverse (or back) FFT on
	    a determined region of the radial transform data. This
	    Fourier filtering step uses graphical curser input only.
	    No 'real' windowing is applied on the inverse transform,
	    but a back-transform window is an option in testing.  When
	    the first curser appears the acceptable responses are 'N',
	    'P', 'S', and ' (any char) ' with the same meaning as in the
	    forward transform routine.  After selecting two endpoints
	    a third curser appears to hold the screen for hardcopy (if
	    desired).  At this time the endpoints may be reselected by
	    responding 'R' to the third curser.  The selection process
	    is repeated as above.  Any other response resumes the com-
	    putation of the backtransform.  The result K**N*CHI vs K is
	    plotted.  N is the weighting chosen in the FT option.

	    The 'S' option selects a Back Transform Window based upon
	    the symetry of the peak selected.  Any area around the
	    peak is indicated with the cusror, 'S' is entered, and
	    the computer selects the peak of the curve. You are then
            prompted for a tolerance value to select symetry of the
	    curve under the peak. A value 0f 10 is suggested.  The
	    endpoints are display, and the program continues as
	    normal. The next cursor can be used to 'R', reselect a
	    different window or to continue the Back Transform.
	 
3 KE

	     KE
		 The KE option keeps the current output arrays by loading
	    them in to the input arrays in preparation for the next
	    step.  In this input-output array mode certain steps may be
	    executed repeatedly until a desired form of the data is ob-
	    tained.  The ability to back up and try again is of parti-
	    cular value when testing the outcome of various analysis op-
	    tions, such as SMOOTHLINE and FOURIER TRANSFORM steps.
	    Auto-keep is currently enabled, so the only time 'KE' must
	    be used is when 'DG' is used.

	    The screen is replotted after this coomand is issued.

3 XP

	     XP
		The XP option uses the graphic curser to determine a
	    region of a plot to expand.  The new plot window is stored
	    in a replot stack having three levels.  In addition, up to
	    3 sets of plot windows can be stored and recalled from disk
	    file. Curser appears and the acceptable options are:

	    (any char)  Locate curser at desired lower left corner
			of the new expand window. A box corner is
			drawn. Curser is returned again for selec-
			tion of upper corner of the expand region.
	    S	    Locate curser at desired lower left corner
			of the new expand window.  Response of 'S'
			indicates that the windows values will be
			stored in one of three storage locations
			on disk.  The response to the second curser
			determines which storage location is used.
	    1	    Window values (1) recalled from disk when
			this response is given to the first curser.
			Window values (1) stored on disk when this
			response is given to the second curser af-
			ter a reponse of 'S' to the first curser.
	    2	    Follows the same procedure.
	    3	    Follows the same procedure.

	    Screen clears and expanded plot appears.   PL returns the
	    original plot.

3 RP

	     RP
		The RP option replots any of the last three expanded plots
	    where the original plot has not been been rescaled or PL has
	    not been executed.  The replot stack is reinitialized when
	    PL is executed.  The replot stack is particularly useful for
	    quickly obtaining various scaled blowups of the absorption
	    edge.  A prompt @ is given and the acceptable responses are:

	    *     most recent expanded plot
	    *-1   2nd most recent expanded plot
	    *-2   3rd most recent expanded plot

	    The screen is cleared and the data is replotted on the 
	    chosen scale.

3 IS

	     IS
		The IS option allows the user to enter sets of plot win-
	    dows from the terminal keyboard into the replot stack.  The
	    stack holds three sets of windows for replotting until the
	    stack is reinitialized by new scaling or execution of PL.
	    New entries to the stack are prompted for and the new scale
	    is used in the replotting.

3 ES

	     ES
		The ES option produces a shift in the V output array of
	    the data so that the horizontal scale is zero at the point
	    specified by the graphic curser.  This is a particularly
	    useful option for energy edge calibration.  When the curser
	    appears the acceptable responses are:
	    (locate curser and type:)

	    N	    The edge shift is not stored for later use.
	    P	    Recalls previous edge shift
	    I	    Terminal input of edge shift value
	    L	    Terminal input of edge shift value loaded
			into storage location on disk, no edge
			shift is executed on the data.
	    (any char)  Normal execution of edge shift, stores
			edge shift in disk file.


3 DG

	     DG
		The DG option uses the graphic curser for interactive
	    deglitching of the data.  DG allows easy multiple deglit-
	    ching.  The deglitching is terminated by the 'E' response
	    after an integral number of pairs of cut points are de-
	    termined using the graphic curser.  The deglitched regions
	    are replaced by a linear interpolation between pairs of cut
	    points and the deglitched data is replotted for inspection.
	    The KE option retains the deglitched data.

3 PT

	     PT
		The PT option uses the graphic curser to label the (X,Y)
	    coordinates of points on the plot.  The printed coordinates
	    usually avoid being written on the data.  Locate the curser
	    and return any character key in response.

	    Note: If the screen is crowded, the program may get stuck in
	    an endless loop trying to find a clear space to print the
	    coordinates.

3 WF

	     WF
		The WF option writes a special format file to the de-
	    fault device for later recall using the RF option.  The file
	    contains the current input array and header to update the
	    parameters and captions.  The filename used for the file
	    depends on the current status of the data.  The format is
	    xxxxxx.*xx where

		   * = R	 Raw ratio file
		   * = L	 Log ratio file
		   * = A	 Absorption vs Energy
		   * = X	 (XANES) Absorption vs Energy
		   * = E	 Chi vs Energy
		   * = K	 Chi vs Wave Vector K
		   * = F	 Fourier Transform Magnitude vs R
		   * = B	 Backtransform K**n*CHI vs K
 		   * = P	 Phase function extracted in PF

	    The special format files can be recalled from disk in either
	    the EXAPLT or EXAFIT programs.

3 PR

	     PR
		The PR option writes the same special format file to the
	    printer instead of the default device.  The header contains
	    the current parameters, captions, and data.

	    Note: Only valid on VT125 versions, and currently only
	    functioning if the printer is connected to the Aux. Port.

	    This bug is scheduled to be fixed.

3 RF

	     RF
		The RF option reads in a special format data file and up-
	    dates all arrays and labels.  The file name must be one of
	    the following  xxxxxx.*xx , where acceptable characters in
	    place of * are R,L,A,X,E,K,F, and B .  An error message is
	    displayed if the filename is in error or the filename is
	    not on the default device.

	    ERROR -- FILE NOT FOUND. TRY THE DIRECTORY FIRST.

3 CS

	     CS
		The CS option initiates a hard copy of the the graphic
	    terminal screen if a hardware screen copy unit is available.
	    A pause of about 5 seconds occurs before the > prompt
	    reappears. 

	                  * * * VT125 ONLY * * *

	    The user is prompted for either a Large or a Small printout.
	    The printing is then spooled to the line printer with
	    the name EXAPLT.PMD and then deleated.

	    Not currently working correctly.

3 PM

	     PM
		The PM option prints to the line printer a copy of the
	    the current header map only.  The header contains the
	    current parameters, captions, and data map.

	    Again, only works on VT125 versions and only if the printer
	    is connected to the Aux. Port.

3 LM

	     LM
		The LM option lists to the terminal screen a current map
	    header. The header contains the current analysis parameters,
	    captions, and data map. 

3 DF

	     DF
		The DF option computes a divided difference differential
	    of the W output array and plots the V,dW arrays on the new
	    scale.  Ideal to use for locating the maximum slope assoc-
	    iated with the absorption edge for the calibration of the 
	    edge. This differential cannot be kept and PL returns to the
	    original V,W plot.

3 PF

	     PF
		The PF option provides most of the EXAFS phase analysis
	    and is used after the phase of the EXAFS oscillations is 
	    extracted in the back-transform BT.  The choices within the
	    phase analysis and fitting coding are numerous. The plotting
	    for this option is self-contained in the PF module so that
	    consecutive executions of the PF option is possible.  The 
	    phase tables are accesssed frequently during the execution
	    of PF coding and should be maintained on the default device.
	    The choices within PF include display of phase data and
	    functions, list of phase data and fitting of phase data.
	    The user may choose to display the experimental phase,
 	    display a phase stored in the tables TEOLEE.PHT, PARAM.PHF,
	    or display both at the same time.  The PHASE PROGRAM is
   	    used to construct the phase tables and the entries therein.
	    It is also possible to store the phase in a normal 
	    EXAFS file.

4 MORE

	    Phase Fitting Additional Information

	    The user may choose to perform three types of fits to
	    the phase data.  One is a linear least-squares fit of a
	    parameterized phase function 

			phi(k) = 2kR + A0 + A1k' + A2k'**2 + A3/k'**3

	    to the experimental data, where the An's are determined by
	    by the best least-squares fit, provided that the values of
	    R and E0 (k'=sqrt[k**2 - .262467]) are known by the user.
	    The coefficients An and E0 can be displayed on the screen
	    and if desired can be entered into the phase tables for
	    later reference.  The second type of fit is a non-linear
	    least-squares iterative fit of a known phase function
	    (only parameterized table or terminal input) to the data in
	    order to determine R and E0.  Of course, a change in R is
	    equivalent to a change in the slope of phi(k) which has a
	    large effect on the phase function a larger values of k. The
	    change in E0 is proportional to 1/k in the phase and thus 
	    has its greatest effect at smaller values of phi(k).  In
	    this respect the two parameters are at most weakly coupled,
	    and therefore ought to converge to a reasonable fit within
	    a few iterations.  The last type of fitting in the phase 
	    module is linear least squares fitting to a phase residual
	    (difference between an experimental phase and a known phase
	    from the tables or input from the terminal) for modeling
	    disorder effects on the EXAFS phase.  The phase residual is
	    modeled by linear and cubic terms (Eisenberger et.al.)

		     delphi(k) =  C1k + C3k**3

	    where the coefficients  C1 and C3 model the effects of dis-
	    order on the EXAFS phase.  C1 is related to the thermal ex-
	    pansion of the nearest-neighbor bonds. This fitting method
	    is informative provided that reference phase shifts are well
	    characterized and fit the data well for small disorder.


4 EXAMPLE

	    Sample PF dialog:

	    (D)ISPLAY ONLY OR DISPLAY AND (F)IT ? D
	  (L(ist) will list the phase data on the printer)
	    (E)XPERIMENTAL OR (T)HEORETICAL PHASE OR (B)OTH ? B
	    (S at this point will interpolate and store the phase at
	   N points, specified in a specific dialog)
	    DO YOU WANT TERMINAL (I)NPUT OF YOUR KNOWN PHASE OR A
	    (P)ARAMETERIZED OR (T)ABULAR PHASE FROM DISK TABLES ? T
	    (S at this point gives the possibility to shift the phase
	   at 2 PI)
 	  PLACE TABLES DISK IN DISK DRIVE AND THEN
	    SPECIFY ABSORBING ELEMENT, QUANTUM NO. L : PT,2
	    SPECIFY SCATTERING ELEMENT : PT
	    ABSORBER:
	    PT2	xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
	    xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
	    xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
	    SCATTERER:
	    PT	xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
	    xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
	    xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
	    OK? Y
	    TYPE IN E0 FOR YOUR TABLE: 0.0
	    TYPE IN R1 FOR YOUR TABLE: 2.774

	    This example shows the dialog for displaying both Pt
	    experimental and reference tabular phase shifts on 
	    the same plot.  The phase tables are accessed for the
	    entries PT2 and PT to construct the reference phase
	    shift and is shifted appropriately by E0 if specified 
	    by other than zero. The R1 value is specified for the
	    subtraction of 2kR1 from the experimental EXAFS phase.
	    Error messages occur if the phase tables are not found
	    on the default disk or if a particular entry is not found
	    in the tables.  The PF option will then terminate and the
	    > prompt will reappear.  A successful table search will
	    result in the display of the table entry values for 
	    verification.  Table entries can only be modified in the
	    PHASE PROGRAM, so the user must exit EXAPLT if changes are
	    desired.  We suggest that the reference phase shifts be
	    loaded into the tables and carefully verified before the
	    PF option is used in EXAPLT.  

3 PH

	     PH
		The PH option sets up the phase removal of a known phase
	    shift from the data prior to Fourier transforming.  Access
	    to the phase tables is required.  The user is prompted to
	    choose the input phase shift to be entered from tables or 
	    manually from the terminal keyboard.  The phase shift to be
	    removed is stored in an array which is passed invisibly
	    to the Fourier transform.  The PH option should be used
	    after the conversion to the wave vector representation and
	    before the Fourier transform.  The dialog is similar to the
	    phase table dialog in the PF option, however, the user must
	    specify whether to remove or add effects of scattering phase
	    shifts.  The Chi vs K oscillations are then replotted 
	    in preparation for the Fourier transform, however, it is
	    necessary to use the KE option to keep the phase shift array
	    prior to using PF.  If the phase shift was determined from
	    tabular entries then the range of data available for trans-
	    forming is limited to the range of the tabular phase func-
	    tion in k (~ 3.8 - 15.2).  The phase removal option proceeds
	    invisibly to the user during the Fourier transforming until
	    the plot is made.  In this option the imaginary part of the
	    Fourier transform is plotted along with the magnitude of the
	    Fourier transform.

3 AF

	     AF
		The AF option provides a comparison of experimental and
	    reference/empirical amplitudes by simple display of the
	    envelopes or by the LN RATIO of the amplitudes technique. 
	    A reference amplitude may be input from the terminal in
	    functional form  AMPL(K)=N/KR**2*F(K)*exp(-2K**2R**2)  with
	    F(K)= A/(1+B**2(K-C)**2), tabular form from disk tables, or
	    interpolated from an input   K**N*CHI file (xxxxxx.Bxx) on
	    disk.  The internal options in AF allow display of the
	    the amplitude envelopes or the LN RATIO of amplitudes
	    vs k**2 and provide least squares curve fitting to obtain
	    the coefficients of

		    LN RATIO= C0+C2K**2+C4K**4

	    where the intercept C0 is  LN( N/R**2 / No/Ro**2 ), the
	    slope C2 = -2 SI**2 (SI**2 is associated with the EXAFS
	    DEBYE WALLER FACTOR in the case of small disorder) and
	    and the quadratic term C4 is an increasing effect of large
	    disorder.  Coding is provided for scaling and weighting the
	    reference amplitude prior to displaying the envelopes or
	    computing the LN RATIO.  A response to the weighting dialog
	    of  / assumes a default of no weighting of the
	    reference amplitude.  For some cases, it may be useful to 
	    fix C0 and only determine C2 and C4 from least squares fits.
	    Coding is provided for this.  Manual fit of the coefficients
	    C0, C2, and C4 is an option as well as the selection of the
	    fit range in K**2.  

		The selection of 'Beat-adjustment' analysis in AF allows
	    the extraction of the backscattering amplitude of a single
	    shell from the backtransformed data of two close-lying 
	    shells of the same backscatterer type.  The approximate
	    formula used is

	    AMP(1 shell)= AMP(2 shells)/CORRECTION
	    where
	    CORRECTION= SQRT{1+C**2+2COS[2(R2-R1)K]}
	    and
	    C=(R1/R2)**2 * EXP[-2(SIGM2-SIGM1)*K**2].

	    The necessary input for this adjustment is R1,R2 (first and
	    second shell bond distance) and SIGM1,SIGM2 (first and 
	    second shell disorder factor).

3 FC

	     FC
		The FC option provides an absorption dependent correction
	    to a fluorescence spectrum which has been removed off of the
	    background absorption level using the 'X' option (XANES) in
	    in SL.  After FC is selected the plot clears and a dialog
	    appears which prompts for the fluorescence correction
	    factor "A".   A is determined from density and thickness
	    relationships in the fluorescence sample.  This correction
	    reduces the measured absorption in proportion to the
	    absolute absorption above the background.  In dilute
	    concentrated samples or thin samples the correction is
	    negligible.  If Mcmaster treatment of the XANES was chosen
	    in 'SL' then the same Mcmaster stepheight must be used
	    to reconstruct the absorption height.  The Mcmaster
	    coefficients obtained with the same dialog as in 'SL'.
	    The corrected spectrum is then replotted for
	    inpection or furthur processing. 

3 ED

	     ED
		The ED option provides a multiple curve plotting step
	    for simultaneously displaying up to four edge or near edge
	    absorption or fluorescence spectra.  In addition, the
	    difference spectra may be displayed rather than the edge
	    spectra.  Difference spectra are simply the normalized
	    absorption spectra with a reference absorption spectrum
	    subtracted.  The energy scales may be shifted to account for
	    chemical differences (shifted peak positions). Normally, the
	    choice of energy coincidence is made based on minimizing the
	    the area under the difference curve in a specific energy
	    region.  A sample dialog is provided:

4 EXAMPLE
	
	    Assume for this dialog that the data file in the EXAPLT
	    program is a CUO (copper oxide) absorption edge. It is then
	    file #0 for the ED option.

	    (P)LOT EDGES OR (D)IFERENCE EDGES? : D
	    ENTER NUMBER OF INPUT FILES (0-3 ;DEFAULT=0) : 3
	    ENTER REFERENCE FILE NUMBER (0-3) : 3
	    TYPE ENERGY RANGE  EMIN,EMAX ;DEFAULT (/)=MAX RANGE: /
	    PLEASE WAIT A MOMENT FOR SPLINE COMPUTATION
	    TYPE INPUT FILE NAME #1 : CUCL.X35
	    TYPE EDGE SHIFT #1 : 0.
	    PLEASE WAIT A MOMENT FOR SPLINE COMPUTATION
	    TYPE INPUT FILE NAME #2 : CUCL2.X35
	    TYPE EDGE SHIFT #2 : -3.5
	    PLEASE WAIT A MOMENT FOR SPLINE COMPUTATION
	    TYPE INPUT FILE NAME #3 : CUFOIL.X05
	    TYPE EDGE SHIFT #3 : 0.
	    PLEASE WAIT A MOMENT FOR SPLINE COMPUTATION

	    This discribes an example of multiple display of 4
	    difference spectra.  The difference spectra will be
	    plotted as follows:

	    difference curve #0  CUO   -  CUFOIL   unshifted
	    difference curve #1  CUCL  -  CUFOIL   unshifted
	    difference curve #2  CUCL2 -  CUFOIL   shifted by -3.5eV
	    difference curve #3  CUFOIL-  CUFOIL   unshifted

	    A similar dialog occurs for the edge plot mode, but
	    the prompt for reference file number does not occur.
	    Scaling is provided in the coding and error messages
	    for file specification errors.  Only those files
	    prior to a file specification error will be plotted
	    or differenced.  To re-display the edges simply
	    respond with  'ED' to the next > prompt after the
	    initial edge display.  A response of 'PL' causes
	    a return to the state prior to the first 'ED' response.
	    If difference spectra are displayed then a 'KE' response
	    after a successful display will retain the difference 
	    curve #0 for further processing.

	    ERROR - FILE NOT FOUND OR ERROR SPECIFYING FILE
	    ERROR - WRONG FILE TYPE FOR EDGE OR DIFFERENCE DISPLAY

3 TI

	     TI
		The TI option contains coding for interpolating the
	    amplitude or phase constructed from the inverse Fourier
	    transform step.  The interpolation is over the TEOLEE
	    range and can be stored as an entry in TEOLEE.TBL tables.
	    The phase and amplitude data must coincide with the range
	    in K (3.7795-15.1178) for the interpolation to execute.
	    Prompts for amplitude weighting and the removal of 2KR
	    from the phase are similar to the 'AF' and 'PF' options.
	    There is a prompt for Table Entry Name (2-letter element
	    name) for each entry.  The coding allows a new entry to
	    supercede an old entry only when you specify it. Coding
	    for 'beat-adjustment' in two shell amplitudes is iden-
	    tical to the 'AF' option. 
2 NOTES

NOTES:   This section is for comments and suggestions

	     THE VALUES STORED IN THE HEADER (MAP) FILE, USED FOR THE HEADER OF
	     THE SPECIAL FORMAT FILES WRITTEN TO DISK AND AS A RECORD OF THE
	     ANALYSIS, COULD POTENTIALLY DIFFER FROM THOSE ACTUALLY USED IN THE
	     DATA ANALYSIS IF THE 'N' (NOSAVE) RESPONSE IS USED WITHOUT DIS-
	     CRETION.

	     SPECIAL FORMAT FILES SHOULD BE WRITTEN AT KEY PLACES IN THE ANALY-
	     SIS SO THAT IF FATAL ERRORS OCCUR, THE ANALYSIS CAN BE RESUMED
	     RATHER THAN STARTED FROM SCRATCH AGAIN.  WE SUGGEST WRITING AT THE
	     ABSORPTION VS ENERGY STAGE AND AT THE CHI VS K STAGE.  THIS WAY
	     ANALYSIS OPTIONS SUCH AS SMOOTHLINE AND FOURIER TRANSFORMING MAY
	     MAY BE RETRIED WITH MINIMUM LOSS OF TIME AND EFFORT.

	     IF A FOURIER TRANSFORM IS WRITTEN TO THE DISK FILE THEN IT MAY
	     ONLY BE RECALLED TO THE PROGRAM FOR DISPLAY.  THE LARGE COMPLEX
	     FOURIER TRANSFORM ARRAY IS NOT RESTORED, ONLY THE MAGNITUDE. 
	     ANY SUBSEQUENT BACK-TRANSFORM, REQUIRING THE USE OF THE COMPLEX
	     ARRAY GENERATED IN THE FORWARD TRANSFORM, CANNOT BE SUCCESSFULLY
	     EXECUTED.  THIS MEANS THAT PHASE AND AMPLITUDE INFORMATION IS ONLY
	     OBTAINED AFTER A SEQUENCE OF FORWARD AND INVERSE TRANSFORMS IS
	     EXECUTED.  COMPLEX PHASE AND AMPLITUDE IS NOT RESTORED BY SIMPLY
	     READING IN A BACKTRANSFORMED (.B*) FILE  

	     ERRORS OCCUR WHEN 8 OR 9 REGIONS IS SPECIFIED IN 'SL' , THIS PROB-
	     LEM HAS NOT BEEN CORRECTED

	     PT DISPLAYS THE COORDINATES OF THE CHOSEN SCREEN POINT AND IT
	     GENERALLY AVOIDS WRITTING ON THE GRAPHICAL DATA.  SOMETIMES IT
	     FAILS WHEN THE SCREEN IS VERY CROWDED AND PRODUCES UNPREDICTABLE
	     RESULTS AND SOMETIMES GOES INTO AN INFINITE SEARCH LOOP.  USE
	     WITH CARE AND ON A LESS CROWDED SCREEN.

	     A SPECIAL FLAG CONTROLS THE OVERPLOTTING OF THE IMAGINARY AND 
	     MAGNITUDE OF THE FOURIER TRANSFORM IF THE PHASE REMOVAL  (PH)
	     IS IN EFFECT.  IF THE TRANSFORM IS RETAINED WITH (KE) THEN A
	     SUBSEQUENT (BT) MUST BE EXECUTED TO CLEAR THE FLAG, OTHERWISE THE
	     OVERPLOTTING WILL CONTINUE TO OCCUR EVEN IF NEW DATA IS READ IN
	     AND OTHER OPTIONS EXECUTED.  IF THE PHASE REMOVED TRANSFORM IS NOT
	     RETAINED WITH (KE) THEN SIMPLY TYPE (PL) TO RESTORE NORMAL
	     PLOTTING.

2 PANIC

	  In the event of a major disaster concerning the Exaplt
	program, help can be obtained by contacting:

			Mark Engbretson
			Brookhaven National Laboratory
			National Synchrotron Light Source
			Building 725A Beamline X18-B
			Upton, New York   11973

			Phone (516) 282-5718


