C-Plot Scripts and Functions for Reflectometry

Template for writing User 4 functions.
Example for writing User 5 functions (gaussian.5.c).

Note:  When compiling functions for C-Plot that are dependent upon the ref.C source, use cppmake4 and cppmake5 instead of C-Plot when compiling User 4 and User 5 functions, respectively.  These files are included in functions.tar.  Usage:  cppmake4 function.4 ref

Otherwise, you can use C-Plot or makefunc to complile the functions.

Do Scripts
addiso Adds isotherm data to the current plot.
dratplot "Display Ratio Plot" was originally used to show comparisons of data ratios, but can be used to plot any series of up to 6 data files in any filter. [code]
dpkey Make the key for the plot from dratplot. [code]
fitplot Plots reflectivity data and a fitted line given the parameters.
gid Extracts and plots grazing incidence angle diffraction from a reflectivity.
isomult Creates a plot made from several saved isotherm datas.
isoplot Plots isotherm data.
lineplot Plots the last two line up scans from the Spec macro line.
logrrf Plots the natural log of R/Rf.
log10rrf Plots the log base 10 of R/Rf.
mon Plots monitor intensity vs. Qz.
pr Scales and plots the current data to filter zf2 (usually the printer).
print Scales and prints a do file to filter zf2 (usually the printer).  This will work with isomult, fitplot, sld/gen_sld, and any other do file that begins with a zw and ends with a zx.
ref Processes and plots reflectivity data by executing gen_ref.4.  This will also create rmon, rtth, and rpress.
rmon Created by do file ref.  Plots monitor count vs. Qz for a reflectivity.
rpress Created by do file ref.  Plots the surface pressure vs. time for a reflectivity.
rrf Normalizes reflectivity to water (R/Rf).
rtth Created by do file ref.  Plots the last reflectivity scan: the two theta motor at Qz=.5.  This is used to determine the reliability of the last point in our reflectivity.
sh Plots intensity vs. sample height.
sld Plots the scattering length density from a given parameter file saved via fitref.5's "SP" commmand (or typed in a similar format).
tth Plots intensity vs. two theta angle.
va13 Quickly sets wt (for y=log(y), c(3)=1) and varies the parameters for the fitref13.5 function. [code]
va14 Quickly sets wt (for y=log(y), c(3)=1) and varies the parameters for the fitref14.5 function. [code]

aps_scans.4 Used to interpret spec style data from APS.
compress.4 Calculates the compressability from current data.
conv.5 This program uses a function used to fit a possion distribution curve after convolution to data.
ConvRef.5 This function is a modified version of fitref.5, with convolution added.
deriv.4 This function creates the derivative of the current data.
div_avr.4 Used in the do file ref.
error.4 Simple program to add or subtract error bars from data.
fitpoly.5 Fits with a polynomial function of up to 9th order. [source]
fitref.5 Does reflectivity fitting.
fitrod.5 Does rodscan fitting.
fix_zero.4 Removes zeros (i.e. y=0) from the current data.  This is basically an outdated function.
gaussian.5 Does Gaussian or Lorenzian data fitting.
gausssq.5 Modified version of gaussian.5 to allow up to 10 peaks.
gen_ref.4 Generates script file gen_ref.  Usually run via the do file ref.
gen_rrf.4 Generates script file gen_rrf.  Usually run via the do file rrf.
gen_sld.4 Generates script file gen_sld.  Usually run via the do file sld.  USEFUL NOTE:  You may edit and reuse the file gen_sld as often as you like.
icsref.5 Calculates incoherent scattering for a monolayer.
isomult.4 Generates script files isolist and isolist2.  Usually run via the do file isomult.
linfit.5 Fits a line to data.
paramfix.4 Eliminates unwanted parameters from reflectivity. Outdated.
ref1.4 Uses the parameter file parameters.dat do create a reflectivity curve.
rrf.4 Calculates R/Rf for the data currently in memory.  Usually run via the do file rrf.
watercap3.5 Water Radial Function Generator.

Script:  addiso
    Usage:  do addiso <filename> <scan_number> <magic_number>
      Where <filename> is the name of the Spec data file, <scan_number> is the scan number of the isotherm, and <magic_number> is the number of molecules spread / 10^16.
    What is it?:
      Addiso extracts and overlays isotherm data from a Spec data file onto the current plot.

Script:  fitplot
Usage:  do fitplot <reflectivity file> <parameter file>
Where <reflectivity file> is a reflectivity data file (.ref) and <parameter file> is a fitref.5 parameter file saved by the command "SP"
What is it?:
This script file plots the R/Rf of the reflectivity data and the parameter's line on a logarithmic axis (so the error bars are viewed correctly).

Script:  isomult
    Usage:  do isomult
    Files Created:
      isolist - All the commands isomult creates.
      isolist2 - If a legend is asked for, it is created with this script (but the legend is drawn with isolist).
    What is it?:
      This script file generates a plot from several isotherms (up to seven).  It is useful because it takes care of data manipulation, x and y axis ranges, and legend text.  Each data set must already be processed (i.e. by the script isoplot) and saved in a file.
      If you need to change/remove any commands that isomult creates, you may edit  isolist and/or isolist2 and type "do isolist"  instead of re-executing isomult.  This will save the time of answering all the questions isomult asks when, lets say, all you want to do is change the name of one file or place the legend in another position.

      If you want to print the current isomult plot, don't re-execute isomult and answer yes to the print question.  Instead, change to the printer's filter (e.g. "zf2") and enter "do isolist" then switch back to your original filter.

Script:  isoplot
    Usage:  do isoplot <filename> <scan_number> <magic_number>
      Where <filename> is the name of the Spec data file, <scan_number> is the scan number of the isotherm, and <magic_number> is the number of molecules spread / 10^16.
    What is it?:
      Isoplot extracts and plots isotherm data from a Spec data file.

Script:  logrrf/log10rrf
    Usage:  do logrrf
      The script will prompt for a file name.  The file should have saved reflectivity data (i.e. sphing5a.ref).
    What is it?:
      This script plots the ln/log10 of R/Rf vs. Qz (linear scale). NOTE:  The error bars are not corrected yet.