Extended IDL Help

  • Return to IDL Topics

    Last modified: Tue Aug 7 08:53:44 2007.


    List of Routines


    Routine Descriptions

    ACTIVATE

    [Next Routine] [List of Routines]
       
    	ACTIVATE
    
     PURPOSE:
    	Calculate activation yield from voltage and current waveforms
           Current and voltage will be put on a uniform time base using
              linear interpolation
              (Hooks are there to use xy type data)
    	Cross sections have been provided by Gary Cooper.
    
     CALLING SEQUENCE:
    
    	Response = ACTIVATE (WDV, WDI [, WDOUT] [, REACTION = reaction] 
                         [, CHARGE = charge] [, PRINT = print] )
    
     INPUTS:
    	WDV:	Waveform data array number for the voltage, units = Volts
    	WDI:	Waveform data array number for the current, units = Ampere
                   Negative values of current are set to zero.
    	WDOUT:	Waveform data array number for the response
                   Default is (Maxwdfarray-1)
    
     KEYWORD PARAMETERS:
        CHARGE:    Ion charge. Default = 1
                   Voltage will be multiplied by this number and current 
                   divided by this number to obtain particle energy and current.
        REACTION:	Desired reaction indicated by a number given by the following:
                   1. Li on LiF -> 24Na
                   2. H  on LiF ->  7Be
                   3. H  on  BN ->  7Be
                   4. C  on  BN -> 24Na
                   5. F  on  BN -> 28Mg
                   If not specified a widget will be provided for the selection.
        PRINT:     Print the yield curve values 
                   Note: These values are also store in Maxwdfarray and may be
                         plotted with: PLO, get_maxwdf()
    
     OUTPUTS:
    	The number of joules/Bq for the given current, voltage and reaction
           is returned.  The response as a function of time and energy are in
           WDOUT (or Maxwdfarray-1) and Maxwdfarray.  
           Note: If all ions are below threshold then zero is returned.
            
     PROCEDURE:
    	Limit voltage to >5% of maximum
           Adjust current and voltage for charge if not 1
           Calculate current yield for these voltages.
           Integrate yield and energy to obtain response (joules/Bq)
    
     EXAMPLE:
    	Assume counts= [28, 20, 30] is the activation of 3 shakers.
           Calculate the energy/cm2 for each if the area of each is .02 cm2
           Assume voltage in array 2 and current in array 3 and the ions have
             a charge of 1 and the reaction is protons on LiF.
    		ener = activate(2, 3, r=2)/.02*counts
                   print, ' Shaker   Counts    Energy/cm2'
                   for i = 0, 2 do print, i, counts(i), ener(i)
           
           Same as the last example but assume the protons go through a 20 micron
              aluminum filter(z=13) before hitting the LiF.
          vout = -9  ; set the unknown quantity as a variable
          stopping, /quiet, 1, getyf(2)*1e-6, vout, 20 , 13
          ;Note: the 1 is protons, voltage is scaled to MeV, 20 & 13 are the foil
          puty, vout*1e6, 2   ; return the attenuated voltage to wdf array 2
          ; the rest is the same as before:
    		ener = activate(2, 3, r=2)/.02*counts
                   print, ' Shaker   Counts    Energy/cm2'
                   for i = 0, 2 do print, i, counts(i), ener(i)
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, May 5, 1996
    

    (See ../pfidl/pfidl_1d/activate.pro)


    ADD

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           ADD
    
     PURPOSE:
           Add a WDF array to a WDF array or to a constant 
           Store the result in the initial WDF array or another WDF array
     CATEGORY:
           Math 
     CALLING SEQUENCE:
           ADD, WD1, WD2 [, WD3]
           ADD, WD1, 0, VAR, [, WD3]
     INPUTS:
           WD1:      WDF array number of the first array
           WD2:      WDF array number of array to be added to first array
      or
           0, VAR    Variable or constant to be added to the first array
     OPTIONAL INPUT:
           WD3:      WDF array number for the sum, if not specified the 
                     sum is stored in WD1 the first array)
     KEYWORD PARAMETERS:
           CLABEL    Replace the dataset comment for array number WD3 
                     with the string or string variable specified
           XLABEL    Replace the dataset x-axis label for array number WD3
                     with the string or string variable specified
           YLABEL    Replace the dataset y-axis label for array number WD3
                     with the string or string variable specified
           SORTX     Sort the X values and take all unique values.
                     Ignored if MASTER is set
           MATCH_ONLY If one array is XY data and the match is not exact,
                      then make a new XY array with only X values in both
                      arrays that differ by less than ERR where
                      ERR =  (xmax-xmin)/(100*np)]  if match_only ge 0
                          = - match_only            if match_only lt 0
                      where np is the number of points in the first array
                         and [xmin, xmax] is the range of the first data array
                      (1% of the average point spacing)
                      The points are selected by:
                           X2-ERR < X1 < X2+ERR
                      In the actual implementation, if both arrays are XY then
                        the X1 values are those of the shorter array and not
                        necessarily the first array.
                      Multiple X2 points which satisfy the inequality are averaged
           MASTER:    If the abscissa of WD1 does not match the abscissa of WD2 
                      then the abscissa values in the master array will be used 
                      exactly in the region of overlap.  If MASTER is negative 
                      then all of the abscissa values in the master array will 
                      be used and ordinate values where there is no abscissa will
                      be set to DEFAULT. If keyword_set(MASTER) and abs(MASTER) is 
                      not 2, then abs(MASTER) is set to 1.
           DEFAULT:   Value to be use when MASTER is negative and there is not 
                      complete overlap of the master curve.
                      Default:  DEFAULT = 0.0
    
     OUTPUTS:
           NONE    The sum is stored in a WDF array in the common block
     COMMON BLOCKS:
           COM.DAT  WDF common block 
     RESTRICTIONS:
           WD1 array must be defined and have valid data
           WD2 or 0 and a Variable must be defined
     PROCEDURE:
           If WD2 is specified:
                WD1 and WD2 are put on a common time base and the sum calculated
                If there are less than 2 points of overlap, then no action is
                taken.  Linear interpolation is used to put the arrays on a
                common abscissa scale using the minimum abscissa increment.
           If 0, VAR is specified:
                WD1 is added to VAR, where VAR is a constant or a variable.
           In either case, the sum is stored in WD3, if specified, or WD1, 
           if WD3 is not specified.
     EXAMPLES:
           Add WDF arrays 2 and 3 and store the result in WDF array 8.
                   ADD, 2, 3, 8
           Add the variable OFFSET to WDF array 2 and store the sum 
           in WDF array 8 and modify the dataset comment.
                   ADD, 2, 0, offset, 8, c = 'Voltage with '+ string (offset)
     MODIFICATION HISTORY:
          Original version, L. P. Mix, May 15, 1992
    

    (See ../pfidl/pfidl_1d/add.pro)


    ADD_COYOTE

    [Previous Routine] [Next Routine] [List of Routines]
     Name: ADD_COYOTE
     
     Description:
           Add the coyote directory to a IDL session path.
           Caution: Some routines in the coyote directory conflict with
                    the IDL distribution.
    
     Format: add_coyote
    
    

    (See ../pfidl/pfidl_1d/add_coyote.pro)


    ADD_RSI_HELP

    [Previous Routine] [Next Routine] [List of Routines]
     Name: ADD_RSI_HELP
     
     Description:
           Add the RSI routines to the LHELP command
           Caution: Some of the help routines are over 10 years old and 
                    the routines have changed or added new keywords.
                    These HELP files are no longer supported by RSI.
    
     Format: add_rsi_help
    
    

    (See ../pfidl/pfidl_1d/add_rsi_help.pro)


    ADD_TOOLS

    [Previous Routine] [Next Routine] [List of Routines]
     Name: ADD_TOOLS
     
     Description:
           Add the tools directory, written by Greg Dunham, to a IDL session path.
    
     Format: add_tools
    
    

    (See ../pfidl/pfidl_1d/add_tools.pro)


    ADD_TRAINING

    [Previous Routine] [Next Routine] [List of Routines]
     Name: ADD_TRAINING
     
     Description:
           Add the training directory to a IDL session path.
           Caution: Some routines in the training directory may conflict with
                    the IDL distribution.
    
     Format: add_training
    
    

    (See ../pfidl/pfidl_1d/add_training.pro)


    AVE

    [Previous Routine] [Next Routine] [List of Routines]
      Function which returns the average value of a waveform data array.
      Optional parameters allow the specification of a limited portion
      of the array.
      NOTE: To obtain the time dependent average of several waveforms, 
            see SUM
      format: AVERAGE = AVE(wd1 [, SD = sd] [, LEFT  = left] [, RIGHT = right]
                          [, /ARITHMETIC_MEAN ] [, /QUIET ])
      where:
        AVERAGE   - average value of the WDF array
        wd1 - WDF array number
        sd  - Standard deviation = sqrt( total(y-ave)^2/ (n-1))
        left, right - optional abscissa value to specify the left and right
                      abscissa values used to determine the local maximum
                      if absent, the default values are the first and last data
                      points, respectively
        Arithmetic_mean - Ignored unless X-Y Data.
                          If set, ave =(Total (Y)/ n_elements(y))
                  Default is Arithmetic_mean not set
                  Procedure with not set is:
                          select valid X values.
                          sort x, y by x 
                          integrate (y dx)
                          ave = int(y dx)/(max(x)-min(x))
        quiet - if present and nonzero, no values will be printed to the terminal
      Note:   The IDL function TOTAL is used to calculate the average
      Examples:
        Print the average value of array 2 between 10 and 1000
          Print, AVE(2, l = 10, r = 1000)
    
        Eliminate a baseline offset in waveform 2 by subtracting the average
        value of the baseline up to the time the signal starts at 35ns
          sub, 2, 0, ave(2, r= 35e-9)
    
        Calculate the average value of array 3 and store it in average;
        suppress terminal output
          AVERAGE =  AVE(2, /quiet)
    
    

    (See ../pfidl/pfidl_1d/ave.pro)


    BLACKBODY

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           BLACKBODY
    
     PURPOSE:
           Generate a blackbody spectrum of Watts/m2/d(unit) vs unit
           where unit is typically temperature in eV.
    
     CATEGORY:
           Analysis
    
     CALLING SEQUENCE:
       BLACKBODY, WDF, TEMP, ENERGY, TOTALOUT = TOTAL, POWER = power,
                       /WaveLength, /HighDensity , NO_SAVE= nosave
                       /Kelvin
                       MINIMUM = minimum, MAXIMUM = maximum
    
          Where:
           WDF   - Waveform array for data storage of the blackbody spectrum.
                   Spectrum will be Watts/m^2/eV
                   Default is first unused wdf array or get_maxwdf().
                Value ( Watts/m^2/eV ) :
                   Spectrum=1.583476669924e+08*Energy^3/(exp(Energy/Temp)-1.d0)
                Value ( Watts/m^2/m ) :
                   Spectrum=1.277159597666d+14*((Energy^5)/(exp(Energy/Temp)-1.d0)
           Temp  - Temperature of the black body emitting surface
                   Units are (eV) unless KELVIN is set
           Energy- Energy values (eV) for the WDF array or wavelength values if
                   wavelength is set.  
                   Energy is ignored if it has less than 3 elements
                   Minimum value = 0.025
                   Default: Energy = t/40 + 15*Temp*findgen(512)/511
                   If HighDensity is set:
                   Default: Energy = t/100+ 25*Temp*findgen(12288)/12287
                 if wavelength is set
                   Wavelength = 1.2398424385d-06/energy
                     where energy is defined above
           TotalOUT - Integrated value of the spectrum over all wavelengths.
                   Total = sigma*Temp^4 (W/m2)
                   where sigma = 1.02830e+09 with Temp in eV.
           POWER - Power calculated for the energy /wavelength
                   Units are Watts/m^2/(m or eV)
           KELVIN- If set, TEMP is in degrees Kelvin
                   (11604.448 degrees Kelvin = 1 ev)
           No_SAVE- Do not save in a wdf array
           WaveLength - If set, WDF will be the spectrum vs photon wavelength
                        Spectrum will be Watts/m^2/meter with wavelenght in 
                        meters unless units is set
                        WaveLength = 1.2398424385d-06/(Energy > 0.025) (meters)
               Spectrum=3.741774922d-26/Wavelength^5/(exp(Energy/Temp)-1.d0)
           UNITS - If set, units are Watts/cm^2/Ang/sr or  Watts/cm^2/eV/sr
                   Depending on whether WAVELENGTH is set
                   We assume that emission into "pi" Sr
           HighDensity - If set a dense set of default energy values are used.
                         See Energy above.
           Minimum - Minimum energy/wavelength (See Energy for defaults.)
           Maximum - Maximum energy/wavelength (See Energy for defaults.)
     OUTPUTS:
           WDF array with power spectrum and the total power in keyword TOTAL.
    
     EXAMPLE:
           Store the black body spectrum for 100 eV source in WDF array 5
             BLACKBODY, 5, 100 
    
     MODIFICATION HISTORY:
           Written by:     L. P. Mix, 4/30/01
    

    (See ../pfidl/pfidl_1d/blackbody.pro)


    BLIN

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           BLIN 
    
     PURPOSE:
           Subtract a constant value from a waveform
           Baseline can be set by clicking left mouse button, by entering
             a value, or by averaging a specified portion of the waveform.
           Once a baseline is set it will moved only if a different
             value is selected.  Until it is set the baseline will follow the 
             cursor.
           Baseline is accepted with the middle mouse button. Program exits.
           Selected baseline is reset with the right mouse button in cursor mode.
           Left and right buttons specify the initial and final portions of the 
             baseline for the average process.
           Exit/Quit  button will exit with no baseline.
           
    
     CALLING SEQUENCE:
    	BLIN, WDF1 [, WDF2] [, OFFSET = offset] [, XRANGE = XRANGE] [,/NO_SAVE]
           [, SAVE = save] [, XSIZE = xsize] [, YSIZE = ysize] [, /AVERAGE]
           [, SD = sd] [, RANGE = range] [, _EXTRA = extrastuff]
    
       where:
           WDF1  - WDF array number or an array name.
           WDF2  - WDF array number to store the result.
                   Default WDF1 = WDF2
    
     KEYWORD PARAMETERS:
    	OFFSET: Value of the baseline selected. Default = 0.0
                   If quit is selected, OFFSET = 0.0
                   If average is set:
                   offset = ave(wdf1, left = range[0], right = range[1], sd=sd)
    	Xrange: Keyword passed to the PLO command.
           SAVE:   Is 0 if NO_SAVE is set or if QUIT is hit
                   Is 1, otherwise
           NO_SAVE:If set, only value will be returned.
           XSIZE:  Size in pixels for the draw widget
           YSIZE:  Size in pixels for the draw widget
                   Default values set in set_drawsize.
           AVERAGE: If set, the baseline will be determine from the average of the
                    waveform over a specified interval.
                    If not set, the baseline is set visually with a cursor.
                    Default is AVERAGE = 1 for the first time.
                    Subsequent calls will use the value from the previous call.
           SD    : If average is set (the default), then this is the standard 
                   deviation of the average.  SD=0 for cursor method.
           RANGE : If average is set (the default), this vector contains the 
                   left and right range for calculating the average baseline.
                   If this is input with two values, these will be used for the initial
                   values of the average range.
           _EXTRA: Any other valid keywords to the plo command.
    
     EXAMPLE:
    	Select the baseline on waveform 4 and subtract it.
             BLIN, 4 
    
           Select the baseline on waveform 5 and the result in waveform 15
           Plot 0nly form -100 to 50 ns.
             BLIN, 5, 15, xr = [-100, 50]*1e-9
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, April 1, 1998
           Added average option, Feb. 19, 2002
           Added keywords: range, sd, July 26, 2002
    
    

    (See ../pfidl/pfidl_1d/blin.pro)


    BOX

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           BOX
     PURPOSE:
           Draw a box grid with different labels on all four sides.
           Scaling will be according to the x1 and y1 values unless save is set.
     
     CALLING SEQUENCE:
           BOX
    
     KEYWORD PARAMETERS:
           X1RANGE  - Xrange for bottom axis.
           X2RANGE  - Xrange for top axis.
           Y1RANGE  - Yrange for left axis.
           Y2RANGE  - Yrange for right axis.
           X1TITLE  - Xtitle for bottom axis.
           X2TITLE  - Xtitle for top axis.
           Y1TITLE  - Ytitle for left axis.
           Y2TITLE  - Ytitle for right axis.
           SAVE     - If set, plot parameters will be set to the second set of 
                      axes. (X2range, Y2range)
           _extra   - Any valid keywords for the plot command.
                      (ticklen, margin, etc)
                      Parameters set by box command are:
                         NoData = 1
                         xstyle, ystyle = 9
                         xmargin, ymargin = !x.margin(0), !y.margin(0)
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, April 2, 1998
    

    (See ../pfidl/pfidl_1d/box.pro)


    CABLCOMP[1]

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           CABLCOMP
    
     PURPOSE:
           Correct the measured signal for cable degredations
    
     CALLING SEQUENCE:
           CABLCOMP, WDF1, WDF2 [, WDF3] [, /PLOTIT] [, /ZOOMIT]
    
     INPUTS:
           WDF1:   Measured degraded signal
           WDF2:   Calculated response function from GET_CABLCOMP
                   NOTE:  WDF2 should be on the same time base as WDF1
    
     OPTIONAL INPUTS:
           WDF3:   Storage location for the calculated signal
                   DEFAULT:  WDF3 = WDF1
    	
     KEYWORD PARAMETERS:
           PLOTIT: Plot WDF1 and WDF3, the cable compensated version of WDF1
                   If KEYWORD_SET(ZOOMIT), then PLOTIT = 1
           ZOOMIT: If set, use ZOOMW to view the plot.  
    
     OUTPUTS:
           The waveform is corrected for the cable attenuations
    
     SIDE EFFECTS:
    	The original data (WDF1) is stored in Get_MaxWDF().
    
     PROCEDURE:
           The procedure uses the time domain convolution described by Bill Boyer
           (SAND87-3072).  The technique is similar to the XDAMP routine
           XI_cabcomp.  Modified for speed increase.
    
     EXAMPLE:
    	Calculate the signal response expected for a signal in WDF array 5 using 
           the calculated response in WDF array 44.  Store the result back in array 5
           and plot the measured and corrected signal.
    
              CABLCOMP, 5, 44, /plot
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, Jr., December 7, 2006
                           From XDAMP routine XI_cabcomp
                           See SAND87-3072, 1987
                           Computer Compensation for Cable Signal Degradations
                             by W. B. Boyer
    

    (See ../pfidl/pfidl_1d/cablcomp.pro)


    CABLCOMP[2]

    [Previous Routine] [Next Routine] [List of Routines]
      procedure XI_cabcomp
    
      Procedure to compensate cables by convolving ENTERED array with a second
      waveform assumed to be a compensator. 
      Maintains number of points in signal array.
    

    (See ../pfidl/pfidl_1d/cablcomp.pro)


    CDB

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           CDB
    
     PURPOSE:
           This routine allows the working directory to be changed to a previous
           directory.  This routine works with CDF and CDS to facilitate
           directory navigation.  Two directory stacks are maintained with 
           these three routines to allow forward and backward navigation similar
           to a browser.  This routine accesses the backward stack.
    
     CATEGORY:
           Utility
    
     CALLING SEQUENCE:
    
           CDB [, NUMBER] [, /SHOW_STACK] [, /CLEAR_STACK] [, /QUIET]
    
     OPTIONAL INPUT:
           Number      - Optional directory number
                       If a number, this is the entry number in the past stack
                         If NUMBER = -1, then the first directory (last directory
                         in the back_stack) will be used.
                       If a string, this string is compared to entries in the 
                         past stack and the first entry found is used.  In the 
                         case of more than one match, a warning is printed.
                       Default: NUMBER = 1 
                       (Directory at the top of the "Past" directory stack.)
                 Note: IF SHOW_STACK or CLEAR_STACK are set, NUMBER is ignored
    
     KEYWORD PARAMETERS:
           SHOW_STACK  - Show the "PAST" stack of directories
           CLEAR_STACK - Empty the "PAST" stack of directories
           QUIET       - Do not print the current directory
    
     PROCEDURE:
           The procedure changes the working directory to the indicated 
           PAST directory stack value.  Before changing the current directory is 
           stored on the "Future" directory stack.  
    
     EXAMPLE:
           Change to the previous directory back in time.
             CDB
    
           Change directory to the 3 directory back
             CDB, 3
    
           Show all directories in the PAST stack.
             CDB, /show
    
           Change to the first directory put on the directory stack.
             CDB, -1
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, December 3, 2003
    

    (See ../pfidl/pfidl_1d/cdb.pro)


    CDF

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           CDF
    
     PURPOSE:
           This routine allows the working directory to be changed to a previous
           directory.  This routine works with CDB and CDS to facilitate
           directory navigation.  Two directory stacks are maintained with 
           these three routines to allow forward and backward navigation similar
           to a browser.  This routine accesses the forward stack.
    
     CATEGORY:
           Utility
    
     CALLING SEQUENCE:
    
           CDF [, NUMBER] [, /SHOW_STACK] [, /CLEAR_STACK] [, /QUIET]
    
     OPTIONAL INPUT:
           Number      - Optional directory number or a search string
                       If a number, this is the entry number in the forward stack
                         If NUMBER = -1, then the last directory (last directory 
                         in the forward_stack) will be used.
                       If a string, this string is compared to entries in the 
                         forward stack and the first entry found is used.  In the 
                         case of more than one match, a warning is printed.
                       Default: NUMBER = 1 
                       (Directory at the top of the "Forward" directory stack.)
                 Note: IF SHOW_STACK or CLEAR_STACK are set, NUMBER is ignored
    
     KEYWORD PARAMETERS:
           SHOW_STACK  - Show the "FOWARD" stack of directories
           CLEAR_STACK - Empty the "FOWARD" stack of directories
           QUIET       - Do not print the current directory
    
     PROCEDURE:
           The procedure changes the working directory to the indicated 
           FOWARD directory stack value.  Before changing the current directory is 
           stored on the "PAST" directory stack.  
    
     EXAMPLE:
           Change to the next directory in time.
             CDF
    
           Change directory to the 3 directory forward
             CDF, 3
    
           Show all directories in the FUTURE stack.
             CDF, /show
    
           Change to the last directory added to the stack.
             cdf, -1
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, December 3, 2003
    

    (See ../pfidl/pfidl_1d/cdf.pro)


    CDS

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           CDS
    
     PURPOSE:
           This routine allows the working directory to be changed using a 
           widget interface.  This routine works with CDF and CDB to facilitate
           directory navigation.  Two directory stacks are maintained with 
           these three routines to allow forward and backward navigation similar
           to a browser.
    
     CATEGORY:
           Utility
    
     CALLING SEQUENCE:
    
           CDS [, DIRECTORY] [, /SHOW_STACK] [, /CLEAR_STACK] [, /QUIET]
    
     OPTIONAL INPUT:
           DIRECTORY - Optional directory
                 Note: IF SHOW_STACK or CLEAR_STACK are set, DIRECTORY is ignored
                       If present, DIALOG_PICKFILE will not be called.
                         The working directory will be changed and the present
                         directory will be placed on the directory stack.
                       Default: DIRECTORY = DIALOG_PICKFILE(/DIRECTORY, /MUST_EXIST)
    
     KEYWORD PARAMETERS:
           SHOW_STACK  - Show the stack of directories
           CLEAR_STACK - Empty the stack of directories
           QUIET       - Do not print the current directory
    
     EFFECT:
    
     PROCEDURE:
           The procedure determines if the directory is valid and changes 
           the working directory.  Before changing the current directory is 
           stored on the "Past" directory stack.  The "Forward" directory stack
           is cleared.
    
     EXAMPLE:
           Change directory to '/remote/data'
             CDS, '/remote/data'
    
           Change directory to a directory to be selected from a widget
             CDS
    
           Show all directories in the stack.
             CDS, /show
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, December 3, 2003
    

    (See ../pfidl/pfidl_1d/cds.pro)


    CHA

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           CHA
    
     PURPOSE:
           Change the prameters of a WDF array
     CATEGORY:
           Utility
     CALLING SEQUENCE:
           CHA, WD1, 
     INPUTS:
           WD1:      WDF number or an array of numbers of WDF arrays to be changed
                     or a search string
     KEYWORD PARAMETERS:
           CLABEL    Replace the dataset comment for array number WD1 
                     with the string or string variable specified
           XLABEL    Replace the dataset x-axis label for array number WD1
                     with the string or string variable specified
           YLABEL    Replace the dataset y-axis label for array number WD1
                     with the string or string variable specified
           APPEND    If set, append the string in CLABEL, XLABEL or YLABEL to
                     the corresponding label with an intervening space unless
                     append is a string. 
           ACLABEL, AXLABEL, AYLABEL - Same as append but only apply to the comment
                     xlabel or ylabel respectively.
           NPOINTS   Change the number of points to the specified number --
                     SEE SIDE EFFECTS
           DELTAT    Change the interval between points to the specified value --
                     SEE SIDE EFFECTS
           TZERO     Change the initial time of the first data point --
                     the effect is similar to the TSH command
           ADT       Change the interval between points to the specified value 
                     and do not change the number of points or their values
           MDT       Multiply the all abscissa values by the specified value
                     and do not change the number of points or their value
           SCALE     Multiply the amplitude by a scale factor.  This is identical
                     to mul, wd1, 0, scale.
                     or to set the amplitude to a function of x or y.
                     example: to set the amplitude to (sin(x)/y) or a user 
                              specified function use: 
                       scale = 'sin(x)/y'.
                       scale = 'My_Function(x, y)' 
                     Note: The user is required to insure valid data.
           QUIET     Don't give WARNINGS.
    
           FILE      Replace the file name with the value in file
     OUTPUTS:
           NONE    The parameters are stored in the WDF common block
     COMMON BLOCKS:
           COM.DAT  WDF common block 
     SIDE EFFECTS:
           If NPOINTS is changed then DELTAT will be changed to allow the data
             to cover the same interval.
           If DELTAT is changed then NPOINTS wlll be changed to allow the data
             to cover the same interval.
           In both cases:
              Linear interpolation will be used to calculate new values
              If the number of points is decreased, then a boxcar filter with 
                width = ((deltat ratio) +1) is used to smooth the data.
           Note: If X-Y data is stored in the waveform array, it will be converted
                  to uniformly space abscissa values if npoints, deltat,
                  or adt is specified.
     RESTRICTIONS:
           WD1 array must be defined and have valid data
     PROCEDURE:
           See SIDE EFFECTS.  For the other parameters, the new values are 
              stored in the WDF common block.
     EXAMPLES:
           Change the comment label of array 4 to inclued the shot number 
             at the end. Assume shot is in variable shot.
                   Shot= 5791
                   CHA, 4, c= shot, /ac
       < OR >      CHA, 4, c= shot, /ap ; since only one label is changed
           Similar to the example above, but use ' - ' as a separator
                   Shot= 5791
                   CHA, 4, c= shot, ac= ' - '
       < OR >      CHA, 4, c= shot, apppend = ' - '
           Change the dataset comment or label to 'Machine voltage (MV)' for
              array 2 and change the amplitude from volts to megavolts
                   CHA, 2, c = 'Machine voltage (MV)', scale = 1e-6
           Change the abscissa units of arrays 2 through 9 to ns from s.
                   CHA, indgen(8)+2, x = 'Time (ns)' , m = 1e9
           Change the abscissa units of arrays 2 through 9 to 1.0, change the 
                   abscissa label to 'Time Steps', and change the initial abscissa
                   value to 0.0.
                   CHA, indgen(8)+2, x = 'Time Steps' , ad= 1, tzero = 0.0
     MODIFICATION HISTORY:
          Original version, L. P. Mix, May 15, 1992
    

    (See ../pfidl/pfidl_1d/cha.pro)


    COLOR_INIT

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
        COLOR_INIT
    
     PURPOSE:
        Select true color (24 bit) if available, or pseudo color (8 bit) visual
        consistently on X, Windows, and Macintosh.
    
     CATEGORY:
        Startup utilities.
    
     CALLING SEQUENCE:
        COLORSET
    
     INPUTS:
        None
    
     OPTIONAL INPUTS:
        None
           
     KEYWORD PARAMETERS:
        RETAIN        Specifies the default method used
                      for backing store when creating new windows.
                      0 => No backing store
                      1 => Server or window system performs backing store
                      2 => Make IDL perform backing store (DEFAULT)
        DECOMPOSED    Specifies the the way in which graphics
                      color index values are interpreted when using displays with
                      decomposed color (TrueColor or DirectColor visuals).
                      0 = > Color indices given by single 8 bit values (DEFAULT)
                      1 = > Color indices given by three 8 bit values
        PSEUDOCOLOR   If set, try selecting PseudoColor (8-bit) mode
                      (default is to try selecting TrueColor (24-bit) mode).
        QUIET         If set, no color information is printed
                      (default is to print the color table size, and number of colors).
                  
     OUTPUTS:
        None
    
     OPTIONAL OUTPUTS:
        None
    
     COMMON BLOCKS:
        None
    
     SIDE EFFECTS:
        This routine changes the IDL visual for the rest of the IDL session.
    
     RESTRICTIONS:
        Only affects X, WIN, and MAC displays.    
        Only has an effect if run before any windows have been
        created, and if no DEVICE commands have been executed.
    
     EXAMPLE:
    
     ;Execute the following command immediately after IDL startup.
    
     color_init
    
     MODIFICATION HISTORY:
        Original by: Liam.Gumley@ssec.wisc.edu, July 16, 1999
        
    

    (See ../pfidl/pfidl_1d/color_init.pro)


    COM

    [Previous Routine] [Next Routine] [List of Routines]
      Compares two WDF arrays and attempts to find amplitude and time shifti
      values which minimize the differences (least squares) between the arrays.
      The fit of arrays, A and B, is of the form:
           A(t) = amp*B(t-tshift) + bline(1)*t + bline(0).
      The default comparison assumes bline(0) and bline(1) are zero.
      Fit assumes continuous data.  Non-uniform waveforms are first put on a uniform
      abscissa spacing.  Both waveforms are then placed on the same uniform spacing 
      using the minimum spacing.
      Following the fit, the left and right hand sides of this equation are
      plotted.
      NOTE: The two maximum WDF arrays are used for the plots if OUT is not specified.
            The next WDF array is used to return the actual values used in weight.
    
      FORMAT:  COM, wd1, wd2 [, /BASE] [, /BSLOPE] [, AMP = amp] 
        [, SDEV = sdev] [, RSDEV = RSDEV] [, BLINE = bline]
        [, TSHIFT = tshift]   [,LEG = leg][, /NOLEG] [, OUT = out]
        [, ERRLIM = errlim]  [, INITDEL = initdel] [, QUIET = quiet]
        [, CORRELATE = correlate] [, TITLE = title] [, /ONLY_TSHIFT]
        [, LEFT = left] [, RIGHT = right] [, ITERATION = iteration]
        [, WEIGHT = WEIGHT] [, LCHARSIZE = lcharsize] [, _EXTRA = extrastuff]
      where:
        wd1, wd2 - WDF array numbers for the arrays to be compared
        base - nonzero value indicates a bline(0) will be allowed to  
               vary from zero
        bslope - nonzero value indicates a bline(1) and bline(0) will 
                 be allowed to  vary from zero
        amp - returned with the calculated value of amp
        bline - returned with the calculated value of bline
        amp - returned with the calculated value of tshift
        sdev - Standard deviation 
               SDEV = SQRT( TOTAL(WEIGHT * (U-V)^2) /TOTAL(WEIGHT))
               where:
                 U are values from WD1 (Stored in out[0])
                 V are values scaled from WD2 (Stored in out[1])
                 WEIGHT - 1 or user provided value
        rsdev - Standard deviation relative to the peak amplitude
        leg - a two element vector specifying the location for the 
              best fit parameters on the plot as a fraction of the 
              plot range.  Default value is [0.04, 0.94]
        noleg - nonzero value indicates that the no best fit
                parameters will be printed on the plot.  If this 
                keyword is zero or omitted, the best fit parameters 
                will be output to the graphics window using the 
                values of leg.
        errlim - error limit for convergence; default is 3.125% of the
                 minimum point spacing
        out - The fitted arrays and weight are stored in the following:
                 if out is a one element array - out = [out, out+1, out+2]
                 if out is a two element array - out = [out[0], out[1], get_maxwdf()-2]
                 if out is not specified or invalid -
                    out= [-1, 0, -2]+ get_maxwdf()
               If weight is specified, it is stored in out[2]
        initdel - initial delta for the iteration.  
                  Second array is shifted this amount. (tsh, wd2, initdel)
                  Default is to perform cross correlation of the two arrays
         quiet  - If present and not zero, no output will be made.
        correlate - Correlation coefficient between the two arrays
         title  - If present this is used for the plot title 
        LEFT    - If present, the waveforms will have this as a minimum abscissa
                  value.  Windowing is done before the fit.
                  Default:  All data is used
        RIGHT   - If preseht, the waveforms will have this as a maximum abscissa
                  value.  Windowing is done before the fit.
                  Default:  All data is used
        
        weight  - If present, the comparison will be weighted by weight.
                  If weight values do not overlap WD1 or if the defined value
                    is LE 0, the value of weight is set to 1.00
            NOTE: Present version only allows weights with no baseline slope.
                  (ie. bline(1) = 0.0)
                  Weight must be a valid wdf array or -1, -2, -101, or -102
                  If weight = -1, then weight = sqrt(wd1>0.0)
                  If weight = -2, then weight = (wd1>0.0)
                  If weight = -101, then weight = 1./sqrt(wd1>0.0)
                  If weight = -102, then weight = 1./(wd1>0.0)
                  if Weight eq 0 then weight = 1.0
                  Default:  Weight = 1.0
                  If specified, actual data is in get_maxwdf-2.
    
         ONLY_TSHIFT - Use amplitude factor of 1.0 and shift the time.
         LCHARSIZE - Character size for the fit parameters
                     To change the legend for the plo command, you must use:
                       PLO, /set , lcharsize = value
                     before calling the COM command.
         _extra - Any keyword understood by the plo command
      Examples:
        Compare array 1 to array 2 with no baseline adjustment
          com, 1, 2
        Compare array 1 to array 2 with sloping baseline and store the amplitude
        in r, the time shift in s, the baseline parameters in basepar.
        Position the legend in the lower right corner. 
          com, 1, 2, /bs, a=r, t=s,  bl=basepar,  leg = [0.7, 0.4]
    

    (See ../pfidl/pfidl_1d/com.pro)


    COMNT

    [Previous Routine] [Next Routine] [List of Routines]
      NAME:
            COMNT
    
      PURPOSE:
         Calculates the amplitude multiplier for the second waveform to minimize
           standard deviation between two WDF arrays.  No time shift is allowed.
         If the two waveforms are not on the same time base, linear interpolation
           is used to populate the abscissa values.
         The standard deviation that is minimized is 
           SD = sqrt(total ((WD1 - Amp*WD2)**2 * Weight)/total(Weight) ) linear
           SD = exp(sqrt(Total((alog(wd1)-alog(wd2)-alog(Amp))**2*Weight)/ 
                   total(weight)))
           Note: For the log case the %-Standard Deviation is (SD-1)*100.
                 If the amplitude is multiplied and divided by SD, then about
                 68% of the data should fall between the two values.
           where Weight is a user specified weight (Default = 1)
             and N is the number of points.
           If log is set, WD1 and WD2 are replaced by alog(wd1) and alog(amp*wd2)
             in the equation above.  
         By default the result is plotted.
         WD1 and WD2 are not modified. 
        
      FORMAT:  COMNT, wd1, wd2  [, OUT = out] [, AMP = amp] [, TSHIFT = tshift]
         [,LEG = leg][, /NOLEG] [, OUT = out] [, /YLOG]
         [, SDEV = sdev] [, RSDEV = RSDEV] [, QUIET = quiet]
         [, CORRELATE = correlate] [, TITLE = title] [, _EXTRA = extrastuff]
    
      where:
        wd1, wd2 - WDF array numbers for the arrays to be compared
                   or a unique name for the wdf arrays.
                   WD2 is moved to out for the calculations.
                   xfr, wd2, out
        out    - The modified values of wd2 are stored in out
                 Default value = get_maxwdf()
        amp    - returned with the calculated value of amp that minimizes the
                 standard deviation
        Weights- Weights used for the least squares fit.
                 Default - Weights = 1.0 for all points
                 Weights is a scalar, then get_value() will be used to interpolate
                   to the abscissa values.  Missing values are 1.0d0
        leg    - a two element vector specifying the location for the 
                 best fit parameters on the plot as a fraction of the 
                 plot range.  Default value is [0.04, 0.94]
        noleg  - nonzero value indicates that the no best fit parameters will 
                 be printed on the plot.  If this keyword is zero or omitted,
                 the best fit parameters will be output to the graphics window
                 using the values of leg.
        tshift - if present and not zero wd2 is time shifted
                 tsh, out, tshift
        ylog   - If set, the fit will use log values for the fit.
                 ie WD1 becomes ALOG(WD1) and Amp*WD2 becomes ALOG(Amp*WD2)
                    in the least square fit equation for SD.
                 If Ylog >0 and Ylog < 0.5 then the range of the two arrays
                   will be limited to Ylog*max(y) where max(y) is the maximum value
                   in each array.
                 If ylog > .5 or < 0 then, the range will be limited to 8 orders 
                   of magnitude
        sdev   - Standard deviation - See SD in the PURPOSE above.
                  
        rsdev  - Standard deviation relative to the peak amplitude (mx(wd1)) in
                 the case of a linear scale and (SD-1)*100 in the case of a log
                 fit
        quiet  - If present and not zero, no output will be made.
        correlate - Correlation coefficient between the two arrays
                    correlate = correlate(wd1, out) or the logs if ylog is set.
        title  - If present this is used for the plot title 
        _extra - Any keyword understood by the plo command
      Examples:
        Compare array 1 to array 2 with no baseline adjustment
          comnt, 1, 2
    
        Compare array 3 to array 6 with a log scale
          comnt, 3, 6, /ylog
    
        Compare array 2 to array 3 with weights in array 9
          comnt, 2, 3, weights = 9
         
        Compare 'xrd1' to array 4
          comnt, 'xrd1', 4
    
    

    (See ../pfidl/pfidl_1d/comnt.pro)


    COMTE

    [Previous Routine] [Next Routine] [List of Routines]
      Calculates the standard deviation between two WDF arrays 
        This is designed for comparison of theoretical and experimental data.
    
        The amplitude of the second waveform is determined by first filtering
          the second waveform with a low pass filter, ie.,
          filt, wdf2, out, delta = 0.361* fwhm(wdf2, /quiet, base=0)
          mx(out) is adjusted to equal mx(wd1) and the standard deviation (SD)
          is calculated using the x values from the waveform with the fewest
          number of points (np) in the region of overlap.  The SD is calculated:
              SD = sqrt( total (wd1-wd2)^2/(np-1))
          NOTE:  SD is calculated using actual waveform values and not the 
                 filtered values.
    
        WD1 and WD2 are not modified. 
        
      FORMAT:  COMTE, wd1, wd2 [, BASE = base] [, TSHIFT = tshift] [, AMP = amp] 
         [, SDEV = sdev] [, RSDEV = RSDEV] [,SCALE = scale] [, QUIET = quiet]
         [,LEG = leg][, /NOLEG] [, OUT = out] [, DELTA = delta] 
         [, RDELTA = rdelta] [, CORRELATE = correlate] [, TITLE = title] 
         [, _EXTRA = extrastuff]
    
      where:
        wd1, wd2 - WDF array numbers for the arrays to be compared
                   WD1 expected to be theory with low noise.
                   WD2 is expected to be experiment
                   WD2 is moved to out for the calculations.
                   xfr, wd2, out
        base   - if present and not zero the the following is performed:
                 sub, out, 0, base
        tshift - if present and not zero wd2 is time shifted
                 tsh, out, tshift
        scale  - If scale is specified then wd2 will be scaled by this value
                 mul, out, 0, scale
                 If scale is not specified or zero then delta or rdelta will
                 be used to filter the data and the resultant amplitude 
                 used to scale wd2 to wd1.
        delta  - if specified wd2 will be filtered with a delta given by delta.
                 ie filt, out, del= delta
                 Default = 0.0
        rdelta - If delta is zero, then wd2 will be filtered with a delta given
                 by rdelta*fwhm(wd2, b=0, /quiet)
                 ie filt, out, del= rdelta*fwhm(wd2, b=0, /quiet)
                 Default = 0.361
                 The default value was chosen to give an 0.1% change in amplitude
                 for a gaussian pulse.
                 If RDELTA = 0 and DELTA = 0 or missing, then no filtering
                 will be performed.
        amp    - returned with the calculated value of amp so that
                 mx(out) = mx(wd1)
        sdev   - Standard deviation 
        rsdev  - Standard deviation relative to the peak amplitude (mx(wd1))
        leg    - a two element vector specifying the location for the 
                 best fit parameters on the plot as a fraction of the 
                 plot range.  Default value is [0.04, 0.94]
        noleg  - nonzero value indicates that the no best fit
                 parameters will be printed on the plot.  If this 
                 keyword is zero or omitted, the best fit parameters 
                 will be output to the graphics window using the 
                 values of leg.
        out    - The modified values of wd2 are stored in out
                 Default value = get_maxwdf()
        quiet  - If present and not zero, no output will be made.
        correlate - Correlation coefficient between the two arrays
         title  - If present this is used for the plot title 
         _extra - Any keyword understood by the plo command
      Examples:
        Compare array 1 to array 2 with no baseline adjustment
          comte, 1, 2
    
        Compare array 3 to array 6 with a filter given by 0.5 of the fwhm.
          comte, 3, 6, rdel=0.5
    

    (See ../pfidl/pfidl_1d/comte.pro)


    CONV

    [Previous Routine] [Next Routine] [List of Routines]
     Name:
            CONV
     Purpose:
            This procedure produces the convolution of two WDF arrays
     Format:
       CONV, WDF1, WDF2 [, WDF3] [, /IDL] [, SIGMA = sigma] [, _extra = extrastuff]
         WDF1   - Input Waveform
         WDF2   - Response waveform.  WDF2 must be shorter than WDF1
                  If Zero, A gaussian will be assumed and SIGMA must be provided
         WDF3   - Storage for convolution
                  Default:  WDF3 = WDF1
     Keywords:
         IDL    - If set the IDL procedure CONVOL is used
                  The default is to multiply the fft of the two waveforms together
                  and to take the inverse fft of the product.  The data is normalized
                  to the response, wdf2.
         Note the following two keywords are passed to GAUSD if WDF2 = 0.
                  The normal keyword is also set.
         SIGMA  - If WDF2 eq 0, sigma of a gaussian.
         Range  - If WDF2 eq 0, range of the gaussian distribution.
                  Default:  Range = [-3.5, 3.5] (units are sigma)
         _extra - may be used to pass keywords to the convol function.
    
        Example:
          Convolve waveform array 10 with a kernel of 2 and store the result in 11
            conv, 10, 2, 11
    
          Use the IDL CONVOL function to do the same procedure.
            conv, 10, 2, 11, /idl, center = 0
              
    

    (See ../pfidl/pfidl_1d/conv.pro)


    CUR

    [Previous Routine] [Next Routine] [List of Routines]
       Name: CUR
      
       A wrapper for IDL cursor which prints the coordinates of the point.
       
       Format: cur [, X] [, Y] [,WAIT] [, SCREEN = screen] [, /quiet] 
                 [, /REAL_VALUE] [, _EXTRA = extrastuff]
         where
               x, y    - Coordinates of the cursor location
               wait    - Optional parameter to cursor command.
                         Default = 3, return with a button down transition
               Screen  - Coordinates in terms of the screen coordinates
                         If engineering units are used, this may be 
                         different than X and Y
               Quiet   - If set, no output will be made
               Real_VALUE - If set, X and Y are real (float) values
                         Default is double precision for IDL 5.5.
            extrastuff - any valid keywords for the IDL cursor command
        Example:
            Print the location of a point on a graph
               cur
    

    (See ../pfidl/pfidl_1d/cur.pro)


    CURP

    [Previous Routine] [Next Routine] [List of Routines]
       Name: CURP
      
       A wrapper for IDL cursor which prints the coordinates of the point.
       
       Format: curp [, P] [,WAIT] [, SCREEN = screen][, _EXTRA = extrastuff]
         where
               p    - Vector coordinates of the cursor location
            wait    - Optional parameter to cursor command.
                         Default = 3, return with a button down transition
            screen  - Actual screen coordinates
                      This may be different from P if engineering units are used.
            extrastuff - any valid keywords for the IDL cursor command
        Example:
            Print the location of a point on a graph
               curp 
    

    (See ../pfidl/pfidl_1d/curp.pro)


    D2E

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           D2E
    
     PURPOSE:
           Convert Densities in a step wedge to an Density vs Exposure Vida file.
    
    
     CALLING SEQUENCE:
    
           D2E, WD1, WD2, calibration = calibration, /print_it
    
           WD1 - Step wedge data vs bin number
           Wd2 - Output Density vs Exposure, Default = wd1+1
           Calibration - number or name for the calibration curve
                 1 or 'G'  = Green Light Calibration, 11/99, 16 erg/cm2
                 2 or 'B'  = Blue Light Calibration, 11/99, 52 erg/cm2
                 9 or 'A'  = Read Alternative Calibration from a file.
                             Dialog Pickfile will be used to select a file
                 Default = 1
                 Note: Exposure value is not case sensitive.
                       In current version, only the first character is checked.
                       For example, case 2 is given by any of the following:
                            2, 'B', 'b', 21, 23456, 'Bread', 'Blue', 'bad_guy'
                       and Alternative is given by any of the following:
                            9, 'A', 'aa', 9999 
                       and anything that is not case 2 or Alternative is case 1 
                  Format for File is:
                    String Identifier
                   (1)  Exposure for upper right hand strip
                   (2)  Exposure for next upper strip to the left 
                       etc
                   (22) Exposure for lower right hand strip 
                   (23) Exposure for next lower strip to the left 
                       etc.
                    Quit when the data noise becomes excessive 
                      Usually about 34 to 38 values.
            PRINT_IT - If set the exposure table is printed.
     
     EXAMPLE:
           Calculate store the Density/exposure data for Green step wedge data in 
    	arrays 1 and store the result in 3.
             d2e, 1, 3
    
    
     MODIFICATION HISTORY:
           Written by:     L. P. Mix, April 24, 2000
    

    (See ../pfidl/pfidl_1d/d2e.pro)


    DECON

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           DECON
    
     PURPOSE:
           Deconvolve a measured signal using a measurement response function
    
     CALLING SEQUENCE:
    
           DECON, WD_SIGNAL, WD_RESPONSE [, WD_DECON]
    
     INPUTS:
           WD_SIGNAL:   Waveform array number of the signal
           WD_RESPONSE: Waveform array number of the response 
    
     OPTIONAL INPUTS:
           WD_DECON:    Waveform array number of the deconvolved signal
                        If missing, signal will be returned in WD_SIGNAL
    	
     KEYWORD PARAMETERS:
           FILTER:	     Document keyword parameters like this. Note that the keyword
                        This keyword is frequently mandatory due to the nature of the 
                        procedure.
           ZERO:        Fraction of the maximum response assumed to be valid.
                        If zero is less than 0.0 or greater than 0.001, it is assumed missing.
                        DEFAULT:  ZERO = 1.0e-7
           PLOT:        Yet another keyword. Try to use the active, present tense
    
     OUTPUTS:
           Deconvolved signal.  No time shifts are applied.
    
     RESTRICTIONS:
           Response should have at least 6 points when put on the same sweep 
           rate as the signal.
    
     PROCEDURE:
           The following steps are taken.
           1.  Put the response on the same time base as the signal if necessary.
           2.  Make an array (N) equal to the length of the response function plus 
               the length of the signal plus additional values to make the total length
               a power of two.  If NR, NS are the length of the response and signal
               then the new arrays have the following number of elements:
                 NNEW = (NR +NS +1) > 32
                 NNEW is increased so that it has only factors of 2, 3, or 5.
           3.  Take the fft of the new response array of length N. (FFT_R)
           4.  Find the maximum amplitude of the FFT and set all modes to complex(1,0)
               that have an amplitude less than ZERO of the maximum amplitude.
                  (ZERO default = 1.0e-7)
           5.  If filter is set, the FFT_R is changed:
                 FFT_R = FFT_R *(1 + .005*FILTER*(MAX_FR/ABS(FFT_R))^2) /(1+ 0.005*FILTER)
           6.  The deconvolution, WDF_DCON, is calculated according to:
                 WDF_DCON = FLOAT(FFT(FFT(WDF_SIGNAL, -1)/FFT_R*AVERAGE(WDF_RESP), 1))
    
     EXAMPLE:
           Assume a measured signal in waveform array 12 and a response function 
           in waveform 4.  Save the deconvolution of the signal in WDF array 22.
              DECON, 12, 4, 22, /filter
           To compare the forward calculation to this result.
              CONV, 22, 4, 23 & plo, [12, 23]
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix
    	February 7, 2007  Update help file and document the procedure
    

    (See ../pfidl/pfidl_1d/decon.pro)


    DELWDF

    [Previous Routine] [Next Routine] [List of Routines]
      format: delwdf, WDFA [, /QUIET]
      This routines clears WDF arrays
      If WDFA is zero or undefined; all arrays are cleared.
      Otherwise, all valid WDF arrays specified by WDFA are cleared.
      example:
      clear all waveform arrays
          delwdf
     or   delwdf, 0
    
      QUIET:  If set, no information is print to the screen
    
     Examples:
      clear waveform array number 15 and 18
          delwdf, [15, 18]
    
      Modified: July 28, 2003, L. P. Mix
                Bug fix and improve efficiency
             
    

    (See ../pfidl/pfidl_1d/delwdf.pro)


    DIF

    [Previous Routine] [Next Routine] [List of Routines]
    
         Differentiate a wdf array
         use a simple differential technique
           this will reduce the number of points by 1
         In the case of X-Y data, derivative is set to zero if dx=0
         if wdf2 is present the result is stored in wdf2
         Keywords are clabel, ylabel, xlabel
    

    (See ../pfidl/pfidl_1d/dif.pro)


    DIGITIZE

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
    	DIGITIZE
    
     PURPOSE:
    	Provide a easy way to digitize points on an image
           Multiple waveforms may be stored.
           Assumptions are made. See Procedure below.
    
     CATEGORY:
    	Graphics 
    
     CALLING SEQUENCE:
    
           DIGITIZE, IMAGE [, WDF]
    
     INPUTS:
           IMAGE:    IMAGE to be digitized.
                     IMAGE should be a 2 dimensional array.
                     If IMAGE is true color, the code will attempt to convert it 
                      to a 2D grey scale image.
                      for example:
                        image = read_tiff('my_file.tiff')
                     An attempt is made to convert true color images to grey scale
                       Technique is to use 
                       New_Image = color_quan(image, true_color, r, g, b, cube=6)
                       True_color is line interleaving:
                          True_color =1 if image = image(3, m, n)
                          True_color =2 if image = image(m, 3, n)
                          True_color =3 if image = image(m, n, 3)
                       If the results are not satisfactory, please convert to 
                       a pseudo color image and try again.
           WDF:      WDF array number for the output.  Default is 1
    	
     KEYWORDS:
           FLIP   :  If set, flip the image to account for the way that IDL
                     displays images from the lower left corner vs upper left for 
                     most other displays.
                       image = reverse(image, (size(image))[0])
           MAXZOOM:  Maximum Zoom ratio.  Default is 20 times input.
           MAXNP  :  Maximum number of points in a curve > 64
                     Default = 4096
      NOTE: XLOG and YLOG must be set as keywords
           XLOG   :  Set for a log X axis 
           YLOG   :  Set for a log Y axis
           XRANGE :  Minimum and Maximum X values used for the Horizontal line
           YRANGE :  Minimum and Maximum Y values used for the Vertical line
           BORDER :  Fraction of screen where Zoom Center will automatically reset
                     Default = 0.1 - Must be in the range [0.01, 0.4]
           RESET  :  Value to which Zoom Center will be shifted.
                     Default = 0.8 - Must be in the range [border, 1-border]
           Example: 
                  For the default values of border and reset:
                     If x location designated is within .1 of the border, the 
                     zoom region will be moved by 0.8 of the screen.
     Procedure:
           Display the image in a magnified screen and use the mouse for picking
             points.
           This utility assumes a Cartesian system with square pixels.
           Log scales must be set with keywords on input 
           For the Horizontal line: The left most point is associated with the 
             minimum X value regardless of the order of digitization.
           For the Vertical line: The bottom most point is associated with the 
             minimum Y value regardless of the order of digitization.
           Steps are:
           1.  Digitize a horizontal line between two know x values.
           2.  Calibrate the vertical displacement using either 
               (a) the horizontal line and 1 additional point
            or (b) 2 points.
           3.  Digitize the curve.
           4.  Save the data in a wdf array.
           5.  User may "exit" or "return to 3" to digitize an additional curve
    
     EXAMPLE:
           Digitize an image a and store it in wdf array 3
             DIGITIZE, a, 3
    
     MODIFICATION HISTORY:
     	Written by:       Paul Mix, January 26, 2000
    

    (See ../pfidl/pfidl_1d/digitize.pro)


    DIRW

    [Previous Routine] [Next Routine] [List of Routines]
    
     NAME:
          DIRW
     PURPOSE:
          Show the WDF arrays in the common area which contain data
     CALLING SEQUENCE:
          DIRW  [, WMIN] [, WMAX] [, TRUNCATE = truncate] [, Xsize = xsize]
                [, PAGE = page] [, RESET = reset]
     INPUTS:
          WMIN   - First waveform array number to be listed or an array of 
                   WDF array numbers 
             or
                 If a single parameter, WMIN can be a search string.
                 Those arrays containing the string in the dataset comment will
                   be listed. The full set of wild card options is available.
                   See GET_MATCH
          WMAX   - Last WDF array number
          TRUNCATE - If set, the dataset comments will be truncated at ';'
                   This is a toggle; If not specified the last value will
                   be used.  Default value =1 -- truncate comments at first ";".
          FILE   - If set, file will be printed. If file< 0 file name will be on 
                   a new line.   This is a toggle; if not specified the last value
                   will be used. Default value = 0
          PAGE   - Number of lines on the directory
          RESET  - If set, a new window will be opened.
          XSIZE  - Width of the window in pixels (generally not set)
     Outputs:
          Waveform array parameters in a widget 
     Example:
          See the contents of all structure arrays
             DIRW
          See the structures with E-field in the comment
             DIRW, 'E-field'
          See the full contents of structure arrays 1 through 13
             DIRW, 1, 13
     (or)    DIRW, 1+indgen(13)
          See all the datasets which begin with v and the associated files
             DIRW,  '^v', /file
    
    

    (See ../pfidl/pfidl_1d/dirw.pro)


    DIV

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           DIV
    
     PURPOSE:
           Divide a WDF array by a constant or a WDF array 
           Store the result in the initial WDF array or another WDF array
     CATEGORY:
           Math 
    
     CALLING SEQUENCE:
           DIV, WD1, WD2 [, WD3]
           DIV, WD1, 0, VAR, [, WD3]
     INPUTS:
           WD1:     WDF array number of the first array
           WD2:     WDF array number of array to be divided into the first array
      or
           0, VAR   Variable or constant to be divided into the first array
     OPTIONAL INPUT:
           WD3:     WDF array number for the quotient, if not specified the 
                    quotient is stored in WD1 (the first array)
     KEYWORD PARAMETERS:
           DZERO     Value used for Division by zero.
                     Zero is defined as AZERO + MAX(ABS(WD2))*RZERO
                     DEFAULT: DZERO = 0.0 
           AZERO     Absolute Value of zero for the above default value.
                     Default = 0.0
           RZERO     Relative value of zero compared to the maximum value.
                     Default = 2.3841858e-07 = (2^(-22))
           CLABEL    Replace the dataset comment for array number WD3
                     with the string or string variable specified
           XLABEL    Replace the dataset x-axis label for array number WD3
                     with the string or string variable specified
           YLABEL    Replace the dataset y-axis label for array number WD3
                     with the string or string variable specified
           SORTX     Sort the X values and take all unique values.
                     Ignored if MASTER is set
           MATCH_ONLY If one array is XY data and the match is not exact, 
                      then make a new XY array with only X values in both 
                      arrays that differ by less than ERR where 
                      ERR =  (xmax-xmin)/(100*np)]  if match_only ge 0
                          = - match_only            if match_only lt 0
                      where np is the number of points in the first array
                         and [xmin, xmax] is the range of the first data array
                      (1% of the average point spacing)
                      The points are selected by:
                           X2-ERR < X1 < X2+ERR
                      In the actual implementation, if both arrays are XY then
                        the X1 values are those of the shorter array and not 
                        necessarily the first array.
                      Multiple X2 points which satisfy the inequality are averaged
           MASTER:    If the abscissa of WD1 does not match the abscissa of WD2 
                      then the abscissa values in the master array will be used 
                      exactly in the region of overlap.  If MASTER is negative 
                      then all of the abscissa values in the master array will 
                      be used and ordinate values where there is no abscissa will
                      be set to DEFAULT. If keyword_set(MASTER) and abs(MASTER) is 
                      not 2, then abs(MASTER) is set to 1.
           DEFAULT:   Value to be use when MASTER is negative and there is not 
                      complete overlap of the master curve.
                      Default:  DEFAULT = 1.0
    
     OUTPUTS:
           NONE     The quotient is stored in a WDF array in the common block
     COMMON BLOCKS:
           COM.DAT  WDF common block 
     RESTRICTIONS:
           WD1 array must be defined and have valid data
           WD2 or 0 and a Variable must be defined
     PROCEDURE:
           If WD2 is specified: 
                WD1 and WD2 are put on a common time base and WD1 divided by 
                WD2.  If there are less than 2 points of overlap, then 
                no action is taken.  Linear interpolation is used to put the 
                arrays on a common abscissa scale using the minimum abscissa 
                increment.  The quotient is set to DEFAULT for all values of WD2
                less than val = RZERO*  mx(WD2)+AZERO.
                    2.3841858e-07 = 2.0^(-22)
                   3.8146973e-06 = 1.0/2L^18
                If the maximum of WD2 is less than 1.0e-30 then all points are
                set to DEFAULT.
           If 0, VAR is specified:
                WD1 is divided by VAR, where VAR is a constant or a variable.
           In either case, the quotient is stored in WD3, if specified, 
           or WD1, if WD3 is not specified.
     EXAMPLES:
           Divide WDF arrays 2 by array 3 and store the result in WDF array 8.
           and label the result: 'signal minus noise'
                   SUB, 2, 3, 8, c = 'signal minus noise'
           Divide the WDF array 2 by the variable RATE and store the difference 
           in WDF array 8.
                   SUB, 2, 0, rate, 8
     MODIFICATION HISTORY:
          Original version, L. P. Mix, May 15, 1992
    

    (See ../pfidl/pfidl_1d/div.pro)


    DROOP

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
    	DROOP
    
     PURPOSE:
           This procedure makes a correction for integrator droop and magnetic
             field diffusion.  The calculation involves the following calculation.
      Note: The math is based on the same assumptions as in XDAMP.
           The implementation is linear in the number of points and is more than 10 
             times faster than XDAMP at 1000 points and more than 200 times faster
             at 20000 points.
    
     CALLING SEQUENCE:
           DROOP, WDFin, E_FOLD [, WDFout]
                 [, CLABEL = clabel] [, XLABEL = xlabel] [, YLABEL = ylabel]
    
     INPUTS:
           WDFin:  WDF array number of the array to be corrected.
           E_Fold: Time constant to use in correcting the data
                   Note: A negative value will decrease the signal
                         A positive value will increase the signal
    
     OPTIONAL INPUT:
           WDFout: Optional output WDF array. If missing or undefined, then 
                     the corrected array will be stored in WDFin
    	
     KEYWORD PARAMETERS:
           CLABEL    Replace the dataset comment for the output array
                     with the string or string variable specified
           XLABEL    Replace the dataset x-axis label for the output array
                     with the string or string variable specified
           YLABEL    Replace the dataset y-axis label for the output array
                     with the string or string variable specified
    
     PROCEDURE:
           All droop corrections are performed on uniformly spaced data. If the
           data is not uniform it is put on a uniform spacing using linear 
           interpolation. YNEW is the droop corrected value for YOLD.
           If dt is the point spacing and n is the number of Y values, then 
              const = dt/e_fold
              scale = (dt * e_fold)/(e_fold - dt)
              exp_fun = exp(-(1+findgen(n-1))*const)
        and
           ynew(0) = yold(0)*scale/dt
           for i = 1, n-1 do ynew(i) = yold(i)*scale/dt + 
                scale/e_fold * total(exp_fun(0:i-1)*reverse(ynew(0:i-1)))
            
     EXAMPLE:
           Correct the data in wdf array 1 for a 300 ns integrator and store
             in wdf array 11.
           DROOP, 1, 300e-9, 11       
    
     MODIFICATION HISTORY:
     	Written by:     Paul Mix, June 4, 1997
    

    (See ../pfidl/pfidl_1d/droop.pro)


    ENDGIF

    [Previous Routine] [Next Routine] [List of Routines]
      Revert to previous settings
         If a BIGWIN was called, the PIXMAP is deleted.
    

    (See ../pfidl/pfidl_1d/endgif.pro)


    ENDJPEG

    [Previous Routine] [Next Routine] [List of Routines]
      Close the MJPEG2000 file and destroy the object.
      Format: EndJPEG
    
      Examples:
      Send the nframe images to a motion JPEG2000 file called: target.mj2
    ; Initialize JPEG2000
        startJPEG, 'target.mj2'
    ; Generate frames
        for i = 1L, nframe do begin
          
          sjpeg
        endfor
    ; Close the file
        endjpeg
    ; View the Movie
        MJ2_Player
    
      MODIFICATION HISTORY:
          Original version, L. P. Mix, April 14, 2006
    

    (See ../pfidl/pfidl_1d/endjpeg.pro)


    ENDP

    [Previous Routine] [Next Routine] [List of Routines]
    Close the printer device and set the graphics output to windows.
     
    

    (See ../pfidl/pfidl_1d/endp.pro)


    ENDPCL

    [Previous Routine] [Next Routine] [List of Routines]
    Close the postscript output file and set the graphics output to the X windows.
    

    (See ../pfidl/pfidl_1d/endpcl.pro)


    ENDPOST

    [Previous Routine] [Next Routine] [List of Routines]
    Close the postscript output file and set the graphics output to the X windows.
    

    (See ../pfidl/pfidl_1d/endpost.pro)


    ENERG

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           ENERG
    
     PURPOSE:
           Return the energy of a particle from the velocity
           See: VELOC for velocity from energy
    
     CALLING SEQUENCE:
           ENERGY = ENERG(Velocity [, MASS] [, /RELATIVISTIC]
                           [, /PROTON] [, /DEUTERON] 
                           [, /ELECTRON] [, /NEUTRON])
    
     OUTPUT:
           ENERGY:   Particle energy (eV)
     INPUTS:
           VELOCITY: Particle velocity in m/s or an array of velocities. 
           MASS:     Particle mass in AMU.
                     1 AMU = 1.66053873e-27 kg
                             931494013 eV (Energy equivalent)
                     DEFAULT: Mass = 1
     KEYWORD PARAMETERS:
       NOTE: The following keywords are NOT checked if MASS is present.
           Once a keyword is found, further checking is stopped.
           PROTON:   If set, assume a proton - MASS = 1.00727646688D0
           DEUTERON: If set, assume a deuteron - MASS = 2.01355321271D0
           NEUTRON:  If set, assume a neutron - MASS = 1.00866491578D0
           ELECTRON: If set, assume an electron - MASS = 5.485799110D-4
    
     OUTPUTS:
           Particle energy for the specified velocities.
    
     RESTRICTIONS:
           VELOCITIES should be greater than 0.0.
    
     PROCEDURE:
           The velocity is calculated using the relationship:
             KE = (Gamma -1)*M where M is the rest energy
                = (sqrt(1/(1-beta^2)) -1) * M
             Where beta = V/C ie the particle velocity compared to the speed-of-light
      
          For: Velocity < 0.2*Speed-of-Light - an expansion of (Gamma -1) is used.
               Velocity > 0.2*Speed-of-Light - the exact calculation is done
    
             These equations use:
                     = 931.494013D6 eV/AMU for M
    
     EXAMPLE:
          Print the energy of a neutron with a velocity of 2.2e7 m/s
            print, ENERG(2.2e7, /n)
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, Jr., April 10, 2007
    

    (See ../pfidl/pfidl_1d/energ.pro)


    ENVELOPE

    [Previous Routine] [Next Routine] [List of Routines]
      This routine calculates the local maximum and minimum of an input WDF array
      and returns the envelope and the period of the maxima and minima.
    
      The envelope uses the maxima and the negative of the minima.
      The period combines the positive and negative periods. 
      XY data is put on a uniform base for this procedure for convenience. This
        feature can be changed.
      Technique:
      0. Put data on a uniform time base if necessary.
      1. Calculate the first derivative.
      2. Filter the derivative with a boxcar filter of width given by smooth.
      3. Determine the points where the derivative switches sign.
      4. Determine the average number of points between zero derivatives = M.
      5. Use FITNP or M/8 points to determine a parabolic fit to the data at each
         zero derivative point.
      6. The least square fit results are used to determine maximum/minimum and the
         center point of the peak.
      Note: If the parabolic fit has the wrong curvature or does not converge, 
               no maxima or minima is recorded.
      OUTPUTS: 
         The minima are multiplied by -1 and merged with the maxima to 
                 provide the result
         NOTE: WMAX = MAXWDFARRAY
         Maxima are stored in WMAX or MAXVAL
         Minima in array WMAX-1 or MINVAL
         Period is stored in WMAX-2 or PERIOD
         Positive period is stored in WMAX-3 or PPERIOD
         Negative period is stored in WMAX-4 or NPERIOD
    
         This routine uses the IDL user function, SVDFIT.
    
         In the case of noisy data singular data may result. 
    
      Format:  ENVELOPE , wd1 [, wd2] [, SMOOTH = smooth] [, PLOT = plot]
                     [, FITNP = fitnp]  [, PERIOD = period] [, PPERIOD = pperiod]
                     [, NPERIOD = nperiod] [, MAXVAL = maxval] [, MINVAL = minval]
    
      where:
        wd1, wd2 - WDF array numbers
                   if wd2 is present, the final curve is stored in wd2
                   otherwise the result is stored in wd1
        smooth   - If present and not zero, the derivative is smoothed using this
                   width. Default is smooth = 25; miminum is 11
        plot     - If present and not zero, the original curve and the extrema
                   are plotted.
        fitnp    - If present, this number of points is used to fit the extrema
                   Default value is average zero crossing spacing (M) divided by 8
                   (for a sine wave this will give an error less than 1.0e-4)
                   Unsmoothed data is used for the least squares fit.
                   If FITNP lt 5 then fitnp is returned with the value used.
        PERIOD   - WDF array for the period, default = WMAX-2
        PPeriod  - WDF array for the positive period, default = WMAX-3
        NPeriod  - WDF array for the negative period, default = WMAX-4
        MAXVAL   - WDF array for the maximum values, default = WMAX-1
        MINVAL   - WDF array for the minimum values, default = WMAX
        
    
      Examples:
        Fit an envelope to the data points in array 2; return the envelope 
        to array 3 and calculate the period. Fit the data between 9 and 100 to 
        an exponential and plot the fit.
          envelope, 2, 3 & print, 'Period = ', ave(80, /q)
          lim, 3, 9, 100 & wdfit, 3, 4, /ytyp, /plot
    
        Fit an envelope to the data in WDF array 4, store the envelope in array
           9 and plot the original data and the envelope.
          envelope, 4, 9, /plot
    

    (See ../pfidl/pfidl_1d/envelope.pro)


    EQ_CHARGE

    [Previous Routine] [Next Routine] [List of Routines]
     Function returns the fraction of a given charge species in equilibrium at
       a given energy.
     This code is from tables generated by John Maenchen from Marion and Young
       and applies only to lithium 7, boron 11, carbon 12, nitrogen 14, 
       oxygen 16, and fluorine 19.
     
     Format:
           fraction = eq_charge(z, q, energy [, ier]
        where:
              z      - ion z, ie number of protons
                       must be 3, 5, 6, 7, 8,  or 9 
                       and mass assumed to be 7, 11, 12, 14, 16, and 19
              q      - atom net charge, must be greater than or equal to zero
                       and less than or equal to Z
              energy - ion kinetic energy or an array of energies
              ier    - optional error flag,
                       0 no errors
                       1 data incomplete or bad
                      -1 errors present (data out of range)
                     -99 Element not supported
              fraction- Charge fraction
                        -1.0 returned for errors 
         Examples
            find the charge fraction lithium(+1) at 5 Mev and store in frac
              frac = eq_charge (3, 1, 5, ier)
    
            Plot the charge fraction versus energy for lithium (+2) between
              zero and 10 MeV
            x = findgen(201)/20
            plot, x, eq_charge(3, 2, x, ier)
    
            Store the charge fractions for lithium in WDF arrays 10 to 13 and 
              plot them in an overlay plot between 0 and 10 MeV
        x = findgen(201)/20
        xlab = 'Energy (MeV)' & ylab='Charge Fraction' & tit=ylab +' vs '+xlab
        for i = 0, 3 do i2w,x,eq_charge( 3, i, x), $
           i+10, xlab=xlab, ylab= ylab, cl= 'Charge - '+strtrim(i, 2)
            plo, 10, 4, /ov, /co, title = tit
    

    (See ../pfidl/pfidl_1d/eq_charge.pro)


    FACTORS

    [Previous Routine] [Next Routine] [List of Routines]
     Return the factors of an integer.
     Format:
           fact = factors (XIN  [, NFactors = nf])
       where:
           X        - Number for which factors are desired.
                      For this routine: 
                       X = Long(ABS(XIN[0])) where XIN is the value input.
           NFactors - Number of factors found
     Example:
       Find the factors of 500
         ff = factors (500, nf = nf)
         print, nf
           5
         print, ff
               2           2           5           5           5
        
         Original version: February 25, 1999, lpmix
    

    (See ../pfidl/pfidl_1d/factors.pro)


    FALLT

    [Previous Routine] [Next Routine] [List of Routines]
     Calculate the fall time of a pulse.
     XY data is converted to a uniform time base
     Maximum deviation from zero is used as the pulse height by default.
     (See RiseT for rise time.)
     Procedure uses linear interpolation to find the last time that the waveform 
       crosses start value (typically 10% of the maximum) and the first time that 
       the waveform crosses the end value (typically 90% of the maximum).
       This procedure produces the minimum rise time and may underestimate the rise
       time if the signal is very noisy.  
    
     Format: FALL = FALLT( WDF [, STARTVALUE = startvalue] [, ENDVALUE = endvalue]
                        [, SMOO = smoo] [, VALUE = VALUE] [, MAXIMUM= maxamp ]
                        [, MAXTIME= maxtime ] [, /POSITIVE] [, /NEGATIVE] )
                        [, /PLOTIT]
         where:
            FALL      - Fall time of the pulse between startvalue and endvalue
                        Fall time is defined as the time from maximum deflection
                        to return to baseline.  The maximum deflection can
                        be positive or negative unless POSITIVE or NEGATIVE is 
                        set.
                        0 is returned if an error occurs.
            WDF       - WDF array for the calculation
            STARTVALUE- Beginning value as a fraction of the peak.
                        Default = 0.90
            ENDVALUE  - End Value as a fraction of the peak.
                        Default = 0.1
            SMOO      - Width for smoothing of the data
                        Smoothed data is stored in get_maxwdf()
                        SMOO = SMOO > 3
                        If SMOO le 0, then no filtering.
                        Default: If SMOO undefined, then smoo = 5
            VALUE     - Vector with actual times for start and end values
            MAXIMUM   - Maximum value used to determine start and end value
            MAXTIME   - Time at maximum value
            POSITIVE  - If set, only positive deflections are considered.
            NEGATIVE  - If set, only negative deflections are considered.
                        If both positive and negative are set, then the
                          maximum deflection is used. (same as if neither are set)
            PLOTIT    - If set, plot the original data, the smoothed data and the start 
                        and end values.
    
          Example:
           print, the 10% to 90% fall time of wdfarray 5 and plot the data.
             PRINT, fallt(5, /plot)
    

    (See ../pfidl/pfidl_1d/fallt.pro)


    FFTF

    [Previous Routine] [Next Routine] [List of Routines]
         format: fftf, wda, y, freq, /double, fast = fast, limit = limit,
                        inverse = inverse
         Find the FFT of an wdf array
         Return the fft as a complex variable, y, and the frequencies in freq
           
            or
    
         Find the real part of an inverse fft of a complex array
         Return the real part of the inverse in WDA, Y is the complex array
           and freq should be delta frequency or an array of frequencies.
           If n_elements (freq) gt 1 then delta freq = freq[1]-freq[0]
    
        The following are used only if inverse = 0 or undefined
         If double is set, calculation is double precision
          FAST     To avoid problems with long FFT's the number of points
                    will be changed to speed the fft.
                    Fast = 0 Do not modify the data
                    Fast = 1 Modify the data by changing the spacing
                    Fast = 2 Modify the data by adding extra points to connect to
                             the first value in the waveform
                    Default: FAST = 0
                    If FAST lt 0 or FAST gt 2, then FAST = 1
          LIMIT    Indicates the number of points which may be added
                    This is approximate.
                    If NP = total number of points and NEL is the original number:
                    LIMIT <= 0  Change NP to a power of 2 or 3 times a power of 2.
                    LIMIT [0,1] Change NP such than (NP-NEL)< LIMIT*NEL
                    LIMIT > 1   Change NP such than (NP-NEL)< LIMIT
                    Default: LIMIT = 0.03
    

    (See ../pfidl/pfidl_1d/fftf.pro)


    FFTW

    [Previous Routine] [Next Routine] [List of Routines]
         Format: FFTW, WDIN, WDA [, WDT] [, WDR] [, WDI] [, /positive] 
               [, /degree] [, /double] [, /mode] [Hanning_filter = hanning_filter]
    
         Find the FFT of an wdf array and store the components in other wdf
              arrays.
         Restrictions: wdin and one other wdf array numbers must be valid.
                       zeros may be used for unused wdf arrays.
          FAST     To avoid problems with long FFT's the number of points
                    will be changed to speed the fft.
                    Fast = 0 Do not modify the data
                    Fast = 1 Modify the data by changing the spacing
                    Fast = 2 Modify the data by adding extra points to connect to
                             the first value in the waveform
                    Default: FAST = 0 
                    Note: /fast will speed up calculations for all waveforms
                          with the number of points > ~500 and a prime number.
                    If FAST lt 0 or FAST gt 2, then FAST = 1
          LIMIT    Indicates the number of points which may be added
                    This is approximate.
                    If NP = total number of points and NEL is the original number:
                    LIMIT <= 0  Change NP to a power of 2 or 3 times a power of 2.
                    LIMIT [0,1] Change NP such than (NP-NEL)< LIMIT*NEL
                    LIMIT > 1   Change NP such than (NP-NEL)< LIMIT
                    Default: LIMIT = 0.03
          DOUBLE    If set, do in double precision.
          HANNING_FILTER - If set, a hanning filter will be applied to the data.
                    If Hanning_filter is ge 1 or less than 0.5 then 
                          Alpha = 0.5 else Alpha = Hanning_filter
          WDA     - the absolute value or magnitude of the FFT
          WDT     - the phase angle, theta = atan(imaginary, real)
                 Note: Phase angel in radians unless degree is specified.
          WDR     - the real part of the complex FFT 
          WDI     - The imaginary part of the complex FFT
          POSITIVE - If present and not zero, then the zero frequency
                     is unchanged, but all positive frequencies are multiplied 
                     by 2 and only positive frequencies are returned.
          DEGREE  -  If set, angle returned in degrees.
          MODE    - If present and not zero, the abscissa is the mode number
                    only positive modes are returned and nonzero mode amplitudes
                    are multiplied by 2
          DELTA   - Increment of the FFT
                    This number multiplied by the abscissa of mode data should 
                    provide the frequency abscissa values
                      DELTA = 1.0/(NP * DELTAT)
         Example:
           calculate the real and imaginary components of the fft of array
           2 and store the result in arrays 10 and 11
             fftw, 2, 0,0,10, 11
           calculate the amplitude of the fft of array 3 and store the positive
           frequency components in array 4. Print the peak.
             fftw, 3, 4, /pos & print, mx(4)
           calculate the amplitude and phase of WDF array 1 into arrays 2 and 3
           store the phase in degrees; find the maximum positive frequency.
             fftw, 1, 2, 3, /deg & a = mx(2,L=0,/quiet,time=freq) & print, freq
           
    

    (See ../pfidl/pfidl_1d/fftw.pro)


    FILT

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           FILT
    
     PURPOSE:
           General purpose filter utility
           (FILT calls LOP, HIP, BAP, or BAR for actual filtering)
     CATEGORY:
           Filter
    
     CALLING SEQUENCE:
           FILT, WD1 [, WD2][, TYPE=TYPE][, ATTEN=ATTEN][,ORDER = ORDER] $
                [, MODE = MODE] [,WIDTH = WIDTH][, /PLOT] $
                [, FREQUENCY = FREQ][, LOW = LOW][, HIGH = HIGH] $
                [, DELTA = DELTA][, BAND=BAND] [, /HP] [,/BP] [, /BR] $
                [, FAST = fast] [, LIMIT = limit]
     INPUTS:
           WD1      WDF array number of the array to be filtered
                    WD1 has NP points with spacing DT
                    NOTE:  If WD1 is x-y data, it will be changed to uniform.
     OPTIONAL INPUT PARAMETERS:
           WD2      WDF array number for storage of the filtered array
     KEYWORD PARAMETERS:
           FAST     To avoid problems with long FFT's the number of points 
                    will be changed to speed the fft.
                    Fast = 0 Do not modify the data
                    Fast = 1 Modify the data by changing the spacing
                    Fast = 2 Modify the data by adding extra points to connect to
                             the first value in the waveform 
                    Default: FAST = 2
           LIMIT    Indicates the number of points which may be added
                    This is approximate.
                    If NP = total number of points and NEL is the original number:
                    LIMIT <= 0  Change NP to a power of 2 or 3 times a power of 2.
                    LIMIT [0,1] Change NP such than (NP-NEL)< LIMIT*NEL
                    LIMIT > 1   Change NP such than (NP-NEL)< LIMIT
                    Default: LIMIT = 0.03 
           TYPE     Type of filter desired. Options are Butterworth, Exponential,
                    User supplied, and Ideal ('BUT', 'EXP', 'USER', 'IDEAL').
                    Only the first 3 letters are checked. Default is 'BUT'
           ATTEN    Frequency domain filter function.  ATTEN = FILTER
                    in the equations below.  Must be supplied with
                    type = 'USER' and have same number of values as dataset WD1.
                    CAUTION:  SET FAST = 0 for user mode.
           ORDER    Order of the filter. Default is 2
           MODE  or
           FREQUENCY  or
           DELTA    These three keywords specify the center frequency of the 
                    filter and are related by the following:
                    MODE = (NP*DT)/DELTA = FREQ*NP*DT.  Only one is required.
                    If none are provided, then default is MODE = 12.
           WIDTH  or
           BAND  or 
           HIGH and LOW
                    These keywords specify the width of band rejection and band
                    pass filters and are related by the following:
                    WIDTH  = BAND*NP*DT = (HIGH-LOW)*NP*DT 
                    If HIGH and LOW are specified then MODE = (HIGH+LOW)/(2*NP*DT)
                    If none are specified, then default is WIDTH = 0.8*MODE
           PLOT     If present, the frequency domain filter function is plotted
                    If PLOT is a two element array, then this is used as XRANGE
                      in the plot command.
                    If PLOT is a one element array and negative then the filter
                      function will be saved in -PLOT if it is a valid WDF array.
                      Otherwise the filter function will be saved in MAX_WDF_ARRAY.
                      Note: MAX_WDF_ARRAY = get_maxwdf()
           /HP      Indicates a high pass filter, default is low pass filter
           /BR      Indicates a band reject filter, default is low pass filter
           /BP      Indicates a band pass filter, default is low pass filter
     OUTPUTS:
           NONE     The filtered array is stored in a WDF array in the common block
     OPTIONAL OUTPUT KEYWORD PARAMETERS:
           ATTEN    If TYPE is not 'USER', ATTEN contains the freq domain
                    filter function.
     COMMON BLOCKS:
           com.dat  WDF common block
     RESTRICTIONS:
           If type is 'USER', ATTEN must be provided
     PROCEDURE:
           The Fourier transform of WD1 is taken and multiplied by a frequency
           domain filter function.  The inverse Fourier transform is taken, and
           the real values stored in WD2 (or WD1 if WD2 is not provided).
           The filter function is defined as follows:
           Assume WD1 has NP points, ^ indicates an exponent, and DIST is an
           array of NP points defined as:
           DIST = [0, 1, 2, 3, 4, 5,..., NP/2, ...,5, 4, 3, 2, 1]
         The low pass filter is defined by the following:
           Butterworth - FILTER = 1/(1 + (DIST / MODE) ^ (2 * ORDER))
           Exponential - FILTER = EXP ( - (( DIST / MODE) ^ ORDER))
           Ideal - FILTER = 1 for DIST < MODE, 0 for DIST > MODE
         The high pass filter is defined by the following:
           Butterworth - FILTER = 1/(1 + ( MODE / DIST ) ^ (2 * ORDER))
           Exponential - FILTER = EXP ( - (( MODE / DIST ) ^ ORDER))
           Ideal - FILTER = 0 for DIST < MODE, 1 for DIST > MODE
         The band type filter is defined by the following where:
           Butterworth - FILTER = 1/(1 +( DIST*WIDTH/(DIST^2-MODE^2))^(2 * ORDER))
           (for band pass: FILTER = 1.0 - FILTER)
           Exponential - FILTER =
                         EXP( - (( (DIST^2-MODE^2) / (DIST*WIDTH) ) ^ (2*ORDER) ))
           (for band reject: FILTER = 1.0 - FILTER)
           Ideal - FILTER = 0 for DIST < MODE - WIDTH/2 or DIST > MODE + WIDTH/2
                                                 = 1, OTHERWISE
           (for band reject: FILTER = 1.0 - FILTER
           NOTE:
           For exponential and butterworth band type frequency, the true center
           mode, CM, is given by CM = MODE * SQRT (1 + (WIDTH/(2*MODE))^2).
           For Butterworth filters, a DELTA equal to the full width at half 
           maximum of a gaussian pulse will only attenuate the peak several percent
     EXAMPLES:
           Filter array 1 with a low pass Butterworth filter with a delta 
           of 15 ns and store the result in array 3.
                    FILT, 1, 3, d= 15e-9
           Filter array 1 with a 100 MHz low pass exponential filter.
                    FILT, 1, f= 100e+6, t = 'exp'
           Filter array 2 with a low pass filter with the 3db set for 12 cycles.
                    FILT, 2
           Filter array 3 with a band pass Butterworth filter with 3db points 
           at 10 and 100 MHz; store the filtered array in 4.
                    FILT, 3, 4, /bp, lo= 1e7, hi= 1e8
           Filter array 2 with a band reject filter to reduce modes 30 to 60.
           Plot the filter function and return it in FARRAY.
                    FILT, 2, /br, m = 45, w= 30, /plot, atten = farray
           NOTE:
           To look at the modes of an array, n, use the following commands:
                    fftf, n, y & plot, abs(y) 
                 or fftf, n, y & plot, abs(y), xr=[0, 100} ! for modes 0 to 100
     MODIFICATION HISTORY:
          Original version, L. P. Mix, May 18, 1992
    
    

    (See ../pfidl/pfidl_1d/filt.pro)


    FIND_PRO

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           FIND_PRO
    
     PURPOSE:
           Find a procedure in the IDL path.
           This uses the routine file_search and is not very fast.
              Can take 10 to 20 seconds to do the search. 
    
     CATEGORY:
           UTILITY
    
     CALLING SEQUENCE:
    
           FIND_PRO, NAME [, FILES = files] [, NFILES = nfiles] [, /SAVE]
                       [, /quiet] [, _EXTRA= extrastuff]
    
         where:
           NAME   - Name of the procedure
                    Wild cards may be used.  See IDL help for FILE_SEARCH
                    Name is converted to lower case.
           FILES  - Files which could be used for this procedure
           NFILES - Number of files found
           SAVE   - If set, looks for a save file
                    Default: SAVE = 0
                    Look for NAME.pro
           QUIET  - If set, no output to the terminal
           _Extaa - any valid keyword for FILE_SEARCH
    
     OUTPUTS:
           A list of files is output to the terminal.
    
     OPTIONAL OUTPUTS:
           The list can be returned as keywords
    
     EXAMPLE:
           Find the source code for a procedure plotfld
             FIND_PRO, 'plotfld'
    
     MODIFICATION HISTORY:
           Written by:     L. P. Mix, June 20, 2002
    
    

    (See ../pfidl/pfidl_1d/find_pro.pro)


    FIT_DATA

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           FIT_DATA
    
     PURPOSE:
           Generate a set of points fit to an input WDF array.
           Options are a spline fit with adjustable tension or a least square
             polynomial fit.
           The spline fit includes a filter option.
           A gui is used unless QUIET is set.
    
     CALLING SEQUENCE:
    	FIT_DATA, WDF, XARRAY [, YARRAY]
       where:
           WDF    - WDF array data array number or a unique string in the 
                    dataset comment
            XARRAY - Abscissa values where interpolated values of WDF are desired
                    XARRAY will be returned with the values used.
                    XARRAY can be specified two ways:
                 Literal value option
                    XARRAY can be the actual values.  A minimum of 4 values is 
                      required.  The values will be sorted.
                      NOTE: Some values may be identical if fewer than 4 values
                            are desired.
                 Do-list option
                    XARRAY can be an initial point and a final point with an 
                      optional spacing. If spacing is missing, an array of 
                      512 points will be generated.
                      XARRAY will extend from XARRAY[0] to or beyond XARRAY[1].
                      For example: XARRAY = [0, 1, .3] will result in 
                      XARRAY=[0, 0.3, 0.6, 0.9, 1.2]
           YARRAY - Ordinate values interpolated from WDF at XARRAY values
                    XARRAY and YARRAY are stored in get_maxwdf()-1
    
     KEYWORD PARAMETERS:
           SAVE:    WDF array for the fitted data.
                    DEFAULT:   SAVE = get_maxwdf()
           TYPE:    Type of fit desired
                    TYPE = 0 ==>> SPLINE fit
                    TYPE = 1 ==>> Least Square fit
                    Default: TYPE = 0
       SPLINE FIT KEYWORDS:
    	TENSION: Tension for the spline fit.
                    DEFAULT: TENSION = 1
           FILTER:  If a spline fit, a filter will be applied to the fit data
                    If FILTER LE 0, NO filter is applied.
                    Default: FILTER = DELTA If DELTA is defined
                                      -1    If DELTA is missing.
           DELTA:   If a spline fit, a filter will be applied.
                    DELTA is passed as delta to the filt command.
                    Default:  DELTA = XRANGE/8
       LEAST SQUARE FIT KEYWORDS:
            DEGREE: Degree of polynomial fit (maximum power of X)
            QUIET:  If set, it will be passed to WDFIT
    
     EXAMPLE:
    	Fit the data in wdf array 11 to points between 100 and 1000 wnameith 
             to X values with a spacing of 0.015 and store the result in 12
              FIT_DATA, 11, SAVE = 12, [100, 1000, .015]  
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, January 13, 2004
    

    (See ../pfidl/pfidl_1d/fit_data.pro)


    FIT_SPEC

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           Fit_Spec
    
     PURPOSE:
           Fit spectrometer output to a blackbody spectrum
           Units are (W/cm2/Angstrom/Steradian) vs Angstroms
           (Assuming PI steradians emission)
           
           See FIT_TEMP for a similar code with Energy as the abscissa value
              (units for FIT_TEMP are (W/m2/eV) vs eV)
    
     CATEGORY:
           Target analysis
    
     CALLING SEQUENCE:
           FIT_SPEC , WDF [, TEMPERATURE = temperature] 
              [, EMISSIVITY = emissivity] [, ITER = iter]
              [, WEIGHTS = weights] [, ERRORS = errors]
              [, MIN_ERROR = min_error] [, /PLOTIT]
              [, SIGMA = sigma] [, CHISQ = chisq]
              [, ITMAX = itmax] [, TOLERANCE = tolerance] 
              [, SAVE = save]  [, QUIET = quiet] [, Verbose = verbose]
              [, /STATISTICAL] [, /Tonly] [, /Eonly]
              
    
     INPUTS:
           WDF:    Input data to be fit
                   Units are (W/cm2/Angstrom/Steradian)
    	
     KEYWORD PARAMETERS:
          Temperature: Fit value of the temperature.  If a value is present, 
                       it will be used as an initial estimate.
          Emissivity : Fit value of the emissivity.  If a value is present
                       it will be used as an initial estimate.
          ITER:     Number of iterations performed
          WEIGHTS:  WDF array of the error estimate for each point or
                      an array of weight values.  The wdf array or the vector
                      must cover the domain of the input data.
          ERRORS:   Ignored if WEIGHTS has valid data
                    These are expected to be fractional estimates of the error.
                    For example if the data has a 5% error then ERRORS = 0.05.
                    Errors may have several formats: Errors may be a
                    WDF array of the error estimate for each point or 
                    the assumed error as a fraction or an array of error values.
                    These errors are used to calculate weights.
                    In the curve fit, actual weights are 1/(Error_Value*Y_value)^2
                    unless STATISTICAL is set(for instrumental or Gaussian weights)
                    If STATISTICAL is set, weights are  1/(Error_Value*Y_value)
                    for statistical or Poisson weights.
                    Y_value are the ordinates for the input data.
          STATISTICAL : See ERRORS above
          MIN_ERROR: Minimum value for error 
                    Default = 1e-3
          PLOTIT:   If set, fit will be plotted.
          POISSON:  If errors are specified, set the weights to 1/(Error Value)
          Sigma:    Standard Deviation for the coefficients for each material
                    CURVEFIT values are scaled by SQRT(CHISQ)
                    If both temperature and emissivity are fit,
                       SIGMA[0] - emissivity
                       SIGMA[1] - temperature
          Chisq:    Value of Chi-squared from CURVEFIT
                    NOTE:  Data is normalized to 1.0
          ITMAX:    Maximum number of iterations
                    Default = 1000
          Tolerance:Change in Chi-squared which ends fit
                    Minimum = 1.0E-16,  Maximum = 0.01
                    Default = 1e-15 
          SAVE:     WDF array for the fit.  Default is GET_MAXWDF()
          Quiet:    If set, terminal output will be minimum.
          Verbose:  If set, terminal output will be maximum.
          Tonly:    If set only, the data is fit to the temperature only.
                    Emissivity must contain a valid value.
          Eonly:    If set only, the data is fit to the Emissivity only.
                    Temperture must contain a valid value.
          
    
     OUTPUTS:
           The fit data is stored in the maximum wdf array unless SAVE is set.
    
     PROCEDURE:
           Data is fit to an equation of the form:
             data = K * Blackbody_Spectrum(T) 
           where K is the emissivity and T is the temperature..
    
     EXAMPLE:
           Fit Spectrometer data which is in WDF array, 5
             FIT_SPEC, 5
    
     MODIFICATION HISTORY:
     	Written by:     L. P. Mix, June 11, 2001
    

    (See ../pfidl/pfidl_1d/fit_spec.pro)


    FIT_TEMP

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           Fit_Temp
    
     PURPOSE:
           Fit spectrometer output to a blackbody spectrum
           Units are (W/m2/eV) vs eV
           
           See FIT_Spec for a similar code with Angstroms as the Abscissa
              (units for FIT_Spec are  (W/cm2/Angstrom/Steradian) vs Angstroms)
    
     CATEGORY:
           Target analysis
    
     CALLING SEQUENCE:
           FIT_TEMP , WDF [, TEMPERATURE = temperature] 
              [, EMISSIVITY = emissivity] [, ITER = iter]
              [, WEIGHTS = weights] [, ERRORS = errors]
              [, MIN_ERROR = min_error] [, /PLOTIT]
              [, SIGMA = sigma] [, CHISQ = chisq]
              [, ITMAX = itmax] [, TOLERANCE = tolerance] 
              [, SAVE = save]  [, QUIET = quiet] [, Verbose = verbose]
              [, /STATISTICAL] [, /Tonly] [, /Eonly]
              
    
     INPUTS:
           WDF:    Input data to be fit
                   Units are (W/m2/eV) vs eV
    	
     KEYWORD PARAMETERS:
          Temperature: Fit value of the temperature.  If a value is present, 
                       it will be used as an initial estimate.
          Emissivity : Fit value of the emissivity.  If a value is present
                       it will be used as an initial estimate.
          ITER:     Number of iterations performed
          WEIGHTS:  WDF array of the error estimate for each point or
                      an array of weight values.  The wdf array or the vector
                      must cover the domain of the input data.
          ERRORS:   Ignored if WEIGHTS has valid data
                    These are expected to be fractional estimates of the error.
                    For example if the data has a 5% error then ERRORS = 0.05.
                    Errors may have several formats: Errors may be a
                    WDF array of the error estimate for each point or 
                    the assumed error as a fraction or an array of error values.
                    These errors are used to calculate weights.
                    In the curve fit, actual weights are 1/(Error_Value*Y_value)^2
                    unless STATISTICAL is set(for instrumental or Gaussian weights)
                    If STATISTICAL is set, weights are  1/(Error_Value*Y_value)
                    for statistical or Poisson weights.
                    Y_value are the ordinates for the input data.
          STATISTICAL : See ERRORS above
          MIN_ERROR: Minimum value for error 
                    Default = 1e-3
          PLOTIT:   If set, fit will be plotted.
          POISSON:  If errors are specified, set the weights to 1/(Error Value)
          Sigma:    Standard Deviation for the coefficients for each material
                    CURVEFIT values are scaled by SQRT(CHISQ)
                    If both temperature and emissivity are fit,
                       SIGMA[0] - emissivity
                       SIGMA[1] - temperature
          Chisq:    Value of Chi-squared from CURVEFIT
                    NOTE:  Data is normalized to 1.0
          ITMAX:    Maximum number of iterations
                    Default = 1000
          Tolerance:Change in Chi-squared which ends fit
                    Minimum = 1.0E-16,  Maximum = 0.01
                    Default = 1e-15 
          SAVE:     WDF array for the fit.  Default is GET_MAXWDF()
          Quiet:    If set, terminal output will be minimum.
          Verbose:  If set, terminal output will be maximum.
          Tonly:    If set only, the data is fit to the temperature only.
                    Emissivity must contain a valid value.
          Eonly:    If set only, the data is fit to the Emissivity only.
                    Temperture must contain a valid value.
          
    
     OUTPUTS:
           The fit data is stored in the maximum wdf array unless SAVE is set.
    
     PROCEDURE:
           Data is fit to an equation of the form:
             data = K * Blackbody_Spectrum(T) 
           where K is the emissivity and T is the temperature..
    
     EXAMPLE:
           Fit SRD data which is in WDF array, 5
             FIT_TEMP, 5
    
     MODIFICATION HISTORY:
     	Written by:     L. P. Mix, June 11, 2001
    

    (See ../pfidl/pfidl_1d/fit_temp.pro)


    FULFNAM

    [Previous Routine] [Next Routine] [List of Routines]
      Return the full file name from input string FNameIn. 
      
      Format: FULFNAM, FNameIn, Full_Name
     or 
      Format:  Full_Name = FULFNAMF( FNameIn)
        where:
          FNameIn  - Input Name
          Full_Name- Output Name
    
    
        This routine handles the following file specifications:-
    
        $ddd/file, $(ddd)/file  Where "ddd" is an environment variable
        ${ddd}/file             pointing to a directory
    
        $fff, $(fff), ${fff}    Where "fff" is an environment variable
                                pointing to a file
    
        $(xxx)yyy ${xxx}yyy     Where "xxx" is an environment variable
                                and entire string points to a file
    
        ~/file                  For file specification relative to user's
                                HOME directory
    
      Contributed by T. D. Pointon, 2/1/94
    

    (See ../pfidl/pfidl_1d/fulfnam.pro)


    FWHM

    [Previous Routine] [Next Routine] [List of Routines]
         this procedure calculates the full with at half maximum of a wdf array
           By setting a keyword, other fractions can be found.
         the maximum absolute value is selected as the peak
         the return value is the full width at half maximum or minimum depending
            on the absolute magnitude of the waveform values.
         NOTE: Data is not filtered
         CAUTION: X-Y data is sorted before fwhm is applied.
                  Strange results will occur if XY data is used which is not a 
                  function; ie more than one y value for an x value.
         format:
            WIDTH = FWHM (WDF, BASE = base, LEFT = left, RIGHT = right, 
                  FIRST = first, SECOND = second, PEAK = peak, QUIET = quiet, 
                  VALUE = value, MAXIMUM = maximum, MINIMUM = minimum)
    
         WIDTH  -  fwhm of the waveform
                   zero is returned if a problem is encountered with input
                   -1   is returned if only first value is found.
                   -2   is returned if only second value is found.
         WDF is the array number
         BASE is the baseline
                  If quiet is not set and BASE is undefined then BASE 
                      is input using the cursor
            NOTE: If QUIET is set, then default is BASE=0
         LEFT is the left boundary of the curve and right the right
           left and right should be used to look for a local extrema over a 
           a limited range of data
           If left is greater than the maximum value then it is set to the 
             minimum.
           If right is less then the minimum value then it is set to the maximum.
    
         FIRST and SECOND are the abscissa values for the half maxima values
           If only one is found, first = second
         VALUE is the value of the half maximum as a fraction of the peak
           Default: VALUE = 0.5
           For example to find the width at 1/4 (25%) of the maximum, VALUE=0.25
           VALUE = (VALUE > .01) < 0.99
         PEAK is the maximum deflection from the baseline unless maximum or
            minimum is set.
         The following keywords can be used to specify a maximum or minimum.
           If both or neither are set, the default is to take the maximum absolute
           deflection from the baseline.
         MAXIMUM - If set, Peak is the maximum positive deflection
         MINIMUM - If set, Peak is the maximum negative deflection
    
         
         if quiet is nonzero, terminal output is eliminated
         Example:
      First: Let
           x = findgen(100)
           y = sin(x*(!pi*0.5/99)) & i2w, x, y, 1
           print, fwhm(1, first= f, second = s,  /quiet) , f, s
         will return:
           -1      33.0000      33.0000
    
      Second: Let
           if  x= findgen(100) & y = sin(x*(!pi/99)) & i2w, x, y, 2
         then
           print, fwhm(2, first= f, second = s,  /quiet) , f, s
         will return: 
           66.0000      16.5000      82.5000
     or
           print, fwhm(2, first= f, second = s,right = 50, /quiet) , f, s
         -1      16.5000      16.5000
     or
           print, fwhm(2, first= f, second = s,left= 45 , /quiet) , f, s
         -2      82.5000      82.5000
     
            NOTE: Results are the same if waveform is negative; ie
                  i2w, x, -y, 2
                  had been used for the examples
    

    (See ../pfidl/pfidl_1d/fwhm.pro)


    GAUS

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           GAUS
    
     PURPOSE:
           Plot an array of data to determine if the data is from a Gaussian or 
           normal distribution.  Data in the WDF array is assumed to be value
           versus sequence number.  This routine is designed to examine a set
           of data to examine the likelihood that it is from a gaussian 
           distribution.
    
           This procedure will make one or all four of the following;
             Sequence plot: Identical to PLO
             Lag plot: Plot of Y[i] vs Y[i-1]
             Histogram Plot: Plot of histogram of the data
             Probability Plot
    
       Note: get_maxwdf() and the two wdf arrays below it are used as 
             work arrays for some plots
    
     CALLING SEQUENCE:
           GAUS, WDdata [, WDSAVE]
    
     INPUTS:
           WDdata  - WDF array number of the sequence of data points
                     or an array of data points
           WDsave  - WDF array number of the probability plot
                     This is ignored for other types of plots
                     This is curve is also stored in get_maxwdf()-2
     KEYWORD Parameters:
           GRID    - Ignored if a single plot is requested.
                     If more than one plot is requested, grid specifies the number
                     of plots per page or the number of plots in the X and Y 
                     direction.  Default: GRID = 1
                     If grid eq 2 then !p.multi = [0,2,1]
                     If grid gt 2 then !p.multi = [0,2,2]
    	SEQUENCE- If set, a sequence plot will be drawn.
                     Input array or Y-values will be plotted versus sample number.
                     X values in WDdata are ignored.
           LAG_PLOT- If set a lag plot will be drawn.  
                     The default is a lag of 1.
                     Y[i] will be the ordinate and Y[i-1] is the abscissa
           HISTOGRAM - If set, a histogram plot will be drawn.  
                     The number of bins will be odd centered on the data average.
                     The approximate number of bins will be sqrt(0.5*np) on each
                     side of the mean value to a value of 3.5*SD.
                     The mean and standard deviation (SD) of the data is printed.
                     A gaussian is overplotted with the same area as the histogram.
                     The histogram and gaussian are stored in the top 3 wdf arrays.
           PROBABILITY - If set, draw a normal probability plot.
                     In this plot the experimental data is plotted as the ordinate
                     and the normal order statistic median is drawn along the 
                     abscissa.
                     The uniform order statistic median is determined by ordering
                     the data and assigning probabilities according to:
                       M[1] = 1 - M[n]
                       M[i] = (i - 0.3175)/(n+.365) for i = 2, 3, ..., n-1
                       M[n] = 1./2^n
                       where n is the number of points.
                     The PFIDL routine get_prob() is used with these probabilities
                     to determine abscissa values.
            The following keywords apply only to PROBABILITY plots:
                COEF   - Coeficients for he least square fit from WDFIT
                RSQUARED - Rsquared for the least square fit from WDFIT.
                MARKERS  - Probability markers for the plot
                           Default = [.05, .25, .75, .95]
    
            ALL_PLOTS - Plot all 4 plots.  For this option, Grid = [2,2]
            QUIET   - Suppress most output to the terminal.
            
            _EXTRA  - Any valid keyword in call to PLOT
                   
     OUTPUTS:
           Requested plots will be made
    
     EXAMPLES:
    	Plot a probability plot of the measurements in the array x
           Save the plot data in wdfarray 23
             GAUS, y, 23, /prob
    
    	Plot all 4 statistical plots on one sheef for the data in wdfarray 4
             GAUS, 4, grid = 4, /all
    
           Make a histogram plot of data in array, xx.
             GAUS, xx, /his
    
           Make a histogram plot of data in array, xx, and show histogram bins
             GAUS, xx, /his, psym = 10
    
     MODIFICATION HISTORY:
           Original version, February 26, 2003
                             L. P. Mix
    

    (See ../pfidl/pfidl_1d/gaus.pro)


    GAUSD

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           GAUSD
    
     PURPOSE:
           Return a normal distribution in an IDL array or a wdf array.
           Function of the form:
           Y = K * exp(-0.5*((X - X0)/SIG)^2)
           K is chosen such that TOTAL(Y) = 1.0
               or Total(y)*DX =1.0
    
     CALLING SEQUENCE:
    
           GAUSD [, WDF]
    
    
     REQUIRED INPUTS: 
           WDF     - If set, return the gaussian in  WDF array, WDF.
                     Default:  WDF = GET_MAXWDF()
    
     KEYWORD Parameters:
           CENTER  - Center of the gaussian.
                     Default: CENTER = 0.0
           SIGMA   - Variance of the distribution
                     Default: SIG = 1
           RANGE   - Range of data in units of SIG
                     Default is symmetric function.
                     If N_elements(RANGE) eq 1 then 
                       RANGE =[-ABS(RANGE), ABS(RANGE)] 
                     Default = [-3.5, 3.5]
                     Range must include the center.
           DX      - Point spacing in X
                     Default: DX = ((Range[1]-Range[0])*SIG)/npoints
           Double  - If set, do calculation in DOUBLE precision.
           NPoints - Number of points estimate.
                     NPOINTS is ignored if DX is specified
                     Default is 501.
           Normal  - If set, Normalization is integral = 1
                     Default: Total(y) = 1
           CLABEL  - Comment label.  Default is the gaussian parameters
           HELPME  - If set, give a help comment 
    
     OUTPUTS:
           Requested gaussian will be stored in a WDF array
     
     SIDE EFFECTS:
           If WDF is zero or omitted, the gaussian is stored in GET_MAXWDF().
    
     EXAMPLES:
    	Plot the default gaussian
             GAUSD & plo, get_maxwdf()
    
           Store a gaussian with width sigma of 10 ns in wdf array 5
             gausd, 5, sig =10e-9
    
     MODIFICATION HISTORY:
           Original version: May 28, 2004, L. P. Mix
    

    (See ../pfidl/pfidl_1d/gausd.pro)


    GETCOLOR

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           GETCOLOR
    
     PURPOSE:
           The purpose of this function is to return the value of a
           "named" color or numbered color. The result is a vector containing
           the values of the color triple.
    
     CATEGORY:
           Graphics, Color Specification.
    
     CALLING SEQUENCE:
           result = GETCOLOR(color)
    
     REQUIRED INPUTS:
           COLOR: A string with the "name" of the color or a color index. 
                  Only the first character is checked; valid values are
                   [R, G, B, M, O, C, Y, W] or [1, 2, 3, 4, 5, 6, 7, 8]
                  Eight colors are allowed; the default colors are: 
                  1   RED       [255,   0,   0]
                  2   GREEN     [  0, 255,   0]
                  3   BLUE      [  0,   0, 255]
                  4   MAGENTA   [255,   0, 255]
                  5   ORANGE    [255, 125,   0]
                  6   CYAN      [  0, 255, 255]
                  7   YELLOW    [255, 255,   0]
                  8   WHITE     [150, 150, 150] (actually grey)!
                  These colors may be changed with PUTCOLOR.
    
                  If the string is anything else, a RED color triple is
                  returned.  If an index is provided, then the default is 
                  the closest color.
    
     KEYWORD PARAMETERS:
           TRUE:  If this keyword is set the specified color triple is returned
                  as a 24-bit integer equivalent. The lowest 8 bits correspond to
                  the red value; the middle 8 bits to the green value; and the
                  highest 8 bits correspond to the blue value. 
    
     COMMON BLOCKS:
           None.
    
     SIDE EFFECTS:
           None.
    
     EXAMPLE:
           To obtain the color values for yellow
           
              value = getcolor('y')
          value = getcolor(7)
    
           To do the same thing on a 24-bit color system, type:
           
              value = getcolor('y', /true)
          value = getcolor(7  , /true)
           
     MODIFICATION HISTORY:
           Written by: Paul Mix, January 11, 2000
                       True color modification written by David Fanning.
                
    

    (See ../pfidl/pfidl_1d/getcolor.pro)


    GETF

    [Previous Routine] [Next Routine] [List of Routines]
         get the corresponding frequencies for a fft of an wdf array
           format is: getf, freq, wdf
           where freq is an IDL array of the frequencies and wdf is
                  the array number
    

    (See ../pfidl/pfidl_1d/getf.pro)


    GETX

    [Previous Routine] [Next Routine] [List of Routines]
         this procedure returns the abscissa values of an wdf array
           format: getx, xarray, wdf, maximum = maximum, minimum = minimum
           where xarray is an IDL array of the x values 
                 wdf is the wdf array number
               minimum - minimum X value
               maximum - maximum X value
    

    (See ../pfidl/pfidl_1d/getx.pro)


    GETXF

    [Previous Routine] [Next Routine] [List of Routines]
         this function returns the abscissa values of an wdf array
           format: x = getxf( wdf, maximum = maximum, minimum = minimum)
           where xarray is an IDL array of the x values 
                 wdf is the wdf array number
               minimum - minimum X value
               maximum - maximum X value
    

    (See ../pfidl/pfidl_1d/getxf.pro)


    GETY

    [Previous Routine] [Next Routine] [List of Routines]
         this procedure returns the ordinate values of an wdf array
         format: gety, yarray, wdf, maximum = maximum, minimum = minimum
         where yarray is the array of ordinate values
               wdf is the WDF array number
               minimum - minimum Y value
               maximum - maximum Y value
    

    (See ../pfidl/pfidl_1d/gety.pro)


    GETYF

    [Previous Routine] [Next Routine] [List of Routines]
         this procedure returns the ordinate values of an wdf array
         format: yarray = getyf(wdf, maximum = maximum, minimum = minimum)
         where yarray is the array of ordinate values
               wdf is the WDF array number
               minimum - minimum Y value
               maximum - maximum Y value
    

    (See ../pfidl/pfidl_1d/getyf.pro)


    GET_CABLCOMP[1]

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           GET_CABLCOMP
    
     PURPOSE:
           Use the response of a cable to use in correcting measured signals
    
     CALLING SEQUENCE:
           GET_CABLCOMP, WDF1, WDF2 [, WDF3] [, /PLOTIT] [, /ZOOMIT]
               [, TRUNCATION = truncation] [, RECORD_LENGTH = reclen]
    
     INPUTS:
           WDF1:   True signal waveform
                   (Signal directly into the recorder)
           WDF2:   Degraded signal recorded after passing through a cable or 
                   other filter
    
     OPTIONAL INPUTS:
           WDF3:   WDF array for the calculated response
                   If WDF3 is not provided or invalid, then WDF3 = get_maxwdf()-1
    	
     KEYWORD PARAMETERS:
           PLOTIT: Plot WDF1, WDF2 and the cable compensated version of WDF2
                   If KEYWORD_SET(ZOOMIT), then PLOTIT = 1
           ZOOMIT: If set, use ZOOMW to view the plot.  
           RECORD_LENGTH: Length of the response 
                   DEFAULT:  RECORD_LENGTH =  250*ROUND(N2/250.)
                             where N2 = N_ELEMENTS(WDF2)
           TRUNCATION: Level at which data is truncated.
                   DEFAULT:  TRUNDATION = 0.5
            NOTE:  The technique is recursive and can grow exponentially
                   for unstable initial conditions.  TRUNCATION must be 
                   adjusted to provide a stable solution.
     OUTPUTS:
           A response waveform is (see WDF3) generated to allow this the 
           compensation to be applied to actual data.
    
     OPTIONAL OUTPUTS:
           A plot of the input signal and the compensated signal is generated.
    
     PROCEDURE:
           The procedure uses the time domain convolution described by Bill Boyer
           (SAND87-3072).  The technique is similar to the XDAMP routine
           XI_gcabcomp.  Modified for speed increase.
    
     EXAMPLE:
           Calculate a compensation function for a step pulse stored in WDF array 7,
           and a degraded pulse stored in WDF array 8.  Plot 7, 8 and the cable
           compensated version of waveform 8.
              GET_CABLCOMP, 7, 8, /PLOT
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, Jr., December 20, 2006
                           From XDAMP routine XI_cabcomp
    

    (See ../pfidl/pfidl_1d/get_cablcomp.pro)


    GET_CABLCOMP[2]

    [Previous Routine] [Next Routine] [List of Routines]
      procedure XI_gcabcomp
    
      Procedure to deconvolves two arrays using serial deconvolution to generate
      a cable compensator. The entered array is the "true" response,
      the second array is the response through the cable (or whatever).
      Generates a new array with the name COMP_ prepended to the signal name.
      User is prompted for toe truncation fraction and the target length of
      the compensator (in case the signal was shortened by earlier processing).
    

    (See ../pfidl/pfidl_1d/get_cablcomp.pro)


    GET_DSET

    [Previous Routine] [Next Routine] [List of Routines]
     Name: GET_DSET
     
     PURPOSE:
           Get PFF dataset numbers for all dataset comments containing
              a specified string.
              -1 indicates no dataset found.
           Note:  Dataset comments in the directory are currently limited to
                  64 characters.  A search string longer than this will result
                  in no matches.
     Format:
           Map = Get_Dset(STRING [, FILEID = fileid] [, MAXDSET = maxdset]
                         [, NDSet = ndset] )
     INPUTS:
           STRING:   Search string 
                     If STRING = '' or ' ' or '*' then 
                         Map = 1+lindgen(ndspff(fid))
                         (Maxdset is ignored)
                     The following special characters can be used:
                     *  - Wild card indicating 0 to n characters
                          To use a * in a search string use "\*"
                     ?  - Wild card indicating 1 and only 1 characters
                          To use a ? in a search string use "\?"
                     ^  - If this is the first character, indicates that
                          the string begins the dataset comment.
                          All other times a ^ is taken literally.
                          To begin a search string with a literal ^ use:
                              "*^" or "\^"
                          All search strings are assumed to begin with "*" unless
                          a "^" is present. 
                     $  - If this is the last character, indicates that the
                          string ends the non-blank portion of the dataset comment.
                          All other times a $ is taken literally.
                          To end a search string with a literal $ use:
                              "*$" or "\$"
                          All search strings are assumed to end with "*" unless
                          a "$" is present.
     OPTIONAL INPUT:
           FILEID  : File id - Default is 0 (The current PFF file) 
           QUIET   : If set, no messages will be printed.
           MAXDSET : Maximum number of files desired.
                     If more than MAXDSET files are found, then an additional
                     search is performed over the returned datasets with the
                     search string modified to force an exact match; ie.
                     if not present a "^" will be added to the front of the 
                     string and a "$" to the end of the string.
           NDSET   : Number of datasets returned.
      EXAMPLES: 
         Find all the datasets with VDIODE in the comment.
                  wdf = get_dset('vdiode')
         Find all the datasets with the non_blank characters only VDIODE
                  wdf = get_dset('^vdiode$')
         Find all the datasets with the string VDIODE and at least one 
           more character at the end
                  wdf = get_dset('vdiode?')
         Read all the datasets in the current file starting at position 1
                  re, 1, get_dset()
         or more simply
                  re, 1, ''
      
    

    (See ../pfidl/pfidl_1d/get_dset.pro)


    GET_FCUP

    [Previous Routine] [Next Routine] [List of Routines]
     NAME: GET_FCUP
     
     Description:
           Propagate an ion pulse to a target assuming that they are
           moving with a velocity corresponding to a specified voltage
           pulse.  The energy versus arrival time is calculated for 
           Protons by default.  The charge collector signals are then
           transported back to the anode and the currents modified to relect
           the rising or falling voltages using the ratio of the arrival times.
           If the slope of the arrival time changes slope it is set to zero.
           The transit time is smoothed using a 5 point boxcar by default.
           Present version limits the response to the high energy portion.
           Note: The voltage pulse is propagated forward. The measured current
                 is then corrected for the transit time or projected back in time.
       Note: This is based on get_vprop
           Velocity is assumed to be given by:
             velocity = sqrt( 2.0 * 1.6022e-19/ 1.6726e-27 * Vc*Q/M)
               where M = 1, 12, 16 for protons, carbon and oxygen, respectively, 
                     Q is the charge, and Vc is the acceleration voltage
     Format:
          GET_FCUP, Vcor, Fcup, OUTPUT, [, Nsecond = nsec] [, distance = distance]
                          [, ionmass = ionmass] [, CHARGE = charge ]
                          [, output= output] [, deltat = deltat] [, SMOOTH = smooth]
                          [, limit = limit] [, /HighVolt] [, /LowVolt]
    
        where
            vcor      wdf array for the corrected voltage or a search string
                      XY data is sorted - Process is terminated if multiple
                        voltages at the same time.
            fcup      wdf array(s) for the charge collectors
                      or a string for the search
            Output    If present and a valid wdf number, this will
                      be used in place of the keyword parameter.
                      If output is a single number and fcup is several then
                      successive arrays will be used.
                      Output may be an array if fcup is an array.
                      This parameter of the keyword must be provided.
            nsecond   abscissa units for vcor
                      default is nsecond = 1, abscissa in nanoseocnds
            distance  ion propagation distance in meters
                      default distance = 0.3 m
            ionmass   Ion mass in amu. Default = 1
                      IONMASS > 1
            charge    Ion charge - Default = 1; Charge > 1
           Note: Only one ion mass and one charge can be used.
            smooth    Smoothing for the transit time.
                      Default = 5
            output    output WDF arrays. Ignored if positional parameter is present
            limit     Voltage cut; eliminate voltages below this value.
                      Default is 10% of peak
                      0 < limit < 0.9 
            HighVolt  If set only the high voltage portion of the arrival time
                      will be saved. 
                      This is the default.
            LowVolt   NOT CURRENTLY ALLOWED.
                      If set only the low voltage portion of the arrival time
                      will be saved. This is ignored if HighVolt is set.
                      Default is to return the high energy arrival time curve.
            Example
               Calculate the current of protons measured at a charge collector
                 30 cm away.
               Assume the energy is in wdf array 3, the fcup in 4,  and store 
               the result in 10
                 get_fcup, 3, 4, out = 10 
     < or >      get_fcup, 3, 4, ion=1, char=1, /high,  out = 10, dist = 0.30
    
               Calculate the currrent of Li+ ions measured at at charge collectors
                 15 cm away using 'VLIDJJ' as the corrected voltage and put 
                 the results beginning in array 40.  The charge collectors are in
                 'Fcup_1c' , 'fcup_2c', ...
      
                 Get_fcup, 'vlidjj', 'fcup_*c', dist =.15, out=40, ion=7
    
               Calculate the current of protons at the anode from a diagnostic
               40 cm away. Assume the energy is in wdf array 3 and store the 
               results beginning in 40. Use all wdf arrays with 'fcup' in the
               comment.  Return only the high voltage branch of the arrival 
               time curve.  Limit results to voltages over 25% of the peak. 
                 get_fcup, 3, 'fcup', dist= .40, /high, ion=1, limit= 0.25, out=40
    

    (See ../pfidl/pfidl_1d/get_fcup.pro)


    GET_IPROP

    [Previous Routine] [Next Routine] [List of Routines]
     NAME: GET_IPROP
     
     Description:
           Propagate an ion pulse to a charge collector assuming that they are
           moving with a velocity corresponding to a specified voltage
           pulse.  The current versus arrival time is calculated for 
           Protons by default.
      IMPORTANT NOTE:
           In all cases charge is distributed later in time so the result will be 
             shifted by a half time step.  That is, the current at a time t1
             is distributed at the charge collector from the arrival time of t1 
             to the arrival time of t2, where t2 is the next data point in the 
             original data.
              
           Velocity is assumed to be given by:
             velocity = sqrt( 2.0 * 1.6022e-19/ 1.6726e-27 * Vc*Q/M)
               where M = 1, 12, 16 for protons, carbon and oxygen, respectively, 
                     Q is the charge, and Vc is the acceleration voltage
     Format:
          GET_IPROP, Vcor, current, OUTPUT, [, /Nsecond ] [, distance = distance]
                         [, ionmass = ionmass] [, CHARGE = charge ]
                         [, output= output] [, deltat = deltat] [, SMOOTH = smooth]
                          [, limit = limit]
    
        where
            vcor      wdf array for the corrected voltage or a search string
                      XY data is sorted - Process is terminated if multiple
                        voltages at the same time.
            current   wdf array(s) for the charge collectors
                      or a string for the search
            Output    If present and a valid wdf number, this will
                      be used in place of the keyword parameter.
                      This parameter or the keyword must be provided.
            nsecond   abscissa units for vcor
                      default is nsecond = 1, abscissa in nanoseocnds
            distance  ion propagation distance in meters
                      default distance = 0.3 m
            ionmass   Ion mass in amu. Default = 1
                      IONMASS > 1
            charge    Ion charge - Default = 1; Charge > 1
           Note: Only one ion mass and one charge can be used.
            smooth    Smoothing for the transit time.
                      Default = 5
            output    output WDF arrays. Ignored if positional parameter is present
            limit     Voltage cut; eliminate voltages below this value.
                      Default is 10% of peak
                      0 < limit < 0.9 
    
            Example
               Calculate the current of protons measured at a charge collector
                 30 cm away.  Assume the energy is in wdf array 3, the current 
                  in 4,  and store the result in 10
                 get_iprop, 3, 4, out = 10 
     < or >      get_iprop, 3, 4, ion=1, char=1, out = 10, dist = 0.30
    
               Calculate the currrent of Li+ ions measured at at charge collectors
                 15 cm away using 'VLIDJJ' as the corrected voltage and put 
                 the results beginning in array 40.  The current is in the array
                 itot.
      
                 Get_iprop, 'vlidjj', 'itot', dist =.15, out=40, ion=7
    
    

    (See ../pfidl/pfidl_1d/get_iprop.pro)


    GET_MATCH

    [Previous Routine] [Next Routine] [List of Routines]
        From a string array return the array elements which contain a specified
          string.  This may be used for WDVALID, STRVALID, and GET_WDF.
          Regular expression matching may be used rather than the default 
            matching defined below. 
    
        format:
            array_numbers = GET_MATCH(string , STRING_ARRAY, 
               RegExpression = regexpression, /SetDefault, /ShowDefault, 
               NELEMENTS =nelements, WDFARRAY = wdfarray, STRUCTURE = structure, 
               CASESEN = casesen )
            where:
              array_number - an array of integers representing the array elements
                             which contain STRING
                             If no matches are found then -1 is returned.
                             If keywords wdfarray or structure then the array
                                numbers are returned.
    
              String       - search string, if it is an array only the first
                             element is used.
                             string = '', '$', '^', '^$, '*' 
                               will return all possible elements
                              
                    Note: String may end in blanks.
                          for example: 'cat ' is different from 'cat'
                          the latter would allow not only'cat dog' but also
                            'cat1', 'cat2'...
                          All trailing and leading blanks are stripped from the
                            string_array.  Therefore 'cat ' would not find 
                            'cat        ' in string_array; the correct string
                            would be: 'cat$'
                     The following special characters can be used:
                     *  - Wild card indicating 0 to n characters
                          To use a * in a search string use "\*"
                     ?  - Wild card indicating 1 and only 1 characters
                          To use a ? in a search string use "\?"
                          Note: '^?'
                     ^  - If this is the first character, indicates that
                          the string begins the dataset comment.
                          All other times a ^ is taken literally.
                          To begin a search string with a literal ^ use:
                              "*^" or "\^"
                          All search strings are assumed to begin with "*" unless
                          a "^" is present. 
                     $  - If this is the last character, indicates that the
                          string ends the non-blank portion of the dataset comment.
                          All other times a $ is taken literally. 
                          Note: The above words "non-blank".  A search string
                                of the form 'cat     $' will be simply 'cat$' 
                          To end a search string with a literal $ use:
                              "\$"
                          All search strings are assumed to end with "*" unless
                          a "$" is present.
              string_array  - String array.  Each element of string array is
                              searched for STRING.  If not present, then WDFarray
                              or STRUCTURE must be set.
                              Note: string_array = strtrim(string_array, 2) but
                                    the input value is not modified.
              RegExpression - If set, the IDL STREGEX function will be used rather
                              than the above procedure.
                              Default: RegExpression =0
    
                Caution:  All PFF directory searches will use the scheme described
                          under the string variable above and the technique 
                          discussion below and not a regular expression search.
    
              SetDefault    - If set, The current value of RegExpression and 
                              CaseSen will become the default values.
                                 DEFAULT:
                                   RegExpression = 0
                                   CaseSen       = 0
                              No matching is performed; -1 is returned.
              ShowDefault   - Show the current settings for Set parameters.
                              No matching is performed; -1 is returned.
              Nelements     - Number of array elements for which a match is found.
              WDFARRAY      - If set, WDF dataset comments will be used for 
                              STRING_ARRAY. If WDFARRAY has two elements, they
                              will be taken as the bounds for the search.
              STRUCTURE     - If set, structure array dataset comments will be used
                              for STRING_ARRAY. If STRUCTURE has two elements, they
                              will be taken as bounds for the search.
              CASESEN       - If present and not zero, then search is case
                              sensitive.  Default is CASESEN=0 (not case sensitive)
        Example:
            List the wdf arrays beginning with M and ending in 8
                print, get_match('^m*8$', /wdf)
            List the wdf arrays beginning with M and ending in 8 and containing
              a total of 7 characters
                print, get_match('^m?????8$', /wdf)
            Print the elements of titles which contain the letters msp 
              and end in cc
                print, titles(get_match('msp*cc$', titles))
            Set regular expressions as the default matching technique
            Print the current values.
                junk = get_match(/set, regex= 1, case= 0, /show)
    
        Technique:
             1. All input strings with '*?' are converted to '?*'
             2. Search string is moved to a work string.
             3. LENWORK is used as a pointer array to the first character of each
                substring.
             4. LENSTR is a length indicator for the length of each substring.
                EXCEPT LENSTR is negative if a ? is found.  The negative value
                of LENSTR is the number of successive ? and thus the number of
                characters to skip.
             5. If a * follows a ? then more characters can be skipped. Lenwork 
                is set negative if an * follows a ?, otherwise it is positive
             6. Leading * are ignored so '*^' is the same as '\^'
             7. Blanks in string_array are only meaningful if they have non-blank
                characters on both sides.
    

    (See ../pfidl/pfidl_1d/get_match.pro)


    GET_MAXWDF

    [Previous Routine] [Next Routine] [List of Routines]
         This function returns the maximum number of wdf arrays
         format: number = get_maxwdf()
    
         NOTE:  The last two arrays are used by some procedures as work arrays
    

    (See ../pfidl/pfidl_1d/get_maxwdf.pro)


    GET_PROB

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           GET_PROB
    
     PURPOSE:
    	This function returns the values normal order statistic medians 
           corresponding to a given fraction.
           (This function is the inverse of the IDL: Gauss_PDF)
    
     CALLING SEQUENCE:
    	Var = GET_PROB (Fractions)
           Where:
           VAR is the value form which a random variable X has has a probability 
             of FRACTIONS of being less than or equal to VAR if X is distributed 
             in a standard Gaussian (normal) distribution with a mean of 0.0 and
             a variance of 1.0
    
     INPUTS:
           Fractions - Probability that a normal random variable is less than
                       the variance.
                       Fractions must be > 0 and < 1.0
                       Out of range values will be set to 0 or 1.
     OPTIONAL KEYWORD:
           NPoints   - If specified, Interpolation array will have this number 
                       of points.  Default = 4096, Minimum = 512
           MAX_Value - If specified, Interpolation array will go to this value.
                       Default = 5, Minimum = 1.0
     COMMON BLOCKS:
           PROB_GAUSS : Used to store the probability distribution function
    
     PROCEDURE:
           Linear interpolation is used to determine the variance.  A table of
           4096 values distributed over the interval [0, 5] is used for the 
           interpolation.
           The user may specify a different array size with the NPOINTS keyword.
    
     EXAMPLE:
           Determine the values required to have the central half of the data.
             print, GET_PROB([.25, .75])
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, February 25, 2003
    

    (See ../pfidl/pfidl_1d/get_prob.pro)


    GET_RESP

    [Previous Routine] [Next Routine] [List of Routines]
     pro  get_resp, wdf1, wdf2, wdf3, filter = filter, plot = plot
       this procedure produces the response function required to get wdf1 from wdf2
       wdf3 is optional, if present the response will be stored in wdf3
       filter is an optional filter multiplier, Default is zero (no filter)
       plot if present and nonzero plots the fft of the various signals
    

    (See ../pfidl/pfidl_1d/get_resp.pro)


    GET_TIME

    [Previous Routine] [Next Routine] [List of Routines]
         this procedure returns the x values of an wdf array at a given y value
         format time = get_time (wdf, y, npoints = npoints)
           where wdf is a wdf array number and y is the ordinate value
           npoints are the number of values found
           zero is returned if y is outside the range of the wdf array
    

    (See ../pfidl/pfidl_1d/get_time.pro)


    GET_VALUE

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           Get_Value
    
     PURPOSE:
           This procedure returns the y values of an wdf array at a given x value
    
     CALLING SEQUENCE:
    
          Value = Get_Value (WDF, X)
    
     INPUTS:
           WDF      -  wdf array number 
           X        -  abscissa value or an array of abscissa values
    	
     KEYWORD PARAMETERS:
          VALID     -  If set, X will be modified to include only values
                       in the domain of the wdf array.
          IVALUES   -  values of x for which valid values are found
                       = -1 if no values are found
          MISSING   -  Value returned if X is outside the domain.
                       Default = 0.0
          QUIET     -  If set, output will be supressed.
                       NOTE:  No error messages will be printed!!
                       DEFAULT:  QUIET = 0
          EPSILON   -  Error limit for Matching values.
                       EPSILON = Min([3.0517578e-5, 1.0/number_of_points(WDF)]) * $
                         Max(Abs(WDF Abscissa))
          MATCH_VALUES- If set and data is XY and X values are not monotonically increasing,
                          then attempt to match X-values in order.
                        This keyword is ignored for uniform data or nonuniform data with
                          increasing values of X.
                        A perfect match is considered if X values differ by less than 
                          Epsilon
                        Default: Match = 0
                        Match = 0, sorts data and does linear interpolation to the 
                          specified values.
     OUTPUTS:
           Function returns the Y values for the specified X values.
    
     PROCEDURE:
           Simple linear interpolation is used for uniform WDF data.
           XY data is sorted and multple ordinates at the same abscissa are averaged.
           If keyword MATCH_VALUES is set, the procedure will attempt to match the 
             specified X values exactly.
    
     EXAMPLE:
    
           Find the y values for an array x in WDF array 4 and store in y.
             y = GET_VALUE(4, x)
    
           Find the y values for an array xx in WDF array with comment 
             "Corrected Voltage" and store in yy.
             y = GET_VALUE('Corrected Voltage', xx)
    
     MODIFICATION HISTORY:
           Written by:     L. Paul Mix 
           November 15, 2002 L. Paul Mix
                           Modified handling of XY data
    

    (See ../pfidl/pfidl_1d/get_value.pro)


    GET_VPROP

    [Previous Routine] [Next Routine] [List of Routines]
     NAME: GET_VPROP
     
     Description:
           Propagate an ion pulse to a target assuming that they are
           moving with a velocity corresponding to a specified voltage
           pulse.  The energy versus arrival time is calculated for 
           Protons, Carbon, and Oxygen by default. 
           Velocity is assumed to be given by:
             velocity = sqrt( 2.0 * 1.6022e-19/ 1.6726e-27 * Vc*Q/M)
               where M = 1, 12, 16 for protons, carbon and oxygen, respectively, 
                     Q is the charge, and Vc is the acceleration voltage
     Format:
          GET_VPROP, Vcor [, Nsecond = nsec] [, distance = distance]
                          [, ionmass = ionmass] [, CHARGE = charge ]
                          [, output= output] [, deltat = deltat]
                          [, limit = limit] [, /HighVolt] [, /LowVolt]
    
        where
            vcor      wdf array for Vcor limited to peak
            nsecond   abscissa units for vcor
                      default is nsecond = 1, abscissa in nanoseocnds
            distance  ion propagation distance in meters
                      default distance = 0.3 m
            ionmass   Ion mass in amu. Default = 1
                      IONMASS > 1
            charge    Ion charge - Default = 1; Charge > 1
                NOTE: IonMass and charge must have the same number of elements or
                      a single element. for example:
            ionMass= [1, 4, 12, 16], charge = 2       is ok  (single Charge)
            ionMass= 16, charge = [1,2,3,4]           is ok  (single Mass)
            ionMass= [1,4,12,12], charge = [1,1,1,2]  is ok  (same Mass & Charge)
            ionMass= [12, 16], charge = [1,2,3,4]    is not ok (not same or single)
            output    output WDF arrays
                      default are vcor+1, vcor+2, ....
            limit     Voltage cut; eliminate voltages below this value.
                      Default is 10% of peak
                      0 < limit < 0.9 
            HighVolt  If set only the high voltage portion of the arrival time
                      will be saved. Data saved as uniform data with spacing deltat.
            LowVolt   If set only the low voltage portion of the arrival time
                      will be saved. This is ignored if HighVolt is set.
                      Data saved as uniform data with spacing deltat. 
                      Default is to return the entire arrival time curve.
            Deltat    Minimum Time spacing. Used only if HIGHVOLT or LOWVOLT is set
                      Default is average initial spacing*0.2
                      If Deltat eq 0, then data will be saved exactly.
            Example
               Calculate the arrival time of protons at a target 30 cm away.
               Assume the energy is in wdf array 3 and store the result in 10
               Return all possible voltages.
                 get_vprop, 3, ion = 1, out = 10 
    
               Calculate the arrival time of protons at a target 40 cm away.
               Assume the energy is in wdf array 3 and store the result in 4
               Return only the high voltage branch of the arrival time curve.
               limit results to voltages over 25% of the peak
                 get_vprop, 3, dist= .40, /high, ion=1, limit = 0.25 
    

    (See ../pfidl/pfidl_1d/get_vprop.pro)


    GET_WDF

    [Previous Routine] [Next Routine] [List of Routines]
        Return the wdf number(s) of all wdf arrays having a certain string
          in the the comment.
        Similar to wdvalid
    
        format:
            array_numbers = get_wdf(string)
            where
              array_number - an array of integers representing the WDF arrays
                             with STRING in the wdf comment 
                             If no matches are found then -1 is returned.
              String       - search string
                             See GET_MATCH for options, wild cards, etc.
        Keywords:
              CASESEN      - If present and not zero, then search is case
                             sensitive.  Default is CASESEN=0 (not case sensitive)
              NELEMENTS    - Number of elements found
        Example:
            List all wdfarrays with data.
               print, get_wdf()
            List the wdf arrays having 'mocam' in the dataset commment.
               print, get_wdf('mocam')
            Plot in an overlay all wdf arrays with 'MOCAM2' in the dataset comment.
               plo, get_wdf('MOCAM2'), /over
    
    

    (See ../pfidl/pfidl_1d/get_wdf.pro)


    GTITLE

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           GTITLE
    
     PURPOSE:
           Write a general title for a plot at the top of the page.
           User must set the y_margin before making a plot which is to have
              a general title.
    
     CALLING SEQUENCE:
    
    	GTITLE [, MyTitle] [, /MULTI] [, YMARGIN = ymargin] [, OFFSET = offset]
                [, CHARSIZE = charsize] [, /SETDEFAULT] 
    
     OPTIONAL INPUTS:
           MYTITLE:    Title for this plot. This is required if default is not set.
           MULTI:      If set, the general title is centered on the page.
                       If not set, the general title is centered over the current
                         plot window.
           YMARGIN:    Space above the plot window. Default value for GTITLE is [4,4].
                       IDL default is [4.000, 2.000] which does not leave room for 
                       a general title.  On the first call to GTITLE the !y.margin
                       will be set to [4,4] unless a value is passed.
                 NOTE: This keyword is checked on the first call to gtitle and 
                       later ignored unless the keyword(SETDEFAULT) is set
           OFFSET:     Offset from the top of the screen.  Default is 0.1 characters.
                       Minimum value is .01
           CHARSIZE:   Character size. Default is 1.5  Minimum value is 0.1
                       If maximum(!p.multi(1:2)) gt 2 then the size is scaled by 0.5
           SetDefault: If set then default values of Title, Charsize, and Offset can
                        be set. The first time GTITLE is called then setdefault is 
                        assumed to be set.
                           
     PROCEDURE:
    	XYOUTS is used to print a general title
    
     EXAMPLE:
           Note: Before making a plot which you wish a general title enter:
              gtitle   ; sets the y-margin to [4,4] the FIRST time called IF the
                         margin is set at [4,2]
       or     !y.margin = [4,4] 
       or     gtitle, /set, ymargin = [4, 4] ; other parameters may also be set
    
           Put the title 'X-Ray Analysis' on a plot and make it the default title
              gtitle, 'X-Ray Analysis', /set
    
           Print the default title in the center of the plot window.
              gtitle
    
           Print the default title in the center of the page
              gtitle, /mul
    
           Print the title 'Special Title' with character size = 2
              gtitle, chars = 2, 'Special Title'
    
     MODIFICATION HISTORY:
     	Written by:        Paul Mix, June 3, 1997
    

    (See ../pfidl/pfidl_1d/gtitle.pro)


    HAK

    [Previous Routine] [Next Routine] [List of Routines]
    
     NAME:
           HAK
     FORMAT: 
           HAK [, CHAR ] [, MESSAGE = message] [, /WIDGET_HAK]
               [, /BYTE_RETURN]
      where:
           MESSAGE:   If MESSAGE is present then:
                      If MESSAGE is a string, print the string. 
                      Otherwise, print, "Hit any key to continue..."
                      If MESSAGE is omitted, nothing will be printed.
           CHAR:      Character entered from keyboard.  Not returned if a 
                        widget is used.
                      Note: CHAR is a byte if it is less than 32 or
                            greater than 126.
           BYTE_RETURN: If set, return a byte regardless of the key struck
           WIDGET_HAK: If set, use a widget to determine if user is ready to 
                       continue.  No character or byte is returned.
     
     PURPOSE:
           HAK is a procedure that performs "Hit any key to continue".  It waits
             for keyboard input, clears the type-ahead buffer and allows the
             application to continue.
           If the device is either Postscript or Encapsulated Postscript,
             the procedure returns with no operation.
     EXAMPLE:
           Plot first 10 waveform arrays 
           Note: First way demonstrates HAK, second way is most efficient
           for i = 1, 10 do begin, plo, i  & hak, /mes & end
         plo, 1, 10
    
           Determine if a person is finished.
             HAK, answ, /byte, message='Hit Q to quit'
             if (answ eq 113B) || (answ eq 81B) then return
    
     Modification History:
           This routine is a modified version of a user routine from PV WAVE.
           Except for the name many changes have been made.
    
    

    (See ../pfidl/pfidl_1d/hak.pro)


    HEADER

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           HEADER
    
     PURPOSE:
           Print a descriptive header (FOOTER) at the bottom of a graphics
           window. 
     FORMAT:
           HEADER [, TEXT] [, CHARSIZE = charsize] [, SPACE = space]
                [, ALIGN = align] [START = start] [, UNSET = unset] [, LINE=line]
                [, SHOWDEFAULT = showdefault] [, SETDEFAULT = setdefault]
                [, /TITLE] [, XSTART = xstart] [, YSTART = ystart]
      where:
           TEXT     - optional string array. Typically this will be the date
                      and file name. DEFAULT ='Date: ' + thin_date()
                      Note: If SETDEFAULT, SHOWDEFAULT or UNSET is specified 
                        then DEFAULT value of TEXT is ' '
           CHARSIZE - Character size for XYOUTS. DEFAULT = 0.6
           SPACE   - Spacing between lines of text. Default = 1.5*Character Height
           ALIGN    - Indicates the alignment of the header. 
                      0 - DEFAULT - Left side of plot window
                      1 -         - Right side of plot window
                      0.5 -        - Centered in the plot window
                      ALIGN is ignored if title is set.
           START    - Vertical height of bottom line of text in units of 
                        character height. 
                      Default = 0.25*Character Height
                      If title is set, start = 0.5*Character Height
           LINE     - If set, the header will be placed on a single line with
                      a separator of ';  ' between elements.
           UNSET    - If present and not zero, will set all the save values
                      of keywords to their default values:
                        CHARSIZE = 0.6 (* Default Value)
                        SPACE = 1.5 (* Character Height)
                        ALIGN = 0.0
                        START = 0.25 (* Character Height)
                        LINE  = 0    (Each element on a single line)
           SHOWDEFAULT - Show the present default header keyword values.
           SETDEFAULT - If present and not zero, then the following parameters will
                      be saved and used as the default values in all future calls
                      to HEADER. If a keyword is specified, it will always be used
                      rather than the saved values.
           TITLE    - If set, center text over the graph.  Align is set to 0.5
           XSTART   - X start location in device units
                      Normally calculated from other parameters
           YSTART   - Y start location in device units
                      Normally calculated from other parameters
           Example:
               Put the date and file name at the bottom of the current plot
                 STUFF = [ 'Date: ' + thin_date(), 'File: ' + filename]
                 header, stuff
    
    

    (See ../pfidl/pfidl_1d/header.pro)


    HISPLT

    [Previous Routine] [Next Routine] [List of Routines]
    
           HISPLT
    
     PURPOSE:
           Read an Alegra unformatted history file or a series of history files.
           Store the data in a PFF file.  Data from multiple files is stored using
           only one time.  If data exists in more than one file then, the data from
           the latest file is used.  If MERGE is set, all data points are saved.
    
     CALLING SEQUENCE:
    
           HISPLT [, IN_FILE] [, OUT_FILE] [, OUT_FILE = outfile]
                  [, FULL_PRECISION = full_precision] [, /ALLSAVE]
                  [, SAVE_SETS = save_sets] [, WDFSAVE = wdfsave]
                  [, MERGE = merge] [, PFF_WRITE= pff_write] [, /Group_Part]
                  [, /SINGLE] [, /DUMP_NUMBER] [ , MULTIPLE = multiple]
                  [, IERROR = ierror] [, /QUIET] [, UNIFORM = uniform]
    
     PARMAETERS:
    
           IN_FILE        - Input file - If not valid, then use pickfile.
                            Multiple files - The number of arrays, particles and 
                            materials is checked but array names are assumed to be
           OUTFILE        - Output file; this is ignored if OUT_FILE is specified.
           SAVE_SETS      - String or array of strings which are used to select
                            datasets to store in wdf arrays.
                            If SAVE_SETS is zero, then no datasets will be saved to
                            a WDF array.
                            If SAVE_SETS is one, then the user will be prompted 
                            for the arrays to save to a WDF array.
                            Default:  SAVE_SETS = 0
                            If PFF_WRITE is not zero, then only those datasets 
                            written to a file can be saved.
           WDFSAVE        - First dataset for saving data to wdf arrays.
                            Ignored if SAVE_SETS is zero or missing.
                            Additional WDF arrays will be created if necessary to
                            store the datasets.
                            DEFAULT: WDFSAVE = 1
           MERGE          - If set, merge all data keeping multiple times.
           FULL_PRECISION - If set, PFF file will be written in full precision.
                            Default is to store with 16 bit precision.
           ALLSAVE        - All datasets that are written to a PFF file will 
                            be stored in WDF arrays
                            If no datasets are written to a PFF file, all 
                            datasets will be stored in WDF arrays.
           WRITE_ALL      - Write all datasets to a PFF file.
                            If set, PFF_WRITE = '*'
           PFF_WRITE      - If PFF_WRITE is a string or an array of strings, then
                            only those arrays will be saved to the pff file.
                            If PFF_WRITE is zero, then no datasets will be written
                            to the PFF file.
                            If PFF_WRITE is one, then the user will be prompted 
                            for the arrays to write to the PFF file.
                            DEFAULT: PFF_WRITE=0
           Group_Part     - If set, group all variables of a particle together
                          - Default: Group_Part = 1
           SINGLE         - If set, read only the selected file.
           MULTIPLE       - If set, read all of the files found without user interaction
                            If not set, the user selects the desired files from a widget.
                            DEFAULT:  MULTIPLE =0
           DUMP_NUMBER    - If set, each dataset will be stored as a function of 
                            the dump number.  The abscissa will range from zero to
                            the number of output time steps.
                     Note:  This allows data to be stored as a uniform dataset and
                            reduces file size by a factor of 2.
           UNIFORM        - If the data is known to be uniform, this keyword will
                            save the data using TIME[1]-TIME[0] as DT.
                            If UNIFORM is not equal to 1, then DT = UNIFORM
           IERROR         - Returns zero unless an error
                            Returns -1 if search string is not found
                            Returns 1 for most other errors
           QUIET          - Suppress extra messages
    
     PROCEDURE:  
           Read the data and store it as required.
           Naming convention for particle data is 'NAME.P00x'
           Naming convention for material data is 'NAME.M00x'
    
    
     EXAMPLES:
           Convert all data in a selected file or a series of selected files to a 
           WDF arrays file.
              HISPLT, /al
    
           Convert data in a selected file or a series of flies to a PFF file.  Use
           a widget to select the files to put into wdf arrays and to save to the 
           pff file.  
              HISPLT, /write, /save, /pff
    
           Convert data from the series 'dyn.his' to a pff file and save the datasets
           of pressure and density beginning in wdfarray 5
              HISPLT, 'dyn.his', save=['pressure', 'density'], wdf=5, /pff
    
    

    (See ../pfidl/pfidl_1d/hisplt.pro)


    HISPLT_HDR

    [Previous Routine] [Next Routine] [List of Routines]
    
      Reads the header (first) dataset of a pff file written from a HISPLT file.
      The HISPLT parameters are printed unless QUIET is set.
      Procedure options are explained below.
       
      Format:  HISPLT_HDR, fileid, FILEID = fileid, TLABEL = tlabel,
                 CLABEL = clabel, APTYPE= aptype, NAMEFILE = filename,
                 PRECISION = precision, NFILES = nfiles, FILES = files,
                 NPOINT = npoint, NMATERIAL = nmaterial, NPOINTVAR = npointvar, 
                 NMATVAR = nmatvar, NGLOBVAR = nglobvar, NTIME = ntime, 
                 NFILETIME = nfiletime, TIMES = times, MERGE = merge, 
                 TIME_HISTORY = time_history, QUIET = quiet,
                 SHORT_FILES = short_files, PATH_FILES = path_files, IER = ier
    
      where:
        fileid  - File id of the PFF file containing the dataset
                - Default is the current file
      Keywords:
    
        FILEID  - File id of the PFF file containing the dataset
                  Ignored if fileid is not zero
        TLABEL  - Dataset type label 
        CLABEL  - Dataset comment label - Core name of the hisplt file(s).
        APTYPE  - Application dataset type
        NAMEFILE- Up to 160 characters describing the file
        PRECISION- If set (precision = 1) then file is written in full (4 byte) 
                  precision.  If precision = 0, the file is written in standard
                  (2 byte) precision.
        NFILES  - Number of files which have been combined for the current file.
        FILES   - Files which have been combined for the current file.
        NPOINT  - Number of points 
        NMATERIAL- Number of materials
        NPOINTVAR- Array of 2 elements.  
                  First is the number of point-variables in the PFF file.
                  Second is the number of point-variables in the HISPLT file.
        NMATVAR - Array of 2 elements.  
                  First is the number of material-variables in the PFF file.
                  Second is the number of material-variables in the HISPLT file.
        NGLOBVAR- Array of 2 elements.  
                  First is the number of point-variables in the PFF file.
                  Second is the number of point-variables in the HISPLT file.
        NTIME   - Number of time-steps in the pff file
        NFILETIME- Number of time-steps in each HISPLT file
        TIMES   - Problem times for data in each of the HISPLT files.
                  TIMES = TIMES[2, NFILES] where:
                    TIMES[0, *] are the intial times for each HISPLT file
                    TIMES[1, *] are the final times for each HISPLT file
        MERGE   - Flag for processing of the HISPLT files.
                  MERGE = 1; all times are kept for every HISPLT file
                  MERGE = 0; Times from later files overwrite times from previous
                    files if there is overlap.
        TIME_HISTORY - If set, each dataset has time as the abscissa.
                       If not set, each dataset is versus the dump indexi
                       Dump_index = [0,1,2,3,4,5...]
        PRECISION - PFF dataset precision.  PRECISION Values:
                   0 - Data stored as a 2-byte integer with offset and scale factor
                   1 - Data stored as a 4-byte real
    
        QUIET   - If present and not zero, do not print any data
                  This is ignored if the dataset comment or dataset type labels 
                  are larger than the available buffer.
        SHORT_FILES - FILES without the path (if it is present).
        PATH_FILES  - Path for SHORT_FILES 
        IER      - Error flag, zero indicates no error
     
      Examples:
        Read file information from the current file.
          HISPLT_HDR
    

    (See ../pfidl/pfidl_1d/hisplt_hdr.pro)


    HISTW

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           HISTW
    
     PURPOSE:
           Generate a histogram for the waveform array amplitudes.
             This procedure uses the IDL procedure, HISTOGRAM
    
     CALLING SEQUENCE:
    
          HISTW, WDF1 [, WDF2] [BINSIZE = binsize] [, NBINS = nbins]
                 [, MAXIMUM = maximum] [, MINIMUM = minimum] [, /PLOTIT ]
                 [, XRANGE = xrange]
                 [, REVERSE_INDICES = reverse_indices] [, LOCATIONS = locations]
    
     
    
     INPUTS:
           WDF1;   Input WDF array to be analyzed
    
     OPTIONAL INPUTS:
           WDF2:   Output WDF array
                   Default:  WDF2 = GET_MAXWDF()-1
            Note:  X values are the median values for LOCATIONS
                   IDL histogram uses the minimum value of each bin and these 
                   values are returned in LOCATIONS.
                   Additional Zeros are added to the return from HISTOGRAM to 
                   allow a nice graph with psym= 10
    	
     KEYWORD PARAMETERS:
           Note:  Some of the defaults are set by HISTW
    
           BINSIZE: Size of BINS
           NBINS:  Number of bins
                   Default: NBINS = (NPOINTS/50 + 2) < 1000
                     where NPOINTS = the number of points in the WDF array
           MAXIMUM: Maximum value to consider for the histogram.  This value is
                    increased by 1.0e-6 before being passed to histogram.
              Note: MAXIMUM is ignored if both BINSIZE and NBIN are specified.
              Default: MAXIMUM = MX(WDF1)
           MINIMUM: Minimum value to consider for the histogram.
               Default:  MINIMUM = MN(WDF1)
           PLOTIT:  If set, WDF2 will be plotted.
                    "plo, wdf2, psym= 10"
           XRANGE:  If two values are provided, only ordinates whose abscissa are 
                    in the specified range are included in the histogram.
                    At least two values must be provided.
                    If there are less than two valid ordinate values, the histogram 
                    will not be calculated.
    
     The following are output if a variable is provided.
           REVERSE_INDICES: See HISTOGRAM for explanation
           LOCATIONS: BIN boundaries
                      If H = getyf(WDF2) then H[i] is the number of values, VAL, 
                      which satisfies: LOCATIONS[i] less/equal V less LOCATIONS[i+1]
              Note:  LOCATIONS will be returned, but cannot be set.
    
     OUTPUTS:
           WDF array with the histogram distribution function
    
     OPTIONAL OUTPUTS:
           REVERSE_INDICES and LOCATIONS may be returned.
    
     PROCEDURE:
           This procedure uses the IDL procedure: HISTOGRAM
    
     EXAMPLE:
           Get a histogram of the amplitude of wdf array 3 and store it in 33
              HISTW, 3, 33
    
           Calculate the histogram of the amplitude of wdf array 5 between values
             of 500E3 and 2E6 with a bin size of 1E5.  Store the result in 75
             and plot the histogram.
             HISTW, 5, 75, min = 5e5, bin = 1e5, max = 2e6, /plotit
    
     MODIFICATION HISTORY:
           Written by:     L. P. Mix, Jr., March 30, 2005
    
    

    (See ../pfidl/pfidl_1d/histw.pro)


    I2W

    [Previous Routine] [Next Routine] [List of Routines]
     format:  i2w [, space], image, wdf, clabel = clab, file = file, $
          xlabel = xlab, ylabel = ylab, epsilon = epsilon, delta = delta, $
          xydata = xydata, /lowres, get_delta= get_delta
         this procedure converts two idl arrays to an wdf array.
         space is the x array  or a two element array of x0 and dx
           Default = [0.0, 1.0]
           Space is required for XY data.
         image is the y array
         wdf is the wdf array number
      Note: the following strings will be stripped of spaces.
         clabel is dataset comment (used for title of plots)
         ylabel is y-axis (ordinate)  or block label
         xlabel is x-axis (abscissa) label
         file is file or source of these dataset values
         epsilon is the presumed accuracy of the values.  If two abscissa values
                closer than epsilon in relative accuracy ie. (xj -xi)/max (abs(x))
                is less than epsilon then they are assumed equal
                  DEFAULT is 1/2^16 = 1.5e-5
         delta is the spacing of the uniformly spaced array
         NOTE:  If the data is sparse then a small value of delta should be 
                specified to insure that all features are resolved.
         xydata if present and not zero, indicates the x and y arrays are to 
                be stored exactly as passed.  If they are used for add, subtract, 
                etc, then they are frequently converted to a uniform timebase.
         lowres is set to reduce the assumed resolution of the input data by
                a factor of 15. This is form ascii data with only 6 digits input.
         get_delta if present and not zero then space and image will be sorted, 
                    duplicate values averaged and a delta calculated and returned
                    in wdf
         Note: delta only is ignored for XY data
      Caution: Space and image must be actual variables for return values to
                     be stored when "GET_DELTA" is set.
      Correct - i2w, space, image, delta, /get_delta
      WRONG!  - i2w, array(0:np-1), array(np:*), delta, /get_delta
                    
     NOTE:
         image is assumed to be a function and space is sorted.
         multiple values of image at a given space value are averaged.
         if Space is not uniformly spaced then the data will be linearly
         interpolated using an interval, delta, equal to the minimum point
         spacing in xarray or producing the maximum of 30000 points or the number
         of points in xarray. If delta is spacified then its value will be used.
     Note: If image is already on a uniform time base, then the CHA
               command will be used to insure a point spacing of DELTA.
    

    (See ../pfidl/pfidl_1d/i2w.pro)


    IDL_FUNCTIONS

    [Previous Routine] [Next Routine] [List of Routines]
     Perform standard IDL functions on an array; these functions include
       absolute value, arc-cosine, natural and base 10 logarithm, arc-sine,
       arc-tangent with 1 or 2 arguments, hyperbolic sine, cosine and tangent,
       exponential function, square root, tangent, real and imaginary parts
       of a complex array, forward and inverse Fourier transform, maximum,
       minimum, total, complex conjugate, statistical functions --
      (linear regression, analysis of variance, cluster analysis,...), and others.
      Example:
        Calculate an array of areas from an array of radii in WDF array 5
        and store in array 6.
          xfr, 5, 6  & cha, 6, scale = '!pi*y*y)'
    
        Calculate an the sine of WDF array 5 times pi/2 
          cha, 5, scale ='!pi*0.5*sin(y)'
    
        Calculate and print the average of WDF array 6.
          gety, array, 6
          average = total(array)/n_elements(array)
          print, `Average of array 6 is `, average
        or 
          print, `Average of array 6 is `, ave(6)
    
        Calculate the log of array 7 divided by x with a cutoff of 1e-3
          cha, 7, 'alog(y > 1e-3)/x'
    
    

    (See ../pfidl/pfidl_1d/idl_functions.pro)


    INT

    [Previous Routine] [Next Routine] [List of Routines]
    
       Integrate an wdf array
         This procedure uses a simple double precision integration scheme.
         Result is stored as a float unless DOUBLE is set.
    
       FORMAT: Int, wdf1 [, wdf2] [, MOMENT = moment] [, KEEP= keep]
               [, clabel = clab] [, ylabel= ylab] [, xlabel = xlab] 
               [, double = double]
       where:
         wdf1, wdf2 - WDF array numbers
                 If wd2 is present, then wd2 = INT(wd1) else wd1 = INT(wd1)
         MOMENT - Allows higher order integrals - moment may be real or integer
                  but x must be gt 0 if x is not a positive integer 
                  default is moment = 0, gives int (y dx)
                  moment = 1 gives int(y x dx)
                  moment = 2 gives int(y x^2 dx)
                  CAUTION: if x is nanoseconds, x^n can underflow!
         KEEP   - If set, then the integration will will keep the same X values. 
                  See description below.
                  Default: KEEP = 0 ; if uniform data
                           KEEP = 1 ; if xy data.
         DOUBLE - If set, the data is stored as double precision.
    
       Description:
         An integral is performed on the input waveform array.
         The value of KEEP determines the type of integral.
       In the discussion that follows:
         The original WDF values are Y at locations X.
           There are NP values of X and Y
         The integral values are Yi at locations Xi 
         The original spacing between points is DX
         DX[i] = X[i+1] - X[i]
    
         KEEP equals zero  (See keyword description above for default value)
           The number of points is increased by 1 and the first point is set to zero
           at a location dx/2 before the first point.
           Xi and Yi have (NP+1) values
             Yi[0] = 0.0
             Xi[0] = X[0] - DX[0]*O.5
           The next point is given by:
             Yi[1] = Y[0] + DX[0]*Y[0] 
             Xi[1] = X[0] + DX[0]*O.5
           Or in general:
             Yi[i+1] = Y[i] + DX[i]*Y[i] 
             Xi[i+1] = X[i] + DX[i]*O.5
             
           For MOMENT not equal to 0, X-values are given by the stored values.
           That is, for MOMENT = M:
             Yi[i+1] = Y[i] + DX[i]*Y[i]*(X[i]^M)
    
         KEEP is not zero (See keyword description above for default value)
           The integral values are at the current X values. 
           Xi and Yi have NP values
             Yi[0] = 0.0
             Xi[0] = X[0] 
           The next point is given by:
             Yi[1] = Y[0] + DX[0]*(Y[0] +Y[1])*0.5
             Xi[1] = X[1] 
           Or in general:
             Yi[i+1] = Y[i] + DX[i]*(Y[i]+Y[i+1])*0.5
             Xi[i+1] = X[i+1] 
    
           For MOMENT not equal to 0, X-values are given by the mid-point of 
              input X-values.
           That is, for MOMENT = M:
             Yi[i+1] = Y[i] + DX[i]*(Y[i]+Y[i+1])*0.5*((X[i]+X[i+1])*0.5)^M
    
       Examples:
         Integrate array 2 and store the result in array 7
           int, 2, 7
         Integrate array 1 and store the result in array 1
           int, 1
         Calculate the first moment of array 1 and store the result in array 1
           int, 1, moment = 1
    

    (See ../pfidl/pfidl_1d/int.pro)


    INVERTCT

    [Previous Routine] [Next Routine] [List of Routines]
     Name:         invertct
     Format:       invertct [, /RESET] [, /XYDATA] [, /GIFDATA]
             where: 
                    RESET    If set, reset the invertct flag
                    GIFDATA  If set, the colors between 9 and !d.table_size-1
                               will be inverted and the foreground and background.
                    XYDATA   if set, will only invert colors between 
                               9 and !d.table_size-1.  Foreground and 
                               background are not changed.
                      NOTE:  If both xydata and gif are set, then the colors 
                             between 9 and !p.color-1 will not be inverted.
                      Note: invertct, /xy, /gif
                            is the same as: swapct
     Purpose:      Reverses the color table
                   Note: Existing plots are modified, but loading a new color 
                         table will change everything back to the original colors.
                   See swapct.pro to modify the only the foreground
                       and background colors.
     Format: invertct
     Technique: switches the color table entries between the minimum and the 
                Maximum ([!p.color, !p.background]) < (!d.table_size -1)
                Minimum is zero unless xydata is set
    

    (See ../pfidl/pfidl_1d/invertct.pro)


    IPROP

    [Previous Routine] [Next Routine] [List of Routines]
       IPROP
    
       Procedure propagates current to a target and separates the target 
         current into a high energy and low energy branch.  The total current
         at the target is also calculated.
       Warning:
              The WDF arrays: MAXWDFARRAY and MAXWDFARRAY-1, are used as 
              scratch areas to calculate the total current. (81 and 82 for current
              version (10/2/95) 
              The Arrival Time vs Time and Actual scale vs Time will be stored
                in these two arrays before leaving.
    
      1. First I and V are put on a common uniform timebase
      2. Voltage is smoothed and limited to 8% of peak
      3. Vdiode is translated to the target.
          k = 2.0 * 1.602177-19/ 1.66054e-27
          velocity of particle = sqrt(k/mass*vdiode)
          for a proton mass = 1.0073
                carbon mass = 12.0000 
      4. Arrival time derivatives are calculated and limited to two branches.
      5. Absolute value of time derivatives is calculated and smoothed with
         a three point boxcar.
      6. Current is translated to the target.
      7. Total current is calculated.
    
    
       format: iprop, vdiode [, idiode] [, vth] [, ith] [, vtl] [, itl] [, itotal]
              [, mass = mass] [, distance = distance] [, smooth = smooth]
    
       where:
          vdiode   - WDF array with diode voltage (volts vs nanoseconds)
          idiode   - WDF array with diode current (amps vs nanoseconds)
                   - Default = vdiode + 1
          vth      - WDF array with high energy target voltage
                     Default = idiode + 1
          ith      - WDF array with high energy target current
                     Default is vth+1
          vtl      - WDF array with low energy target voltage
                     Default is ith+1
          itl      - WDF array with low energy target current
                     Default is vtl+1
          itotal   - WDF array with total target current
                     Default is itl+1
          mass     - Atomic Mass in AMU, Default = 1.007276 = proton
          distance - Distance to target, Default = 0.3 meters
          smooth   - Number of points used to smooth the voltage, Default = 5
                     Set to 0 to get no smoothing
    

    (See ../pfidl/pfidl_1d/iprop.pro)


    JOINW

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           JOINW
    
     PURPOSE:
           Join one WDF array to another WDF array
           Store the result in the initial WDF array or another WDF array
           Name changed to joinw to avoid IDL conflict in Statistical library
     CATEGORY:
           Math 
     CALLING SEQUENCE:
           JOINW, WD1, WD2 [, WD3] [, VALUE = VALUE] [, XYDATA = xydata]
                         [, DELTA = delta] [, /QUIET] [, /ALLDATA]
     INPUTS:
           WD1:      WDF array number of the first array
           WD2:      WDF array number of array to be joined to first array
     OPTIONAL INPUT:
           WD3:      WDF array number for the composite; if not specified the 
                     composite is stored in WD1 the first array.
           ALLDATA:  Ignore the remaining keywords.  All of the data in WD1 and WD2
                     is combined and sorted in X.  The result is stored as XY DAta
           VALUE:    If specified, the first array will be terminated at VALUE 
                       and the other array will be ignored before the abscissa
                        value of VALUE.
                     If either array has less than 3 data values, a warning
                       will be printed unless quiet is set. 
                     If VALUE is not specified, result will be a combination 
                       of the two arrays in the region of overlap.  This is the 
                       same as /ALLDATA unless DELTA is set.
                       Values will be sorted and stored as XY data unless delta
                       is set. 
           XYDATA:   If set data will be stored as xydata. Also if either array
                     is xydata or if VALUE is not specified, the result is XYDATA
                     unless delta is set.
           Delta:    If set, xydata = 0 and data will be put on a uniform time with
                     a spacing of delta regardless of other items.
     OUTPUTS:
           NONE    The sum is stored in a WDF array in the common block
     COMMON BLOCKS:
           COM.DAT  WDF common block 
     RESTRICTIONS:
           WD1 and WD2 arrays must be defined and have valid data
     EXAMPLES:
           Join WDF arrays 2 and 3 together and store the result in WDF array 8
                   JOINW, 2, 3, 8
           Join WDF arrays 3 and 5 using one array up to 1.0 and the other 
           beyond 1.0 and store the result in WDF array 9
           in WDF array 8.
                   JOINW, 3, 5, 8, value = 1.0
     MODIFICATION HISTORY:
          Original version, L. P. Mix, May 15, 1992
         modified 
    

    (See ../pfidl/pfidl_1d/joinw.pro)


    LAB

    [Previous Routine] [Next Routine] [List of Routines]
         this routine changes the comment of an wdf array
         format: lab, wdf, string [, append = append]
         where
           wdf is the WDF array number or an array of WDF array numbers
           string - the comment and is used for the title of plots
                    If string is an array, then it must have the same number of 
                    elements as the number of valid arrays in wdf.
           Append - if not zero the the current comment will be modified
                    if gt 0 then string is appended to the current comment
                    if lt 0 then string is prepended to the current comment
         Example:
           Label array 2 as `Ion Current vs Time'
             lab, 2, `Ion Current vs Time'
    
           Add shot number to dataset comments for arrays 1 to 10
           Assume shot is the shot number.
             for i =1, 10 do lab, i, wdcomment(i)+' - '+ strtrim(shot,2)
       or    lab, indgen(10)+1, ' - '+strtrim(shot, 2), /append
    

    (See ../pfidl/pfidl_1d/lab.pro)


    LABEL

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
    	LABEL
    
     PURPOSE:
    	Add a label or text string to a plot using the cursor for placement.
           The location is determined with the cursor
           XYOUTS is used for the label.
    
     CALLING SEQUENCE:
    
    	LABEL [, LABEL_STRING] [, Xval] [, Yval] [, /RESET] 
                 [, _extra = extrastuff]
    
     Optional INPUTS:
    	LABEL_STRING - String to be placed on a plot
                          If string is undefined, zero length, or not a string,
                            then the user will be prompted for a string.
           Xval         - X-value for the label in data coordinates.
           Yval         - Y-value for the label in data coordinates.
           Note: If missing or if keyword (reset) is set, then the values will be
                 set interactively.
           RESET        - If set, the user will be expected to set the position of
                          the label using the cursor.
           _extra       - Alignment, charsize, charthick, Text-Axes, color, ...
                          Any valid keyword for XYOUTS.
           
     EXAMPLE:
          Label a plot at a point to be determined with a string to be entered.
            LABEL
    
          Label a plot on the screen and save the values for a postscript plot.
            labelstring = '' or labelstring = 0 ; since zero is not a string
            < plot command >
            label, labelstring, x, y, /reset
            startpost
            < plot command >
            
            label, labelstring, x, y
            endpost
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, December 15, 1997
    

    (See ../pfidl/pfidl_1d/label.pro)


    LEGEND

    [Previous Routine] [Next Routine] [List of Routines]
       Produce a legend for a plot
       format: legend, string, linestyle = linestyle, psymbol = psymbol, 
               color = color, position = position, /device, /data, /normal,
               /relative, mspace = mspace, thick = thick, nextpos = nextpos,
               offset = offset, box = box, cbox = cbox, bfill = bfill,
               bthick = bthick, cxyouts = cxyouts
       where
             STRING    - String array with the legend text for each line in the 
                         legend.
             LINESTYLE - Array of integers indicating the linestyle for each line
                         Linestyle may be omitted for text-only legends.
                         Default is 0, solid line. Other values are the same as IDL
                         -1, No LINE; 0, Solid; 1, Dotted; 2, Dashed; 3, Dash-Dot;
                         4, Dash-Dot-Dot-Dot; 5, Long Dashes
                         Linestyle should have one value for all curves or one
                           value for each value of string. If there are fewer 
                           values, then they will be recycled.
             PSYMBOL   - Array of integers indicating the symbol for each line
                         Default is 0, no symbol.  If there are fewer values
                         of psymbol than curves then they will be recycled.
                         Values are the same as IDL (abs(pysmbol) is used).
                         1, +; 2, *; 3, period(.); 4, Diamond; 5, Triangle;
                         6, Square; 7, X; 8, UserDefined.
             COLOR     - Color for symbols and lines for each line of the legend
                         Default is !p.color (white for X and Black for PostScript)
                         If there are fewer values of color than curves then they
                         will be recycled.
                         Values are: 1, red; 2, green; 3, blue; 4, magenta;
                         5, orange; 6, cyan; 7, yellow; 8, white; 0, black
             CXYOUTS   - Color of the legend printing
             POSITION  - Position on the plot in units determined by keywords.
                         Default is data coordinates if position is specified.
                         If POSITION is undefined then default is at a relative 
                            position of [0.04, 0.94] of the plotting area.
             /device, /data, /normal, /relative  - only one may be specified.
                         Determines the coordinates for the position keywork
                         Data refers to the plot coordinates (Default)
                         Relative is relative the actual grid 
                         Device is in device coordinates
                         Normal is normalized space coordinates
             Mspace    - Multiplier for the spacing between lines
             Thick     - parameter sent to oplot
             Charsize  - parameter sent to xyouts; if not specified, set to 
                         1/max(!p.multi(1:2)-1)>1
             FILL      - Indicates filled symbols - only for symbols 11 and higher
                         (see PLO, MKSYMBOL)
             SYMSIZE   - Symbol size multiplier
             NEXTPOS   - Next position for the legend in data coordinates
                         Use this keyword for successive calls to legend
             OFFSET    - Use to offset the count on the symbols, colors, linestyles
                         Default = 0
             BOX       - Draw a box around the legend if set.
                         If box is undefined and 
                           Cbox is set or Bfill is set or bthick is set 
                             then BOX = 1
                       - If Box has 4 elements, they will be taken as the position
                         of the box.  Format is:
                         BOX = [xmin, ymin, xmax, ymax
                         Units are the same as POSITION
                         Otherwise the size will be estimated.
                         The color will be specified by CBOX
             CBOX      - Color of the BOX. Default is !P.COLOR
             BFILL     - Fill the box with the specified color.
                         Note to erase an area: BFILL = !p.background
             BTHICK    - Thickenss of the lines for the box.
             MARGIN    - Margin for box.  Default = [2, 1] in units of characters
                         (ie, !D.X_CH_SIZE and !D.Y_CH_SIZE) 
             Example:
               Label curves with numbers in the upper left hand corner of the grid
               legend, sindgen(10), pos= [0.04, 0.94], /relative, lin = 1, $ 
                        color = [2, 3, 4, 5, 6, 7, 1]
    
               Put a box around the words, 'Experimental Data', with a thickness
               of 2 and color yellow at [2, .4] in data units
                    legend, 'Experimental Data', pos=[2, .4], cbox =7, bthi=2
    
               Same as above put put a background color of 4 and use a green print
                    legend, 'Experimental Data', pos=[2, .4], cbox =7, bthi=2, $
                      bfill = 4,cxy = 2
    

    (See ../pfidl/pfidl_1d/legend.pro)


    LHELP

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
    	LHELP
    
     PURPOSE:
    	Provides a graphical user interface to the user help procedures
             mk_library_help can be used to generate the help file
             IDL_HELP_PATH can be used to add user routines to the PFIDL routines
    
     CATEGORY:
    	Help documentation
     FORMAT:
           LHELP [, /HTML] [, /REMOTE ] [, /SET_default ] [, /SHOW_default]
                 [, /PDF]
    
           HTML   - If set, an HTML version of help will be used.
                    Default = 0
           REMOTE - If set, a Netscape browser must be running.
                    Default = 0
           PDF    - If set a FrameMaker version of help will be displayed using the
                    Acrobat reader.
                    This version will not be current with all commands.
    
      NOTE: If either or both of the following keywords are set, then help
            will not be invoked.
           SET    - If set, the values of HTML and REMOTE if present, will
                    will be set as the default.
           SHOW   - If set, show the current defaults.
     Example:
           Display an old style IDL help widget
             lhelp
    
           Display the PDF version of help.
             lhelp, /pdf
    
           Display a help menu in the current Netscape session.
             lhelp, /remote, /html
    
     OUTPUTS:
    	None. A widget interface is used to allow reading the help text.
     COMMON BLOCKS:
    	None.
     MODIFICATION HISTORY:
           Original version May 17, 1995, lpmix
    

    (See ../pfidl/pfidl_1d/lhelp.pro)


    LIM

    [Previous Routine] [Next Routine] [List of Routines]
      Limit the range or domain of a WDF array.  Limits on the domain 
      of the function are approximate; the domain is reduced to the first
      data value with abscissa greater than start and the last data value
      less than stop.
      format: LIM, WDA, START [, STOP]  [, /YAXIS] [, /KEEP]
      where:
        WDA   - WDF array number, a search string,  or an array of array numbers 
     
        START - Lower limit for the array(s)
                or an array of two or more values.
                If START is an array, then START = MIN(START) & STOP = MAX(START)
        STOP  - Upper limit for the array(s)
        YAXIS - If nonzero, then the range of the WDF array is modified
                If zero or missing, then the domain of the WDF array is modified
        KEEP  - If Y-axis is set, and if keep is greater than zero
                  all values out of range will be set to the nearest extreme.
                If Y-axis is set, and if keep is less than zero
                  all values out of range will be dropped.
                If keep is missing or zero, then waveform will not start until the 
                  first valid point, and will end at the last valid point.  Points
                  out of range will be set to the limit.
    
      Examples:
        Limit array 2 to a range of y-values between 0 and 20. 
          lim, 2, 0, 20, /y
        Limit array 2 to abscissa values of 0 to 200 ns.
          lim, 2, 0, 200e-9
        Limit arrays 2 to 5 to abscissa values between begin and end
          lim, [2,3,4,5], begin, end
     or:  lim, indgen(4)+2, begin, end
        Limit all arrays with the name 'mocam' to points selected by zoomw, 1.
          zoomw, 1, xcur= xx
          lim, 'mocam', xx
    
    

    (See ../pfidl/pfidl_1d/lim.pro)


    LIMITS

    [Previous Routine] [Next Routine] [List of Routines]
         This procedure returns the range of abscissa and ordinate values
    
         Format: LIMITS, WDF [, /KEEP] [, XRANGE = xrange] [, YRANGE = yrange]
         where:
           WDF    - WDF array number or array of numbers
                    This array may be modified if it contains invalid WDF arrays.
           KEEP   - If set, WDF will not be modified and xrange and yrange 
                    will contain (0,0) for the range of invalid WDF.
                    Default is KEEP = 0
                    WDF will return only with valid WDF arrays or -1 if 
                    none of the arrays are valid.
           XRANGE - XRANGE[2, *] has the minimum and maximum abscissa values
                    for each wdf array
           YRANGE - YRANGE[2, *] has the minimum and maximum ordinate values
                    for each wdf array
           QUIET  - Do not send messages if datasets are not valid.
           
    
    

    (See ../pfidl/pfidl_1d/limits.pro)


    LINE_RM

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           LINE_RM
    
     PURPOSE:
    	This routine removes a portion of a waveform.
           The intent is to allow line removal from otherwise smooth spectra.
           The total length and the point spacing will not be modified.
           See the example below for calculating the area of a line.
           (WDEDIT can be used for interactive line removal.)
    
     CATEGORY:
    	Analysis
    
     CALLING SEQUENCE:
           LINE_RM, WDF [, VALUE] [, WIDTH = width] [, SAVE = save]
      
        WHERE:
           WDF     Waveform array number or a search string for a unique array
           VALUE   Abscissa value for the middle of the removal area.
                   This is optional if WIDTH has two values.
           WIDTH   Width of the removal area.  
                   If width is negative and less than 1, it will be used as 
                     a multiplier that is WIDTH = abs(WIDTH)* VALUE
                   If width is positive, it will be the total width of the 
                     region with value as the middle.
                   If width has two values, VALUE is ignored and the two values 
                     are used as the lower and upper values for removal.
                   Default:  WIDTH = 0.01*VALUE
           SAVE    WDF array number for the modified array
                   Default: SAVE = WDF
    
     PROCEDURE:
           All abscissa values greater than (VALUE - 0.5*WIDTH) and less than
             (VALUE + 0.5*WIDTH) are deleted.
           Other abscissa values are not changed.
           Regardless the value of WIDTH, the first and last points and a
             minimum of 3 points will be kept.
    
     EXAMPLE:
           Eliminate data values in a 1% region around 2008 from WDF array 5
             LINE_RM, 5, 2008
    
           Eliminate values of waveform 12 between 1000 and 1012.
             LINE_RM, 12, WIDTH = [1000, 1012]
           
           Calculate the area of a spectral line in waveform 11
           1.  Specify the extent of the line
               ZOOMW, 11, xcursor = xc
           2.  Remove the line from the original waveform
               LINE_RM, 11, SAVE = 12, WIDTH = xc
           3.  Subtract the background from the line; use the original waveform
               abscissa values
               sub, 12, 11, 13, master = 2
           4.  Calculate the area
               int, 13 & print, 'Integral of the line =', mx(13)
            
     MODIFICATION HISTORY:
     	Written by:     L. P. Mix, August 31, 2004
    

    (See ../pfidl/pfidl_1d/line_rm.pro)


    LOADXYCT

    [Previous Routine] [Next Routine] [List of Routines]
        Loads the colors for an x,y plot
        Default values may be changed using PUTCOLOR
     format: loadxyct, color_table, quiet = quiet, freeze = freeze, $
           setdefault = setdefault, showdefault = showdefault, reset = reset, $
           unset = unset, background = background, color = color
    
      where: 
          FREEZE - If set, color table is not modified.
          QUIET  - If set, no messages are printed.
          SetDefault - Set Initial or final color in the color table
                       Default - Background = [0,0,0]
                                 Color = [255, 255, 255]
          ShowDefault - Show background and color defaults
          Reset/Unset - Return initial and final colors to the defaults
    
       Load a color table and set the bottom 9 colors as shown below
       If color table is not specified then the last color table specified
       will be loaded.
       These 8 colors may be set using the routine PUTCOLOR:
         PUTCOLOR, colors
           where colors is colors[8,3]
    
       Default colors are 
          1   RED       [255,   0,   0]
          2   GREEN     [  0, 255,   0]
          3   BLUE      [  0,   0, 255]
          4   MAGENTA   [255,   0, 255]
          5   ORANGE    [255, 125,   0]
          6   CYAN      [  0, 255, 255]
          7   YELLOW    [255, 255,   0]
          8   Grey      [150, 150, 150] 
    

    (See ../pfidl/pfidl_1d/loadxyct.pro)


    LPRINT

    [Previous Routine] [Next Routine] [List of Routines]
      Procedure to send a postscript file to a printer
        (LPRINT = Local Print command)
    
      format: LPRINT [, file] [, DESTINATION = destination] [, /NOSAVE]
                      [, FILEIN = filein] [, COLOR = color] 
      where:
        file   - file to be printed - If file is specified, then that value
                 will become the default in future calls to LPRINT
                 To return to the default value, use ' ' for the file
                 DEFAULT = default_printfile (SEE "SET_PRINTER")
                 Note: IF file is specified, then keyword file is ignored.
        DESTINATION - site specific
                 If DESTINATION is specified, COLOR is ignored.
                 If DESTINATION is specified, that value will be used on all
                   future calls to LPRINT unless NOSAVE is set. 
                 To return to the default value of the destination use D= ' '
                 Use SET_PRINTER, /show to see current printer defaults.
        NOSAVE - If DESTINATION is specified and NOSAVE is set, value will not
                 be saved. 
                 If FILE is specified and NOSAVE is set, value will not
                 be saved.
        COLOR  - if present and not zero, indicates the default 
                 color printer
                 This parameter is ignored if DESTINATION is specified
                 DEFAULT is COLOR = 0
        FILEIN - Alternate method of specifying file.
    
    
      Examples:
        Print idl.ps on the default printer
          lprint
    
        Print /users/lpuser/idl/junk.ps on the default printer
          lprint, '/users/lpuser/idl/junk.ps'
        NOTE: to print the same file again use the command: lprint
    
        Print idl.ps on the default color printer
          lprint, /c  
        or if all prints are to go to tek_paper use
          lprint, d = 'tek_paper'
        Print idl.ps to laser4si but send all future plots to current values.
          lprint, d = 'laser4si', /nosave
    

    (See ../pfidl/pfidl_1d/lprint.pro)


    LS

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           LS
    
     PURPOSE:
           Show files in current directory.
     CATEGORY:
           UTILITY 
     CALLING SEQUENCE:
           LS [, SPEC] [, CURRENT = current] [, NFILES = nfiles] [, /QUIET]
                       [, _EXTRA = extrastuff] 
     OPTIONAL PARMAETERS
           SPEC      - File filter
                       If SPEC is an array, only the first element is used.
     KEYWORDS:
           CURRENT   - Files in the current directory 
                    or files which match the SPEC file filter.
           NFILES    - Number of files found
                       The following syntax is used:
                       current = FILE_SEARCH (COUNT = nfiles)
           _EXTRA    - Any valid keyword to FILE_SEARCH
           QUIET     - If set, no output.  Keyword CURRENT must be used.
     OUTPUTS:
           CURRENT directory file names or file names which match SPEC.
     EXAMPLES:
           Show all files in the current directory
                 ls
    
           Show all files which end in .dat
                 ls , '*.dat'
    
           Show full path names to all files that begin with pbfa2z_8'
           Put the number of files in nf, and put the filse in fils
             LS, 'pbfa2z_8*', nfiles = nf, /fully_qualify, current = fils
    
     MODIFICATION HISTORY:
          Original version, L. P. Mix, January 3, 1997
    

    (See ../pfidl/pfidl_1d/ls.pro)


    MED

    [Previous Routine] [Next Routine] [List of Routines]
         this procedure smooths an array using a median type filter
         width is the width of the median
               Default value = 5 
         if wdf2 is a valid wdf array, the result is stored there.
            if WDF2 is not valid or undefined, then result is stored in  WDF1
    

    (See ../pfidl/pfidl_1d/med.pro)


    MID

    [Previous Routine] [Next Routine] [List of Routines]
         NAME: MID
         
         This function calculates the center of a wdf array according to the
             equation:
              center = total(x*dx*y) / total(dx*y)
          If keyword cylindrical is set then mid returns:
              center = total(x*x*dx*y) / total(x*dx*y)
         Procedure:
             Get x, y and calculate dx. 
               DX calculated as average dx on either side if not uniform.
               End values of DX are the end values. 
             Get offset
             Calculate MID = TOTAL(x*dx*(y-offset))/TOTAL(dx*(y-offset))
             TOTAL is the idl function.
         Format:
            center = MID(wdf [, LEFT = left] [, RIGHT=right] [, /PLOTIT] [, /QUIET]
               [, /INQUIRE] [, OFFSET = offset] [, AREA = area] [, IERR = ierr])
               [, /cylindrical]
        where
         CENTER   -  Center point defined above
                     If abs(area) is less than 10e-2*xrange*yrange/2)
                       a warning will be issued. (where xrange = right-left
                       and yrange = max(y)-min(y))
                     Perhaps less baseline or other modification will provide
                       a better answer.
         WDF      -  WDF array number or name of a wdf array
         LEFT     -  Minimum X value to consider
                     If LEFT is outside the data range, it is set to the minimum.
         RIGHT    -  Maximum X value to consider
                     If RIGHT is outside the data range, it is set to the maximum.
         INQUIRE  -  If set, waveform will be plotted and user asked to indicate
                     the baseline.
         OFFSET   -  If inquire is set, the baseline will be returned in offset.
                     If inquire is not set, then the value in offset will be 
                       subtracted from the ordinate values. Default = 0.0
         AREA     -  Value of Total(dx*y). For some shapes this is an area;
                       for others, an integral.
         PLOT     -  If set the waveform, offset, and median will be plotted.
         QUIET    -  If set, will not print the area warning.
         IERR     -  Set to 0 if data is valid, -1 if not valid
                     Set to 1 if area fails the above criteria.
         Example:
     
           Find the center of the following:
           x = findgen(100) & y = x*exp(-x/20)  & i2w, x, y, 1
            center = mid(1, /pl)
    
          Find the center of mass for waveform 4, using the average of the 
            data from the start to 50 ns as the offset. Calculate the mid point
            using data between 50 and 150 ns.
            cm = mid(4, left=50e-9, ri= 150e-9, off= ave(4, r= 50e-9, /qui))
          
          Find the median of waveform 'lineout 3' and plot the result.
          Set an offset using a widget.
            median = mid('lineout 3', /plot, /inquire)
    
          MODIFICATION HISTORY:
           Written by:     Paul Mix, April 1, 1998
    

    (See ../pfidl/pfidl_1d/mid.pro)


    MIRROR

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           MIRROR
    
     PURPOSE:
           Mirror a WDF array about its initial point or a user-specified 
             abscissa value
           Store the result in the initial WDF array or another WDF array
           The number of points is doubled according to the following:
           New_x = 2*Tmirror -reverse(x)
           New_y = reverse(y)
     CATEGORY:
           Math 
     CALLING SEQUENCE:
           MIRROR, WD1, [, WD2] [, TMIRROR = tmirror]
     INPUTS:
           WD1:      WDF array number of the first array
     OPTIONAL INPUT:
           WD2:      WDF array number for the composite; if not specified the 
                     composite is stored in WD1 the first array.
           TMIRROR:  Absciaas value for mirror symmetry. 
                     Default: Minimum abscissa value
           JOIN:     Join the New_X and New_Y to the old values
                     Default is JOIN = 0 - Return only the mirror values
    
     OUTPUTS:
           NONE    The mirror is stored in a WDF array in the common block
     COMMON BLOCKS:
           COM.DAT  WDF common block 
     RESTRICTIONS:
           WD1 arrays must be defined and have valid data
     EXAMPLES:
           Mirror WDF array 2 and store the result in WDF array 8
                   MIRROR, 2, 8
    
           Mirror array 5 about t = 2.0e-9
                   MIRROR, 5, T=2.0e-9
     MODIFICATION HISTORY:
          Original version, L. P. Mix, October 20, 1993
          Modified to add tmirror, November 21, 1994, lpm/dbs
    

    (See ../pfidl/pfidl_1d/mirror.pro)


    MKSYMBOL

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:		MkSymbol
     PURPOSE:	Make neat little user defined symbols
     CATEGORY:	Plotting/Graphics
    
     CALLING SEQUENCE:	MkSymbol,symbol
    
     INPUTS:
    	Symbol          an integer indicating the desired symbol:
                           0, Square; 1, Circle; 2, Triangle, 3, Diamond;
                           4, Big X or X; 5, Delta; 6, Star; 7, Plus;
                           8, Hexagon; 9, Pentagon; 10, Clover; 
                           11, PACMAN; 12, Spiral
                           an alternative option is to enter a string with 
                           sufficient characters to uniquely identify the symbol.
    			Some possible options are Square,Triangle,Circle,
    			Hexagon,BigX,Clover,Spiral,Star...
                           DEFAULT: symbol = 1 (CIRCLE)
                           See SYMBOL_LIST in the help for a complete list.
    
     KEYWORD PARAMETERS:	
    	SIZE	Symbol size      (default=!p.thick)
    	LIST	using LIST=Some_variable will return the vector
    		 of available symbol names in Some_variable      
    	HELP	returns this documentation header
    
     and also the keywords which apply to USERSYM
    	THICK	Line thickness   (default=1)
    	FILL	Fill symbol?     (default=0=no)
    	COLOR   Symbol color 
     EXAMPLES:
           Define a clover leaf for plot symbol 8.
             mksymbol, 10     mksymbol, 'cl'
           Define a filled pacman for symbol 8
             mksymbol, 11, /fill     mksymbol, 'pa', /fill
    
     SIDE EFFECTS:		Calls  USERSYM to load the new symbol
     
     MODIFICATION HISTORY:     original version
                                Brian Jackel   August 10 1992
                                University of Western Ontario
                               Modified for PFIDL 
                                L. P. Mix, June 2, 1994
    

    (See ../pfidl/pfidl_1d/mksymbol.pro)


    MK_HELP

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           MK_HELP
    
     PURPOSE:
    	Make LHELP help files for directories in IDL_PATH
             Default behavior is to not include EXAMPLES directories
    
     CAUTION:  User must have write permission in the pfidl help directory
                 or specify a help path
    
     CALLING SEQUENCE:
           MK_HELP
    	
     KEYWORD PARAMETERS:
           LIBS:   Libraries (directories) to be included
                   LIBS is a string array
                   Default is all directories in !PATH except for the
                     IDL "examples" directories
                     Examples directories are listed with "_" replacing 
                     directory separators
                   If LIBS is present only those specified directories
                     will be generated
           HELP_PATH: Directory for storing the help files.
                   This allows users to include their routines in LHELP
                   See example below
           EXCLUDE: Directories to exclude
                    Default ='util$'
           VERBOSE: List directories as they are processed
    
     OUTPUTS:
           Help files for LHELP are generated in the PFIDL help file directory.
           Alternatively, the user may specify a HELP_PATH for storing the files.
           These files are only for the widget help format; html help is not 
             currently supported with this routine.
    
     RESTRICTIONS:
           User must have write permission in the PFIDL help file directory or 
             specify a HELP_PATH to store the files.
    
     EXAMPLE:
           Update all help files in IDL_PATH except for the IDL example files.
             MK_HELP
    
           Update the PFIDL_1D help files.
             MK_HELP, LIBS = '1D'     ; assuming that no other directories
                                      ;   contain this search string.
    
           Update the PFIDL_1D and PFIDL_2D directories.
             MK_HELP, LIBS = 'PFIDL_' 
     or      MK_HELP, LIBS = ['PFIDL_1D', 'PFIDL_2D']
    
    	Update EXAMPLES directories.
             MK_HELP, LIBS = 'examples'
    
           Generate help files for user routines located in the directory:
             "/home/username/idl" and its subdirectories.
           Assume the user has his help files in "/home/username/idl/help_files"
           (for additional help contact Paul Mix - (505) 845-7493 )
           User should have the following two lines in his IDL_STARTUP procedure.
    
      !path = expand_path('+/home/username/idl')+path_sep(/search_path)+!path
      !help_path = '/home/username/idl/help_files'+path_sep(/search_path)+!help_path
    
           To generate the help files enter:
             MK_HELP, LIBS ='username', help_path ='/home/username/idl/help_files'
           LHELP should now display personal procedure help files.
    
     MODIFICATION HISTORY:
           Written by:	L. P. Mix, 21 February 2003
    

    (See ../pfidl/pfidl_1d/mk_help.pro)


    MN

    [Previous Routine] [Next Routine] [List of Routines]
      Function which returns the minimum, or local minimum, of a WDF array and
      optionally the abscissa value at which it occurs.  Optional parameters 
      allow the specification of a limited portion of the array.  The maximum
      in the same interval can be returned.
      format: MIN_VALUE = MN(WD1 [, TIME = time] [, LEFT  = left] [, RIGHT = right]
                            [, RANGE = range] [, MAX = maxx] [, TMAXIMUM = tmax]
                          [, ABSOLUTE = absolute] [, QUIET = quiet])
      where:
        MIN_VALUE - Minimum value of WDF array on the specified interval
        WD1       - WDF array number
        TIME      - Abscissa value for which the local minimum value occurs;
                    for multiple minima, this is the first
        left, right - optional abscissa value to specify the left and right 
                      abscissa values used to determine the local minimum
                      if absent, the default values are the first and last data 
                      points, respectively
        MAX        - Maximum value of WDF array on the specified interval
        TMAXIMUM   - Abscissa value at which the local maximum occurs.
        RANGE      - Range of abscissa values for the MIN/MAX
        ABSOLUTE   - If set the absolute keyword will be set in the "MIN" command
                     (See MIN in the IDL Reference Guide)
        IER        - error flag = 0 if no errors = 1 if data is not in the range
        quiet - if present and nonzero, no values will be printed to the terminal
    
      Note:   The IDL function MIN is used to determine min_value and time.
    
      Examples:
        Print the minimum and maximum value of array 2, between 10 and 1000
          Print, MN(2, l = 10, r = 1000, m = mm), mm
    
        Calculate the minimum value of array 3 and store it in bot and the time
        at which it occurs in btime; suppress terminal output
          bot =  MN(2, time = btime, /quiet)
    
    

    (See ../pfidl/pfidl_1d/mn.pro)


    MUL

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           MUL
    
     PURPOSE:
           Multiply a WDF array by a constant or a WDF array 
           Store the result in the initial WDF array or another WDF array
     CATEGORY:
           Math 
     CALLING SEQUENCE:
           MUL, WD1, WD2 [, WD3]
           MUL, WD1, 0, VAR, [, WD3]
     INPUTS:
           WD1:     WDF array number of the first array
           WD2:     WDF array number of array to multiply the first array
      or
           0, VAR   Variable or constant to multiply the first array
     OPTIONAL INPUT:
           WD3:     WDF array number for the product if not specified the 
                    product is stored in WD1 (the first array)
     KEYWORD PARAMETERS:
           CLABEL    Replace the dataset comment for array number WD3
                     with the string or string variable specified
           XLABEL    Replace the dataset x-axis label for array number WD3
                     with the string or string variable specified
           YLABEL    Replace the dataset y-axis label for array number WD3
                     with the string or string variable specified
           SORTX     Sort the X values and take all unique values.
                     Ignored if MASTER is set
           MATCH_ONLY If one array is XY data and the match is not exact,
                      then make a new XY array with only X values in both
                      arrays that differ by less than ERR where
                      ERR =  (xmax-xmin)/(100*np)]  if match_only ge 0
                          = - match_only            if match_only lt 0
                      where np is the number of points in the first array
                         and [xmin, xmax] is the range of the first data array
                      (1% of the average point spacing)
                      The points are selected by:
                           X2-ERR < X1 < X2+ERR
                      In the actual implementation, if both arrays are XY then
                        the X1 values are those of the shorter array and not
                        necessarily the first array.
                      Multiple X2 points which satisfy the inequality are averaged
           MASTER:    If the abscissa of WD1 does not match the abscissa of WD2 
                      then the abscissa values in the master array will be used 
                      exactly in the region of overlap.  If MASTER is negative 
                      then all of the abscissa values in the master array will 
                      be used and ordinate values where there is no abscissa will
                      be set to DEFAULT. If keyword_set(MASTER) and abs(MASTER) is 
                      not 2, then abs(MASTER) is set to 1.
           DEFAULT:   Value to be use when MASTER is negative and there is not 
                      complete overlap of the master curve.
                      Default:  DEFAULT = 1.0
    
     OUTPUTS:
           NONE     The product is stored in a WDF array in the common block
     COMMON BLOCKS:
           COM.DAT  WDF common block 
     RESTRICTIONS:
           WD1 array must be defined and have valid data
           WD2 or 0 and a Variable must be defined
     PROCEDURE:
           If WD2 is specified:
                WD1 and WD2 are put on a common time base and the product
                calculated.  If there are less than 2 points of overlap, then 
                no action is taken.  Linear interpolation is used to put the 
                arrays on a common abscissa scale using the minimum abscissa 
                increment.
           If 0, VAR is specified:
                WD1 is multiplied by VAR, where VAR is a constant or a variable.
           In either case, the product is stored in WD3, if specified, 
           or WD1, if WD3 is not specified.
     EXAMPLES:
           Multiply WDF arrays 2 and 3 and store the result in WDF array 8.
                   MUL, 2, 3, 8, c = 'Power', y = 'Power (W)'
           Multiply the variable pi to WDF array 2 squared and store the product
           (areas) in WDF array 8.
                   MUL, 2, 2, 8          ; Square array 2 and store in 8
                   MUL, 8, 0, !pi        ; Multiply by pi
     MODIFICATION HISTORY:
          Original version, L. P. Mix, May 15, 1992
    

    (See ../pfidl/pfidl_1d/mul.pro)


    MX

    [Previous Routine] [Next Routine] [List of Routines]
      Function which returns the maximum, or local maximum, of a WDF array and
      optionally the abscissa value at which it occurs.  Optional parameters
      allow the specification of a limited portion of the array.
      XY data is converted to uniform data if SOFT is set
    
      format: MAX_VALUE = MX(WD1 [, TIME = time] [, LEFT  = left] [, RIGHT = right]
                          [, RANGE = range] [, MIN = min] [, TMINIMUM = tmin]
                          [, SOFT = soft] [, DEGREE = degree] 
                          [, ABSOLUTE = absolute] [, QUIET = quiet])
      where:
        MAX_VALUE - Maximum value of WDF array between on the specified interval
        WD1       - WDF array number
        TIME      - Abscissa value for which the local maximum value occurs;
                    for multiple maxima, this is the first
        LEFT, RIGHT - Optional abscissa value to specify the left and right
                    abscissa values used to determine the local maximum
                    If absent, the default values are the first and last data
                    points, respectively
        MIN       - Minimum value on the specified interval
        TMINIMUM  - Abscissa value at which the local minimum occurs.
        SOFT      - if presetn a fit to the data will be performed to determine
                    the maximum
                    If soft is less than 1 then the fit will be over points 
                    within (soft*mx) of the peak. Default = 0.96
              Note: Last two waveform arrays are used if SOFT is set.
                    get_maxwdf() has peak values
                    get_maxwdf()-1 has fitted values.
        RANGE     - Actual range of the abscissa values.
        DEGREE    - Degree of the fit. DEFAULT = 2 
                    IGNORED unless Soft ne 0
        ABSOLUTE  - If set the absolute keyword will be set in the "MAX" command
                    (See MAX in the IDL Reference Guide)
                    ABSOLUTE is ignored with the soft keyword.
        IER       - error flag 0 = no error, 1 if data is not in the range
        quiet     - If nonzero, no values will be printed to the terminal
    
      Note:   The IDL function MAX is used to determine max_value and time.
    
      Examples:
        Print the maximum value of array 2, between 10 and 1000
          Print, MX(2, l = 10, r = 1000)
    
        Calculate the maximum value of array 3 and store it in bot and the time
        at which it occurs in btime; suppress terminal output
          bot =  MX(3, time = btime, /quiet)
    
    

    (See ../pfidl/pfidl_1d/mx.pro)


    MYTITLE

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           MYTITLE
    
     PURPOSE:
           Write a general title for a plot at the top of the plot.
    
     CALLING SEQUENCE:
    
    	MYTITLE , MyTitle [, OFFSET = offset] [, CHARSIZE = charsize]
                       [, /BOTTOM] [_extra = extrastuff]
    
     OPTIONAL INPUTS:
           MYTITLE:    Title for this plot. This is required.
           OFFSET:     Offset.  This is added to the default position.
                       Units are normalized units.
                       If offset is a single value, it will be applied to the 
                         Vertical position.
           CHARSIZE:   Character size. Default is 1.2 
                       If maximum(!p.multi(1:2)) gt 2 then the size is scaled by 0.5
           BOTTOM:     If set, Text will be put below the plot.
                       If CHARSIZE is not set, CHARSIZE = 1.0
           _EXTRA:     Any valid keywords to XYOUTS
                           
     PROCEDURE:
    	XYOUTS is used to print a general text string.
           Position is 0.5* total(!x.window) in the horizontal direction
             and 0.5*(!y.window(0)+!y.region(0)) in the vertical direction (Bottom)
             or 0.5*(!y.window(1)+!y.region(1)) in the vertical direction (Top)
    
     EXAMPLE:
           Note: Before writing a title a plot must be made.
    
           Put the title 'X-Ray Analysis' on a plot and make it the default title
              mytitle, 'X-Ray Analysis'
    
           Print the title 'Special Title' with character size = 2
              mytitle, chars = 2, 'Special Title'
    
     MODIFICATION HISTORY:
     	Written by:        Paul Mix, October 19, 1998
    

    (See ../pfidl/pfidl_1d/mytitle.pro)


    NEWEND

    [Previous Routine] [Next Routine] [List of Routines]
      This procedure adds zero value points to a WDF array to extend its
      domain to a specified value.  If the array's domain already includes
      the specified endpoint, no action is taken.
      The first point added will be equal to the point spacing for uniform data
         and to half the minimum spacing for xy data
      Note:  To add zero values to an array before the beginning of the data,
      use the TSH command. 
      format: NEWEND, wd1, value, delta = delta
      where:
        wd1 - WDF array number or an array of wdf array numbers
        value - designated final abscissa value
        delta  - ignored unless XY data. If XY data this will be twice the spacing
                 for additional points if required.
                 If delta is not specified, then NEWEND will set delta to the
                    minimum of the minimum current spacing or 1e-4*max(x)
        
      Examples:
      Extend the data in array 1 by adding zero values to an abscissa value
      of 200e-9
        newend, 1, 200e-9
      Extend the data in array 2, presently with values between abscissa
      values of 65e-9 to 180e-9, to cover the domain [0, 200e-9] by adding
      zero values at both ends
        tsh, 2
        newend, 2, 200e-9
    

    (See ../pfidl/pfidl_1d/newend.pro)


    PAD

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           PAD
    
     PURPOSE:
           Decrease the point spacing of a WDF array using a FFT technique.
           This technique attempts to preserve the frequency content of the 
           waveform.  
           Note: If the waveform does not begin and end at the same value of 
                 the amplitude then distortions will be generated at either 
                 extreme.
     CATEGORY:
           Utility
     CALLING SEQUENCE:
           PAD, WD1, DDT
     INPUTS:
           WD1:      WDF number or an array of numbers of WDF arrays to be changed
           DDT:      Decrease the interval between points by this factor
                     Default is 2.
     OUTPUTS:
           NONE    The parameters are stored in the WDF common block
     COMMON BLOCKS:
           COM.DAT  WDF common block 
     SIDE EFFECTS:
            If the waveform does not begin and end at the same value of 
              the amplitude then distortions will be generated at either 
              extreme.
     RESTRICTIONS:
           WD1 array must be defined and have valid data
     PROCEDURE:
           A fft is taken and zeros are added at higher frequencies to bring 
              the inverse point spacing to the desired value.
     EXAMPLES:
           Increase the number of points in dataset 22 by a factor of 3
                   PAD, 22, 3
           Increase the number of points in datasets 1 to 10 by a factor of 4
                   PAD, 1+indgen(10), 4
     MODIFICATION HISTORY:
          Original version, L. P. Mix, January 13, 1994
    

    (See ../pfidl/pfidl_1d/pad.pro)


    PARSER

    [Previous Routine] [Next Routine] [List of Routines]
      This routine converts a string to a float, integer array, or string array.
     format:  
        PARSER, string, array, np, integer = integer, ignore = ignore, 
                stringarray = stringarray
         string     - Input string to separate
                      If a zero length string, np = 0 and no values returned.
         array      - Output array
         np         - Number of elements
         INTEGER    - Optional keyword.  If set, Array is converted to an integer
                        with ROUND
         STRINGARRAY- Optional keyword.  If set, Array is a string array.
                      If stringarray is set, then one string will be returned 
                      even if string is all blanks.  All blanks will be removed.
         IGNORE     - Any nonnumeric characters to be ignored are listed 
                      in ignore. See example. They are converted to spaces
         DELIMITER  - Default value is space = 32B 
                      Other values are tab = 9B
    
     Example:
         Parse string into an integer array, array 
           parser, string, array, np, /integer
    
         Read all remaining records in a file , unit, and put the numbers in new
         Ignore ",", "$", and "&"
           npmax = 4096 & new = make_array(npmax)
           i = 0
           str = ' '
           ignore = [",", "$", "&"]
           while (not eof(unit)) and i lt npmax do begin
             readf, unit, str
             parser, str, array, np, ignore = ignore
             if i+np ge npmax then np = npmax-i
             if np gt 0 then new (i:i+np-1) = array(0:np-1)
             i = i+np
           endwhile
           if i gt 0 then new = new(0:i-1) else new = 0
    

    (See ../pfidl/pfidl_1d/parser.pro)


    PE2PFF

    [Previous Routine] [Next Routine] [List of Routines]
        convert a Perkin Elmer file to a pff file
                 This routine uses read_pe
    
        format pe2pff [, File_Name] [, IMAGE] [, SPACE]
                [, TLABEL = tlabel] [, CLABEL = clabel] [, BLABEL = blabel]
                [, XLABEL = xlabel] [, YLABEL = ylabel] [HEADER = header]
                [, NPOINTS = npoints] [, DELTA = delta] [, OUTFILE = outfile]
     (input)    [, FILTER = filter] [, SCALE = scale] [SWAP = swap]
                [, PATH = path] [, DELETE = delete]
                [, XIMAGE = ximage] [, XHEADER = xheader] [PHEADER = pheader]
                [, DESTINATION = dest] [, PLOTIT = plotit]   
    
         where 
            File_Name - the name of the file with or without an extension
                        if no name is specified, PICKFILE will be used
        image -    array containing the image file
        space -    array containing the dataset x and y arrays. Use
                      SP2XYZ, image, space, x, y
                   to obtain x and y (SPACE = [X, Y])
                   Note: MicroD offsets are ignored.  Both X and Y start at (0, 0)
        tlabel -   Dataset type label
                   Default is the value of "SETVAL"
                     (Specular Density, Transmission or Intensity)
        clabel - dataset comment label
                 Default is File Name // Comment1 // Comment2 // ScanTime
        blabel - title or label for this block
                 Default is Specular Density, Transmission or Intensity
                   depending on the value of "SETVAL"
        xlabel - horizontal dimension label for this block
                 Default is 'X (microns)'
        ylabel - Verticle dimension label for this block
                 Default is 'Y (microns)'
        header - Complete header for the PE dataset
        npoints- Array of points for each dimension
        delta  - Array of microns/step for each dimension
        outfile- File name without path information
        filter - Optional filter. If specified this parameter must have at least
                   two values which are taken as the maximum and minimum of the
                   scanned data.  If three parameters are given, the third is taken
                   as the default value given to all data which falls outside the
                   specified range.  Default value is [0, 5000, -1]
                   That is all data less than 0 and greater than 5000 will be set
                   to -1.  With the default scaling of 800, this corresponds to
                   values between 0 and 6.25
        scale  - Parameter used to scale the integer counts.
                 Default is 1/800 = 1.25e-3
        swap   - This keyword is set by default according to the following:
                 Windows and linux: SWAP =0
                 UNIX: SWAP = 1
                 If SWAP = 0, then the bytes in IMAGE will not be swapped.
                 Note: VAX data must be swapped.
        path   - Directory path to the desired file
                 This is the same default value as used in OPENPFF
        delete  - If set, delete the Perkin Elmer files
        ximage  - Extension for the image file. Default is .img
        xheader - Extension for the header file. Default is .hdr
        pheader - If the keyword is set, the header will be printed to the screen
    
        destination - Path of the destination file
                         If no destination is specified the file will be
                         written in the same directory as the PE file
        plotit    - if set, a crude plot will be made of the image
    
         Example
         pe2pff, 'S6411n5j' ; read file S6411n5j from current directory
     or 
         pe2pff             ; read a file to be determined form PICKFILE
     or  pe2pff, /pheader, 'S6411n5j.Hdr' ; read S6411n5j and print header
         pe2pff, /plot     ; read a file to be determined and plot it
    

    (See ../pfidl/pfidl_1d/pe2pff.pro)


    PE_AVE

    [Previous Routine] [Next Routine] [List of Routines]
     Name: PE_AVE
      Average Perkin-Elmer calibration data from a pff file. 
      should have cal_top.pff and cal_bot.pff in the same directory.
     
     Example:
       pe_ave
    

    (See ../pfidl/pfidl_1d/pe_ave.pro)


    PE_CAL

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           PE_CAL
    
     PURPOSE:
           Obtain Calibration Data from the PE Scanning Microdensitometer
           Code is specific to a 21 step calibration wedge with two areas
           of calibration data
    
     CALLING SEQUENCE:
           PE_CAL [, FILENAME] [, WIDTH = width] [, UP = up] [, DOWN = down]
                     [, MANUAL = manual][, AVERAGE = average] [, OUTPUT = output]
                     [, VALID_PEAK = valid_peak] [, STRUCTURE = structure]
                     [, NPMIN = npmin] [, /SD] [, CALIBRATION = calibration]
                     [, WORK = work] [, FILTER = filter] [, /ROTATE ]
                     [, THRESHOLD = threshold] [, VERBOSE = verbose]
                     [, /QUERY]
      where:
           FILENAME - Filename of a header or image file.
         
     KEYWORDS:
           STRUCTURE - If a valid sturcture, then FILENAME is ignored and 
                       the data is taken from structure.
           ROTATE - If set, image will be rotated 180 degrees
           WIDTH  - Width of the lineout 
                    Default: 20% of Y-range
           UP     - Distance to the middle of the Upper scan from the 
                    middle of the lower set of calibration data
                    Default = 10% of the Y-range
               Note: Ignored if MANUAL is set
           DOWN   - Distance to the middle of the Lower scan from the 
                    middle of the lower set of calibration data
                    Default = 10% of the Y-range
               Note: Ignored if MANUAL is set
           MANUAL - If set, use cursor to set top and bottom scans 
                    If set, UP and DOWN are ignored.
           Average- Fraction of the step used to obtain an average
                    Default = 0.7
           npmin  - Minimum number of points around a step to ignore
                    Default = 5 points.
           OUTPUT - Output waveform arrays corresponding to the bottom and top
                    lineouts vs bin number and the Density vs Exposure curve.
                    Default if n_elments(output) eq 0 = [1, 2]
                    Default if n_elments(output) eq 1 = [output,output+1]
           Valid_peak - Derivative change must exceed Valid_peak * standard_dev
                        Default value = 2
           SD     - If set, standard deviation is stored in the next array 
                    Standard deviation = sqrt( total(y-ave)^2/ (n-1))
           CALIBRATION - Calibration curve number or name for the film 
                         and step-wedge. 
                      See D2E for values. ('Blue', 'Green', 1, 2)
                      NOTE:  Use D2E, output[0], wdf, calibration = calibration 
                             to use the data with another calibration curve.
           WORK   - Work array; Default = get_maxstr()-1
           FILTER - Set for noisy signals. If negative, filt will be called with 
                    DELTA = -FILTER
           THRESHOLD - Relative parameter for determining the steps.
                       Default = 0.4
           VERBOSE - If set additional information will be presented
                     Default: VERBOSE = 0
           QUERY   - If set, the code will interrogate the user on the number of 
                     highest amplitude bin.  Normally this will not be done if 21
                     steps are found.
                     
     This version is set for the following parameters:
      Contact Paul Mix to change
           Fudge_factor = 500 microns
           
     PROCEDURE:
           1. Read data file
           2. Take lineouts
           3. Use upper lineout to determine bins.
              Smooth and take derivative 
           4. Calculate average bin value
           5. Store outputs in Output
     OUTPUTS:
           Return todays date in the form: Month day, year
    
     RESTRICTIONS:
           No restrictions.
    
     Structure Arrays get_maxstr()-1 and get_maxstr() contain the image data.
     Waveform arrays 71 to 74 are used for calculations.
     Waveform arrays 75, 76 have the lineout values vs film position
    
     EXAMPLE:
           PE_cal 
    
     MODIFICATION HISTORY:
     	Written by: Paul Mix, March 14, 2000
    

    (See ../pfidl/pfidl_1d/pe_cal.pro)


    PE_WRI

    [Previous Routine] [Next Routine] [List of Routines]
     Name: PE_WRI
      Write Perkin-Elmer calibration data to a pff file.
      should have cal_top.pff and cal_bot.pff in the same directory.
     
     Example:
       pe_wri 
    

    (See ../pfidl/pfidl_1d/pe_wri.pro)


    PLO

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           PLO
    
     PURPOSE:
           Plot a WDF array or multiple WDF arrays
     CATEGORY:
           Input/Output
     CALLING SEQUENCE:
           PLO, WDA [, NCURVE] [, WSELECT = WSELECT] [, XRANGE =xr][, YRANGE =yr] 
         [, /OVER][, TITLE =title][, GRID =grid][, LEGEND =leg][, /NOGRID] [, /NSYMBOL] 
         [, PSYMBOL =symbol] [, FILL = fill ] [, SYMSIZE = symsize] [, /SPECTRUM]
         [, LSYMSIZE = lsymsize] [, LINESTYLE =linestyle] [, COLOR = color]
         [, LGSP = lgsp] [, ALLSYMBOL = allsymbol][, NCHAR = nchar][,LNAME = lname]
         [, DATA = data] [, THICK = thick ] [, /NLINESTYLE] [, CHARSIZE =charsize]
         [, LCHARSIZE = lcharsize] [, NEXTPOS = nextpos] [, /RIGHT] [, /LEFT]
         [, /SETDEFAULT] [, UNSET = unset] [, SHOWDEFAULT = showdefault] 
         [, /TRUNCATE ] [, /Engineering] [, /QUICK] [, /ZEROLINE] [, /ASPECT ]
         [, /WAIT] [, /HEADER] [, RESET = reset] [, BLEGEND = blegend]
         [, START_OFFSET= start_offset] [, ABSOLUTE_VALUE = absolute_value]
         [, LOGRANGE = logrange] [, _EXTRA = extrastuff]
     INPUTS:
           WDA:      WDF array number or an array of WDF array numbers
                       or a search string ('*' represents all arrays)
                       If WDF is an array of strings, the results of the search
                       strings will be concatenated and unique values selected.
                       If the first value is a '*', then other values are ignored.
           Note:     Data with more than 19999 points will be thinned to 3000
                     pairs for postscript and 1500 pairs for other displays unless
                     QUICK is set. The pairs will be in the range of the plot.
                     Set keyword QUICK = 0 to avoid this thinning.
                     If xrange is specified the resultant array must have at least
                       4500 points (9000 for PS) for thinning to occur.
                     (If x is not monotonically increasing then no automatic 
                      thinning will occur.)
                     
     OPTIONAL INPUT:
           NCURVE:   Number of curves to be plotted.  If WDA is a single WDF 
                     array number, then WDA and the following ncurve-1 arrays
                     will be plotted.  If WDA is an array or the search
                     string returns more than 1 value, then NCURVE is ignored.
           WSELECT:  Ignored unless WDA is a string.  If WDA is a string, then 
                     only dataset comments containing WSELECT are used.
                     If WSELECT is an array, it will be applied sequentially.
                     EXAMPLE:  Plot datasets beginning with Current and Voltage for
                     shot 2345 assuming these strings are in the dataset comments.
                       PLO, ['^current', '^voltage'], wselect ='2345'
                     See GET_MATCH for discussion of string matching.
    
     KEYWORD PARAMETERS:
           SPECTRUM  Indicates a spectrum from red to blue to be used for the 
                     curves.  See the RAINBOW command.  The user may also issue
                     the spectrum command and specify colors in the PLO command. 
                     Spectrum sets the following if they are not set:
                       NLINESTYLE =  1
                       NSYMBOL    =  1
                       LEGEND     = -1
                       LCHARSIZE  =0.6
                     The following commands are identical:
                        rainbow, 5
                        plo, 1, 5, /over, /nl, /ns, leg = -1, color = 10+indgen(5)
                     or
                        plo, 1, 5, /over, /spectrum
           COLOR     Indicates the color to be used for the curve.  
                     See also SPECTRUM keyword.  If /OVER is 
                     present the successive curves will be drawn in different 
                     colors.  If a single color>0 is given, it will be used as the
                     first color and the colors below will be sequenced over 
                     color = (color +indgen(7) ) mod 7 + 1.
                     If the color is zero, then color = !p.color. If 
                     more than 1 color is specified, these colors will be sequenced
                     The colors are: red(1), green(2), blue(3),
                     purple(4), orange(5), light blue(6) and yellow(7).
    
           XRANGE, YRANGE - two element vectors indicating the desired range for
                     the plots in the horizontal and verticle directions. If XSTYLE
                     and YSTYLE are not specified then these values will be rounded
                     to "nice" values. If a single value is specified, the minimum
                     and maximum of the data will be used.
                     If xrange is specified and quick is not set to zero, the data 
                       will be set to the XRANGE with a fudge of 25% of XRANGE
                       additional data points on each end.
                     If engineering is specified, these values will be automatically
                     scaled.
           LOGRANGE  If a log scale is specified with /ytype or /ylog, the minimum will 
                     be specified as LOGRANGE*YRANGE[1] unless YRANGE is specified.
                     LOGRANGE must be greater than zero and less than 1.
           ENGINEERING If set, maximum/minimum values will be in the interval 
                     (1, 1000).  For example, if maximum is 1.0e7 volts and 
                     250 e-9 sec  then the y values will be multiplied by 1e-6
                     and ' x1e6' will be added to the y label and x values 
                     multiplied by 1e9 and ' x1e-9' added to the x label.
                     Caution - WARNING -Beware: If XTITLE or YTITLE are specified
                       then the title will be as specified, regardless whether 
                       the data has been scaled.
                     If xrange and yrange are specified, they will be scaled.
           ASPECT    If set, X and Y axes will have the same relative scale
           TITLE     Plot Title. Default is the curve label unless over is set.
                     If TITLE is an array, multiple lines will be printed.
           GRID      Indicates the number of plots to a page with a scalar value or
                     the number of plots in the horizontal and vertical directions
                     with a vector.  With a scalar value, N, the number of plots 
                     in the vertical direction is approximately sqrt(N). GRID is 
                     ignored with overlay plots and for plots with a single curve.
           HEADER    If specified a plot header, consisting of a date or dates 
                     and the current file name, is displayed in the lower left
                     corner of the plot.  See the HEADER command to set default 
                     DEFAULT is HEADER = 1
                     HEADER = 0 will eliminate the header.
                     HEADER parameters (character size, spacing, alignment).
                      If header = -1, the date is the current date and time.
                      If header = -2, the date is the modification date of the file.
                        (On certain installations, the dataset comment contains
                         the string 'DATETIME='.  The string after this flag 
                         is used as the time for the shot. A ';' is taken as 
                         then end of this field. If a ; is not found the string is 
                         assumed to be 20 bytes long. Time should be the last 
                         parameter in this field; time of the form hh:mm:ss is 
                         truncated at the second colon.)
                     If the file is not specified, then the date is the current
                       date regardless of the value of header.
                     HEADER = -3 or any positive number(>0) will give both dates 
                     NOTE: For X-windows screen dumps, many will want to increase
                          the character size with the command:
                          HEADER, /set, charsize = 0.8
                          (Default is 0.6 of current size)
           LEGEND    Specifies the location of the legend on overlaid plots.
                     If LEG = -1, no legend is drawn. Default is [0.04, .94] 
                     relative to the grid
           TRUNCATE  If set to zero, the full dataset comment will be used as 
                       a title. Default is to not limit the title to the characters
                       before the first ' - ' in the comment. (TRUNCATE =0)
                       If truncate is set only caracters before a ' - ' will be used
           QUICK     If set and the dataset has more than 3*NQ points, reduce the 
                     plotted data to 2*NQ where NQ = max(nn, quick) 
                     (nn = 1500 for postscript, 750 otherwise.)
              Note:  The actual data is not modified.
              Note:  Strange results can occur if the data is non-uniform.
                     Example:
                        Plot array 1 with the default 500 intervals (1000 pts).
                           plo, 1, /q
                     Technique: Same as automatic filtering but the defaults are 
                                less by a factor of 3. Also no check will be made on
                                whether the abscissa values are monotonically
                                increasing with XY data.
                       1.  Reduce the data by a fixed ratio - n
                               (up to (n-1) points can be lost for the plot)
                               (if n is less than 2 ignore this keyword)
                       2.  For each n points determine a minimum and a maximum.
                       3.  Assign the minimum amplitude and the maximum to an 
                           X-value near the midpoint of the bin.
                       4.  Plot the thinned data.
           LGSP      If specified, the legend spacing is multiplied by this 
                     parameter.
           NCHAR     Number of characters in the legend 
                     Default is 30 for PostScript and 12 otherwise.
           LNAME     Array of names (strings) for use in the legend.
                     The number of elements must be the same as or greater than 
                        the number of curves.
                     Default is the dataset comment for each waveform.
                     If NCHAR is not specified, then all characters are printed.
                     If NCHAR is specified, then each element of LNAME will be 
                            truncated to NCHAR characters.
           DATA      If present and not zero, indicates LEG is in DATA coordinates 
                     Default is DATA = 0 unless RIGHT is set.
           LINESTYLE Indicates the type of line to be used.  Lines specified by
                     LINESTYLE are: solid(0), dot(1), dash(2), dot-dash(3),
                     dot-dot-dot-dash(5), and long dash(5).  If the keyword OVER
                     is present then if LINESTYLE contains:
                     a.  more than one value, then the linestyle types 
                           are sequenced over the specified values.
                     b.  a single value not equal to -1, then the linestyle types 
                         are given by LINESTYLE= (LINESTYLE + [0,2,3,4,5,1]) mod 6
                     c.  If LINESTYLE is -1, a solid line is used for all plots.
                     If the keyword OVER is not present, then all plots are done
                       with LINESTYLE (0) unless an array is specified.
           /NOGRID   Indicates the curve should be plotted on the existing grid.
           /OVER     Indicates curves are to be overlaid. A legend is printed to
                     distinguish curves.  The location of the legend can be 
                     specified with the keyword LEG. Linetypes and symbols are 
                     used automatically. 
                     Title by default is '' if over is set.
           PSYMBOL   Indicates the type of line and symbol to be used.  If is less
                     than zero, a symbol will be plotted at every point and no 
                     line will be drawn.  If SYMBOL is greater than zero, only
                     about 18 symbols will be plotted and lines will connect the
                     points.  Values of SYMBOL are: plus sign(1), 2 (asterisk),
                     3 (period), 4 (diamond), 5 (triangle), 6 (square), 7 ("X"),
                     8 (USER Defined) and 10 is histogram mode with horizontal
                     and vertical lines connecting the points.  Default for 
                     USER Defined is a filled circle. 
                     Note: PSYMOL = 10 and PSYMBOL = -10 have identical results.
                     Note: GET_SYMBOL_POINTS is used to set symbol point position
                           Value of the number of points is the set in WDERR.
                           To have 10 points use:
                             WDERR, /set , npoint = 10 
                     (If the symbol value is greater than 10 then ll will be 
                     subtracted from the value and MKSYMBOL will be called.)
                     (See help on SYMBOL_LIST for a description of additional
                     symbols.)
                     Note: Symbols may also be specified as names:
                       PSYM=['sq', 'ci', 'diamond', 'clover']
                       These will be converted to numbers. [11, 12, 14, 21]
                       A null or blank string('' or '  ') will result in no symbol.
                     If the keyword OVER is present, then if SYMBOL contains:
                     a.  more than one value, then the SYMBOL types 
                           are sequenced over the specified values values.
                     b.  otherwise symbol = [1,2,4,5,6,7]
                     If OVER is not set then the default is no symbol.
                     The absolute value of symbol is used and the frequency is
                     governed by allsymbol. The keyword NSYMBOL will eliminate all
                     symbols.
          FILL       This has no effect on symbols 1 to 10. On symbols 11 and higher
                     the symbols will be filled if FILL is not zero.
                     IF FILL has n values, then for multiple curves FILL has the  
                       value FILL(i mod n) for the ith curve.
                     Example: psym = ['sq', 'sq', 'ci', 'ci'] , fill = [0, 1]
                       will provide a filled and unfilled square and then the same
                       for a circle.
          SYMSIZE    Symbol size multiplier
          LSYMSIXE   Legend symbols use LSYMSIZE as a multiplier to the default
                     LSYMSIZE is a scalar 
          ALLSYMBOL  If present and not zero, a symbol is plotted at every point.
                     If allsym is negative, only symbols will be plotted.
                      (This is the same as psymbol negative, but if both allsymbol
                        and psymbol are negative then they will cancel.)
                     If allsym is positive, a line will be drawn with a symbol at 
                          every point
          /NLINESTYLE  If present and nonzero, all the lines will be solid 
                       This is the same as linestyle = -1
                       Note: If NLINESTYLE is set, then linestyle is set to -1.
          /NSYMBOL  If present and nonzero, no symbols will be plotted in the 
                     overlay mode.  ALLSYMBOL is set to zero.
          THICK     Line thickness, default is !p.thick
          CHARSIZE  Parameter sent to the PLOT command to vary the character size
                    CHARSIZE is used to scale !P.CHARSIZE if it has been changed
                      from the default value of zero.
                    This keyword also affects the legend text. See LCHARSIZE below.
                    Default is CHARSIZE = 1. * !p.charsize
          LCHARSIZE Parameter sent to the LEGEND command to vary the character size
                    in the legend. The value sent is actually LCHARSIZE*CHARSIZE
                    Default is LCHARSIZE = 1.
          NEXTPOS   Next legend position in data coordinates. This keyword can be
                    used to add text below a legend. 
          LEFT      Indicates a new plot using the left axis.
                    A single axis will be drawn on the left side of the grid
                    For this plot XMARGIN will be set to 
                       XMARGIN = [!X.margin(0), !X.margin(0)]
                    and YSTYLE = 8.
                    NOTE: If LEFT is set, NOGRID is set to 0.
                    NOTE: If LEFT is set, OVER is set to 1 if more than 1 curve.
          RIGHT     Indicates a NOGRID plot making and using the right axis.
                    If RIGHT is present and not zero, then:
                      A single axis will be drawn on the right side of the existing
                        grid
                      The wdf array(s) will be overplotted on the existing grid.
                    Before using this command, a plot should be created using
                      the keyword: /LEFT
                    NOTE: If RIGHT is set then NOGRID is set to 1.
                    NOTE: After this command all memory of the original y-axis 
                          scaling is lost
          ZEROLINE  Indicates a horizontal line at y = 0 is to be drawn.
                    If keyword_set(right) then left and right zero's will be 
                      aligned.
                    If n_elements(zeroline) eq 1 and zeroline lt -255, 
                      no zero line will be drawn.
                    If n_elements(Zeroline) eq 1 and zeroline gt 0, a solid line
                      with color = !p.color will be drawn.
                    If n_elements(Zeroline) eq 1 and zeroline lt 0, a solid line
                      with color = abs(zeroline) will be drawn.
                    If n_elements(Zeroline) ge 2 then a line with 
                      color = abs(zeroline(0)) and style = abs(zeroline(1))
                      will be drawn. (See LINESTYLE for options)
    
          WAIT      If present and  not zero, PLO will pause after every plot until
                    a key is pressed. This can be used with statements such as:
                      for i = 3, 9, 3 do plo, i, 3, /ov, /w
          BLEGEND   Parameters for a box around the legend.
                    This is passed to the legend command as an extra keyword.
                    If BLEGEND is not a structure but is defined, then 
                      BLEGEND={BOX:1} 
                    and a box will be drawn around the legend.
                    This keyword may also be used to set the color of the printing.
          _EXTRA    Any valid parameters for the plot command may be entered.
                    These inclued: XTITLE, YTITLE, XMARGIN, YMARGIN, 
                    XSTYLE, YSTYLE, XTYPE, YTYPE, T3D, Zvalue,  etc.
         START_OFFSET - Character offset between top of the graph and the title.
                    Default: START_OFFSET = 0.5
         ABSOLUTE_VALUE - If set, the plot will have only positive or negative 
                    numbers.
                    If ABSOLUTE_VALUE equals -1 then the ordinate y is defined
                    as ABS(Y), where y are the ordinate values of WDF array.
                    NOTE:  This is dangerous and could confuse some people.
                    If  ABSOLUTE_VALUE is not zero and not -1, then PLO will 
                    determine if the WDF array has a larger positive deflection
                    or a negative deflection.
                    If the largest deflection from zero is positive, yrange[0] = 0.0
                    If the largest deflection from zero is negative, yrange[1] = 0.0
         SETDEFAULT-If present and not zero, then the following parameters will be 
                    saved and used as the default values in all future calls to PLO
                    If a keyword is specified, it will always be used rather than
                    the saved values.  This keyword may be used with a regular 
                    plot command; for example:
                      PLO, 1, 3, /over, /ns, /nl, /co, xr = [0, 150e-9], /set 
                    will set default values of 1 for color, nlinestyle, over, 
                    xrange and nsymbol. 
                    To temporily change use the keyword; for example,
                      PLO, 1, 3, xr = [20, 80]*1e-9 
                    will use the above keywords but xrange would now be 20 to 80ns
                    The default value remains 0 to 150 ns until a new value is set
                      or until PLO is called with UNSET.
                    To temporarily use auto scaling for X: plo, 1, 3, xr = 0
    
                    Normal default values are listed below.
                    Keyword     Default value
                    COLOR       0
                    OVER        0
                    XRANGE      0
                    YRANGE      0
                    LINESTYLE   [0,2,3,4,5,1] (LINESTYLE= -1 implies NLINESTYLE= 1)
                    GRID        0
                    PSYMBOL     [1,2,4,5,6,7]
                    FILL        0
                    HEADER      1
                    SYMSIZE     0
                    SPECTRUM    0
                    LEGEND      [0.04, 0.94]
                    NCHAR       0  (NCHAR = 0 implies using the default of 30/12)
                    BLEGEND     0
                    DATA        0
                    NSYMBOL     0
                    ALLSYMBOL   0
                    CHARSIZE    1
                    ZEROLINE    0
                    LCHARSIZE   1
                    ENGINEERING 0
                    TRUNCATE    0
                    LNAME       0 (Use dataset comment)
                    BLEGEND     0
                    ABSOLUTE_VALUE 0
          RESET {or}
          UNSET     If present and not zero, will set all save values of keywords
                    to their default values. This keyword can be used alone or in a
                    regular plot command with other plot values or keywords
                    including the SETDEFAULT keyword
                    Examples: 
                      Set the above defaults:
                            plo, /unset
                      Set the above defaults, make over = 1 the new default and 
                        plot curves [1,2,3] in an overlay plot: 
                            plo, 1, 3, /over, /set, /unset
          SHOWDEFAULT Show the present default plot values.
     OUTPUTS:
           Designated datasets are plotted.
     COMMON BLOCKS:
           COM.DAT  WDF common block 
     RESTRICTIONS:
           WD1 array must be defined and have valid data
     PROCEDURE:
           If NCURVE is specified:
                WDA and NCURVE-1 datasets are plotted in the specified form.
           Otherwise:
                The dataset WDA or the array of datasets defined by WDA are plotted.
     EXAMPLES:
      Plot array 1 using the default settings.
        plo, 1
      Plot array 2 using diamond symbols and a dashed line on the existing graph.
        plo, 2, psym = 4, line= 2, /nogrid
      Plot arrays 1,..., 6 using different colored lines on a single grid
        plo, 1,6,/ov, /col
      Plot array 1 in a log-log plot with exact axis scaling in the X direction.
        plo, 1, xr = [1e6, 12e6], /xstyle, /xlog, /ylog 
      Plot an overlay of arrays 1,..., 6 with  abscissa of 0 to 100 and 
      range of 0 to 10
        plo, 1,6, xr = [0, 100], yr = [0, 10], /over
      Plot arrays 1,..., 10 on separate grids with 6 grids to a page
        plo, 1, 10, g=[3,2]
    or: plo,indgen(10)+1,g=6
      Plot arrays 1, 4,5, 9 on one grid
        PLO, [1,4,5,9], /ov
      Plot all arrays beginning with \`mspin\' on a common time base from 
      0 to 200 ns.  This requires two commands.  Plot 4 horizontal and 3 
      vertical to a page.
        re, 1, `^mspin', nc = ncurve
        plo, 1, ncurve, xr = [0, 200e-9], gr = [4, 3];
    
     In the above example, overlay plot only those arrays which begin 'mspin2'
        plo, 'mspin2', /over
    
     MODIFICATION HISTORY:
          7/7/94   lbb   Added HEADER keyword
          Original version, L. P. Mix, May 15, 1992
    

    (See ../pfidl/pfidl_1d/plo.pro)


    PLOTCUBE

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           PLOTCUBE
    
     PURPOSE:
           Plot a WDF array or structure array in a 3D cube. Can be used
              with scalar field arrays or wdf arrays.
           This routine can also be used to indicate a series of slices of 
              a 3D shape.
           The default axis is z verticle, x, horizontal and y into the screen.
           Note: For postscript !p.font = -1 gives better results usually.
    
     CALLING SEQUENCE:
    
           PLOT_CUBE, NORMAL, ZVALUE, STR [, REVERSE = reverse ]
           [, SLICE = slice] [, WDFARRAY = wdfarray] [TRANSPOS= transpos]
           [, NOERASE = noerase] [, AXROTATE = axrotate] [, AZROTATE = azrotate]
           [, EDGES = edges] [, EColor = ecolor] [, Elinestyle = elinestyle]
           [, XRANGE =xrange] [, YRANGE =yrange] [, ZRANGE =zrange]
           [, XSTYLE = xstyle ] [, YSTYLE = ystyle ] [, ZSTYLE = zstyle ]
           [, _EXTRA = extrastuff]
    
     where:
           NORMAL  - An array indicating the normal direction to the plot plane
                     and the position along the normal for the plot plane.
                     The normal is indicated by the flags of 1, 2, or 3 for 
                     X, Y and Z normal. If the number of elements of NORMAL 
                     is less than ZVALUE, then NORMAL will be replicated to
                     provide additional values.
           ZVALUE  - An array indicating the value of the normal plane where
                     it intercepts the normal axis.
                     These values are the interval [0, 1] (Normalized units)
           STR     - An array of structure array numbers or WDF array numbers
                     to be plotted in each of the normal planes.  STR must have
                     at least as many values as ZVALUE 
                     (or 1 value if slice is specified)
           REVERSE - Plot arrays in reverse order.
           TRANSPOS- Transpose parameter to go to plotstr.
                     If not specified, transpos = 1 for y normal and zero otherwise
                     If specified with n elements then ith plot uses 
                        transp= transpos(i mod n)
           SLICE   - If set, the kvalues and slice coordinates will be set 
                     according to the value of normal, zvalue and range.
                     NOTE: range must be set in the direction for slice
                  plotstr, str, normal, (zvalue-range(0))/(range(1)-range(0)), ...
                     Default is slice = 0
           WDFARRAY- If the keyword is set, the str values will be interpreted as 
                     as WDF array numbers.  The default is WDFarray = 0.
           NOERASE - If set the plot will not be erased and the 3 dimensional 
                     transfrom will not be generated.
                     For example, the commands shade_surf, surface or 
                     or plotstr with these keywords can be used to set up the
                     transform:
                     plotstr, 1, /save, /shade & plotcube,/noerase, ...
           AXROTATE- Rotation about the X axis. Default = 30
           AZROTATE- Rotation about the Z axis. Default = 30
           EDGES   - An array of integers indicating edges of the reference
                     cube which are to be drawn. Values are:
                     10 or 11  the x axis
                     12        the edge parallel to x axis at y = 1
                     13        the edge parallel to x axis at z = 1
                    >13        the edge parallel to x axis at y=1 and z = 1
                     20 or 22  the y axis
                     21        the edge parallel to y axis at x = 1
                     23        the edge parallel to y axis at z = 1
                    >23        the edge parallel to y axis at x=1 and z = 1
                     30 or 33  the z axis
                     31        the edge parallel to z axis at x = 1
                     32        the edge parallel to z axis at y = 1
                    >33        the edge parallel to z axis at x=1 and y = 1
           ECOLOR  - Color of line used to plot edges; Default = !p.color
                     If ecolor has fewer values than edges,
                       color values are recycled.
           ELINESTYLE - Linestyle used to plot edges; Default = 0
                        If elinestyle has fewer values than edges,
                          elinestyle values are recycled.
           XYZ Range - Range of values for the plot
           XYZ Style - Style values form each axis 
                       Default is style = 1 if range has two values.
    
           Any valid additional keywords which can be used with PLOTSTR or PLO
             can be used.
    
           PROCEDURE:
             Set up the 3D transform.
             Plot the edges if requested.
             Repeat over plots
               Rotate to the appropriate normal plane.
               Use plo or plotstr to generate the image
    
           Examples:
             Assume lineouts in wdf arrays 1 to 5 corresponding to locations
             loc = [1, 3, 4, 5, 7]. Plot these in X-normal planes in reverse order
               plotcube, /reverse, 1, loc/6.0, indgen(5)+1, /wdf
             
             Plot the field magnitude on three faces of a cube from structure 
               array 3
               plotcube, [1, 2, 3], [0,0,1], 3,  /slice, $
                   xrange = [0, 5], yrange= [1, 3], zrange= [0, 10]
             Note: If all three faces come from the same structure array, only
                   one array must be specified
    
             For a plot similar to the one above with no labels and larger plots:
               plotcube, [1, 2, 3], [0,0,1], 3,  /slice, $
                   xrange = [0, 5], yrange= [1, 3], zrange= [0, 10], $
                   xticks = 1, yticks = 1, xmargin = [0,0], ymargin = [0,0], $
                   xtickname = [' ', ' '], ytickname = [' ', ' '], title = ' '
    

    (See ../pfidl/pfidl_1d/plotcube.pro)


    POLY_ROOTS

    [Previous Routine] [Next Routine] [List of Routines]
     Function Poly_ROOTS
       Returns the real roots of a quadratic or cubic equation of the form:
       
          A*X^3 + B*X^2 + C*X + D = 0.0
     or   A*X^2 + B*X^1 + C = 0.0
     or   Coef[0] + Coef[1]*X + Coef[2]*x^2 + Coef[3]*X^3 = 0
    
     Format:
    
      Poly_Roots = Poly_ROOTS(A, B, C [, D] [, /verbose] [, /REAL_ONLY] [, COEF = coef])
     or 
      Poly_Roots = Poly_ROOTS(Coef, [, /verbose] [, /complex])
    
     PARAMETERS:
    
       Poly_ROOTS  - Roots of the polynomial
                     Only real roots are returned if REAL_ONLY is set.
                     In general, Poly_Roots is a complex array.
       A, B, C, D  - Coefficients of a polynomial as noted below:
                     A*X^3 + B*X^2 + C*X + D = 0.0
                     For a quadratic function, D must be absent.         
       COEF        - Coefficient array of a function.
                     Same definition as C in the IDL function: POLY(X, C)
    
      NOTE:  print, poly(Poly_Roots, coef) 
             should return very small values.
     Keywords:
    
       VERBOSE    - if set, print the values
       REAL_ONLY  - Ignored unless roots are complex
                    If set, only real roots are returned.
       COEF       - Same as COEF parameter.
    
     Modification history:  Original version: 4 October 2006, L. Paul Mix
    

    (See ../pfidl/pfidl_1d/poly_roots.pro)


    PRESET

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           PRESET
    
     PURPOSE:
           Reset font, line thicknesses, and multi plots.
     CATEGORY:
           UTILITY 
     CALLING SEQUENCE:
           PRESET
     OUTPUTS:
           None
     EXAMPLES:
           Reset default plot parameters
                 PRESET
     MODIFICATION HISTORY:
          Original version, L. P. Mix, January 3, 1997
    

    (See ../pfidl/pfidl_1d/preset.pro)


    PRIAR

    [Previous Routine] [Next Routine] [List of Routines]
      Prints the parameters of a WDF array.  Maximum and minimum values, the 
      number of points, the file from which it was read, and the character strings 
      associated with each of the labels is printed with ordinate values.
    
      Format: PRIAR, wd1 [, NPOINT = npoint] [, /STATISTICS]
      where:
        wd1 - WDF array number
        npoint - sspecifies the number of ordinate values to be printed.
                 If npoint is negative, all values will be printed.
                 If npoint is omitted, up to 72 values will be printed.
        statistics - If set, print statistical data on the y-array
                 (SEE - STATS)
    
      Examples:
        Print the parameters and up to 72 values of array 3
          priar, 3
        Print the parameters and the entire set of ordinates for array 4
          priar, 4, np = -1
    

    (See ../pfidl/pfidl_1d/priar.pro)


    PS2X

    [Previous Routine] [Next Routine] [List of Routines]
       switch from a postscript file to X windows
    
       format: ps2x
            sets the output device to xwindows
    

    (See ../pfidl/pfidl_1d/ps2x.pro)


    PUTCOLOR

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           PUTCOLOR
    
     PURPOSE:
           The purpose of this function is to set the default colors for the 
           drawing colors which are set by LOADXYCT.
    
     CATEGORY:
           Graphics, Color Specification.
    
     CALLING SEQUENCE:
           PUTCOLOR  [, COLORS]  [, VALUE]  [, RESET = reset]
    
     Optional INPUTS:
           COLORS: An array of R, G, B values to set the drawing colors.
                  Default values for each color are shown below.
                  Eight colors are allowed: 
                  1   RED       [255,   0,   0]
                  2   GREEN     [  0, 255,   0]
                  3   BLUE      [  0,   0, 255]
                  4   MAGENTA   [255,   0, 255]
                  5   ORANGE    [255, 125,   0]
                  6   CYAN      [  0, 255, 255]
                  7   YELLOW    [255, 255,   0]
                  8   WHITE     [150, 150, 150] (actually grey)
                  Colors may be an array, COLORS[8, 3] to set all 8 drawing colors.
                  Colors may be an array of 3 values to set only one of the colors.
                  If COLORS has only 3 values, then the color value must be specified.
           VALUE: This parameter specifies the color value to be replaced.
                  This parameter is ignored if COLORS has 24 values.
                  This parameter must be greater than zero and less than 9 (1 to 8).
     KEYWORDS:
           RESET: If set, the default values are set.
            NOTE: If PUTCOLOR has no valid parameters, the colors will be reset.
     COMMON BLOCKS:
           The LOADXYCT_COMMON has the default line color set.
    
     SIDE EFFECTS:
           Default drawing colors will be changed.
    
     EXAMPLE:
           To set the default colors.
             PUTCOLOR
         PUTCOLOR, /reset
    
           To set color 5 to [125, 125, 125] and reset all other colors to their
           default values.      
             PUTCOLOR, /reset,  [125, 125, 125], 5
    
           To keep all current drawing colors, but to change color 8 to a lighter
           grey ([180, 180, 180]).
             PUTCOLOR, [180, 180, 180], 8
    
     MODIFICATION HISTORY:
           Written by: Paul Mix, May 10, 2005
                
    

    (See ../pfidl/pfidl_1d/putcolor.pro)


    PUTX

    [Previous Routine] [Next Routine] [List of Routines]
      Store an array of abscissas (x-values) into a WDF array.
    
      Format: PUTX, xarray,  wd1
      where:
        xarray - Values to be use as Abscissa values for WD1
                 X-array must have the same number of values as wd1.
        wd1 - WDF array number
      Example:
        Put the IDL array time into WDF array 4
          putx, time, 4
    

    (See ../pfidl/pfidl_1d/putx.pro)


    PUTY

    [Previous Routine] [Next Routine] [List of Routines]
      Store an array of ordinates (y-values)  into a WDF array.
      Note:  The array must have the same number of elements as the original array.
      Note:   PUTY can be used with GETY to perform IDL functions on an array. 
    
      Format: PUTY, yarray,  wd1
      where:
        yarray - array to be stored as ordinates in a WDF array
        wd1 - WDF array number
      Examples:
        Put the IDL array  voltage into WDF array 4
          puty, voltage, 4
        Calculate the square root of the contents of array 4
          puty, sqrt ( getyf(4) ), 4
    

    (See ../pfidl/pfidl_1d/puty.pro)


    PWD

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           PWD
    
     PURPOSE:
           Show current directory.
     CATEGORY:
           UTILITY 
     CALLING SEQUENCE:
           PWD [, CURRENT = current] [, /QUIET]
     KEYWORDS:
           CURRENT   - Name of current directory.
           QUIET     - NO output to terminal
     OUTPUTS:
           CURRENT directory
     EXAMPLES:
           Show current directory
                 PWD
     MODIFICATION HISTORY:
          Original version, L. P. Mix, January 3, 1997
    

    (See ../pfidl/pfidl_1d/pwd.pro)


    QUIT

    [Previous Routine] [Next Routine] [List of Routines]
     Name: QUIT
       Exit IDL.
     Format: QUIT
       Note: This is just another way to end IDL.
    

    (See ../pfidl/pfidl_1d/quit.pro)


    RAINBOW

    [Previous Routine] [Next Routine] [List of Routines]
        loads a RAINBOW specturm of colors for an x,y plot starting in color 10
    
     format: RAINBOW, NCOLORS, /SET_SPECTRUM, /GET_SPECTRUM, /RESET_SPECTRUM
                RED = red, BLUE = blue, GREEN = green, /INVERT_CT
    
      where: 
          NCOLORS      - Number of colors required
                         If Red, Green and Blue have NC values then the colors
                         given by:
                         val = round(nc*findgen(ncolors)/(ncolors-1))
                         are stored in color table values 10, 11, ..., (9+ncolors)
          SET_SPECTRUM - If set, reset the values of red, green and blue for the 
                         spectrum.  NCOLORS is optional.  RED, GREEN and Blue are
                         arrays with the same number of elements.  Values must be
                         in the range of [0, 255] 
          GET_SPECTRUM - If set, return the values of red, green and blue for the 
                         current spectrum.  NCOLORS is optional.
          RESET_SPECTRUM - If set, reset the values of red, green and blue for
                         the current spectrum to default values.
                         NCOLORS is optional.
          RED, GREEN, BLUE  - Current spectrum color values.
          INVERT_CT    - If set, reverse the order of R, G, and B
     
          Written 1/18/00 - lpm
    

    (See ../pfidl/pfidl_1d/rainbow.pro)


    READASC

    [Previous Routine] [Next Routine] [List of Routines]
        read an ascii file
        format is:  readasc, fname,nvar,x,y, label=label, np=np, /limit,
                    formatin=format, type = type, skip = skip, error = error, 
                    endnumber= endnumber, /double, /complex, /dcomplex
        where 
          fname   - the file name or a unit number
                    if a file name then the file is opened and closed at the end
                    if a number then the file is read directly
                      if unit is equal to zero then pickfile will be used 
                      to determine a file
          nvar    - the number of variables in a record
                    form is x, y1, y2, y3, ... 
          x       - abscissa values - dimensioned x(np)
                    If keyword, MATRIX, is set, XP will be a matrix with
                       dimensions [nvar, np].
          y       - ordinate values - dimensioned y(np, nvar-1)
                    Undefined if MATRIX is set
          label   - string array of the names of the yi's
          np      - number of data values read 
                    if np is zero or undefined then the program will attempt 
                      to read 8192 values
                    otherwise, the program will attempt to read np values
                    in all cases np is returned with the actual number read
          LIMIT   - If set, the number of values read will be limited to NP
                    Ignored if FORMATIN is 1 or 3
          formatin - input format of the data
                  0 (DEFAULT) only data values in the file maximum of np values
                  1  number of points followed by data values; this value
                     overrides the values set by np
                  2  Nvar-1 labels (stored in name) followed by data values
                  3  number of points followed by nvar-1 labels then data values
          type    - Variable type to be returned
                    Default is 4 (float)
                    Values are:
                    4  Float
                    5  Double precision Float
                    6  Complex
                    7  String
                    9  Double precision Complex
                    If type is not equal to one of these values then type = 4
          DOUBLE  - If set, type = 5
          COMPLEX - If set, type = 6
          DCOMPLEX- If set, type = 9
          STRINGVAR - If set, type = 7
          Note:  Double, complex and dcomplex keywords are checked after type
                 and will change any previous values.
          skip    - If the file has several lines of header information which
                    must be skipped, set skip equal to this number of lines.
                    (DEFAULT: SKIP = 0)
          error   - If no errors occur, error = 0
                    Not zero if an open error or no data read.
          endnumber - If set, reading stops when this X-value is reached.
                    NOTE:  Not allowed if type eq 7
          MATRIX  - If set, return a matrix with dimensions [nvar, np]
    
        Read an array from unit 2 and store in array x. Assume format = 1
           READASC, 2, 1, x, format = 1
        Read 2 arrays of data from a file selected by pickfile and store it in
        arrays x and y.  Assume format = 2: label followed by data to EOF.
           READASC, 0, 2, x,y , format= 2, lab= lab
        Read 5 arrays from file 'PFIDL.dat', into arrays a and b and label = lab
        Assume data format 3.
           READASC, 'PFIDL.dat', 5,  a, b, form = 3, label = lab
        Read 4 arrays from file, 'testdata', into arrays R and S. Assume 
        data has no header but only 4 columns of data.
           READASC, 'testdata', 4, R, S, form = 0
    

    (See ../pfidl/pfidl_1d/readasc.pro)


    READDITA

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
    	READDITA
    
     PURPOSE:
    
           This procedure reads a DITABIS format file for the IP plate data and outputs a
           psl (photo stimulable level) dose equivelent file.  The data for the
           conversion and the image parameters are read from the Fuji .PCB or .INF
           header file.  The image data itself must be in a .IMG file of the same 
           name as the header file.
    
     CALLING SEQUENCE:
    
           READDITA, STRUCTURE, [, FILE] [, /WINDOW_IMAGE]
               [/STRUCTURE] [, /IMAGE] [, /WRITETIFF] [, /REVERSEimage]
               [, CLABEL = clabel] [, XLABEL = xlabel] [, YLABEL = ylabel]
               [, TLABEL = tlabel] [, SWAPENDIAN = swapendian] [, /VERBOSE]
               [, /KEEP_AXIS] [, XRANGE = xrange] [, YRANGE = yrange]
               [, HEADER = header]
    
     INPUTS:
           STRUCTURE  - Structure Array Number or variable if STRUCTURE 
                        or IMAGE is set.
           FILE       - DITABIS file name
                        If zero of undefined, DIALOG_PICKFILE will be used.
    
     KEYWORD PARAMETERS:
           WINDOW_IMAGE - If set, Ditabis image is windowed before it is stored in a
                        structure and returned.  
                        Default:  WINDOW_IMAGE = (N_ELEMENTS(IMAGE) gt 4e7) ? 1 : 0
           KEEP_AXIS  - If set keep the original coordinates for the image.
                        DEFAULT:  Set initial X and Y values to zero
           XRANGE     - Minimum and Maximum X values for the windowed image.
           YRANGE     - Minimum and Maximum Y values for the windowed image.
     
           STRUCTURE  - If set and if image is not set, the structure is returned in
                        the variable STRUCTURE
           IMAGE      - If set, the DITABIS image is returned in the variable STRUCTURE
           WRITETIFF  - If set, DITABIS is written to a tiff file.
                        If WRITETIFF is a string, WRITETIFF will be the name of the
                          TIFF file.
                        Default: TIFF_FILE = FILE(without extension)+'.tif'
           REVERSEimage - If not specified, image will be reversed.
                        IDL has a convention from bottom to top; TIFF stores 
                        image top to bottom.  Image will be reversed unless REVERSE
                        DEFAULT:  REVERSE = 1
                 Note:  WRITETIFF will write the original image regardless of this
                        keyword value.
           SWAPENDIAN- If set, this keyword will determine if bytes are swapped.
                        Default:
                          BYTE_ORDER, IMAGE, /SWAP_IF_LITTLE_ENDIAN
           CLABEL     - Dataset comment for the structure
                        DEFAULT: CLABEL = FILE
           XLABEL     - Abscissa comment for the structure
                        DEFAULT: XLABEL = 'X'
           YLABEL     - Ordinate comment for the structure
                        DEFAULT: YLABEL = 'Y'
           TLABEL     - Type label for the structure
                        DEFAULT: TLABEL = 'DITABIS Image'
           VERBOSE    - Print the header information 
                        Default: VERBOSE = 1
           HEADER     - If ARG_PRESENT(HEADER) the header information will be 
                        returned in the variable, HEADING.
                        If HEADING is set, ARG_PRESENT is false, the header
                        information will be added to the comment label.  The 
                        header will be separated by ' - ' so that truncate will 
                        eliminate this information from plots.  
                          USE:  SHELP, STR, /Comment to see the comment
     OUTPUTS:
           This procedure returns the dose equivelent file from the DITABIS scanner
           data in a PFIDL structure or an array.  This array may be written to a 
           TIFF file.
    
     PROCEDURE:
           Read the header information at the beginning of the file to get image size.
           Read the image into an unsigned integer, scale the image, and store in a
             PFIDL structure. 
           Window the image if it is large.
           The scaling information is from the header:
              image = image/gain
              image = ((xresoluion)^2) * (4000/Sensitivity) * $
                      (10^(Latitude*(float(image)/gradLevels-0.5))
    
     EXAMPLE:
           Read shot_670.img into structure 1.
             READDITA, 1, 'shot_670.img'
    
           Read an image to be selected into structure 2.
             READDITA, 2
    
     MODIFICATION HISTORY:
           Original Version:  L. Paul Mix     April 16, 2005
           DITABIS format information added   
                              
    

    (See ../pfidl/pfidl_1d/readdita.pro)


    READFUJI

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
    	READFUJI
    
     PURPOSE:
    
           This procedure reads a FUJI format file for the IP plate data and outputs a
           psl (photo stimulable level) dose equivelent file.  The data for the
           conversion and the image parameters are read from the Fuji .PCB or .INF
           header file.  The image data itself must be in a .IMG file of the same 
           name as the header file.
    
     CALLING SEQUENCE:
    
           READFUJI, STRUCTURE, [, FILE]
               [/STRUCTURE] [, /IMAGE] [, /WRITETIFF] [, /REVERSEimage]
               [, CLABEL = clabel] [, XLABEL = xlabel] [, YLABEL = ylabel]
               [, TLABEL = tlabel] [, SWAPENDIAN = swapendian] [, /VERBOSE]
    
     INPUTS:
           STRUCTURE  - Structure Array Number or variable if STRUCTURE 
                        or IMAGE is set.
           FILE       - FUJI file name
                        If zero of undefined, DIALOG_PICKFILE will be used.
    
     KEYWORD PARAMETERS:
           STRUCTURE  - If set and if image is not set, the structure is returned in
                        the variable STRUCTURE
           IMAGE      - If set, the FUJI image is returned in the variable STRUCTURE
           WRITETIFF  - If set, FUJI is written to a tiff file.
                        If WRITETIFF is a string, WRITETIFF will be the name of the
                          TIFF file.
                        Default: TIFF_FILE = FILE(without extension)+'.tif'
           REVERSEimage - If not set, image will be reversed.
                        IDL has a convention from bottom to top; TIFF stores 
                        image top to bottom.  Image will be reversed unless REVERSE
                        DEFAULT:  REVERSE = 1
                 Note:  WRITETIFF will write the original image regardless of this
                        keyword value.
           SWAPENDIAN- If set, this keyword will determine if bytes are swapped.
                        Default:
                          BYTE_ORDER, IMAGE, /SWAP_IF_LITTLE_ENDIAN
           CLABEL     - Dataset comment for the structure
                        DEFAULT: CLABEL = FILE
           XLABEL     - Abscissa comment for the structure
                        DEFAULT: XLABEL = 'X'
           YLABEL     - Ordinate comment for the structure
                        DEFAULT: YLABEL = 'Y'
           TLABEL     - Type label for the structure
                        DEFAULT: TLABEL = 'FUJI Image'
           VERBOSE    - Print the header information 
                        Default: VERBOSE = 1
     OUTPUTS:
           This procedure returns the dose equivelent file from the fuji scanner
           data in a PFIDL structure or an array.  This array may be written to a 
           TIFF file.
    
     PROCEDURE:
           Read the header file to get image size.  Read the image into an unsigned
             integer, scale the image, and store in a PFIDL structure. 
           The scaling information is from the header file:
              image = ((xresolution)^2) * (4000/Sensitivity) * $
                      (10^(Latitude*(float(image)/gradLevels-0.5))
    
     EXAMPLE:
           Read shot_670.img into structure 1.
             READFUJI, 1, 'shot_670.img'
    
           Read an image to be selected into structure 2.
             READFUJI, 2
    
     MODIFICATION HISTORY:
           Original Version:  L. Paul Mix     January 5, 2005
           FUJI format information from a routine by Steve Quillin, June 23 1998  
                              
    

    (See ../pfidl/pfidl_1d/readfuji.pro)


    READHDF

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           READHDF
    
     PURPOSE:
           Read XDAMP formatted HDF files.
           This routine is based on the copyrighted xdamp procedure, XI_readfile,
             written by William P. Ballard as part of the Xdamp package.
             Ref. SAND98-0907
    
     CALLING SEQUENCE:
           Format:
             READHDF [, FILENAME] [, WDF = WDF] [, STRUCTURE = structure]
            [, TITLE = title] [, DATE = date] [, HEADER = header] [, NOTES = notes]
            [, NWDF = nwdf] [, NSTR = nstr] [, HELP = help]
            [, FILE_READ = file_read] [, IERROR = ierror]
    
     OPTIONAL INPUTS:
           FILENAME - Name of the HDF file to be opened.
                      The default file extension is ".hdf"  
                      If file is omitted or undefined or is not a string,
                      PICKFILE will be used to select a file.
    	
     KEYWORD PARAMETERS:
           WDF     - First WDF array for storing the waveform data
                     Default = 1
                     If not enough waveform arrays are available, the number will
                     be increased to read all the waveform data.  If the number 
                     of waveform arrays is increased, it is incremented in groups
                     of 500.
           STRUCTURE - First structure array for storing the image data
                     Default = 1
                     If not enough structure arrays are available, the number will
                     be increased to read all the image data.  If the number 
                     of waveform arrays is increased, it is incremented in groups
                     of 100.
           TITLE   - Shot title and date if it is available.
           HEADER  - Shot header information
           NOTES   - Shot notes if they are available.
           NWDF    - Number of waveforms read into PFIDL.
           NSTR    - Number of images read
           HELP    - If set, a help message is printed.
           FILE_READ- File opened and read
           IERROR  - Returns zero if no error.
    
    
     OUTPUTS:
           Data will be read and stored in waveform and structure arrays.
    
     PROCEDURE:
           This is a modified version of the XDAMP procedure XI_readfile.
    
     EXAMPLE:
           Read data from the file example.hdf.
             READHDF, 'example.hdf'
    
           Read data from an hdf file to be selected by pickfile.  Store the 
           waveform data beginning with WDF array 21.
             READHDF, wdf = 21
     MODIFICATION HISTORY:
     	Written by:     L. P. Mix, May 14, 2002
                      based on routine by W. P. Ballard.
    

    (See ../pfidl/pfidl_1d/readhdf.pro)


    READHIST

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           READHIST
    
     PURPOSE:
           Read a unformatted history file from QUICKSILVER
    
     CALLING SEQUENCE:
    
           READHIST, WDFARAY [, DATASET] [, /ALLDATA]
                    [, NDATASET = ndataset ] [, NARRAY = narray]
                    [, FILENAME = filename] [, MDT = mdt] [, /HELPME] 
    
     OPTIONAL INPUTS:
           WDFARRAY  - WDF array number or an array of numbers.
                       Default = 1
                       If more arrays are selected than contained in WDFARRAY,
                       then sequential numbers will be used.
                       If WDFARRAY is an array then MAXWDFARRAY will not be
                       increased so some arrays could remain unsaved if a
                       sufficient number of arrays are not available.  
                       If WDFARRAY is a scalar or undefined, MAXWDFARRAY will
                       be increased to insure that all arrays are read.
                       If increased, MAXWDFARRAY will be an even number at least
                       two larger than necessary.
    
           DATASET   - Dataset number or an array of dataset numbers 
                    or Search string or an array of search strings.  Result of the
                       search strings will be sorted each dataset read only once.
                       If dataset is missing and ALLDATA is not set then datasets
                       are selected from a widget list.  GET_MATCH is used with
                       default settings for string values.
                       If DATASET = '' or '*' then ALLDATA will be set.
           ALLDATA   - If set, the entire file will be stored. DATASET is ignored.
           NDATASET  - Total number of datasets in the file
           NARRAY    - Number of datasets read into wdf arrays
           IGNORE    - READHIST expects an integer number of 512 byte records
                       If IGNORE is set, READHIST truncates the data to an integer
                       number of records.
                       Default: IGNORE =1
           FILENAME  - Name of the file.  Default: FILENAME ='qcks.his'
                       If qcks.hist is missing or filename =0, then 
                         DIALOG_PICKFILE will be used.
           MDT       - Optional time scale factor.  The time or abscissa values
                       are multiplied by this number. Default: MDT =1
           HELPME    - If set, print a help message.
    
     OUTPUTS:
           The selected WDF arrays will be stored.
    
     RESTRICTIONS:
           This will read files generated on the Intel and UNIX machines but
           has not be verified on MAC's and DEC machines, but should also work
           there.
    
     PROCEDURE:
          1. Open the file and determine if byte swapping is required, the total
             length of the file, and the total length of the header.
          2. Close and reopen and read the string portion of the header.
          3. Close and reopen the file and read the data.
          4. Determine the desired datasets.
          5. Store the data.
    
         Single precision file format:
               Word 0:                    Fortran Record Length
               Word 1:                    NHISTW  (# of history signals)
               Word 2:                    TIMSTP  (simulation time step)
               Words 3-5:                 SKPHIS(1-3)  (history do-list)
                         (t0 = SKPHIS(1)*TIMSTP, dt = SKPHIS(3)*TIMSTP)
               Word 6:                    PLNAM  (# of characters in title)
               Words 7-(6+NHISTW*PLNAM)   ASCII format of NAMHIS(1-NHISTW)
               Additional    Floating point data to the first -1
          Double precision file format:
               Word 0:                    Fortran Record Length
               Word 1a:                   Negative number flag for real*8
               Word 1b:                   NHISTW  (# of history signals)
               Word 2a, 2b:               TIMSTP  (simulation time step)
                                          (real*8)
               Words 3 to end are unchanged, but the floats are real*8
    
     EXAMPLE:
           Read the data from qcks.his and store in WDF arrays beginning at 4
              READHIST, 4, /all
    
           Read the data from a file determine from a GUI and store in arrays 
           beginning in WDF array 1.
              READHIST
    
           Read the data from a file, picked from DIALOG_PICKFILE, with the 
           string 'current' and '^v' and store the arrays beginning in WDF array 1.
              READHIST, 1, ['current', '^v'], file =0
    
     MODIFICATION HISTORY:
           Written by:     LPMix, October 1, 1998
           Modified to provide double precision: November 28, 2005
    

    (See ../pfidl/pfidl_1d/readhist.pro)


    READIC

    [Previous Routine] [Next Routine] [List of Routines]
        Read an ascii file into wdf arrays from a Inbedded Controler
        Format:  readic, fname, WDF,narray = narray,np = np
        where: 
          fname   - the file name or a unit number
                    enter 0 to use pickfile
                    if a file name then the file is opened and closed at the end
                    if a number then the file is read directly
                      if unit is equal to zero then pickfile will be used
                      to determine a file
          WDF     - First WDF array or an array of NARRAY WDF arrays
                    WDF must be either a single value or an array of 
                    narray values
          narray  - the number of arrays in the file 
          np      - Returned with the number of points read in each array
                    
          If file contains labels, they are stored in the dataset comment
        Example:
        Read waveform data from a file selected by pickfile and store it in
        WDF array 10
           READIC, 0, 10
    

    (See ../pfidl/pfidl_1d/readic.pro)


    READIMAGE

    [Previous Routine] [Next Routine] [List of Routines]
     Read an ascii image file
     
     Format: readimage, str [, file] [, NP = np] [, NCOL = ncol]
      where:
            STR  - Structure array number
            File - file name
            NP   - Number of points read or to be read.
                   If more than 4096 points, set np to the value.
            NCOL - Number of columns [Default = 4]
                                   
       Example:
            Read an image into structure 3. Pick the file from a widget.
            READIMAGE, 3
    

    (See ../pfidl/pfidl_1d/readimage.pro)


    READLAB

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           READLAB
     PURPOSE:
           This procedure reads a LabView binary file format developed
             at Sandia National Laboratories.
     CALLING SEQUENCE:
           READLAB, Filename [, Wdf]
           READLAB, Wdf
           READLAB
    
     INPUTS:
           Filename: Character string containing the filename
                     If missing DIALOG_PICKFILE will be used to determine the file.
                     If Filename is present and equal to zero, DIALOG_PICKFILE
                       will be used to determine file
           Wdf: WDF array number for the first dataset.
                Following datasets will be in consecutive WDF arrays.
                If necessary, SET_MAXWDFARRAY will be used to increase the 
                  number of WDF arrays available.
                DEFAULT:  WDF = 1
     KEYWORDS:
           NARRAY:  Number of arrays read
    
     OUTPUT:
           Wdf: Sandia binary LabView Data in WDF arrays
    
     Technique:
           Read data from file using the ASCII keywords:
           Name:  Name of dataset
           T. Zero: Initial point
           Delta T: Point spacing
           Points:  Number of points
           Data:  Data Values
    
     MODIFICATION HISTORY:
           Original version, L. P. Mix, October 28, 2003
     
       Example:
           Read a Sandia LabView binary file to be selected from a widget
             READLAB
    
           Read a Sandia LabView binary file to be selected from a widget 
             and store the waveforms beginning in wdfarray 101
             READLAB, 101
    

    (See ../pfidl/pfidl_1d/readlab.pro)


    READNIF

    [Previous Routine] [Next Routine] [List of Routines]
        Read an ascii file into wdf arrays from a hp54111D digitizer
        format is:  readnif, fname, WDF,narray = narray,np = np
        where 
          fname   - the file name or a unit number
                    enter 0 to use pickfile
                    if a file name then the file is opened and closed at the end
                    if a number then the file is read directly
                      if unit is equal to zero then pickfile will be used
                      to determine a file
          WDF     - First WDF array or an array of NARRAY WDF arrays
                    WDF must be either a single value or an array of 
                    narray values
          narray  - the number of arrays in the file 
          np      - Returned with the number of points read in each array
                    
          If file contains labels, they are stored in the dataset comment
        Example:
        Read waveform data from a file selected by pickfile and store it in
        WDF array 10
           READNIF, 0, 10
    

    (See ../pfidl/pfidl_1d/readnif.pro)


    READPE

    [Previous Routine] [Next Routine] [List of Routines]
      Read a Perkin Elmer formatted dataset into an PFIDL structure or read
      a LLNL L-Division PDS file.   
      
    
      Format: READPE , STR [, File_Name] [ , image] [ , space ]
                [, TLABEL = tlabel] [, CLABEL = clabel] [, BLABEL = blabel]
                [, XLABEL = xlabel] [, YLABEL = ylabel] [HEADER = header]
                [, NPOINTS = npoints] [, DELTA = delta] [, OUTFILE = outfile]
                [, XRANGE = xrange] [, YRANGE = yrange] [, SETVAL = setval]
     (input)    [, FILTER = filter] [, SCALE = scale] [SWAP = swap] 
                [, PATH = path] [, MICRONS = microns] [, MMETERS = mmeters]
                [, XIMAGE = ximage] [, XHEADER = xheader] [PHEADER = pheader]
                [, FILE_ONE = file_one] [, FILE_TWO = file_two]
      where:
        STR    - Structure array number for the PE image 
                 Unused structure will be selected or get_maxstr()
        File_Name - Name of the Perkin Elmer file with or without an extension.
                    File_Name may also be a search string if it is unique.
                    For example: File_Name= '*f4*' if f4 is a unique search string.
                    Note: Any extensions will be removed and 
                          extensions of .hdr and .img  will be assumed.
                   (See XHEADER and XIMAGE below.)
                   filein will be modified to provide a complete path name
                   If XHEADER and XIMAGE are omitted, readpe will search for .hdr 
                     and .img without regard to case.
        image -    array containing the image file
        space -    array containing the dataset x and y arrays. Use
                      SP2XYZ, image, space, x, y 
                   to obtain x and y (SPACE = [X, Y])
                   Note: MicroD offsets are ignored.  Both X and Y start at (0, 0)
        tlabel -   Dataset type label
                   Default is the value of "SETVAL"
                     (Specular Density, Transmission or Intensity)
        clabel - dataset comment label
                 Default is File Name // Comment1 // Comment2 // ScanTime
        blabel - title or label for this block
                 Default is Specular Density, Transmission or Intensity
                   depending on the value of "SETVAL"
        xlabel - horizontal dimension label for this block
                 Default is 'X (mm)'
        ylabel - Verticle dimension label for this block
                 Default is 'Y (mm)'
        header - Complete header for the PE dataset
        npoints- Array of points for each dimension
        delta  - Array of microns/step for each dimension
                 Valid only for uniform data
        outfile- File name without path information
        xrange - Range of X-values
        yrange - Range of Y-values
        setval - Data type D = Density, T= Transmission, E = Exposure
     Following are input parameters - values used are returned.
        filter - Optional filter. If specified this parameter must have at least
                   two values which are taken as the maximum and minimum of the
                   scanned data.  If three parameters are given, the third is taken
                   as the default value given to all data which falls outside the
                   specified range.  Default value if SETVAL = 'D' is [0, 5000, -1]
                   That is all data less than 0 and greater than 5000 will be set
                   to -1.  With the default scaling of 800, this corresponds to 
                   density values between 0 and 6.25
                   Filter = 0 if setval not equal to density
                   If many values are filtered, the SWAP parameter may be wrong.
        scale  - Parameter used to scale the integer counts.
                 Default is 1/800 = 1.25e-3 if SETVAL = D
                 Default is 1 otherwise.
        swap   - This keyword is set by default according to the following:
                 Windows and linux: SWAP =0
                 UNIX: SWAP = 1
                 If SWAP = 0, then the bytes in IMAGE will not be swapped.
                 If SWAP = 1, then the bytes in IMAGE will be swapped.
                 Scans from a PC must be swapped if read on a SUN, HP or SGI.
        path   - Directory path to the desired file
                 This is the same default value as used in OPENPFF
        MMETERS- If set, save image in millimeters.
                 Default: See MICRONS below
        MICRONS- If set, save image in microns.
                 If microns is set, save raw image in microns using the delta values
                 provided in the HDR file.  MMETERS is ignored.
                 If MICRONS is not set, save the image in millimeters.
                 If MMETERS is set save the image in millimeters.
                 If MMETERS is not set and polynomial scaling is specified, the 
                 image is stored using the polynomial scaling otherwise the image
                 will be stored in millimeter units.
        ximage - Extension for the image file.
        xheader- Extension for the header file.
        pheader - If the keyword is set, the printer will be printed to the screen
        file_one - Header file
        file_two - Image file
    
        EXAMPLE
            read the file S6424n4f into structure 3
                READPE, 3, 'S6424n4f'
    
            Read a file into structure 5; select the file with DIALOG_PICKFILE
                READPE, 5
    
     MODIFICATION HISTORY:
        Written by:       L. P. Mix, 2/29/00
        March 1, 2005     Added L-Division extensions
        
    

    (See ../pfidl/pfidl_1d/readpe.pro)


    READPOP

    [Previous Routine] [Next Routine] [List of Routines]
        Name: READPOP
     
        read a ASCII POP  file
        format is:  readpop, fname, str
        where 
          fname   - the file name or a unit number
                    if a file name then the file is opened and closed at the end
                    if a number then the file is read directly
                      if unit is equal to zero then pickfile will be used 
                      to determine a file
          str     - Structure Array Number to store the image
                    Default is Maxstructure
        Assumes file of the form:
    $-----------------------------------------$
    $ time=    7.40000 sh.
    $ (KIMAX,LIMAX) = (  60, 152) ;  (R,Z) direction.
    $ Response used is sfcamrsp taken from file sfcamrsp        .
    inputexp/vlb/gs  7.40/ 152/  60
    $  LI=   1,       (1<=KI<=KIMAX)
     0.00000E+00/ 1.04872E-97/ 1.04872E-97/ 1.04872E-97/ 1.04872E-97/
     1.04872E-97/ 1.04872E-97/ 1.04872E-97/ 1.04872E-97/ 1.04872E-97/
     
        Stores the data in str
    
        Example:
        Read an array from unit 2 and store in structure x.
           READPOP, 2, x
    
        Read the image from file 'IMMG74' and store in structure 3
           READPOP, 'IMMG74', 3
    
        Read from a file determined by PICKFILE and store in structure 4
           READPOP, 0, 4
    

    (See ../pfidl/pfidl_1d/readpop.pro)


    READRGA

    [Previous Routine] [Next Routine] [List of Routines]
        Read an ascii file into wdf arrays from a residual gas analyzer
        format is:  readrga, fname, WDF, NARRAY = narray, NP = np, 
                     DATETIME= datetime
        where 
          fname   - the file name or a unit number
                    enter 0 to use pickfile
                    if a file name then the file is opened and closed at the end
                    if a number then the file is read directly
                      if unit is equal to zero then pickfile will be used
                      to determine a file
          WDF     - First WDF array or an array of NARRAY WDF arrays
                    WDF must be either a single value or an array of 
                    narray values
          NARRAY  - the number of arrays in the file 
          NP      - Returned with the number of points read in each array
          DATETIME- If set, the DATE and TIME are stored at the end of the 
                    dataset comment but are not plotted if truncate is set on PLO
                    
          If file contains labels, they are stored in the dataset comment
        Example:
        Read waveform data from a file selected by pickfile and store it in
        WDF array 10
           READRGA, 0, 10
    

    (See ../pfidl/pfidl_1d/readrga.pro)


    READSIG

    [Previous Routine] [Next Routine] [List of Routines]
     NAME: 
           READSIG
     PURPOSE:
           This procedure reads a LLNL SIG uniform format ASCII data file.
           Present version written entirely in IDL but requires IDL 5.6
     CATEGORY:
           Customization
     CALLING SEQUENCE:
           READSIG, Filename, Wdf
           READSIG, Wdf
           READSIG, Filename, Init, Dt, Y-values
           READSIG, Init, Dt, Y_Val
    
     INPUTS:
           Filename: character string containing the filename
           Wdf: WDF array number
     OUTPUT:
           Wdf: SIG data in WDF array
           INIT: Initial data point
           DT  : Point spacing 
           Y_Val : Y-values for the data
     KEYWORDS:
          NP: Actual number of points read including init and dt.
      DOUBLE: If set, file will be read in double precision
     INITIAL: Value of initial point
     DELTA_T: Data Spacing
     XLABEL, YLABEL, CLABEL - Only used with 1 or 2 parameters
              Dataset abscissa, ordinate and comment labels.
              Default value for XLABEL and YLABEL is ' '.
              Default value for CLABEL is FILENAME. 
     MODIFICATION HISTORY:
           Original version, M. F. Pasik, August 14, 1996
           Modified to include different outputs and to use a Fortran read.8/14/96
    
       Example:
           Read data1.sig into idl variables and return the number of points in J
               j = 0
               readsig, 'data1.sig', t0, dt, y, np =j
    
           Read data1.sig into WDF array 5 with labels
               readsig, 'data1.sig', 5, xlabel = 'History', $
                 Ylabel = '# of Particles' , Clabel = 'QS Particle Creation' 
    

    (See ../pfidl/pfidl_1d/readsig.pro)


    READTABLE

    [Previous Routine] [Next Routine] [List of Routines]
        read an ascii table, as from a spread sheet
        format is:  readtable, unit,nvar,x,y, np=np
          NOTE
         use readasc, unit, nvar, x,y, np= np in the future
         this procedure is being eliminated!!
    
        where 
          unit    - the unit of the file which is open
          nvar    - the number of variables in a record
                    form of the record is assumed to be: x, y1, y2, y3, ... 
          x       - abscissa values - dimensioned x(np)
          y       - ordinate values - dimensioned y(np, nvar-1)
          np      - on input NP is the number of data values to be read
                    if np is less than or equal to zero or undefined
                      4096 values will be attempted to be read 
                      otherwise np values will be read 
                    np will always return the number of values read
        Example:
          A table contains time in the first column and voltage and current 
          in the next two.  The file is called 'data'.
            openr, unit, 'data', /get
            readtable, unit, 3, time, stuff
            volt = stuff(*, 0) & curr = stuff(*, 1)
            free_lun, unit
    

    (See ../pfidl/pfidl_1d/readtable.pro)


    READTEK2

    [Previous Routine] [Next Routine] [List of Routines]
        read an ascii data file of the following form:
        This is a "tek plot" file from mach2 
           old style with data in columns, one variable to a column
     
     TITLE = "restart file, 1 mm shell"
     VARIABLES = "x", "y", "Ux", "Uy", ...., "Mat#"
     ZONE T= "Block 1", I = 93, J = 161  F= POINT
     data - block 1
     ZONE T= "Block 2", I = 93, J = 161  F= POINT
     data - block 2
     etc
        format is:  readtek2 [, fname] [, WDF] [, label=label] [maxblock = maxblock]
                           [, npoints =np] [, Narray = narray] [Maxnp = maxnp]
        where 
          fname   - the file name
                    if a file name then the file is opened and closed at the end
                    If fname is zero or omitted then PICKFILE will be used to get
                      the file name.
          NOTE: If only one parameter is given and the parameter is a number, 
                then ReadTek2 assumes that it is a STR number.
          STR     - Structure array number or an array of numbers.
                    Default is 1  
          narray  - number of arrays read
              The following keyword is ignored in this version ie NDIM ==2
          NDIM    - Number of Dimensions - Default = 2
          Group   - Grouping of arrays into datasets.
                    Default = [3, 1, 3, 1, 1, 1, 1, 1]
          MaxNP   - Maximum number of points, default current version = 131072
          Maxblock- Maximum number of blocks, default current version = 8
    
     EXAMPLES:
        Read a file and store the data beginning in WDF array 1.
           READTEK2, 0
       or  READTEK2, 1 
        Note: Default WDF array is 1 but procedure must be called with at
              least 1 parameter.
     
        Read a file and store the arrays starting in wdfarray 10
           READTek2, 10 
       or  READTek2, 0, 10
      
        Read file 'DAT1234' and store the data in WDF array 1
           READTek2, 'DAT1234', 1
       or  READTek2, 'DAT1234'         ; since WDF = 1 is default
    
        Read a file and store in arrays [1, 3, 5, 7, 9, 11]
           READTek2, 1+2*indgen(6)
        Note: If there are more than 6 waveforms, additional waveforms will be
                stored in 12, 13, ....
              If there are less than 6 waveforms, no data will be stored in the
                additional WDF arrays.
    
    

    (See ../pfidl/pfidl_1d/readtek2.pro)


    READTEK3

    [Previous Routine] [Next Routine] [List of Routines]
        read an ascii data file of the following form:
        This is a "tek plot" file from mach2
           new style with data in output one variable at a time.
           ie all the x, then all the y, ...
     
     TITLE = "restart file, 1 mm shell"
     VARIABLES = "x", "y", "Ux", "Uy", ...., "Mat#"
     ZONE T= "Block 1", I = 93, J = 161  F= POINT
     data - block 1
     ZONE T= "Block 2", I = 93, J = 161  F= POINT
     data - block 2
     etc
        format is:  readtek3 [, fname] [, WDF] [, label=label] [maxblock = maxblock]
                           [, npoints =np] [, Narray = narray] [Maxnp = maxnp]
        where 
          fname   - the file name
                    if a file name then the file is opened and closed at the end
                    If fname is zero or omitted then PICKFILE will be used to get
                      the file name.
          NOTE: If only one parameter is given and the parameter is a number, 
                then ReadTek3 assumes that it is a STR number.
          STR     - Structure array number or an array of numbers.
                    Default is 1  
          narray  - number of arrays read
              The following keyword is ignored in this version ie NDIM ==2
          NDIM    - Number of Dimensions - Default = 2
          Group   - Grouping of arrays into datasets.
                    Default = [ 1, 1, 1, 1, 1]
          MaxNP   - Maximum number of points, default current version = 131072
          Maxblock- Maximum number of blocks, default current version = 8
    
     EXAMPLES:
        Read a file and store the data beginning in WDF array 1.
           READTEK3, 0
       or  READTEK3, 1 
        Note: Default WDF array is 1 but procedure must be called with at
              least 1 parameter.
     
        Read a file and store the arrays starting in wdfarray 10
           READTek3, 10 
       or  READTek3, 0, 10
      
        Read file 'DAT1234' and store the data in WDF array 1
           READTek3, 'DAT1234', 1
       or  READTek3, 'DAT1234'         ; since WDF = 1 is default
    
        Read a file and store in arrays [1, 3, 5, 7, 9, 11]
           READTek3, 1+2*indgen(6)
        Note: If there are more than 6 waveforms, additional waveforms will be
                stored in 12, 13, ....
              If there are less than 6 waveforms, no data will be stored in the
                additional WDF arrays.
    
    

    (See ../pfidl/pfidl_1d/readtek3.pro)


    READTIFF

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           READTIFF
    
     PURPOSE:
    	Read a tiff file and return the image, a structure or store it
             in a PFIDL structure array
    
     CALLING SEQUENCE:
      Format:  READTIFF, STRUCTURE  [, FILE] [, DX = dx] [, DY = dy] 
               [, SCALE = scale] [, CLABEL = clabel] [, XLABEL = xlabel]
               [, YLABEL = ylabel] [, TLABEL = tlabel] [, REVERSE = reverse]
               [, /IMAGE] [, /STRUCTURE] [, /INTEGER]
    
     INPUTS:
    	STRUCTURE  - Structure Array Number or variable if STRUCTURE 
                        or IMAGE is set.
           FILE       - TIFF file name
                        If zero of undefined, DIALOG_PICKFILE will be used.
    
     KEYWORD PARAMETERS:
           DX         - X increment 
                        DEFAULT: DX = 1
           DY         - Y increment  - Ignored if DX is undefined
                        DEFAULT: DY = DX 
           SCALE      - Intensity Scale Factor
                        DEFAULT: SCALE = 1
           CLABEL     - Dataset comment for the structure
                        DEFAULT: CLABEL = FILE
           XLABEL     - Abscissa comment for the structure
                        DEFAULT: XLABEL = 'X'
           YLABEL     - Ordinate comment for the structure
                        DEFAULT: YLABEL = 'Y'
           TLABEL     - Type label for the structure
                        DEFAULT: TLABEL = 'TIFF Image'
           IMAGE      - If set, the tiff image is returned in the variable STRUCTURE
           STRUCTURE  - If set and if image is not set, the structure is returned in
                        the variable STRUCTURE
           INTEGER    - If set, save the image as an integer array
           REVERSEIMAG- If not set, image will be reversed.
                        IDL has a convention from bottom to top; TIFF stores 
                        image top to bottom.  Image will be reversed unless REVERSE
                        is set to zero (ie. REVERSE = 0)
                        DEFAULT:  REVERSE = 1
           
     OUTPUTS:
    	A tiff image is stored in a structure array or returned either as an 
           image or a structure.
    
     RESTRICTIONS:
           The procedure handles standard tiff files.
    
     PROCEDURE:
           The procedure attempts to use the IDL procedure READ_TIFF to read the file.
           If this is unsuccessful, it attempts to use a special tiff reader.
    
     EXAMPLE:
           Read the tiff image, "shot2122.tiff" and store the image in structure 2
             readtiff, 2, 'shot2122.tiff'
    
    	Return the image from  "shot2122.tiff" in variable imag2122.
             readtiff, imag2122, 'shot2122.tiff'
    
           Return the image as a structure in variable str from a file to be selected 
           using DIALOG_PICKFILE
              readtiff, str, /structure
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, August 7, 2003
    
    

    (See ../pfidl/pfidl_1d/readtiff.pro)


    READTK

    [Previous Routine] [Next Routine] [List of Routines]
        read an tkdas data file
           Code assumes first line contains 1 non-blank label for each column of data
         Format consists of tab delimited columns of the form:
         Note: Each Title may not have spaces in this version.
      title
      t0
      delta_t
      Npoints
      y1  (at t0)
      y2
      y3
      .
      .
      .
      yN (at t0+(N-1)*delta_t)
    
        format is:  readtk [, fname] [, WDF] [, data = data] [, label=label] 
                           [, npoints =np] [, Narray = narray]
        where 
          fname   - the file name
                    if a file name then the file is opened and closed at the end
                    If fname is zero or omitted then PICKFILE will be used to get
                      the file name.
          NOTE: If only one parameter is given and the parameter is a number, 
                then ReadTK assumes that it is a WDF number.
          WDF     - WDF array number or an array of numbers.
                    Default is 1  
                    If WDF is less than 0 and n_elements(data) > 0 then no WDF
                      arrays will be stored.
          DATA    - Input data data = data (npoints+2, narray)
                    (Initial time and delta time are first two points.)
          label   - string array of the names of the arrays
          npoints - number of data values read for each dataset
          narray  - number of arrays read
     EXAMPLES:
        Read a TKDAS file and store the data beginning in WDF array 1.
           READTK, 0
       or  READTK, 1 
        Note: Default WDF array is 1 but procedure must be called with at
              least 1 parameter.
     
        Read a TKDAS file and store the arrays starting in wdfarray 10
           READTK, 10 
       or  READTK, 0, 10
      
        Read TKDAS file 'DAT1234' and store the data in WDF array 1
           READTK, 'DAT1234', 1
       or  READTK, 'DAT1234'         ; since WDF = 1 is default
    
        Read a TKDAS file and store in arrays [1, 3, 5, 7, 9, 11]
           READTK, 1+2*indgen(6)
        Note: If there are more than 6 waveforms, additional waveforms will be
                stored in 12, 13, ....
              If there are less than 6 waveforms, no data will be stored in the
                additional WDF arrays.
    
        Read the data from a TKDAS file into an array DATA and store data beginning
          in wdf array 1.
             READTK, 0, data = data
        To only return the array without storing data in WDF arrays then:
             READTK, -1, data = data
    

    (See ../pfidl/pfidl_1d/readtk.pro)


    READTK2

    [Previous Routine] [Next Routine] [List of Routines]
        read an tkdas data file
           Code assumes 2 datasets per file
    
        format is:  readtk [, fname] [, WDF] [, data = data] [, label=label] 
                           [, npoints =np] [, Narray = narray]
        where 
          fname   - the file name
                    if a file name then the file is opened and closed at the end
                    If fname is zero or omitted then PICKFILE will be used to get
                      the file name.
          NOTE: If only one parameter is given and the parameter is a number, 
                then ReadTK assumes that it is a WDF number.
          WDF     - WDF array number or an array of numbers.
                    Default is 1  
                    If WDF is less than 0 and n_elements(data) > 0 then no WDF
                      arrays will be stored.
          DATA    - Input data data = data (npoints+2, narray)
                    (Initial time and delta time are first two points.)
          label   - string array of the names of the arrays
          npoints - number of data values read for each dataset 
          narray  - number of arrays read - present version = 2
     EXAMPLES:
        Read a TKDAS file and store the data beginning in WDF array 1.
           READTK2, 0
       or  READTK2, 1 
        Note: Default WDF array is 1 but procedure must be called with at
              least 1 parameter.
     
        Read a TKDAS file and store the arrays starting in wdfarray 10
           READTK2, 10 
       or  READTK2, 0, 10
      
        Read TKDAS file 'DAT1234' and store the data in WDF array 1
           READTK2, 'DAT1234', 1
       or  READTK2, 'DAT1234'         ; since WDF = 1 is default
    
        Read a TKDAS file and store in arrays [1, 3, 5, 7, 9, 11]
           READTK2, 1+2*indgen(6)
        Note: If there are more than 6 waveforms, additional waveforms will be
                stored in 12, 13, ....
              If there are less than 6 waveforms, no data will be stored in the
                additional WDF arrays.
    
        Read the data from a TKDAS file into an array DATA and store data beginning
          in wdf array 1.
             READTK2, 0, data = data
        To only return the array without storing data in WDF arrays then:
             READTK2, -1, data = data
    

    (See ../pfidl/pfidl_1d/readtk2.pro)


    READTQHIS

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           READTQHIS
    
     PURPOSE:
           Read a unformatted history file from TWOQUICK
    
     CALLING SEQUENCE:
    
           READTQHIS, WDFARAY [, NDATASET = ndataset ] [, NARRAY = narray]
                    [, FILENAME = filename] [, MDT = mdt] [, /HELPME] 
    
     OPTIONAL INPUTS:
           WDFARRAY  - WDF array number or an array of numbers.
                       Default = 1
                       If more arrays are selected than contained in WDFARRAY,
                       then sequential numbers will be used.
                       If increased, MAXWDFARRAY will be an even number at least
                       two larger than necessary.
           NDATASET  - Total number of datasets in the file
           NARRAY    - Total number of WDF arrays populated
           FILENAME  - Name of the file.  Default: FILENAME ='tqhis.dat'
                       If tqhis.dat is missing or filename =0, then 
                         DIALOG_PICKFILE will be used.
           MDT       - Optional time scale factor.  The time or abscissa values
                       are multiplied by this number. Default: MDT =1
                       Default time step equal 1.
           HELPME    - If set, print a help message.
    
     OUTPUTS:
           The selected WDF arrays will be stored.
    
     RESTRICTIONS:
           This will read files generated on the Intel and UNIX machines but
           has not be verified on MAC's and DEC machines, but should also work
           there.
           Current version assumes less than 8000 history variables.
    
     PROCEDURE:
          1. Open the file and determine if byte swapping is required.
          2. Close and reopen the file and read the data.
          3. Determine the desired datasets.
          4. Store the data.
    
    
     EXAMPLE:
           Read the data from qcks.his and store in WDF arrays beginning at 4
              READTQHIS, 4, /all
    
           Read the data from a file determine from a GUI and store in arrays 
           beginning in WDF array 1.
              READTQHIS
    
           Read the data from a file, picked from DIALOG_PICKFILE, with the 
           string 'current' and '^v' and store the arrays beginning in WDF array 1.
              READTQHIS, 1, ['current', '^v'], file =0
    
     MODIFICATION HISTORY:
           Written by:     LPMix, April 4, 2003
    

    (See ../pfidl/pfidl_1d/readtqhis.pro)


    READWD3

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           READWD3
    
     PURPOSE:
           Read fit parameters from a WDFIT3 fit file
    
     CALLING SEQUENCE:
    
           READWD3 [, File_Name] [, WDFARRAY = wdf] [, NPOINTS = npoints]
             [, XDATA = data] [, YDATA = ydata]
             [, XRANGE = xrange] [, CLABEL = clabel] [, XLABEL = xlabel]
             [, YLABEl = ylabel] [ , FILENAME = filename] [, IERROR = ier]
    
     INPUTS:
           File_Name:  If undefined or zero, PICKFILE will be used
                       Data will be read into the WDFIT3 common block
           IERROR:     If no error occurs, zero is returned.
           WDFARRAY:   If set, fit curve will be stored in the 
                       specified WDF array, an empty array, or in get_maxwdf().
                       If WDF is a variable, the value will be returned.
                       For example: wdf =-1
                                    READWD3, wdf = wdf
                           Upon return wdf will be a number designating the actual
                           WDF array where the data is stored.
                       If XDATA is defined, these values will be used.
           XDATA:      If present, these data values will be scaled by WDFIT3
                         curve.  XDATA must have 3 or more elements.
           YDATA:      If xdata is present, YDATA contains the corrensponding values
     *********************
           NOTE:
           The following keywords are ignored unless WDFARRAY is defined.
     *********************
           NPOINTS:   Number of points used to calculate the response
                      NPOINTS = NPOINTS > 32
                      Default: 500
                      NPOINTS is ignored if XDATA has 3 or more points.
           XRANGE:    Range of the response curve
                      Xrange will be adjusted so that only valid fit data is used.
                      If range is zero, the default value is used.
                      Default: Valid range of the fit
           CLABEL:    Dataset comment (used for title of plots)
                      Default: clabel ="Response - Filename=XXX;;DATETIME=YYY"
                      where XXX is the file containing the step wedge data
                            YYY is the date the the fit was calculated
                      Note: "Plo, /truncate" will terminate the title at " - "
           XLABEL:    X-axis (abscissa) label
                      Default: "Film Density"
           YLABEL:    Y-axis (ordinate) label
                      Default: "Film Exposure"
           FILENAME:  File or source of these dataset values
                      Default: File_Name
    
     EXAMPLE:
           Read output from a fit and generate a response curve from 0.2 to 4 
           in WDF array 30.  Use pickfile to get the datafile.
             READWD3                    ; read the fit parameter
             data = .2+findgen(500)/499*3.8 
             scale_regrid, data         ; generate the response
             put_wdfarray, [.2, 3.8/499, data], 30, clab = 'Response'     
           
             READWD3, wdf=30,  clab = 'Response', xrange = [.2, 4]
    
     MODIFICATION HISTORY:
             Written by:  LPMix, August 10, 1998
             Modification: L. P. Mix, October 5, 2002
                             Added WDF option
    

    (See ../pfidl/pfidl_1d/readwd3.pro)


    READ_PDS

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           READ_PDS
    
     PURPOSE:
           Read a PDS Shrink data file in the LLNL, L-Division, file format.
           This format is used by the Perkin-Elmer PDS machine.
           (PDS files are PhotoDensitometer files in the L-Division format.)
           The Perkin-Elmer file format utilizes a subset of L-Division PDS format.
           For historical reasons, the READPE routine has been expanded to 
           include the L-Division file extensions.
    
     CALLING SEQUENCE:
           See READPE
    
     PROCEDURE:
           Read the header file and then read the image file.
           More details are in READPE
    
     MODIFICATION HISTORY:
        Written by:       L. P. Mix, March 1, 2005
    

    (See ../pfidl/pfidl_1d/read_pds.pro)


    READ_PE

    [Previous Routine] [Next Routine] [List of Routines]
      Read a Perkin Elmer formatted dataset into IDL. 
    
      Format: READ_PE , File_Name , image , space 
                [, TLABEL = tlabel] [, CLABEL = clabel] [, BLABEL = blabel]
                [, XLABEL = xlabel] [, YLABEL = ylabel] [HEADER = header]
                [, NPOINTS = npoints] [, DELTA = delta] [, OUTFILE = outfile]
     (input)    [, FILTER = filter] [, SCALE = scale] [SWAP = swap] 
                [, PATH = path]
                [, XIMAGE = ximage] [, XHEADER = xheader] [PHEADER = pheader]
      where:
        File_Name - Name of the Perkin Elmer file with or without an extension.
                    Note: Any extensions will be removed and 
                          extensions of .hdr and .img  will be assumed.
                    (See XHEADER and XIMAGE below.)
                   filein will be modified to provide a complete path name
        image -    array containing the image file
        space -    array containing the dataset x and y arrays. Use
                      SP2XYZ, image, space, x, y 
                   to obtain x and y (SPACE = [X, Y])
                   Note: MicroD offsets are ignored.  Both X and Y start at (0, 0)
        tlabel -   Dataset type label
                   Default is the value of "SETVAL"
                     (Specular Density, Transmission or Intensity)
        clabel - dataset comment label
                 Default is File Name // Comment1 // Comment2 // ScanTime
        blabel - title or label for this block
                 Default is Specular Density, Transmission or Intensity
                   depending on the value of "SETVAL"
        xlabel - horizontal dimension label for this block
                 Default is 'X (microns)'
        ylabel - Verticle dimension label for this block
                 Default is 'Y (microns)'
        header - Complete header for the PE dataset
        npoints- Array of points for each dimension
        delta  - Array of microns/step for each dimension
        outfile- File name without path information
        filter - Optional filter. If specified this parameter must have at least
                   two values which are taken as the maximum and minimum of the
                   scanned data.  If three parameters are given, the third is taken
                   as the default value given to all data which falls outside the
                   specified range.  Default value is [0, 5000, -1]
                   That is all data less than 0 and greater than 5000 will be set
                   to -1.  With the default scaling of 800, this corresponds to 
                   values between 0 and 6.25
        scale  - Parameter used to scale the integer counts.
                 Default is 1/800 = 1.25e-3
        swap   - This keyword is set by default according to the following:
                 Windows and linux: SWAP =0
                 UNIX: SWAP = 1
                 If SWAP = 0, then the bytes in IMAGE will not be swapped.
        path   - Directory path to the desired file
                 This is the same default value as used in OPENPFF
        ximage  - Extension for the image file. Default is .img
        xheader- Extension for the header file. Default is .hdr
        pheader - If the keyword is set, the printer will be printed to the screen
    
        EXAMPLE
            read the file S6424n4f and retrieve all the parameters for writing 
            the file as a pff file.  Print the header.
                read_pe, 'S6424n4f', image, space, tlab = tlab, clab = clab
                  blab = blab, xlab = xlab, ylab = ylab, /ph
    
            Note: to write the above data first insure a PFF file is open or
                  if necessary create the file and then write it:
                createpff, 'S6424n4f.pff'
                writepff, 0, image, space, tlab = tlab, clab = clab
                  blab = blab, xlab = xlab, ylab = ylab
    
    
        written 1/ 16/ 95 by lpm
    

    (See ../pfidl/pfidl_1d/read_pe.pro)


    REASC

    [Previous Routine] [Next Routine] [List of Routines]
        read an ascii file into wdf arrays
        format is:  reasc, fname,narray,WDF, formatin=format, skip = skip, /csv, $
                      xydata = xydata, endnumber = endnumber, sortx = sortx, $
                      delimiter = delimiter, ierror = ierror
        where 
          fname   - the file name or a unit numberr
                    if a file name then the file is opened and closed at the end
                    if a number then the file is read directly
                      if unit is equal to zero then pickfile will be used
                      to determine a file
          narray  - the number of arrays in the file 
                for formatin = 0,1,2,3 -
                    each data record is of the form: x, y1, y2, y3, ..., y(narray) 
                    Note: This is one less than the number used for the procedure
                     READASC because a single array can be read with READASC.
                for formatin = 4 -
                    Each dataset is separate. 
                      If narray is less than 1, then all data in the file will 
                        be read if possible. 
                      If WDF is an array, then narray = n_elements(wdf)
                    Only MAXWDFARRAY datasets may be read.
                    If the file contains more than this, then the file must be
                    opened and read sequentially. 
                     EXAMPLE:
                        openr,unit, 'data.dat, /get 
                        reasc, unit, 40, 1, formatin=4  ; read 40 datasets 
                          (do work)
                        reasc, unit, 40, 1, formatin=4  ; read next 40 datasets 
                          (do work)
                        reasc, unit, 40, 1, formatin=4  ; read next 40 datasets 
                          (etc)
                        close, unit
          WDF     - First WDF array or an array of NARRAY WDF arrays
                    WDF must be either a single value or an array of 
                    narray values
          formatin - input format of the data
                   - if formatin lt 0 then first value is NARRAY.
                       and formatin = abs(formatin)
                  0  only data values in the file maximum of np values
                  1  number of points followed by data values; this value
                     overrides the values set by np
                  2  Narray label followed by data values
                  3  (DEFAULT) number of points followed by narray labels 
                     then data values
                  4  EXCEL format
                     (narray+1) labels in one line followed by (narray+1) columns:
                      xlabel y1label y2label ... ynarray_label
                      x, y1, y2, y3, ..., y(narray)
                  5  XDamp ascii format:
                        dataset comment/title
                        xlabel
                        ylabel
                        number of points = np
                        xvalue yvalue (repeated np times) 
                    Multiple datasets may be put into a file
          np      - Number of points which are read
          skip    - If the file has several lines of header information which
                    must be skipped, set skip equal to this number of lines.
                    (DEFAULT: SKIP = 0)
          xydata  - If set then the data will be left on a nonuniform grid.
          endnumber - If defined, reading will stop when this number is reached.
          CSV       - If set, the comma will be the delimiter for the EXCEL array
                      labels. If CSV is set then delimiter is ignored.
                      NOTE:  If the labels contain spaces, CSV must be set.
          delimiter - If present, this will be used as delimiter for the EXCEL
                      array labels
          sortx     - If set, Sort X values before saving.
                      Ignored unless XYDATA is set.
          ierror    - Zero if no error
                    - -1 if no file selected
                    - -2 if file does not exist or no read access
                    -  1 if error reading file
                    -  2 error in WDF arrays
          If file contains labels, they are stored in the dataset comment
        Example:
        Read an array from unit 2 and store in wdf array 12. Assume format = 1
           REASC, 2, 1, 12, format = 1
        Read an unknown number of arrays from file tqdata.dat in format 2 with 
           the number of waveforms as the first number and plot them.
           REASC, 'tqdata.dat', n, 1, form=-2
           plo, 1, n, /over
        Read waveform data from a file selected by pickfile and store it in
        WDF array 10.  Assume format = 2: label followed by data to EOF.
           REASC, 0, 1, 10 , format= 2
        Read 5 arrays from file 'PFIDL.dat', into WDF arrays 
        2,3,4,5,6.  Assume data format 3.
           REASC, 'PFIDL.dat', 5, 2
        Read 3 arrays from file, 'testdata', into WDF arrays 3, 6, 9. Assume 
        data has no header but only 4 columns of data.
           REASC, 'testdata', 3, [3,6,9], form = 0
    

    (See ../pfidl/pfidl_1d/reasc.pro)


    REENS

    [Previous Routine] [Next Routine] [List of Routines]
        Read an EnSight XY Plot Data Format
    
        Format:
              ReEnS [, FNAME] [, WDF] [, NWDF = nwdf] [, ARRAY = array]
                    [, /HELPME]
        where 
          FNAME   - File name
                    If fname is a number, undefined, or omitted, 
                      Dialog_Pickfile will be used to pick the file.
                    FNAME is returned with the name of the file opened
          WDF     - First WDF array or an array of WDF arrays
                    WDF may be either a single value or an array of values
                    If additional wdf arrays are needed, sequential values 
                    will be used.  If the maximum number of WDF arrays is
                    reached, the maximum will be incremented to a multiple 
                    of 100.
                    If WDF is missing or invalid, WDF = 1
          NWDF    - Number of WDF arrays which are read
          JOINSEG - Join segments into one WDF array.
                    If JOINSEG lt 0, sort the data
          SORT    - Sort abscissa values if JOINSEG is set.
                    Same as JOINSIG = -1 (i.e., JOINSIG is less than zero)
          ARRAY   - Actual WDF arrays saved.
          HELPME  - If set, a one line help line will be printed.
              % Format: REENS [, FNAME] [, WDF] [, NWDF = nwdf] [, ARRAYS = arrays]
    
        Procedure:
          Data is read and stored as XY data in WDF arrays.
          Data must be in the EnSight XY Plot Data Format
          Read is terminated on an error.
          If an array has one or two values, additional data points
            will be added to bring the total to 3 points.
          If a curve has multiple segments, they will be put into
            sequential waveforms with segment numbers appended.
            " - Seg #"
        Example:
    
        Read waveform arrays from file voltage.dat and store the data
           beginning in wdf array 21.
           REENS, 'voltage.dat', 21 
    
        Same as the first example, but plot the data 6 to a screen.
           REENS, 'voltage.dat', 21, array = arr
           PLO, arr, grid = 6
        Modification History:
           Original version, L. P. Mix, December 6, 2002
    
    

    (See ../pfidl/pfidl_1d/reens.pro)


    RELNOTES

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           RELNOTES
    
     PURPOSE:
    	Print current IDL version release notes.
           Accepts Q to quit
    
     CALLING SEQUENCE:
    
    	RELNOTES
    
     INPUTS:
    	None.
    
     KEYWORDS:
    	PAGE - Set to the page size for the printout.
                  Default = 40
    
     OUTPUT:
    	Basic information is printed.
    
     COMMON BLOCKS:
           NONE.
    
     SIDE EFFECTS:
           None.
    
     RESTRICTIONS:
    	None.
    
     MODIFICATION HISTORY:
           Written, LPM, Sandia National Labs, 21 July 1999
           Adapted from IDLinfo by DMS, RSI, 17 April 1997
               
    

    (See ../pfidl/pfidl_1d/relnotes.pro)


    REMACH

    [Previous Routine] [Next Routine] [List of Routines]
        read a mach2 history file into wdf arrays
        format is:  remach, fname, WDF, skip = skip, $
                      xydata = xydata, endnumber = endnumber
        where 
          fname   - the file name or a unit numberr
                    if a file name then the file is opened and closed at the end
                    if a number then the file is read directly
                      if unit is equal to zero then pickfile will be used
                      to determine a file
          WDF     - First WDF array or an array of NARRAY WDF arrays
                    WDF must be either a single value or an array of 
                    narray values
          np      - Number of points which are read
          skip    - If the file has several lines of header information which
                    must be skipped, set skip equal to this number of lines.
                    (DEFAULT: SKIP = 0)
          xydata  - If set to zero, the data will be left on a nonuniform grid.
                    Default: XYDATA = 1
          endnumber - If defined, reading will stop when this number is reached.
          If file contains labels, they are stored in the dataset comment
        Example:
        Read waveform data from a file selected by pickfile and store it in
        WDF array 10.  Assume format = 2: label followed by data to EOF.
           REMACH, 0, 10 
        Read 3 arrays from file, 'history', into WDF arrays 3, 6, 9. 
           REMACH, 'history', [3,6,9]
    

    (See ../pfidl/pfidl_1d/remach.pro)


    RERESP

    [Previous Routine] [Next Routine] [List of Routines]
        read an ascii frequency response file into wdf arrays
        Store the amplitude and the complex values.
        format is:  reresp, fname, WDF, np = np , npatch = npatch, nfreq = nfreq
        where
          fname   - the file name or a unit numberr
                    if a file name then the file is opened and closed at the end
                    if a number then the file is read directly
                      if unit is equal to zero then pickfile will be used
                      to determine a file
          WDF     - First WDF array or an array of NARRAY WDF arrays
                    WDF must be either a single value or an array of values
                    If no value is provided, WDF is the first unused array number
                    or 1 if all arrays are full.
                    Additional patches are stored in successive arrays.
          np      - Number of points which are read
          Npatch  - If number of patches is greater than 512, this must be se.
                    to a number larger than the number of patches.
          Nfreq   - If more than 512 frequencies, this must be set to a number
                    larger than the number of frequencies.
        Example:
        Read an array from unit 2 and store in wdf array 12
           RERESP, 2,12
        Read 3 patches from file, 'testdata', into WDF arrays 3, 6, 9.
           RERESP, 'testdata', 3, [3,6,9]
    

    (See ../pfidl/pfidl_1d/reresp.pro)


    RESTORECT

    [Previous Routine] [Next Routine] [List of Routines]
        restore  a color table from a file
        special command to restore the bottom 8 colors and the last color and 
           and scale the others to fill the table
        if filename is no used then the keyword filename is used
        format: restorect, filename, filename = filenam
    

    (See ../pfidl/pfidl_1d/restorect.pro)


    RESTOREPFIDL

    [Previous Routine] [Next Routine] [List of Routines]
    
      Restore the data stored in WDF arrays and in structure arrays
    
      Format:  RESTOREPFIDL, FILE, KEEP = keep, _extra = extrastuff, $
              FILENAME = filename, SSTART = sstart, QUIET = quiet
    
      where:
          FILE    -  File in which the data is stored
                     If FILE is not a string or FILE does not exist,
                        DIALOG_PICKFILE is called.
                     Default is 'pfidlsave.dat'
          FILENAME-  Alternate method of specifying file name.
               Note: If FILE is specified, FILENAME is ignored.
               Note: If FILE equals ZERO, then DIALOG_PICKFILE will be called.
    
          KEEP    -  if positive and valid, all wdfarrays greater than or equal 
                       to keep will be unaffected by the restore command.
                       ( same as keep = [keep, maxwdfarray] )
                     if negative and valid, all wdfarrays less than or equal
                       to keep will be unaffected by the restore command.
                       ( same as keep = [1, -keep] )
                     if keep has two or more elements then elements from keep(0) to 
                       keep(1) will be saved where keep is redefined to:
                       keep = round([(min(keep, max = m) > 1) , (m < maxwdfarray)])
               Note: If keep is zero, no waveforms will be saved.
               Note: If there is not enough WDF arrays available to store all saved arrays,
                     then MAXWDFARRAY will be increased.
          SSTART   -  Structure arrays which are restored will be saved beginning
                      with structure array sstart or 1 if sstart is not valid or
                      not specified
               Note: If there is not enough structure arrays available to store all saved 
                     structures then MAXSTRARRAY will be increased.
          QUIET   -  If set, no information regarding the file or the number 
                     of arrays and structures will be printed.
          _EXTRA  -  Any additional keywords recognized by RESTORE
      Example:
        Restore  the data from a previous session
          restorepfidl
    
        Restore the data from the session in file 'qs5581.sav'
          restorepfidl,  'qs5581.sav'
    
        Restore the data from a file to be determined and begin storing the
        waveform data in wdfarray 101
          restorepfidl, 0, keep = -100
    

    (See ../pfidl/pfidl_1d/restorepfidl.pro)


    REVIDA

    [Previous Routine] [Next Routine] [List of Routines]
        read a VIDA file into a wdf array
        Format is :
               xlabel ylabel
                x1     y1
               ...    ...
                xn     yn
              -999    -999
        format is:  revida, fname, WDF, xydata = xydata
        where 
          fname   - the file name or a unit numberr
                    if a file name then the file is opened and closed at the end
                    if a number then the file is read directly
                      if unit is equal to zero then pickfile will be used
                      to determine a file
          WDF     - WDF array for storage
          npoints - Returned with the number of points read.
          xydata  - If set to zero, then the data will be put on a uniform grid.
                    Default is XYDATA = 1, ie save as read
          skip    - If a number gt 0, then that many lines will be skipped
                    before reading the labels.
        Example:
        Read a VIDA array from unit 2 and store in wdf array 12.
           REVIDA, 2, 1
    
        Read VIDA data from a file selected by pickfile and store it in
        WDF array 10.
           REVIDA, 0, 10
    
        Read a VIDA arrays from file, 'testdata.vida' into WDF arrays 3
           of the following form:
            111 = FORMAT #
            2 = # TABLE COLUMNS
            1  1 = ITYPE, IORDER
            0.00E+00  0.00E+00 = ABSTOL, RELTOL
                         X             Y
                   5033.39     0.0182046
                   5035.53     0.0194887
    
           REVIDA, 'testdata.vida', 3, skip = 4
    

    (See ../pfidl/pfidl_1d/revida.pro)


    RISET

    [Previous Routine] [Next Routine] [List of Routines]
     Calculate the rise time of a pulse.
     XY data is converted to a uniform time base
     Maximum deviation from zero is used as the pulse height by default.
     (See FALLT for the fall time.)
     Procedure uses linear interpolation to find the last time that the waveform 
       crosses start value (typically 10% of the maximum) and the first time that 
       the waveform crosses the end value (typically 90% of the maximum).
       This procedure produces the minimum rise time and may underestimate the rise
       time if the signal is very noisy.  
    
     Format: RISE = RISET( WDF [, STARTVALUE = startvalue] [, ENDVALUE = endvalue]
                        [, SMOO = smoo] [, VALUE = VALUE] [, MAXIMUM= maxamp ]
                        [, MAXTIME= maxtime ] [, /POSITIVE] [, /NEGATIVE] [, /PLOTIT )
    
         where:
            RISE      - risetime of the pulse between startvalue and endvalue
                        Rise time is defined as the time from the base line to 
                        maximum deflection.  The maximum deflection can
                        be positive or negative unless POSITIVE or NEGATIVE is
                        set.
                        0 is returned if an error occurs.
            WDF       - WDF array for the calculation
            STARTVALUE- Beginning value as a fraction of the peak for rise time.
                        Default = 0.10
            ENDVALUE  - End Value as a fraction of the peak for the rise time.
                        Default = 0.9
            SMOO      - Width for smoothing of the data
                        Smoothed data is stored in get_maxwdf()
                        SMOO = SMOO > 3
                        If SMOO le 0, then no filtering.
                        Default: If SMOO undefined, then smoo = 5
            VALUE     - Vector with actual times for start and end values
            MAXIMUM   - Maximum value used to determine start and end value
            MAXTIME   - Time at maximum value
            POSITIVE  - If set, only positive deflections are considered.
            NEGATIVE  - If set, only negative deflections are considered.
                        If both positive and negative are set, then the
                          maximum deflection is used. (same as if neither are set)
            PLOTIT    - If set, plot the original data, the smoothed data and the start 
                        and end values.
    
          Example:
           print, the 10% to 90% rise time of wdfarray 5 and plot the data.
             PRINT, riset(5, /plot)
    

    (See ../pfidl/pfidl_1d/riset.pro)


    RMBASE

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           RMBASE
    
     PURPOSE:
           Remove a complex baseline offset from a set of waveform data 
           Store the result in the initial WDF array
     CATEGORY:
           Math 
     CALLING SEQUENCE:
           RMBASE, WD1, WD2, FIRST, LAST
     INPUTS:
           WD1       WDF array number of the dominant part of the baseline
           WD2       WDF array number of the complete baseline
           FIRST     First WDF array number of the composite signal
     OPTIONAL INPUT:
           LAST      Last WDF array number of the composite signal.  If omitted,
                     only the first array is done.
     KEYWORD INPUT:
           BASE      If present, specifies a uniform baseline used for comparison
           XR        If present, specifies the range of X-values plotted 
           QUIET     If present and not zero then the comparisons and each 
                     subtracted waveform are not plotted
           NOPLOT    same as quiet (If either is set, no data is plotted.)
           TSH       If present, specifies the waveforms are to be shifted to the
                     timing of WD1 as determined by the comparison
     OUTPUTS:
           NONE    The subtracted signal is stored in the same WDF array
                   in the common block
     COMMON BLOCKS:
           COM.DAT  WDF common block 
     SIDE EFFECTS:
           WDF arrays maxwdfarray-1 and maxwdfarray are used as scratch arrays
     PROCEDURE:
           The COM procedure is used to calculate the amplitude and time shift 
           be used between WD1 and the composite array
           WD2 is then scaled and shifted and subtracted from the composite array
     EXAMPLES:
           WDF array 2 has a large x-ray spike between 10 and 50 ns which is 
           recorded on a detector.  WDF arrays 3 through 10 in addition to the 
           x-ray signal have ion signals.  Separate the ion and x-ray signals.
                   xfr, 2, 1
                   lim, 1, 10e-9, 50e-9
                   rmbase, 1, 2, 3, 10
     MODIFICATION HISTORY:
          Original version, L. P. Mix, May 19, 1992
    

    (See ../pfidl/pfidl_1d/rmbase.pro)


    RTP

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           RTP
    
     PURPOSE:
           Raise a WDF array to a power
           Store the result in the initial WDF array or another WDF array
             If power is not an integer, then negative values will be set to zero.
     CATEGORY:
           Math 
     CALLING SEQUENCE:
           RTP, WD1, VALUE [, WD2]  [, /EXACT]
     INPUTS:
           WD1:      WDF array number of the first array
         VALUE:      Power to which the first array is to be raised
     OPTIONAL INPUT:
           WD2:      WDF array number for the result; if not specified or invalid 
                     then the sum is stored in WD1 (the first array)
         EXACT:      If present and not zero, aborts the calculation if WD1 < 0 
                     and value is a real.  This is ignored if VALUE is an integer.
                     
     OUTPUTS:
           NONE    The sum is stored in a WDF array in the common block
     COMMON BLOCKS:
           COM.DAT  WDF common block 
     RESTRICTIONS:
           WD1 array must be defined and have valid data a power must be defined
     PROCEDURE:
           If VALUE is an integer then the result is calculated
               Result is WD1^VALUE
           If VALUE is not an integer then the result is calculated
               Result is exp(VALUE* alog(WD1)) if WD1 > 0
            or Result is 0.0 if WD1 < 0.0
    
           In either case Result is stored in WD2, if specified, or WD1.
     EXAMPLES:
           Raise array 2 to the 1.5 power and store the result in array 3
           Set any negative values in array 2 to zero
                   RTP, 2, 1.5, 3
           Raise array 2 to the 0.5 power and store the result in array 3
           Do not do the calculation if any values are less than zero
                   RTP, 2, 0.5, 3, /exact
           Raise array 2 to the 3 power and store the result in array 4
                   RTP, 2, 3, 4
     MODIFICATION HISTORY:
          Original version, L. P. Mix, May 15, 1992
    

    (See ../pfidl/pfidl_1d/rtp.pro)


    SAVECT

    [Previous Routine] [Next Routine] [List of Routines]
        save a color table in a file
        special command to restore the bottom 8 colors and scale the others
        to fill the table
        format: savect, file = filename
    

    (See ../pfidl/pfidl_1d/savect.pro)


    SAVEPFIDL

    [Previous Routine] [Next Routine] [List of Routines]
    
      Save the data stored in WDF arrays and in structure arrays
    
      Format:  SAVEPFIDL, FILE, FILE = filename, _EXTRA = extrastuff, /QUIET
    
      where:
          file    -  File in which the data is stored
                     Default is 'pfidlsave.dat'
          Filename- Alternate method of specifying file name.
          NOTE:  FIND_NEWFILE will be called to insure the filename is unique.
                 If filename is not unique, then:
                 If file contains a . then add _# before the period
                 If file has a leading . the add _# to the end
                 If file has no . then add _#
        NOTE: If FILE is specified, FILENAM is ignored.
          _EXTRA  -  Any additional keywords recognized by SAVE
          QUIET   -  If set, no information regarding the output file name or the 
                     number of arrays processed will be printed.
      Example:
        Save the data from the current session
          savepfidl
    
        Save the data from the current session in file 'qs5581.sav'
          savepfidl, file = 'qs5581.sav'
    

    (See ../pfidl/pfidl_1d/savepfidl.pro)


    SETDEFAULT

    [Previous Routine] [Next Routine] [List of Routines]
      Set default path and filter for read and conductor/grid parameters
      format; setdefault [, PATH = path] [, FILTER = filter]
                         [, ccolor = ccolor] [, cthick = cthick]
                         [, gcolor = gcolor] [, gthick = gthick]
                         [, transplot = transplot]
                    [directoryhelp= dirhelp] [, directoryfont = dirfont] 
                    [directorypage= dirpage]
        where: 
             PATH   - Initial path for OPENPFF if no path is specified
             FILTER - Initial filter for OPENPFF if no filter is specified
        where c and g refer to conductor and grid and:
             color - default color of the conductor must be greater than
                     zero and less than !d.table_size
                     1 to 7 are the basic colors 
                     The colors are: red(1), green(2), blue(3),
                     purple(4), orange(5), light blue(6), yellow(7)
                     gcolor may be an array to sequence over colors.
             thick - default line thickness, greater than 0, less than 20
            fcolor - default color code for contour plots.(PLOTFLD)
            directoryhelp - 0 no help, 1 print a help for DIRP
            directoryfont - name of scroll directory font
            directorypage - number of lines on a scroll directory
      Example:
          set the default path to '/extra/qs/qs5851/' and the filter to '*.pff'
            setdefault, path = '/extra/qs/qs5851/' , filter = '*.pff'
    
          set conductor color to red and thickness to 3 times normal
            and set grid to green and 0.5
            setdefault, ccolor = 1, cthick = 3, gcolor = 2, gt=0.5
    

    (See ../pfidl/pfidl_1d/setdefault.pro)


    SETDIRPFF

    [Previous Routine] [Next Routine] [List of Routines]
         This routine sets directory pointer of the current pff file.  
             or alternatively, will return the total number of datasets.
    
         format: setdirpff, dataset, fileid
     
         where
             dataset - desired dataset pointer value
             fileid  - file id of the PFF file containing the data
     
         if dataset is undefined or is less than or equal to zero then
             the total number of datasets is returned in dataset.
               
    
         Example
           set the dataset pointer to dataset 6
              setdirpff, 6
    
           store in n, the number of datasets in the current pff file
              n = -1 & setdirpff, n
           or
              n = ndspff( )
    

    (See ../pfidl/pfidl_1d/setdirpff.pro)


    SETPFF

    [Previous Routine] [Next Routine] [List of Routines]
       Set the current file pointer to file with specified file id
       Format: SETPFF,  fileid, ierror
       where:
          fileid - file id of desired file
          ierror - Returns 0 if no errors
       Note:  If fileid is undefined or is zero, nothing is done.
        Example:
       Set the current file pointer to the file with a file id (fid) of 3
          setpff, 3
    

    (See ../pfidl/pfidl_1d/setpff.pro)


    SET_DRAWSIZE

    [Previous Routine] [Next Routine] [List of Routines]
         Name:
                SET_DRAWSIZE
         Purpose:
                Set the default size of draw widgets.
         
         Format: 
                set_drawsize
         
         No required parameters.  If no keywords, help will be given.
          
         Keywords:
           SHOWDEFAULT:  Show current values
             NOTE:  Show is executed last; any changes are current.
    
       The following are the size in pixels for the draw widgets.
       If a single value then it is used for XSIZE and YSIZE = ratio * XSIZE
       If two values then they are [XSIZE, YSIZE]
    
           RATIO:        Ratio of YSIZE to XSIZE-- YSIZE = RATIO*XSIZE
           BIGSIZE:      Set default size for TQEDIT, QSEDIT, WDEDIT
           MEDSIZE:      Set default size for LINSTR, XCURW, WDSPLIT
           DUALSIZE:     Set default size for ZOOMW
           SMALLSIZE:    Set default size for PREVIEW in LINSTR
    
       Example:
         set the size for the preview frame to 450 in X and 400 in Y
           SET_DRAWSIZE, small = [450, 400]
    
         Show current defaults
           SET_DRAWSIZE, /show
    
       Original version: February 4, 1998, lpm
    
    

    (See ../pfidl/pfidl_1d/set_drawsize.pro)


    SET_MAXWDFARRAY

    [Previous Routine] [Next Routine] [List of Routines]
        Set the maximum number of wdf arrays
    
        format:
            set_maxwdfarray, maxwdf [, /quiet]
            where
              maxwdf - an integer indicating the maximum number of WDF arrays
                       maxwdfarray = abs(long(maxwdf)) > 10
                       Default maximum is 82
    
              QUIET  - If set no warning will be issued if the number of
                       datasets is decreased
             Note: If the number of WDFarrays is decreased, data can be lost.
                   Any data above maxwdf will be deleted.
    
        Example:
            Set the number of WDF arrays to 102.
               set_maxwdfarray, 102
    

    (See ../pfidl/pfidl_1d/set_maxwdfarray.pro)


    SET_PRINTER

    [Previous Routine] [Next Routine] [List of Routines]
      Procedure to show or set the destination for LPRINT
    
      format: SET_PRINTER [, /SHOW] [, DESTINATION = destination]
                  [, COLOR_DEFAULT = color_def] [, BW_DEFAULT = bw_def]
                  [, PRINTFILE = printfile] [, FILE_PATH = file_path]
                  [, /UNIQUE_PRINTFILE]
      where:
        SHOW     - If set, show current defaults
        DESTINATION - If not blank, send all plots to this destination.
                 Set DESTINATION to '' to return to the color and bw_defaults.
        COLOR_DEFAULT - Set the color default to this destination
        BW_DEFAULT - Set the black and white default to this destination
        PRINTFILE  - Default printfile for postscript, pcl output and lprint.
                     Default: PRINTFILE = 'idl.ps' 
                     Note:  If the first character is '/' or '.' for unix or the 
                            second and third characters are ':\' for Windows then 
                            printfile is assumed to be a fully qualified file name
                            and file_path is set to '' (NULL string).
                     Note:  FulFnam will be used to resolve the printfile name
                            on Unix/Linux systems.
        FILE_PATH  - If set, PRINTFILE will be placed in this directory.
                     Default: FILE_PATH = '.' for unix
                     Default: FILE_PATH = 'c:\temp' for windows
        UNIQUE_PRINTFILE - If set each printfile will be unique. 
                     For example: If printfile ='idl.ps' then the second time
                                  the actual file will be 'idl_001.ps'
                           The first additional number will be given by the 
                           value of (UNIQUE_PRINTFILE > 1)
    
      Examples:
        Determine the current default printer destination
          SET_PRINTER, /show
    
        Set the color default to 962_1_hp8550
          SET_PRINTER, col='962_1_hp8550'
    
        Send all plots to 962_1_hp8550
          SET_PRINTER, dest='962_1_hp8550'
    
        Put all plotfiles into the home directory on UNIX
          SET_PRINTER, file_path =  getenv('HOME')
        or 
          SET_PRINTER, file_path = '~/'
    
        Set the plotfile to 'idl.ps' in the printer directory under home
          SET_PRINTER, printfile = '~/printer/idl.ps'
    
    

    (See ../pfidl/pfidl_1d/set_printer.pro)


    SGIF

    [Previous Routine] [Next Routine] [List of Routines]
      Save the current screen information to a file.
    
      Format: SGIF [, FILENAME] [, NO_SORT = no_sort]
    
      where:
        filename - optional filename.
                   Default is set by startgif
                   ('idl' is the default value if none is specified
                     ie.  idl0001.gif, idl0002.gif  ....etc.)
    
      Examples:
      Send the plots to gif files of the form: movie0001.gif, movie0002.gif, ...
        startgif, file =  'movie'
        < do a plot >
        sgif
        < do a plot >
        sgif
        < do a plot >
        sgif    ; etc
        endgif
    

    (See ../pfidl/pfidl_1d/sgif.pro)


    SHOWPFF

    [Previous Routine] [Next Routine] [List of Routines]
      Show all opened PFF files, 
      their file id (fid) and indicate the location of the current file pointer.
      The current file id, and arrays of the user file ids and filesnames
        can be received as keywords.
      Format: SHOWPFF [, current = current] [, ufid = ufid] [, /QUIET]
                  [, filename = filename]  [, NUMBER= number]
      where
             current - user file id of the current file
             ufid    - array of user file id's
             filename- Array of file names corresponding to the ufid's
                       Note: longer filenames are returned with PFF_INFO
             number  - number of files open
                       Note: Number of datasets available with NDSPFF and PFF_INFO
             quiet   - If present and not zero, send no output to terminal
      Example:
      Show the status, including file id, of all opened PFF files
        showpff
      
      Get the filenames and user file id's for all open files
      Do not send any output to the terminal
      Note: File names will be truncated to 60 characters
        showpff, c= cur, u=u, num= n, fil= fil, /q
    

    (See ../pfidl/pfidl_1d/showpff.pro)


    SIGFIT

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           SIGFIT
    
     PURPOSE:
    	Fit a waveform array to a sigmoid of the form:
             Y = BASE + AMPLITUDE/(1 +exp(ALPHA*(X-MIDDLE)))
             where X and Y are the cartesian coordinates of the waveform
           The sign of alpha will affect the values of BASE and AMP
    
    
     CALLING SEQUENCE:
           SIGFIT, WDF [, WDFOUT] [, BASE = base] [, AMPLITUDE = amplitude]
             [, ALPHA = alpha] [, MIDDLE = middle] [, /PLOTIT]
             [, TOL = tol] [, ITER = iter] [, ITMAX = itmax]
             [, CHISQ = chisq] [, INITVAL = initval] [, /VERBOSE]
             [, WEIGHT = weight] [, SCALE = scale]
    
     INPUTS:
           WDF:    Waveform array number or comment label for a waveform array
                   that specifies the data for the sigmoid fit.
           WDFOUT: Waveform array number for the fitted data.
                   Default:  WDFOUT = WDF
    	
     KEYWORD PARAMETERS:
           BASE:   Fit value for the BASE value of the sigmoid
                   (see  PURPOSE: above)
           AMPLITUDE: Fit value for the AMPLITUDE value of the sigmoid
                   (see  PURPOSE: above)
           ALPHA:  Fit value for the ALPHA value of the sigmoid
                   (see  PURPOSE: above)
           MIDDLE:  Fit value for the MIDDLE value of the sigmoid
                   (see  PURPOSE: above)
           PLOTIT:  If set, the original data and the fit data will be plotted.
           TOL:     Tolerance input to CURVEFIT
                    Default: TOL = 2e-6
           ITER:    Number of iterations in CURVEFIT
           ITMAX:   Maximum number of iterations in CURVEFIT
                    Default: ITMAX = 20
           CHISQ:   Reduced goodness-of-fit statistic from CURVEFIT
           INITVAL: Initial values for the CURVEFIT routine
                    This is a vector of 4 values
                    INITVAL =[BASE, AMPLITUDE, ALPHA, MIDDLE]
                    Default values calculated:
                      LIMITS, WDF, XRANGE=xr, YRANGE = yr
                      BASE = yr[0]
                      AMPLITUDE = yr[1] - BASE
                      ALPHA = SIGN*10/(xr[1]-xr[0])
                      MIDDLE = TOTAL(GET_TIME(WDF,BASE+0.5*AMPLITUDE,NP= NP))/NP 
               Where: SIGN = (DERIVATIVE > 0) ? -1 : +1
                  and DERIVATIVE is the average slope of the WDF array
           VERBOSE: If set, parameters will be printed to the screen.
    
      Note:  If WEIGHT is not defined, then SCALE and NORMALIZE_WEIGHT are ignored
    
           WEIGHT:  If set, this is a valid WDF array number to use as a weight.
                    WEIGHT is an array number or comment label for a WDF array.
                    WEIGHT should have the same number of elements as WDF.  
                    The actual weight is determined by the value of scale.
               Note: If W are the values of weight for the points in WDF, they may
                     be stored in a wdf array with the following:
                       I2W, W, WEIGHT, clabel = 'Calculated Weights'
           SCALE:   Ignored unless WEIGHT contains a valid WDF array number
                    If WEIGHT is set, SCALE determines how WEIGHT values are used.
                    In the discussion below, assume Y = GETYF(WEIGHT) and 
                      FIT_WEIGHT is the weight passed to CURVEFIT.
                    IF SCALE is undefined, SCALE = 1
                      FIT_WEIGHT = Y ^ SCALE
           NORMALIZE_WEIGHT: If NORMALIZE_WEIGHT is zero then weight is not normalized
                    If NORMALIZE_WEIGHT is missing:
                       TOTAL(WEIGHT) = NX ; where NX = Number of Points
                    If NORMALIZE_WEIGHT NE 0 then 
                       TOTAL(WEIGHT) = ABS(NORMALIZE_WEIGHT)
                     
     OUTPUTS:
           A waveform array with the sigmoid fit to the data and the
           parameters for the waveform array.
    
     PROCEDURE:
           The IDL procedure, CURVEFIT, is used to fit the data with a uniform 
           weight of 1.0 unless WEIGHT is specified.
    
     EXAMPLE:
           Fit waveform array, 8, to a sigmoid and store the fitted data in
             wdf array 9.
             SIGFIT, 8, 9
    
     MODIFICATION HISTORY:
            Written by:    L. Paul Mix, October 12, 2004
    

    (See ../pfidl/pfidl_1d/sigfit.pro)


    SIGFIT2

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           SIGFIT2
    
     PURPOSE:
    	Fit a waveform array to the sum of two sigmoids of the form:
      Y = BASE + AMP0/(1 +exp(ALPHA*(X-MIDDLE)))+ AMP1/(1 +exp(BETA*(X-MIDDLE)))
             where X and Y are the cartesian coordinates of the waveform
           The sign of alpha will affect the values of BASE and AMP
    
    
     CALLING SEQUENCE:
           SIGFIT2, WDF [, WDFOUT] [, BASE = base] [, AMPLITUDE = amplitude]
             [, ALPHA = alpha] [, BETA = beta] [, MIDDLE = middle] [, /PLOTIT]
             [, TOL = tol] [, ITER = iter] [, ITMAX = itmax]
             [, CHISQ = chisq] [, INITVAL = initval] [, /VERBOSE]
             [, WEIGHT = weight] [, SCALE = scale]
    
     INPUTS:
           WDF:    Waveform array number or comment label for a waveform array
                   that specifies the data for the sigmoid fit.
           WDFOUT: Waveform array number for the fitted data.
                   Default:  WDFOUT = WDF
    	
     KEYWORD PARAMETERS:
           BASE:   Fit value for the BASE value of the sigmoid
                   (see  PURPOSE: above)
           AMPLITUDE: Fit value for the AMPLITUDE value of the sigmoid
                   AMPLITUDE is a two element vector.
                   AMPLITUDE = [AMP0, AMP1]
                   (see  PURPOSE: above)
           ALPHA:  Fit value for the ALPHA value of the sigmoid
                   (see  PURPOSE: above)
           BETA:   Fit value for the ALPHA value of the sigmoid
                   (see  PURPOSE: above)
           MIDDLE:  Fit value for the MIDDLE value of the sigmoid
                   (see  PURPOSE: above)
           PLOTIT:  If set, the original data and the fit data will be plotted.
           TOL:     Tolerance input to CURVEFIT
                    Default: TOL = 2e-6
           ITER:    Number of iterations in CURVEFIT
           ITMAX:   Maximum number of iterations in CURVEFIT
                    Default: ITMAX = 20
           CHISQ:   Reduced goodness-of-fit statistic from CURVEFIT
           INITVAL: Initial values for the CURVEFIT routine
                    This is a vector of 6 values
                    INITVAL =[BASE, AMP0, AMP1, ALPHA, BETA, MIDDLE]
                    Default values calculated:
                      LIMITS, WDF, XRANGE=xr, YRANGE = yr
                      BASE = yr[0]
                      AMPLITUDE = yr[1] - BASE*[1, .2]
                      ALPHA = SIGN*10/(xr[1]-xr[0])
                      BETA = 0.2 * ALPHA
                      MIDDLE = TOTAL(GET_TIME(WDF,BASE+0.5*AMPLITUDE,NP= NP))/NP 
               Where: SIGN = (DERIVATIVE > 0) ? -1 : +1
                  and DERIVATIVE is the average slope of the WDF array
           VERBOSE: If set, parameters will be printed to the screen.
    
      Note:  If WEIGHT is not defined, then SCALE and NORMALIZE_WEIGHT are ignored
    
           WEIGHT:  If set, this is a valid WDF array number to use as a weight.
                    WEIGHT is an array number or comment label for a WDF array.
                    WEIGHT should have the same number of elements as WDF.  
                    The actual weight is determined by the value of scale.
               Note: If W are the values of weight for the points in WDF, they may
                     be stored in a wdf array with the following:
                       I2W, W, WEIGHT, clabel = 'Calculated Weights'
           SCALE:   Ignored unless WEIGHT contains a valid WDF array number
                    If WEIGHT is set, SCALE determines how WEIGHT values are used.
                    In the discussion below, assume Y = GETYF(WEIGHT) and 
                      FIT_WEIGHT is the weight passed to CURVEFIT.
                    IF SCALE is undefined, SCALE = 1
                      FIT_WEIGHT = Y ^ SCALE
           NORMALIZE_WEIGHT: If NORMALIZE_WEIGHT is zero then weight is not normalized
                    If NORMALIZE_WEIGHT is missing:
                       TOTAL(WEIGHT) = NX ; where NX = Number of Points
                    If NORMALIZE_WEIGHT NE 0 then 
                       TOTAL(WEIGHT) = ABS(NORMALIZE_WEIGHT)
                     
     OUTPUTS:
           A waveform array with the sigmoid fit to the data and the
           parameters for the waveform array.
    
     PROCEDURE:
           The IDL procedure, CURVEFIT, is used to fit the data with a uniform 
           weight of 1.0 unless WEIGHT is specified.
    
     EXAMPLE:
           Fit waveform array, 8, to a sigmoid and store the fitted data in
             wdf array 9.
             SIGFIT2, 8, 9
    
     MODIFICATION HISTORY:
            Written by:    L. Paul Mix, October 12, 2004
    

    (See ../pfidl/pfidl_1d/sigfit2.pro)


    SJPEG

    [Previous Routine] [Next Routine] [List of Routines]
      Save the current screen information to a motion JPEG2000 file.
      File is determined by STARTJPEG
      Movie can be seen using MJ2_Player or 
    
      Format: SJPEG
    
      Examples:
      Send the nframe images to a motion JPEG2000 file called: target.mj2
    ; Initialize JPEG2000
        startJPEG, 'target.mj2'
    ; Generate frames
        for i = 1L, nframe do begin
          
          sjpeg
        endfor
    ; Close the file
        endjpeg
    ; View the Movie
        MJ2_Player
    
      MODIFICATION HISTORY:
          Original version, L. P. Mix, April 12, 2006
    
    

    (See ../pfidl/pfidl_1d/sjpeg.pro)


    SMO

    [Previous Routine] [Next Routine] [List of Routines]
      Smooth a WDF array using a boxcar or median type filter
    
      NOTE: Array elements within WIDTH/2 of the ends of the waveform 
            may not be modified depending on the value of CLIP
    
      NOTE: Non-Uniform data is filtered without regard to abscissa value.
    
      Format: SMO, wd1, [, wd2] [, WIDTH = width] [, CLIP = clip] [, /MEDIAN]
      where:
         wd1, wd2 - WDF array numbers
                    If wd2 is present, then wd2 = SMO (wd1) 
                    else  wd1 = SMO ( wd1)
         WIDTH - width of the filter; the default value is 5
                 (width is always odd; if width is even then: width=width+1)
         CLIP  - Parameter for handling the ends of the array.  If clip =
              0  Default - average the first and last WIDTH/2 points and 
                 linearly interpolate at the beginning and end of the curve
             >0  (or /clip) remove the first and last WIDTH/2 points
             <0  do nothing the the first and last WIDTH/2 points
         MEDIAN  if set, use a median rather than a boxcar filter
         
      Examples:
      Calculate a box car filter (width = 5) of array 2 and store the result
      in array 3.
        smo, 2, 3
      Calculate a box car filter with width of 11 of array 1 and store the 
      result in array 5.  Clip the unfiltered points
        smo, 1, 5, w=11, /c
    

    (See ../pfidl/pfidl_1d/smo.pro)


    SP2XYZ

    [Previous Routine] [Next Routine] [List of Routines]
      Decompose a spatial array from the READPFF command into its component 
      arrays for 1D, 3D and vector dataset types.
      Format: SP2XYZ, image, space, x [, y] [, z ]
      where:
        image - image array from READPFF
        space - space array from READPFF
        x - one dimensional array for the first spatial dimension of the data
        y - one dimensional array for the second spatial dimension of the data
        z - one dimensional array for the third spatial dimension of the data
      Examples:
      Convert the spatial array, geom, of a series of image frames from the array, 
      picture, into x, y, and time arrays.
        sp2xyz, picture, geom, x, y, time
    

    (See ../pfidl/pfidl_1d/sp2xyz.pro)


    SPICT

    [Previous Routine] [Next Routine] [List of Routines]
      Save the current screen information to a file.
    
      Format: SPICT [, FILENAME]
    
      where:
        filename - optional filename.
                   Default is set by startgif
                   ('idl' is the default value if none is specified
                     ie.  idl0001.pict, idl0002.pict  ....etc.)
    
      Examples:
      Send the plots to gif files of the form: movie0001.pict, movie0002.pict, ...
        startgif, file =  'movie'
        < do a plot >
        spict
        < do a plot >
        spict
        < do a plot >
        spict    ; etc
        endgif
    

    (See ../pfidl/pfidl_1d/spict.pro)


    SPNG

    [Previous Routine] [Next Routine] [List of Routines]
      Save the current screen information to a file.
    
      Format: SPNG [, FILENAME]
    
      where:
        filename - optional filename.
                   Default is set by startgif
                   ('idl' is the default value if none is specified
                     ie.  idl0001.png, idl0002.png  ....etc.)
    
      Examples:
      Send the plots to gif files of the form: movie0001.png, movie0002.png, ...
        startgif, file =  'movie'
        < do a plot >
        spng
        < do a plot >
        spng
        < do a plot >
        spng    ; etc
        endgif
    

    (See ../pfidl/pfidl_1d/spng.pro)


    STARTEPS

    [Previous Routine] [Next Routine] [List of Routines]
      Generate an encapsulated postscript file of the next graphics commands for 
      incorporation into another document; no graphics is sent to the screen.
      Helvetica font is used.  This may be changed by adding a extra keyword.
      Note: ENDPOST must be used to close the file and return to terminal output
      Format: STARTEPS  [, FONT = font]  [, COLOR= color]  [, BOLD = bold]  
                      [, COPY = copy] [, INTERPOLATE = interpolate]
                      [, THICK = thick]  [, XYTHICK = xythick]
                      [, PREVIEW=preview] [, FILE=file]  [, BITS = bits]
                      [, NOLOAD = noload] [, _extra = extrastuff]
      where:
        font - font size in points.  Default is 18 pt
        color - black and white output is used if color is set to zero.
                Default is color= 1
        copy - See Set_plot - Copy color table from current device to postscript
                              Default = 0
        Interpolate - See Set_plot - Interpolate current color table to the new
                      device. Default = 0
             Note: If X-Y color table is used, these pure colors will be changed
        bold - specifies bold print for the output if present and nonzero
                Default is 0
        thick - specifies the plot line thickness.  Default is 5
        xythick - Specifies the axes thicknesses. Default is 5.
        preview - generate a preview frame for the file if present and nonzero
                  Default is 0 (No preview frame and smaller file size)
        file - output file name for the encapsulated postscript output.
               Default is the default print file.
               See "SET_PRINTER" or enter "SET_PRINTER, /SHOW"
               If a directory is not specified then the file will be in the 
                 default directory.
        bits - bits per pixel.  Default is 8
        noload - if set, no color table will be loaded.
                 DEFAULT: LOADXYCT
        _extra and extrastuff are valid keywords and values for the device command
    
      Examples:
      Send the next plot to a file called 'QSsummary.eps' with a preview frame 
      and plot a graph.
        starteps, /preview, file = 'QSsummary.eps
        plo, 2, 3, /ov, title = 'Summary of Calculations' 
        endpost
    
      Same as above but plot in "Times" font. Change the first line as follows:
        starteps, /preview, file = 'QSsummary.eps', /times
    

    (See ../pfidl/pfidl_1d/starteps.pro)


    STARTGIF

    [Previous Routine] [Next Routine] [List of Routines]
      Set the screen to generate a plot suitable for generating a GIF file or 
        a PICT file or a TIFF file for inclusion in a word document.
      Note: ENDGIF must be used to restore the old screen parameters.
      True Type fonts are used.
    
      Format: STARTGIF [, FILE] [, FONT = font]  [, SIZE_CHAR = size_char]
                      [, BIGWIN = bigwin] [, CHARACTER_SIZE = character_size ]
                      [, /NOSWAP] [, THICK = thick]  [, XYTHICK = xythick]
                      [, INQUIRE = inquire] [, FILENAME =file] 
                      [, NUMBER = number]  [, _extra = extrastuff]
      where:
        file       - output file name for the GIF or PICT output.
                     Default is 'idl000n.gif' or 'idl000n.pict'
                      (that is, File = 'idl')
        font       - Font Name (any True Type font)
                     Default = 'Helvetica Bold'
                     Default font will be changed to font if font is specified.
                     Note: Use the following to set a different true type font.
                        device, set_font = font, /tt_font
        NOSWAP     - If set color map will not be switched.
                     If NOSWAP lt 0 then background and drawing colors will be
                       switched.
                     Default is to issue the command:
                       INVERTCT, /GIF
                     and when endgif is entered:
                       INVERTCT, /RESET
        BIGWIN     - If set, BIGWIN will be called.  This will make a large PIXMAP
                     window for the plot.  If BIGWIN has two elements, then
                     BIGWIN = [ XSIZE, YSIZE] in the call to BIGWIN.
        Character_size - Multiplier for the default character size.
                      Default character size is defined in "Size_char" below
        Size_char   - Width and height for character.
                      If no values given - Default = [1, 1.4]*0.022*!d.y_size
                      If 1 value given   - Default = [1, 1.4]*size_char
                      
                      Note 1: The current font size is stored in !d.x_ch_size and
                              !d.y_ch_size.  These are read only.
                      Note 2: Use the following to set another character size.
                              device, set_character_size = [x_ch_size, y_ch_size]
                    
        thick       - specifies the plot line thickness.
                      Default is 0.004*!d.y_size
        xythick     - Specifies the axes thicknesses.
                      Default is 0.004*!d.y_size
        inquire     - Used to set the font to a hardware font.
                      If set to a number, then the command a = xfont() will be
                      executed and the result set to the value.
                      If set to a string, then that hardware font will be used.
                      One font on the HP is
         "-adobe-helvetica-bold-r-normal--34-240-100-100-p-182-iso8859-1"
        FILENAME    - Output file name.  This is ignored if FILE is present.
        NUMBER      - Initial number for the screen capture.  
                      Default = 1
                  Number for the next screen capture if STARTGIF has been 
                      called.
    
                      Number must be greater than or equal to zero.
                      
        extrastuff  - Any valid keywords and values for the device command
    
      Examples:
    
      Send the plots to gif files of the form: movie0001.gif, movie0002.gif, ...
      NOTE:
       For a PICT file replace SGIF with SPICT. For TIFF replace SGIF with STIFF.
        Startgif, file =  'movie'
        < do a plot >
        sgif
        < do a plot >
        sgif
        < do a plot >
        sgif    ; etc
        endgif
    

    (See ../pfidl/pfidl_1d/startgif.pro)


    STARTJPEG

    [Previous Routine] [Next Routine] [List of Routines]
      Make the object to write a motion JPEG2000 file.
      Note: ENDJPEG must be used to close the file.
      Note: StartGif may be used to obtain TrueType fonts, wider lines, 
            and white background.
    
      Format: STARTJPEG [, FILE] [, REVERSIBLE = reversible] [_EXTRA = extrastuff]
    
      where:
        file       - output file name for JPEG2000 output
                     Default is 'idljpeg.mj2'
                     A Unique file will be opened if none is specified.
        REVERSIBLE - Specifies if the compression is lossy.
                     Default: REVERSIBLE = 1 
                     Typically is will be faster to compress and decompress lossy
                     (ie, REVERSIBLE = 0) frames, but this depends on the image
                     content.
        extrastuff - Any valid keywords and values for the OBJ_NEW command for an
                     IDLffMJPEG2000 object.
    
      Examples:
      Send the nframe images to a motion JPEG2000 file called: target.mj2
    ; Initialize JPEG2000
        startJPEG, 'target.mj2'
    ; Generate frames
        for i = 1L, nframe do begin
          
          sjpeg
        endfor
    ; Close the file
        endjpeg
    ; View the Movie
        MJ2_Player
    
    

    (See ../pfidl/pfidl_1d/startjpeg.pro)


    STARTP

    [Previous Routine] [Next Routine] [List of Routines]
      Generate a plot for the default printer
      Note: ENDP must be used to close the device and return to terminal output
      Format: STARTP  [, FONT = font]  [, COLOR= color]  [, BOLD = bold]
                      [, COPY = copy] [, INTERPOLATE = interpolate] [, FILE=file]
                      [, BITS = bits] [, THICK = thick] [, XYTHICK = xythick]
                      [, NOLOAD = noload] [, PORTRAIT = port] [, _extra = extrastuff]
      where:
        portrait - put output into portrait mode with a full page
                  margin is 1/2 inch, size is 7.5x10 inches
                  DEFAULT is landscape
        charsize - Multiplier for character size
                   If set, !p.charsize = charsize
        font - font thickness Default = 3
               !p.charthick = font
        color - black and white output is used if color is set to zero.
                Default is color= 0
        copy - See Set_plot - Copy color table from current device to postscript
                              Default = 0
        Interpolate - See Set_plot - Interpolate current color table to the new
                      device. Default = 0
             Note: If X-Y color table is used, these pure colors will be changed
        bold - specifies bold print for the output if present and nonzero
                Default is !p.charthick = 2*font
        thick - Plot line thickness.  Default is 5
        xythick - Axis thickness.  Default is 5
        bits - bits per pixel.  Default is 8
        noload - if set, no color table will be loaded.
                 DEFAULT: LOADXYCT
        _extra - any acceptable variables in the call to the "device" procedure
                 for example: /avant will use Avant Garde PostScript font
      Note:  When using Postscript, Greek characters are accessed using "!9" and
             the norman font is "!3" for example distance in microns for an
             axis label would be written: xtitle='Distance (!9m!3m)'
      Examples:
      Send the next plots to a file called 'QSsummary.ps'
        startpost, file = 'QSsummary.ps
        { plot the stuff }
        endpost
    

    (See ../pfidl/pfidl_1d/startp.pro)


    STARTPCL

    [Previous Routine] [Next Routine] [List of Routines]
      Generate a pcl file of all graphics output. No graphics is sent
      to the screen.
      Note: ENDPCL must be used to close the file and return to terminal output
      Format: STARTPCL [, FILE] [, FONT = font]  [, COLOR= color]  [, BOLD = bold]
                      [, COPY = copy] [, INTERPOLATE = interpolate] [, FILE=file]
                      [, BITS = bits] [, THICK = thick] [, XYTHICK = xythick]
                      [, NOLOAD = noload] [, PORTRAIT = port] [, _extra = extrastuff]
      where:
        file - output file name for the postscript output.
               If the file parameter is used the keyword file is ignored.
               Default  the default print file.
               See "SET_PRINTER" or enter "SET_PRINTER, /SHOW"
        portrait - put output into portrait mode with a full page
                  margin is 1/2 inch, size is 7.5x10 inches
                  DEFAULT is landscape
        charsize - Multiplier for character size
                   If set, !p.charsize = charsize
        font - font thickness Default = 3
               !p.charthick = font
        color - black and white output is used if color is set to zero.
                Default is color= 0
        copy - See Set_plot - Copy color table from current device to postscript
                              Default = 0
        Interpolate - See Set_plot - Interpolate current color table to the new
                      device. Default = 0
             Note: If X-Y color table is used, these pure colors will be changed
        bold - specifies bold print for the output if present and nonzero
                Default is !p.charthick = 2*font
        thick - Plot line thickness.  Default is 5
        xythick - Axis thickness.  Default is 5
        bits - bits per pixel.  Default is 8
        noload - if set, no color table will be loaded.
                 DEFAULT: LOADXYCT
        _extra - any acceptable variables in the call to the "device" procedure
                 for example: /avant will use Avant Garde PostScript font
      Note:  When using Postscript, Greek characters are accessed using "!9" and
             the norman font is "!3" for example distance in microns for an
             axis label would be written: xtitle='Distance (!9m!3m)'
      Examples:
      Send the next plots to a file called 'QSsummary.ps'
        startpost, file = 'QSsummary.ps
        { plot the stuff }
        endpost
    

    (See ../pfidl/pfidl_1d/startpcl.pro)


    STARTPOST

    [Previous Routine] [Next Routine] [List of Routines]
      Generate a postscript file of all graphics output. No graphics is sent 
      to the screen.  Helvetica font is used in landscape orientation.
      Font may be changed using the _extra keyword.
      Note: ENDPOST must be used to close the file and return to terminal output
      Format: STARTPOST [, FILE] [, FONT = font]  [, COLOR= color]  [, BOLD = bold]
                      [, COPY = copy] [, INTERPOLATE = interpolate] [, FILE=file]
                      [, BITS = bits] [, THICK = thick] [, XYTHICK = xythick]
                      [, SET_DEFAULT = set_default] [, NOLOAD = noload]
                      [, PORTRAIT = port] [, DATAPLOT = data]
                      [, _extra = extrastuff]
      where:
        file - output file name for the postscript output.
               If the file parameter is used the keyword file is ignored.
               Default is the default print file.
               See "SET_PRINTER" or enter "SET_PRINTER, /SHOW"
               If a directory is not specified then the file will be in the 
                 default directory.
        portrait - put output into portrait mode with a full page
                  margin is 1/2 inch, size is 7.5x10 inches
                  DEFAULT is landscape
        font - font size in points.  Default is 18 pt
        color - black and white output is used if color is set to zero.
                Default is color= 0
        copy - See Set_plot - Copy color table from current device to postscript
                              Default = 0
        Interpolate - See Set_plot - Interpolate current color table to the new 
                      device. Default = 0
             Note: If X-Y color table is used, these pure colors will be changed
        bold - specifies bold print for the output if present and nonzero
                Default is bold = 0
        thick - Plot line thickness.  Default is 5
        xythick - Axis thickness.  Default is 5
        bits - bits per pixel.  Default is 8
        noload - if set, no color table will be loaded.
                 DEFAULT: LOADXYCT
        set_default - If set the defaults for portrait, font, and color may 
                 be set. 
                Note:  Default values are:
                       Color = 0 & Portrait = 0 & font = 18
                NOTE:  The command is ignored and only the default is changed.
        DATAPLOT:  If set, assume a data plot.
                   Keyword defaults become:
                     Thick = 2.5
                     XYthick = 2.5
                     Font = 10
        _extra - any acceptable variables in the call to the "device" procedure
                 for example: /avant will use Avant Garde PostScript font
      Note:  When using Postscript, Greek characters are accessed using "!9" and 
             the norman font is "!3" for example distance in microns for an 
             axis label would be written: xtitle='Distance (!9m!3m)'
      Examples:
      Send the next plots to a file called 'QSsummary.ps'
        startpost, file = 'QSsummary.ps
        { plot the stuff }
        endpost
    
    
      Same as above but plot in "Times" font. Change the first line as follows:
        starteps, /preview, file = 'QSsummary.eps', /times
    

    (See ../pfidl/pfidl_1d/startpost.pro)


    STATS

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           STATS
    
     PURPOSE:
           This routine prints or returns statistical values about an IDL array.
    
     CATEGORY:
           Statistics
    
     CALLING SEQUENCE:
           STATS, ARRAY
    
     INPUTS:
           ARRAY:	Array for which statistics are desired.
                   Minimum of 4 points required
    
     KEYWORD PARAMETERS:
           QUIET:	If set, no output to the terminal
           NPOINTS: Number of values
           FINITE:  Number of valid values
           VALID:   Linear array of valid values
           NAN:     Number of values that are not a number
           INFINITE: Number of values that are +/- infinity
           ZERO:    Number of points that are zero
    
       Following refer only to finite values:
           MAXIMUM: Maximum value in the array.
           MINIMUM: Minimum value in the array.
           PEAK:    Maximum absolute value.
           AVERAGE: Average value = TOTAL/NPOINTS
           STANDARD: Standard deviation of the data
           MEDIAN:  The middle value.  Half of the points are less than the 
                    median and half are greater than the median.
           BQUARTILE: Value for which 25% are less than and 75% are greater than.
           TQUARTILE: Value for which 75% are less than and 25% are greater than.
           LOWER:   Lower estimate of the distribution.  Values below this should be 
                    considered as outliers.  
                    LOWER = BQUARTILE - 1.5*(TQUARTILE - BQUARTILE)
           UPPER:   Upper estimate of the distribution.  Values above this should be 
                    considered as outliers.  
                    LOWER = TQUARTILE + 1.5*(TQUARTILE - BQUARTILE)
    
     OUTPUTS:
           Statistics for the array are printed and returned in keywords.
    
     RESTRICTIONS:
           Array of 4 or more elements must be provided.
    
     PROCEDURE:
           NAN's and INF's are removed from the array and values calculated.
    
     EXAMPLE:
           Obtain the statistics of the Y-values in WDF array: 5
             STATS, GETYF(5)
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, Jr., September 19, 2006
    

    (See ../pfidl/pfidl_1d/stats.pro)


    STIFF

    [Previous Routine] [Next Routine] [List of Routines]
      Save the current screen information to a file.
    
      Format: STIFF [, FILENAME] [, COMPRESSION = compression]
    
      where:
        filename - optional filename.
                   Default is set by startgif
                   ('idl' is the default value if none is specified
                     ie.  idl0001.gif, idl0002.gif  ....etc.)
        compression - Compression type (see Write_Tiff)
                      Default = 1
                      If set, all future calls will default to the value set.
    
      Examples:
      Send the plots to gif files of the form: movie0001.gif, movie0002.gif, ...
        startgif, file =  'movie'
        < do a plot >
        sgif
        < do a plot >
        sgif
        < do a plot >
        sgif    ; etc
        endgif
    

    (See ../pfidl/pfidl_1d/stiff.pro)


    STOPPING

    [Previous Routine] [Next Routine] [List of Routines]
      Calculate the ion range using the formulation of J.Maenchen
    
       format: stopping, zion,  ein, eout, thick, mat [, press] [, edel] [, ier]
                [, aion = aion]
                [, quiet = quiet] [, ion_name = ion_name] [, foil_mat = foil_mat]
         where:
              zion    - z of the ion
              ein     - input energy (Mev) (may be an array)
              eout    - output energy (Mev) (may be an array)
              thick   - foil thickness (microns) (may be an array)
              mat     - z of the foil or one of several compounds listed below:
             MAT = 0    VACUUM
             MAT = 1,92 elements with Z = MAT
             MAT = 101  polyethylene: C-H2,  rho = 0.92
             MAT = 102  mylar:  C10-H8-O4,  rho = 1.395
             MAT = 103  lithium fluoride:  Li-F,  rho = 2.601
             MAT = 104  teflon: C-F2,  rho = 2.20
             MAT = 105  kimfol: H14-C16-O3,  rho = 1.21
             MAT = 106  kapton: C22-H10-N2-O4,  rho = 1.42
             MAT = 107  parylene-n:  C8-H8,  rho = 1.11
             MAT = 108  parylene-c:  C8-H7-Cl,  rho = 1.28
             MAT = 109  parylene-d:  C8-H6-Cl2,  rho = 1.418
             MAT = 110  erbium deuteride:  Er-D2,  rho = 8.64(used H in derivation)
             MAT = 111  brass: Cu62-Zn35-Pb3,  rho = 8.49
             MAT = 112  monel: Fe-Ni67-Cu32,  rho = 8.83
             MAT = 113  inconel: Cr19-Fe18-Ni53-Mo3-Nb5,  rho = 8.19
             MAT = 114  LB4: Li0.4-B1.8-O2.9, rho = 2.2
             MAT = 115  LB5: Li0.2-B1.8-O2.8, rho = 2.2
              press   - pressure if MAT is a gas; default = 1 torr
              edel    - energy loss (ein-eout)
              ier     - error parameter, number of iterations or problem if neg.
              aion    - Ion mass in AMU. If not set, average atomic mass will be
                        used for the stopping.
              quiet   - if set, no output.
                        Default: list the results
              ion_name- Name of the ion
              foil_mat- Name of the foil material
    
       Discussion:
             One of the parameters (ein, eout, thick) must be negative.
             The negative parameter will be determined.
             If any of the parameters (ein, eout, thick) are arrays then
                the other parameters will be made into arrays of equal length
                using the first value to pad arrays if needed.
             Only 1 value of zion and nmat are allowed
    
       Example
             Determine the range of Li in Au at 1, 5 and 10 MeV
               STOPPING, 3, [1,5,10], 0, -1, 79
        or 
               thick = -1 & STOPPING, 3, [1,5,10], 0, thick, 79
              Note: The value of THICK will be changed to an array of thichnesses.
    

    (See ../pfidl/pfidl_1d/stopping.pro)


    SUB

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           SUB
    
     PURPOSE:
           Subtract a WDF array or a constant from a WDF array 
           Store the result in the initial WDF array or another WDF array
     CATEGORY:
           Math 
     CALLING SEQUENCE:
           SUB, WD1, WD2 [, WD3]
           SUB, WD1, 0, VAR, [, WD3]
     INPUTS:
           WD1:     WDF array number of the first array
           WD2:     WDF array number of array to be subtracted from the first array
      or
           0, VAR   Variable or constant to be subtracted from the first array
     OPTIONAL INPUT:
           WD3:     WDF array number for the difference, if not specified the 
                    difference is stored in WD1 the first array)
     KEYWORD PARAMETERS:
           CLABEL    Replace the dataset comment for array number WD3
                     with the string or string variable specified
           XLABEL    Replace the dataset x-axis label for array number WD3
                     with the string or string variable specified
           YLABEL    Replace the dataset y-axis label for array number WD3
                     with the string or string variable specified
           SORTX     Sort the X values and take all unique values.
                     Ignored if MASTER is set
           MATCH_ONLY If one array is XY data and the match is not exact,
                      then make a new XY array with only X values in both
                      arrays that differ by less than ERR where
                      ERR =  (xmax-xmin)/(100*np)]  if match_only ge 0
                          = - match_only            if match_only lt 0
                      where np is the number of points in the first array
                         and [xmin, xmax] is the range of the first data array
                      (1% of the average point spacing)
                      The points are selected by:
                           X2-ERR < X1 < X2+ERR
                      In the actual implementation, if both arrays are XY then
                        the X1 values are those of the shorter array and not
                        necessarily the first array.
                      Multiple X2 points which satisfy the inequality are averaged
           MASTER:    If the abscissa of WD1 does not match the abscissa of WD2 
                      then the abscissa values in the master array will be used 
                      exactly in the region of overlap.  If MASTER is negative 
                      then all of the abscissa values in the master array will 
                      be used and ordinate values where there is no abscissa will
                      be set to DEFAULT. If keyword_set(MASTER) and abs(MASTER) is 
                      not 2, then abs(MASTER) is set to 1.
           DEFAULT:   Value to be use when MASTER is negative and there is not 
                      complete overlap of the master curve.
                      Default:  DEFAULT = 0.0
    
     OUTPUTS:
           NONE     The difference is stored in a WDF array in the common block
     COMMON BLOCKS:
           COM.DAT  WDF common block 
     RESTRICTIONS:
           WD1 array must be defined and have valid data
           WD2 or 0 and a Variable must be defined
     PROCEDURE:
           If WD2 is specified: 
                WD1 and WD2 are put on a common time base and WD2 subtracted from
                WD1.  If there are less than 2 points of overlap, then 
                no action is taken.  Linear interpolation is used to put the 
                arrays on a common abscissa scale using the minimum abscissa 
                increment.
           If 0, VAR is specified:
                VAR is subtracted from WD1, where VAR is a constant or a variable.
           In either case, the difference is stored in WD3, if specified, 
           or WD1, if WD3 is not specified.
     EXAMPLES:
           Subtract WDF arrays 2 and 3 and store the result in WDF array 8.
                   SUB, 2, 3, 8, c = 'Signal with background removed'
           Subtract the variable OFFSET to WDF array 2 and store the difference 
           in WDF array 8.
                   SUB, 2, 0, offset, 8
     MODIFICATION HISTORY:
          Original version, L. P. Mix, May 15, 1992
    

    (See ../pfidl/pfidl_1d/sub.pro)


    SUM

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           SUM
    
     PURPOSE:
           Take the sum of multiple WDF arrays into a new WDF array. Optionally
             calculate the average of these curves.  
           NOTE: If no overlap exists with the first curve, the data will be
                 ignored in the sum but the data will be included in determining
                 the denominator.
     CATEGORY:
           Mathematics
     CALLING SEQUENCE:
           SUM, WDA, NCURVE [,SAVE] [,/PLOTIT][,/AVERAGE][, NCURVES=NCURVES]
                       [,/QUERRY] [, STANDARD = STANDARD] [, SDeviation = SD]
                       [, SACTUAL = sactual] [, ACTUAL = actual]
                       [, WEIGHTS = weights] [, ERRORS = errors]
     INPUTS:
           WDA:      WDF array number or an array of WDF array numbers or a 
                     search string.
           NCURVE:   Number of curves to be plotted or the destination for the
                     total of the arrays.
                     If WDA is a single WDF array number, then WDA and the
                       following (NCURVE-1) arrays will be totaled.  NCURVE is a 
                       required input parameter.
                     If WDA is an array of WDF arrays, then NCURVE is optional.
                       If present, NCURVE will be interpreted as SAVE and the 
                       third parameter is ignored.
     OPTIONAL INPUT:
           SAVE:     WDF array number for the sum or average of the WDF arrays.
                     The total is always stored in the last WDF array unless
                       average is calculated and stored in that array
     KEYWORDS:
           PLOT:     If present and not zero, plot the total.
           AVERAGE:  If present and not zero, average the curves (see NOTE: above)
                     AVERAGE will be set if ERRORS or WEIGHTS are set.
           STANDARD: If AVERAGE is set and STANDARD is not equal to zero, the 
                     standard deviation from the average is calculated and stored
                     in MAXWDFARRAY-1. If STANDARD is less than zero, the stand
                     standard deviation will be stored in abs(standard). 
                       standard = sqrt(sum(y^2)-n*(average^2)/(n-1))
                     If ERRORS or WEIGHTS are set, then 
                       standard = SQRT(1./TOTAL(WEIGHT))
           SD        same as standard. Note: SD and Standard are resolved by:
                         If keyword_set(sd), then standard = sd
           NCURVES:  The number of curves used for the TOTAL and the 
                       denominator in calculating the average.  This includes
                       all arrays in the range with valid data.  (see NOTE above)
           ALL:      If set, all curves will be added and averaged using entire
                     domain of all curves.
                     Note: If ALL is set and STANDARD is set, then STANDARD is 
                           defined equal to zero where n=1 unless errors
                           are provided..
                     If DISCRETE is set, then ALL is set.
                     If ALL is set, then AVERAGE =1 unless it is defined = 0.
           QUERRY:   If present and not zero, the user will indicate the 
                       arrays to be summed or averaged.
           CLABEL:   Replace the dataset comment for array number SAVE
                     with the string or string variable specified
           XLABEL:   Replace the dataset x-axis label for array number SAVE
                     with the string or string variable specified
           YLABEL:   Replace the dataset y-axis label for array number SAVE
                     with the string or string variable specified
           WEIGHTS:  WDF array of the weight for each for each point
                     If weights is set and does not cover the domain of the data,
                     the closest value will be used for continuous data.
                     The number of WDF arrays must be the same as the
                     number of waveforms to be summed or averaged.
           ERRORS:   WDF arrays with the errors for each point.
                     This keyword is not checked if WEIGHTS is set.
                     If ERRORS is set and does not cover the domain of the data,
                     the closest value will be used for continuous data.      
                     ERRORS are the standard deviations for each point in the 
                     waveform.  These errors are used to calculate weights.
                     If STATISTICAL is not set,  weights are 1/(Error_Value)^2
                     (for instrumental or Gaussian weights).
                     If STATISTICAL is set, weights are  1/Error_Value
                     (for statistical or Poisson weights).
                     ERRORS must be greater than zero.  Values less than or equal
                     to zero are set equal to 1E-3*MIN(Positiver_Values_of_ERRORS)
           STATISTICAL : See ERRORS
           DISCRETE: If set, consider the WDF arrays as discrete elements.
                     If DISCRETE is set, ALL is set absolutely.
                     (If Weights or Errors are provided, missing weight or error
                     points will not be included in the sum/average.)
                     Values are considered equal if they vary by less
                     than 2.5% of minimum spacing.
                     If DISCRETE is a float lt 0.4 then it will be used to set 
                       the minimum spacing (DISCRETE = DISCRETE * MIN_SPACING)
                     If DISCRETE is negative, it will be used as the scale length.
                     (/DISCRETE implies (DISCRETE = 0.025*MIN_SPACING))
                     (DISCRETE = -10 implies values within 10 X units are considered 
                      equal.  X-Value used is the average.)
                     If ERRORS or WEIGHTS is set, the abscissa values must be
                     within 0.4 of the data abscissa value.
                     If the data is not sparse and there are multiple ordinates or
                     weights/errors, the mean value will be calculated and used in the 
                     calculation.
           ACTUAL:   WDF arrays used in the sum/average
           SACTUAL:  WDF arrays used in the sum/average as a string with 
                     spaces between values.
           QUIET:    If set, do not print information messages.
     OUTPUTS:
           NCURVES   Number of WDF arrays which have valid data
           SUM     - Total of the designated arrays is stored in a WDF array.
     COMMON BLOCKS:
           COM.DAT  WDF common block
     RESTRICTIONS:
           WD1 array must be defined and have valid data 
           The last WDF array will be used as a scratch array to calculate the sum
           NCURVE may be changed 
     PROCEDURE:
           If WDA is a single value:
                WDA and the following NCURVE-1 datasets are added together and 
                the result is stored into SAVE or the last WDF array if SAVE is
                not provided.
           If WDA is an array:
                Each WDF array indicated by the elements in WDA is added together
                and the total is stored in NCURVE or the last WDF array if 
                NCURVE is not provided.
     EXAMPLES:
           Add WDF arrays 2 and 3 and store the result in WDF array 8.
                   SUM, 2, 2, 8
               SUM, [2, 3], 8
               ADD, 2, 3, 8
    
           Add arrays 2 and 3 and store the result in array 8.  The first example
             will also store the sum in WDF array 82.
                   SUM, 2, 2, 8      ADD, [2, 3], 8
    
           Add arrays 1, 2, 3 and store the result in array 8.  Assume the data is
             discrete and you wish to combine all points that are within 5.  
             Calculate a weighted average using the error estimates from WDF 
             [11, 12, 13]
                   SUM, 1, 3, 8, discrete = -5, error = 11+indgen(3)
    
           Add arrays 2 through 7 and store the result in array total. Total
             must be in the range [1, 82] or be undefined. Store standard deviation
             in WDF array 30
                   SUM, 2, 6, total, stand = -30
    
           Average selected arrays beginning with 'MOCAM2' and store the result
             in array 65. Calculate the standard deviation and plot a summary.
                   SUM, /average, 'mocam2', /qu, 65, sd = -68
                   add, 65, 68, 66, cl='SD-Max'
                   sub, 65, 68, 67, cl='SD-Min'
                   plo, 'mocam2', /ov, /co & plo, 65, 3, /ov, /co, /no
    
           Add arrays 12 through 28 and store the result in array 8
                   SUM, 12, 28-11, 8
    
           Add arrays 2, 4, 5, 6, 12, 15, plot the sum and store the result in
             array 8
                   SUM, [2, 4, 5, 6, 12, 15], 8, /p
    
           Add arrays 2 through 7, calculate the average and store the average
             in array 7 with the sum in array 42 and the number of arrays in narr.
                   SUM, 2, 6, 7, /average, n = narr
    
           Add WDF the selected arrays 2 through 17, plot the total and 
             store the result in WDF array 42.
                   SUM, 2, 17-2+1 , /plot, /querry
    
           Note the "Select ALL" button can be used to select all the arrays 
             and then a few arrays can be deselected.
    
     MODIFICATION HISTORY:
          Original version, L. P. Mix, December 15, 1992
    

    (See ../pfidl/pfidl_1d/sum.pro)


    SWAP

    [Previous Routine] [Next Routine] [List of Routines]
     Name:         swap.pro
     Purpose:      Reverses background and drawing colors for future plots
                   Note: Does not change color table so existing plots are 
                         not modified
                   See swapct.pro to modify color table
     Format: swap
     Technique: switches !p.color and !p.background
    

    (See ../pfidl/pfidl_1d/swap.pro)


    SWAPCT

    [Previous Routine] [Next Routine] [List of Routines]
     Name:         SWAPCT
    
     Format:       SWAPCT [, /RESET]
            where
                   RESET restores original color table.
     Purpose:      Reverses background and drawing colors for future plots by
                   exchanging the colors in the color table. 
                   Note: Existing plots are modified, but loading a new color 
                         table will change everything back to the original colors.
                   See swap.pro to modify the drawing colors
     Technique: switches the color table entries for !p.color and !p.background
    

    (See ../pfidl/pfidl_1d/swapct.pro)


    SYMBOL_LIST

    [Previous Routine] [Next Routine] [List of Routines]
     Special symbols available with MKSYMBOL 
        and their number and character representation
     #    Name     Character
     0    Square     SQ
     1    Circle     CI or O
     2    Triangle   TR
     3    Diamond    DI
     4    Big X      BI or X
     5    Delta      DE
     6    Star       ST
     7    Plus       PL or +
     8    Hexagon    HE
     9    Pentagon   PE
     10   Clover     CL
     11   PACMAN     PA
     12   Spiral     SP
    

    (See ../pfidl/pfidl_1d/symbol_list.pro)


    TEMPERATURE

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           TEMPERATURE
    
     PURPOSE:
           Convert power in Watts/m^2 to an effective temperature.
           Procedure is iterative with an error limit of 1e-5
    
     CATEGORY:
           Analysis
    
     CALLING SEQUENCE:
           TEMPERATURE, WDFin [, WDFout] [, MINIMUM = minimum] 
               [, MAXIMUM = maximum] [, /LIMITS] 
               [, /ARRAY] [, NPOINTS = NPOINTS]
    
          Where:
           WDFin - Waveform array containing photon power (W/m2)
                   Values must be greater than 1e9.  
             NOTE: Values less than this are changed to 1e9
           WDFout- Waveform array equivalent temperature (eV)
                   Default: WDFin
           MINIMUM - Minimum energy represented by WDFin
           MAXIMUM - Maximum energy represented by WDFin
           LIMITS  - Limits on the minimum and maximum energies.
                     Default: LIMITS = [0.5, 10.0]
          NOTE:  If minimum is greater than LIMITS[1]*temperature or maximum is 
                 less than LIMITS[0]*temperature, a temperature of zero is returned
           ARRAY   - If set, then WDFin is an array of one or more elements
                     The calculated temperatures are stored as an array in WDFout
           NPOINTS - If specified, the number of points used to calculate the 
                     spectrum between minimum and maximum.
                     Default is 1024
     OUTPUTS:
           WDF array with equivalent temperature
    
     PROCEDURE:
           An initial temperature is calculated assuming the power is for the 
           entire spectrum.  This blackbody spectrum is integrated using 
           1000 points between minimum and maximum.  The integrated power povides
           an estimate of the observed power to the total blackbody power.
           A new temperature is calculated and the process is repeated until the 
           temperature does not change. CALC_TEMP in util is used for this process.
    
     EXAMPLE:
           WDF array 5 contains total radiated power between 120 eV and 2000 eV.
           convert it to temperature in array 7.
             TEMPERATURE, 5, 7, min=120, max = 2000 
    
    
    
     MODIFICATION HISTORY:
           Written by:     L. P. Mix, 5/18/01
    

    (See ../pfidl/pfidl_1d/temperature.pro)


    TLPARAM

    [Previous Routine] [Next Routine] [List of Routines]
     NAME: 
    	TLPARAM
     PURPOSE:
    	This procedure computes and (optionally) displays 
    	transmission line parameters as a function of frequency from 
    	voltage/current/power time histories.
     CATAGORY:
    	Math
     CALLING SEQUENCE:
    	TLPARAM, Wdf1a, Wdf1b, Defn, Wdf2a, Wdfout, Distance
     INPUTS:
        First define the inpedance using the first 3 parameters:
        Impedance is Z = V/I = V^2/P = P/I^2
        Any combination of V, I and P may be used and indicated in Defn
    	Wdf1a: voltage, current or power time history at position #1
    	Wdf1b: voltage, current or power time history at position #1
    	Defn: definition of impedance: 'iv', 'vi', 'pv', 'vp', 'pi', 'ip'
                 Alternatively, 1, 2, 3, 4, 5, 6 may be used.
                 where I represents current, V is voltage, adn P is power
                 and the two elements are in Wdf1a and Wdf1b respectively
                 Default = 'IV'
    	Wdf2a: voltage, current or power time history at position #2
                  Must be the same parameter as in Wdf1a.
    	Wdfout: WDF array number to store transmission line parameters
                   Output will be stored in this WDF array and the next 6 arrays
                   (see Outputs)
    	Distance: Distance in meters between Position #1 and Position #2
     KEYWORD PARAMETERS:
    	Res: maximum desired frequency resolution
                Default value is the previous value if this routine
                has be run in the current session or 1/(np*dt) where
                np is the number of points and dt is the point spacing.
    	Fmax: maximum frequency component to compute
                Default value is the previous value if this routine
                has be run in the current session or the value 
                min(1024*res, 0.5/dt) where dt is the point spacing
           Note: Res and Fmax are approximate and will be used as guides.
                 dt will be modified to produce good values for the FFT
    	Quiet: if present and non-zero, the parameters are not displayed
    	GHz: if present and non-zero, use frequency units of GHz
    	MHz: if present and non-zero, use frequency units of MHz
     OUTPUTS:
    	Wdfout  : Re(Z0) (Real part of the impedance)
    	Wdfout+1: Im(Z0) (Imaginary part of the impedance)
    	Wdfout+2: alpha = Re(gamma)
    	Wdfout+3: beta  = Im(gamma)
    	Wdfout+4: ereff = (beta*c/omega)**2
    	Wdfout+5: PUL L = Z0*beta/omega
    	Wdfout+6: PUL C = beta/omega*Z0
     MODIFICATION HISTORY:
    	Original version, M. F. Pasik, March 18, 1994
    	Modified for different impedance definitions, March 21, 1994
    	Changed method for computing phase, M. F. Pasik, April 29, 1994
    	Added FFT common block/keywords, M. F. Pasik, May 16, 1994
    	Added quiet keyword, M. F. Pasik, June, 9, 1994
    	Fixed bug in the computation of alpha, M. F. Pasik, June 22, 1994
    	Improved user interface, M. F. Pasik, August 5, 1994
    	Modified method for computing phase, M. F. Pasik, August 9, 1994
    	Added some checks, modified some mechanics, L. P. Mix, February 15, 1995
    

    (See ../pfidl/pfidl_1d/tlparam.pro)


    TODAY

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           TODAY
    
     PURPOSE:
           Return the Calendar day for the current day.
    
     CALLING SEQUENCE:
           now = TODAY()
    
    
     OUTPUTS:
           Return todays date in the form: Month day, year
    
     RESTRICTIONS:
           No restrictions.
    
    
     EXAMPLE:
           Label waveform 6 with today's date.
              lab, today(), 6
    
    
     MODIFICATION HISTORY:
     	Written by:	Paul Mix 
    

    (See ../pfidl/pfidl_1d/today.pro)


    TSH

    [Previous Routine] [Next Routine] [List of Routines]
      Performs time shift on a WDF array.  This procedure can be used to 
      synchronize two arrays or to insure an array begins at zero.
      Format:  TSH, WD1    [, AMOUNT] [, DELTA = delta] [, /IGNORE]
      where:
        wd1 - WDF array number or an array of wdf array numbers
        amount - time shift.  If amount is zero or omitted, then the 
                 array will start at zero by deleting all points before 
                 zero or by adding zero amplitude points if wd1 begins after zero.
            Note: XY data will start at zero by adding points if necessary, but then
                  only those points greater than zero will be included, ie, 
                  except for the first point, no additional points will be added to
                  linearly interpolate data to x =0..
        IGNORE - If set, AMOUNT = 0 will do nothing to WD1.
        delta  - ignored unless XY data. If XY data this will be twice the spacing
                 for additional points if required. 
                 If delta is not specified, then TSH will set delta to the minimum
                    of the minimum current spacing or 1e-4*max(x)
          XY data is handled according to:
                1. If the first X value is within 50% of delta then the first point
                     will be moved by linear interpolation to zero
                2. If the first X value is between 1.0 and 0.5 of delta then
                     a zero value will be added at zero
                3. If the first X value is greater than delta then a point will
                     be added at x = x0-0.5*delta and at zero with a y-value of zero
    
      Examples:
      Make array 1 begin at an abscissa value of zero.  Add initial zeros
             if necessary.
         tsh, 1
      Time shift (add to the abscissa values of) array 1 the amount, -2.42e-6
         tsh, 1, -2.42e-6
    

    (See ../pfidl/pfidl_1d/tsh.pro)


    UNDEFINE

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           UNDEFINE
    
     PURPOSE:
           The purpose of this program is to delete or undefine
           an IDL program variable from within an IDL program or
           at the IDL command line. It is a more powerful DELVAR.
    
     AUTHOR:
           FANNING SOFTWARE CONSULTING
           David Fanning, Ph.D.
           2642 Bradbury Court
           Fort Collins, CO 80521 USA
           Phone: 970-221-0438
           E-mail: davidf@dfanning.com
           Coyote's Guide to IDL Programming: http://www.dfanning.com
    
     CATEGORY:
           Utilities.
    
     CALLING SEQUENCE:
           UNDEFINE, variable
    
     REQUIRED INPUTS:
           variable: The variable to be deleted.
    
     SIDE EFFECTS:
           The variable no longer exists.
    
     EXAMPLE:
           To delete the variable "info", type:
    
            IDL> Undefine, info
    
     MODIFICATION HISTORY:
           Written by David Fanning, 8 June 97, from an original program
           given to me by Andrew Cool, DSTO, Adelaide, Australia.
           Simplified program so you can pass it an undefined variable. :-) 17 May 2000. DWF
    

    (See ../pfidl/pfidl_1d/undefine.pro)


    USERQSINIT

    [Previous Routine] [Next Routine] [List of Routines]
      Initialize default conductor/grad parameters and the plot orientation
      format: this routine is called by the QS/PFIDL procedures
             Each user can put his own version of this routine in his own 
             procedure library and uncomment the lines he wishes.
             The present version sets the following parameters.
      use: cp /opt/rsi/pfidl/pfidl/pfidl_1d/userqsinit.pro {local directory}
    
         transdefault - interchange x and y axis in field plots
         load default color tables default values are 
              loadxyct
         concolor - store the default color for conductors 
         conthick - store the default thickness for conductors
         grdcolor - store the default color for grids
         grdthick - store the default thickness for grids
         fldcolor - store the default color for field plots (PLOTFLD)
         directorypage - store the default page size for scroll directory (DIRP)
         directoryhelp - store the default for directory help window
         oldpath  - the default path for PICKFILE
         oldfilter - the default filter for PICKFILE
    

    (See ../pfidl/pfidl_1d/userqsinit.pro)


    VELOC

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           VELOC
    
     PURPOSE:
           Return the velocity of a particle from its kinetic energy
           See: ENERG for energy from velocity.
    
     CALLING SEQUENCE:
           VELOCITY = VELOC(Energy [, MASS] [, /RELATIVISTIC]
                           [, /PROTON] [, /DEUTERON] 
                           [, /ELECTRON] [, /NEUTRON])
    
     OUTPUT:
           VELOCITY: Particle velocity (meters/second)
     INPUTS:
           Energy:	  Particle kinetic energy in eV or an array of energies. 
           MASS:     Particle mass in AMU.
                     1 AMU = 1.66053873e-27 kg
                             931494013 eV (Energy equivalent)
                     DEFAULT: Mass = 1
     KEYWORD PARAMETERS:
           RELATIVISTIC: If set, use relativistic calculation.
                         Generally if ENERGY is less than 1e-6 of rest mass,
                         classical calculations are used.
                         (Beta (= V/C) less than 0.001414)
       NOTE: The following keywords are NOT checked if MASS is present.
           Once a keyword is found, further checking is stopped.
           PROTON:   If set, assume a proton - MASS = 1.00727646688D0
           DEUTERON: If set, assume a deuteron - MASS = 2.01355321271D0
           NEUTRON:  If set, assume a neutron - MASS = 1.00866491578D0
           ELECTRON: If set, assume an electron - MASS = 5.485799110D-4
    
     OUTPUTS:
           Particle velocity for the specified energies.
    
     RESTRICTIONS:
           Energies should be greater than 0.0.
    
     PROCEDURE:
           The velocity is calculated using
          For: ENERGY < 1e-6*MASS(eV)
             Velocity = SQRT(ENERGY *2*1.602176462d-19/MASS(kg))
          For: ENERGY >  1e-6*MASS(eV)
             Velocity = SQRT((MASS(eV)+ MASS(eV)+ Energy)*ENERGY)/(1.0+ENERGY/MASS(eV))/MASS(eV)*SOL()
    
             The Momentum, P, is equal to Gamma*Beta*Mass
             Where Gamma = (Energy+MASS)/MASS
                   Beta = Velocity/(Speed of Light)
                   
             These equations use:
                Mass = 1.66053873 kg/AMU
                     = 931.494013D6 eV/AMU
    
     EXAMPLE:
          Print the velocity of a neutron with an energy of 2.45 Mev
            print, VELOC(2.45e6, /n)
    
          Make a waveform array in 22 with velocity vs energy for protons.
            ener = 10^(findgen(121)/20)
            v = VELOC(ENER, /P)
            i2w, ener, v, 22, /xydata, clab = 'Velocity vs Energy', $
               xlab = 'Energy (eV)', ylab = 'Velocity (m/s)'
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, Jr., April 10, 2007
    

    (See ../pfidl/pfidl_1d/veloc.pro)


    W132

    [Previous Routine] [Next Routine] [List of Routines]
        set screen width to 132 characters
        Format: w132
        NOTE: Must be in an xterm with 80/132 switching enabled
        Example:
          Set screen to 132 characters
          w132
    

    (See ../pfidl/pfidl_1d/w132.pro)


    W2I

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           W2I
    
     PURPOSE:
           Convert a WDF array to IDL arrays: X and Y
            or 
           Convert a WDF array to an IDL Structure
    
     CATEGORY:
           Utility
    
     CALLING SEQUENCE:
           W2I, X, Y, N
           or
           W2I, ARRAY, N
           or 
           W2I, STR, N, /STRUCTURE
    
     INPUTS:
           N:      WDF array number,
                   N must be between 1 and MaxWDFarray.
    
     OUTPUTS:
           X:      IDL array variable with X-axis values
           Y:      IDL array variable with Y-axis values
           ARRAY:  IDL array of the form [X0, DX, Yarray]
           STR:    IDL structure variable
                   
    
     KEYWORD OUTPUT PARAMETERS:
           STRUCTURE: If set, all other keywords are ignored.
                      If the number of points is zero, then zeros will be
                      returned for all structure labels.
                      No error will be sent unless N is out of range.
                      Structure labels are:
                      type    - 6 type for WDF arrays
                      ndim    - 1 dimension
                      block   - 1 Number of blocks
                      range   - 2 element array with the minimum and maximum
                                abscissa values
                      yrange  - 2 element array with the minimum and maximum
                                ordinate values
                      np      - number of points
                                zero indicates no data in this array
                      x0      - Initial point 
                      dx      - Spacing for uniform data; -1 for x-y data
                      x       - Abscissa values
                      y       - Ordinate values
                      xlab   - Abscissa label
                      ylab   - Ordinate label
                      file    - File from which the data originated
                      clab    - Dataset comment label
                      tlab    - Dataset type label
    
           CLABEL:  Returns WDF dataset comment or title
           XLABEL:  Returns WDF dataset X-axis label
           YLABEL:  Returns WDF dataset Y-axis label
           FILE:    Returns the name of the file for these dataset values
    
     RESTRICTIONS:
           WDF array must be defined and have valid data unless the 
           keyword, STRUCTURE, is set. 
    
     PROCEDURE:
           X and Y values are returned for WDF dataset N
           or a stucture is returned.
    
     EXAMPLE:
           Convert WDF dataset 2 to arrays: RADIUS and TIME.  Save the dataset 
           axis labels in TLAB and RLAB.
                   W2I, TIME, RADIUS, Xlab = TLAB, Ylab= RLAB, 2
           Get all the information about waveform array 23.
                   w2i, str, 23 , /s
     
     MODIFICATION HISTORY:
          Original version, L. P. Mix, May 15, 1992
          Added structure keyword, 12/15/94
          Added array variable, 4/21/97
    
    

    (See ../pfidl/pfidl_1d/w2i.pro)


    W80

    [Previous Routine] [Next Routine] [List of Routines]
        set screen width to 80 characters
        Format: w80
        NOTE: Must be in an xterm with 80/132 switching enabled
        Example:
          Set screen to 80 characters
          w80
    

    (See ../pfidl/pfidl_1d/w80.pro)


    WDCOMMENT

    [Previous Routine] [Next Routine] [List of Routines]
      This function returns the WDF comment for an array. 
      Format:  com = WDCOMMENT(WDF)
      where:
        WDF - Valid WDF array number or an array numbers.
      Example:
        Print the comment label for array 5
          Print, wdcomment(5)
        Add the shot number to a comment of array 3, where shot number is SHOT.
          cha, 3, c= wdcomment(3)+', Shot '+strtrim(shot, 2)
    
    

    (See ../pfidl/pfidl_1d/wdcomment.pro)


    WDEDIT

    [Previous Routine] [Next Routine] [List of Routines]
      Edit a WDF array shape by adding or deleting points.  A reference
      dataset can be plotted over the curve being edited.  The editing is
      interactive using the cursor.
      Format:  WDEDIT, wd1 [, wd2]  [, OVER = wd3] 
      where:
        wd1, wd2 - WDF array numbers
                   if wd2 is present, the final curve is stored in wd2
                   otherwise the result is stored in wd1
        wd3 - WDF array number of the curve to be plotted over wd1 
      KEYWORDS:
        X/Ysize  - size of the graphics screen
        CLABEL   - Comment label -  Default = WDF1 comment label
        XLABEL   - X label -  Default = WDF1 X label
        YLABEL   - Y label -  Default = WDF1 Y label
        FILE     - File -  Default = WDF1 file
        XLOG, YLOG - for a log X or Y axis.
                   If less than 1 then the range of x or y will be limited
                   to xlog*max(x) and/or ylog*max(y)
                   If /ylog or /xlog is used then minimum is 1e-4* max(value)
      Examples:
        Edit data points in array 2 and return the data to array 2
          WDedit, 2
        Edit data points in array 2 and return the data to array 3;
        use array 1 as a reference
          WDedit, 2, 3, 1
    
        Edit Waveform 6 and store the result in 6 but append " - Modified"
          to the dataset comment.
          WDEDIT, 6, c = wdcomment(6)+ ' - Modified'
    

    (See ../pfidl/pfidl_1d/wdedit.pro)


    WDERR

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           WDERR
    
     PURPOSE:
    	Plot error bars over a previously drawn plot.
           Note: get_maxwdf() is used as a work array.
    
     CALLING SEQUENCE:
           WDERR, WDdata, relative = rel_err
           WDERR, WDdata, WDerror
    
    	WDERR, WDdata, WDLow, WDHigh
    
     INPUTS:
           WDdata  WDF array number of the data curve
           WDerror WDF array number of the error curve
                   Error bars extend from (WDdata-WDerror) to (WDdata+WDerror)
           WDLow:  Negative error estimate for the data
           WDHigh: Positive error estimate for the data
                   Error bars extend from (WDdata-WDLow) to (WDdata+WDHigh)
    
     KEYWORD Parameters:
    	WIDTH:  The width of the error bars.  The default is 1% of plot width.
           NPOINTS:Number of error bars. Default is 18 (see DELTA)
           MATCH:  Match the points in WDdata
           DELTA:  Spacing of the error bars.  If npoints is greater than zero,
                   then delta will be calculated from NPOINTS.  If NPOINTS is 
                   undefined or <= 0 then DELTA will be used as the spacing.
                   If DELTA is larger than the range of the data then it is set to 0.
                   If DELTA is undefined or 0.0 then 18 error bars will be generated.
                   Note: DELTA is secondary to NPOINTS.  If NPOINTS is provided, 
                   then DELTA is ignored.
           RELATIVE: If set, then WDerror, WDLow, and WDHigh are considered to be
                   the relative error if these parameters are defined.
                   Error bars extend from WDdata*(1.0-WDerror)) to 
                                          (WDdata*(1.0+WDerror))
              or
                   Error bars extend from (WDdata*(1.0-WDLow)) to 
                                          (WDdata*(1.0+WDHigh))
              or   If there is only 1 parameter then:
                   If RELATIVE is between 0 and 1, then a constant error 
                     equal to RELATIVE will be used.
                     Error bars extend from (WDdata*(1.0-RELATIVE)) to
                                            (WDdata*(1.0+RELATIVE))
           SETDEFAULT     If set, values of NPOINTS and WIDTH will be saved.
                          NOTE: Save value of WIDTH = abs(WIDTH)
                          NOTE: Save value of NPOINTS = abs(NPOINTS) > 1
           SHOWDEFAULT    If set, show default values of NPOINTS and WIDTH
           XERROR: Draw Horizontal error bars with from X-Xerror to X+Xerror
           WDXerror: This is a WDF array number or a search string used to 
                     determine XERROR as a function of X.  
                     If two values are specified, the first is used for the negative
                     XERROR and the second as the positive XERROR.
                     Horizontal error bars are drawn using the current value of 
                     in WDXERROR from X-Xerror to X+Xerror.
               Note: This keyword is ignored if XERROR is not zero
           _EXTRA: Any valid keyword in call to OPLOT
                   
    
     OUTPUTS:
    	None.
    
     SIDE EFFECTS:
    	An overplot is produced.
           Last WDF array is used as a work array.
    
     EXAMPLES:
    	To plot symmetrical error bars where for WDF array 3 using error 
             estimates in WDF array 4.
               plo, 3               ; plot the data
               wderr, 3, 4        ; overplot the error bars
    
           To plot error bars using Y-errors from WDF array 61 and X-errors
             from WDF array 51 on waveform in WDF 9
                plo, 9
                wderr, 9, 61, WDXerror = 51
    
     MODIFICATION HISTORY:
           Original version, January 29, 1998
             Based on IDL routine ERRPLOT
    

    (See ../pfidl/pfidl_1d/wderr.pro)


    WDFIT

    [Previous Routine] [Next Routine] [List of Routines]
      Fit a WDF array to a polynomial using the IDL user function, SVDFIT.
      Format:  WDFIT, wd1 [, wd2] [, degree = degree] [, WEIGHT =weight]
                        [, COEF =coef], [, XTYPE = xtype] [, YTYPE = ytype]
                        [, DOUBLE = double] [, QUIET = quiet] [, PLOT = plot]
                        [, SDR = sd] [, SDA = sda] [, RSQUARED = rsquared]
      Note: Relative standard deviation is sqrt((y -yfit)^2/(np-1))/max(abs(y))
            where yfit is the fitted y value and np is the number of points
      Note: GET_MAXWDF() is used as a work array if plot is set
      where:
        wd1, wd2 - WDF array numbers
                   if wd2 is present, the final curve is stored in wd2
                   otherwise the result is stored in wd1
        degree   - the degree of the polynomial fit -- default value is 1
                   i.e. a linear fit (NOTE: for the average value (degree =0)
                   use the AVE routine)
        weight   - optional weight array for the points -- default is 1
        coef     - coef of the polynominal
        X[Y]type - If present and not zero, then a log fit in the X[Y] direction
                   is performed.  Only points greater than zero will be used in 
                   the log direction.
        plot     - If present and not zero, a plot of the fit is performed.
                   Default is plot = 0
        quiet    - If present and not zero, no output will be sent.
                   Default is quiet = 0
        double   - If set to zero then the calculation will be done in single
                   precision.  Default is double precision.
        SDR      - Relative standard deviation
      Note: Relative standard deviation is sqrt((y -yfit)^2/(np-1))/max(abs(y))
            where yfit is the fitted y value and np is the number of points
        SDA      - Absolute standard deviation
      Note: Absolute standard deviation is sqrt((y -yfit)^2/(np-1))
            where yfit is the fitted y value and np is the number of points
        RSQUARED - Correlation coefficient R^2 defined for a linear fit as:
                   Rsquared = (coef[0]*total(y)+coef[1]*total(x*y)- $
                     (total(y)^2)/np) /(total(y*y)-(total(y)^2)/np)
                   where np is the number of x-y points
                   If not a linear fit then RSQUARED = 1
    
      Examples:
        Fit data points in array 2 with a linear fit; return the data to array 2
          WDfit, 2
    
        Fit data points in array 2 to a polynomial of the form y = c(j)*x^j 
           where j goes from 0 to 3 and return the data to array 3;
          WDfit, 2, 3, d= 3
    

    (See ../pfidl/pfidl_1d/wdfit.pro)


    WDFIT3

    [Previous Routine] [Next Routine] [List of Routines]
      Fit a WDF array to a polynomial using the IDL user function, SVDFIT.
      Up to 3 different polynomials may be used. 
      Calculated fit is stored in a WDF array and , optionally, written to a file.
      Note: Scale_regrid, with default parametes, is used to calculate values.
    
      Format:  WDFIT3, wd1 [, wd2] [, /YLOG] [, /YTYPE] [, VALID = valid]
                       [, FUDGE = fudge] [, /Exact_Range] [, XYDATA = xydatain]
                       [, Zoom_Cursor = zoom_cursor] [, YRANGE = yrange]
      where:
        wd1, wd2 - WDF array numbers
                   if wd2 is present, the final curve is stored in wd2
                   otherwise the result is stored in MAXWDFARRAY.
        Ytype    - If present and not zero, then a log fit in the Y direction
                   is performed.  Only points greater than zero will be used in 
                   the log direction.
        YLog     - Same as ytype.
        VALID    - Domain of validity for the fit.
                   Default: valid = [minimum, maximum]+[-1, 1]*delx
                     where delx = 0.02*(maximum-minimum)
        Exact_Range - If set VALID = [minimum, maximum]
        Fudge    - 2 element vector sent to scale_regrid (see PFIDL2/scale_regrid)
                   Used to insure that the fitted function is continuous
                   Default values are .05 of VALID
        XYDATA   - If set to zero or a negative number, the data will be 
                   interpolated to a uniform grid i fit is X-Y data.
                   If XYDATA is negative then XYDATA is the number of points in
                   the linear interpolation.  Default: NPOINT = 1024
                   Default:  XYDATA = 1, use exact data points
        Zoom_Cursor - If set ZOOMW will be used to select the break point if 
                      the cursor is used.
                      DEFAULT: ZOOM_CURSOR=1
        YRANGE   - If two values, these will be the default YRANGE for the plot.
    
      Discussion:
           The first execution of the command will be performed with:
             Number of Breaks = 2
             Break Points =[ Minimum + range/16, Maximum - range/16]
                           where range = maximum-minimum
             Degree =[ 2, 5, 3]
           In the case of a singular value degree will automatically be reduced to
           obtain a fit.
           Current version adds a minimum of one point past the break point
             and will add two points if it is within 1/16 of the domain of the fit.
    
      Examples:
    
        Fit data points in array 2 to a polynomial multiple polynomials.
        Save the fit in array 3.
          WDfit3, 2, 3
    

    (See ../pfidl/pfidl_1d/wdfit3.pro)


    WDINFO

    [Previous Routine] [Next Routine] [List of Routines]
      This function returns the stored infomation about a WDF array. 
    
      Format:  WDINFO, WDFin [, WDF = WDF] [, NWDF = nwdf]
               [, COMMENT = comment] [, NPOINTS = npoint]
               [, XLABEL = xlabel] [, YLABEL = ylabel]
               [, XMIN = xmin] [, YMIN = ymin]
               [, XMAX = xmax] [, YMAX = ymax]
               [, DX = dx] [, FILE = file]
      where:
        WDFin - Valid WDF array number or an array numbers, or a search string.
                Note:  WDF = wdvalid(WDFIN, /valid)
        WDF   - Waveform array numbers for the data
                Note:  WDF = wdvalid(WDFIN, /valid)
        NWDF  - Number of waveform array numbers
        COMMENT - Dataset Comments for the waveform arrays
        NPOINTS - Number of data values in the WDF array
        XLABEL- Abscissa label
        YLABEL- Ordinate label
        XMIN  - Minimum abscissa value
        XMAX  - Maximum abscissa value
        YMIN  - Minimum ordinate value
        YMAX  - Maximum ordinate value
        DX    - DX value for uniform data.
                DX = 0, for Nonuniform Data
        FILE  - File from which the data came
        
    
      Example:
        Obtain the file name for wdf 5 and store in variable: FILENAME.
          WDINFO, 5, FILE = FILENAME
    
    

    (See ../pfidl/pfidl_1d/wdinfo.pro)


    WDSPLIT

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
    	WDSPLIT
    
     PURPOSE:
           Split a waveform into two parts. Either an exponential or a 
           linear ramp can be selected. The start point and the 
             a. Zero point for a linear ramp.
             b. Exp(-3) point for an exponential
           is selected. The remainder is the difference between the original 
           waveform and the first part. 
        Note: Breaks occur only at existing X-values.
    
     CALLING SEQUENCE:
    	WDSPLIT, WDF [, _EXTRA= extrastuff]
     or    WDSPLIT, WDF, WDF2 [, _EXTRA= extrastuff]
     or    WDSPLIT, WDF, WDF1, WDF2 [, _EXTRA= extrastuff]
    
      where:
           WDF   Waveform array which is to be split
           WDF1  Storage location for First Half of WDF
                 Default location is to replace WDF
           WDF2  Storage location for Second Half of WDF
                 Default location is WDF +1
      KeyWords:
           X/YSize: Size of the graphics window
           LCTYP Type of fit: 0= Linear, 1= Exponential
           Any keywords use by the PLO command.
      Note:
           Mouse buttons are mapped to widget buttons, cursor must be in the
             DRAW area of the main widget for the following mouse commands.
              Left Button   = Set Value
                  Note: A carriage return in the data field will also set the value.
              Middle Button = Accept/Save
                 (current designated lineout will be saved)
              Right Button  = Reset All Points
                 (All points will be undesignated)
              Note: If a the last point required to define a curve is selected
                    more than once, the previous "last point" is replaced.
           Set Point Buttons: These perform the same function as a  in either
                              the X or Y windows above the buttons.
    
     EXAMPLE:
    	Split array 60 and put the parts in 60 and 61.
             WDSPLIT, 60
    
           Split array 40 and put the parts in 40 and 50
             WDSPLIT, 40, 50
    
           Split array 45 and put the first and second halves in 50 and 60
           Do not change 45 and plot only the range [30, 90].
             WDSPLIT, 45, 50, 60, xrange = [30, 90]
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, January 3, 1997
    

    (See ../pfidl/pfidl_1d/wdsplit.pro)


    WDVALID

    [Previous Routine] [Next Routine] [List of Routines]
     Name: WDVALID
    
     NOTE: VALID is a flag to determine the mode of this routine.
    
         If keyword(valid) is not set.
         This function returns an array of valid WDF array numbers.
         Minimum , maximum and a search string can be specified.
         
     or
         If keyword(valid) is set.
         This function returns an array of valid WDF array numbers
         from a proposed array of numbers or a string.
    
    
     Format:
       array = WDVALID([STRING] , [Maximum = maximum] [,Miminum = minimum]
               [,Npoint = npoint] [,case_sensitive = case_sensitive])
               [, VALID = valid] [, QUIET = quiet]
    
       where:
        IF VALID is zero or omitted:
             STRING is a search string. Leading and trailing blanks are ignored.
                    String may be a number. This routine uses:
                           str = strtrim(string(0), 2)
                      where str is the actual search string
                      For example s = wdvalid(180) will return 
                       a wdf array with a comment of 'BDOT_180'
                    If missing, all valid arrays are returned.
             Minimum is the minimum value desired, Default = 1
             Maximum is the maximum value desired, Default = maxwdfarray
               Maximum  and minimum are sorted.
             Npoint is the number of values returned.
             Case_sensitive if set makes the search case sensitive.
             CAUTION: CASE is a special word so use /c or /ca or /cas or /case_
                      or more letters but /case will give an error.
        IF VALID is not zero:
             STRING  - an array of possible WDF arrays.
                       Must be a byte, integer, long or a float variable.
                       Floats are converted to LONG using ROUND
                       See GET_MATCH for wild card options
                       A search string.
                         If an array, only the first element is used.
             NPOINT  - the number of values returned.
             QUIET   - if set, not output will be generated.
                       if not set, messages will be printed if STRING contains
                         invalid wdf arrays.
                        Messages of the form if VALID is a string:
                       "% "+STRTRIM(VALID, 2)+": "+ message
                  or   "% INVALID WDF: " + message
               where message =
                    WDF array number is UNDEFINED
             or     WDF array must be a byte, integer, long, or float value 
             or     WDF array number must be greater than 0 and 

    (See ../pfidl/pfidl_1d/wdvalid.pro)


    WHATSNEW

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
    	WHATSNEW
    
     PURPOSE:
    	Provides an acrobat interface to the Whats New file.
    
     CATEGORY:
    	Help documentation
     FORMAT:
           WhatsNew
    
     COMMON BLOCKS:
    	None.
     MODIFICATION HISTORY:
           Original version July 5, 2001
    

    (See ../pfidl/pfidl_1d/whatsnew.pro)


    WHATS_NEW

    [Previous Routine] [Next Routine] [List of Routines]
      Purpose:
              Print new features of IDL and PFIDL
      Format: 
              whats_new
    

    (See ../pfidl/pfidl_1d/whats_new.pro)


    WHELP

    [Previous Routine] [Next Routine] [List of Routines]
      Lists the dataset comments for each of the WDF arrays. 
      Format: WHELP [, wda_min] [, wda_max]  [, NPOINT = npoint] [,/FULL]
                    [, /COMMENT] [, /FILE] [, /STATISTICS]
      where:
        WDA_MIN- Indicates the first wdf array to be listed
                 WDA_MIN may be an array 
             or
                 If a single parameter, WDA_MIN can be a search string.
                 Those arrays containing the string in the dataset comment will
                   be listed. If the first character is '^' then the comment must
                   begin with the following letters letters.
                   If string length is 1 then '^' will be taken as a search string.
           Note: Only WDF arrays containing data will be printed.
           Note: FULL = 0 if WDA_MIN is a string
        WDA_MAX- Indicates the last wdf array to be listed
                 If wmax is le 0 then wmax = maxwdfarray
        NPOINT - Indicates the number of points to be printed with a full listing
                 Default is 0.  If NPOINT is less than zero, all points will
                 be listed.  If NPOINT is greater than zero, NPOINT points will
                 be listed.  If NPOINT is specified, then FULL = 1.
        FULL   - Indicates the full array information is to be printed if
                 present and not zero.
                 If NPOINT is specified, then FULL = 1
                 If STATISTICS is specified, then FULL = 1
        STATISTICS - Statistical values on the Y- Values
                 (see STATS)
        FILE   - If set, file information will be printed.
        Comment- If set, full comment will be printed. ';' or ';;'will be taken as a
                 carriage return. If comment is set, then full = 0.
                 Note: If one instance of ';;' is found that will be the delimiter
                       for the remainder of the line.
         Note: If wmax is missing, default is FULL = 1 unless COMMENT is set.
               If wmax is present, default is FULL = 0
      Examples: 
      Print a directory of the dataset comments for all the WDF arrays
          whelp 
      Print a full listing of the WDF array values for arrays 1 thru 3
          whelp, [1, 2, 3]
     (or) whelp, 1, 3, /fu
     (or) whelp, 1, 3, n=0 (prints no data values only the range of data)
    
      List all datasets with 'MOCAM' in the dataset comments.
          whelp, 'mocam'
    

    (See ../pfidl/pfidl_1d/whelp.pro)


    WHICH

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           WHICH
    
     PURPOSE:
           Shows source for a compiled routine.
           If routine is not compiled, a message will be printed.
     CATEGORY:
           UTILITY 
     CALLING SEQUENCE:
           WHICH [, SPEC][, OUTPUT = output] [, NOUTPUT = noutput] [/FULL] [, /QUIET]
     OPTIONAL PARMAETERS
           SPEC    - Name of a compiled procedure or an array of names.
                     If SPEC is missing, a blank or a null string, $
                        the source of all routines will be shown
                     (See Get_Match for search techniques.)
     KEYWORDS:
           OUTPUT  - Variable to receive the output from the WHICH command.
           NOUTPUT - Number of lines of output.
             Note: This is more than the number of routines if SPEC is not defined.
           FULL    - Passed to IDL HELP to obtain hidden procedures
           QUIET   - If set, no output.  Keyword OUTPUT must be used.
     OUTPUTS:
           Source file name for routines which match SPEC.
     EXAMPLES:
           Show the source files for currently compiled routines
                 WHICH
             WHICH, ''
    
           Show all source files files which begin with PLO.
                 WHICH , '^PLO'
           Show all source files files which end with PLO.
                 WHICH , 'PLO$'
    
     MODIFICATION HISTORY:
          Original version, L. P. Mix, December 3, 2001
    

    (See ../pfidl/pfidl_1d/which.pro)


    WIN

    [Previous Routine] [Next Routine] [List of Routines]
      Limit the extent of a dataset.  The cursor is used to indicate the 
      desired initial and finals values of the abscissa;  therefore, a curve
      with relevant abscissa values must be plotted before a window command 
      can be issued.  This command is similar to the LIM command, except the
      cursor is used to designate the domain of the array.
      Format:  WIN, WD1 [, START]  [,STOP]
      where:
        wd1 - WDF array number
        start - initial abscissa value
        stop - final abscissa value
      Example:
      Window array 1  using the cursor.
        win, 1
      Window arrays 2 through 10 to the same domain (requires two commands.)
        win, 2, beg, last 
        lim, 3+indgen(8), beg, last
    

    (See ../pfidl/pfidl_1d/win.pro)


    WRIASC

    [Previous Routine] [Next Routine] [List of Routines]
        Write a number of WDF arrays to an ascii file or idl arrays
        File format is determined by the user.
        The arrays are limited to the region of overlap and put on an common 
           time base using the minimum point spacing of the arrays.
        format is:  WRIASC, fname, WDF [, narray] [, formatout=format]
                        [, XOUT = xout] [, YOUT = yout] [, INTERNAL = internal]
                        [, NPOINT = npoint] [/VIDA] [, /KEEP_X]
                        [, DELIMITER = delimiter] [, XYDATA = xydata]
                        [, APPEND = append] [, ERROR_KEEP = error_keep]
                        [, MISSING = missing]
        where
          fname   - the file name 
                    If fname = 0 then fname ='PFIDLdefault.dat'
          WDF     - First WDF array or an array of WDF arrays
                    WDF may be a single search string, or 
                    WDF be a single value or an array of WDF values
          narray  - the number of arrays to be written to the file
                    if present and greater than 0 then WDF(0) and then next
                    narray-1 datasets will be written to a file
          formatout - output format of the data
                  0  only data values in the file
                  1  number of points followed by data values
                  2  Narray labels followed by data values
                  3  (DEFAULT) number of points followed by narray labels 
                     then data values
                  4  EXCEL spreadsheet  
                     NARRAY+1 labels are written on the first line.
                     x value followed by narray Y values are on the following lines
                  5  VIDA - Only 1 waveform may be output
          xout, yout - X and Y values written to the file 
          xydata   - indicates that the data is not to be writen as a wdf array
                     Note: Only one array can be written. NPOINT is ignored.
                       DEFAULT = 1     If only one array is written
                                 0     Otherwise
           NOTE:  Use KEEP_X to write multiple arrays with the X values of the
                  first dataset
          VIDA     - If set, Formatout is set to 5
          internal - if present and not zero, the x and y values will be put into
                     arrays xout and yout only and no file will be written.
          npoint   - maximum number of points to be output per waveform
                     Npoint must be greater than 3 
                     If n_elements(wdf) = 1 and narray is missing or 1 then
                       WDF will not be put on a uniform time base.
                     Default = 4096
          delimiter- character string delimiter between output values 
                     Default= ' '
          keep_x   - If set, WRIASC will keep only x values which are the same 
                     as the first dataset.  Data will be written as XY data.
                     If data does not match, a warning will be issued but output 
                     will continue.  If points vary by less than ERROR_KEEP of the
                     spacing, they will be considered equal.
                     Matching details if keep_X is positive:
                     1-If the number of points are the same, the difference in the 
                       X-arrays is compared to the error_keep value.  If all of the 
                       values are the considered equal, the processing continues.
                     2-If the number of points are different or if some of the X arrays
                       do not match, then the following steps are performed:
                         The initial X array is sorted
                         The current X array is limited to the domain of the initial array
                         The current X array is matched to the first and all values within 
                           error_keep are stored
                         In the case of multiple values Y-values at the same X-value, the 
                           last value is the one written to the file.
                     Matching details if keep_X is negative:
                     1-If the number of points are the same, the difference in the
                       X-arrays is compared to the error_keep value.  If all of the
                       values are the considered equal, the processing continues.
                     2-If the number of points are different or if some of the X arrays
                       do not match, then the ordinates of the second array will be 
                       linearly interpolated to the values in the first array.  Missing
                       values will be set to "MISSING".
          MISSING  - If keep_x is set missing values will be set to this value.
                     Default:  Missing = -99999.00
          error_keep - Acceptable difference in X values if KEEP_X is set.
                     Actual error for each point is (dx*error_keep) where
                       dx is the absolute difference between successive x values.
                     Default:  ERROR_KEEP = 0.08
          append   - If set, the file will be opened to append
        Example:
        Write 5 arrays into file 'PFIDLdefault.dat' from  WDF arrays 
        2,3,4,5,6.  Assume data format 3.
           WRIASC, 0, 2, 5 
       WRIASC, 0, [2,3,4,5,6]
        Write 3 arrays to file, 'testdata' from  WDF arrays 3, 6, 9. Assume 
        data format to have no header but only 4 columns of data.
           WRIASC , 'testdata', [3,6,9], form = 0
    
        Put arrays 3, 4, 5 on a common time base and put the amplitudes into AMP
        and the times into TIME
           WRIASC, 0, [3,4,5], x= time, y = amp, /internal
    

    (See ../pfidl/pfidl_1d/wriasc.pro)


    WRITEHDF

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           WRITEHDF
    
     PURPOSE:
           Write XDAMP formatted HDF files.
           This routine is based on the copyrighted xdamp procedure, XI_savefile,
             written by William P. Ballard as part of the Xdamp package.
             Ref. SAND98-0907, Version 3.123
    
     CALLING SEQUENCE:
           Format:
             WRITEHDF [, FILENAME] [, WDF = WDF] [, STRUCTURE = structure]
               [, TITLE = title] [, HEADER = header] [, NOTES = notes]
               [, NWDF = nwdf] [, NSTR = nstr] [, HELP = help] [, IERROR = ierror]
               [, OUTFILE = outfile] [, AUDIT = audit] [, /batch]
    
     OPTIONAL INPUTS:
           FILENAME - Name of the HDF file to be opened.
                      The default file extension is ".hdf"  
                      If the specified file does not have an extension, this 
                      extension will be added to the filename.
                      If file is omitted or undefined or is not a string,
                      the current directory will be the name of the file.
                      A unique name will be selected.
    	
     KEYWORD PARAMETERS:
           WDF     - An array of WDF array numbers or a search string for the 
                     waveforms to be saved to the HDF file.
                     WDF = 0 indicates no waveforms to be written
                     Default = '*' 
           STRUCTURE - An array of structure array numbers or a search string for
                     the images to be saved to the HDF file.
                     Structure = 0 indicates no images to be written
                     Default = '*'
           TITLE   - Shot title
           DATE    - Shot date
           HEADER  - Shot header information; may be a string array.
           NOTES   - Shot notes if they are available; may be a string array.
           NWDF    - Number of waveforms written
           NSTR    - Number of images written
           HELP    - If set, a help message is printed.
           IERROR  - Returns zero if no error.
           OUTFILE - Output file name
           AUDIT   - String array to be written with each waveform
                     One element of the array is written with each waveform.
                     If the number of elements in AUDIT is less than the number of 
                     waveforms, then the audit will be be value be defined by the 
                     following:
                       audit[i]= audit[ i mod n_elements(audit)]
                     If AUDIT is undefined, the file name for the waveform will be 
                     written.
                     In the case of structures, the file name will always be written.
           BATCH   - If set, no widgets will be used
    
    
     OUTPUTS:
           Data will be written to a HDF file
    
     PROCEDURE:
           This is a modified version of the XDAMP procedure XI_savefile.
    
     EXAMPLE:
           Write all data to the file example.hdf.
             WRITEHDF, 'example.hdf'
    
           Write all waveforms beginning with 'ip' to a file of the same name as
           the current directory.
             WRITEHDF, '^ip', str =0
    
     MODIFICATION HISTORY:
     	Written by:     L. P. Mix, May 14, 2002
                      based on routine by W. P. Ballard.
    

    (See ../pfidl/pfidl_1d/writehdf.pro)


    WRITETK

    [Previous Routine] [Next Routine] [List of Routines]
        write a tkdas data file
         Format consists of tab delimited columns of the form:
         Note: Each Title may not have spaces in this version.
      title
      t0
      delta_t
      Npoints
      y1  (at t0)
      y2
      y3
      .
      .
      .
      yN (at t0+(N-1)*delta_t)
    
       format is:  writetk , fname , WDF [, narray]
        where 
          fname   - the file name
                    if a file name then the file is opened and closed at the end
          NOTE: If only one parameter is given and the parameter is a number, 
                then ReadTK assumes that it is a WDF number.
          WDF     - WDF array number or an array of numbers.
                    Default is 1  
                    If WDF is less than 0 and n_elements(data) > 0 then no WDF
                      arrays will be stored.
          Narray  - If WDF is a single number then Narray total arrays will be 
                    written beginning with WDF.
     EXAMPLES:
        Write a TKDAS file with arrays [2, 3, 4, 5, 6] to data.dat
           writeTK, 'data.dat', 2, 5 
       or  WRITETK, 'data.dat', [2, 3, 4, 5, 6]
    
           ORIGINAL version: April 8, 1997
    

    (See ../pfidl/pfidl_1d/writetk.pro)


    X2PS

    [Previous Routine] [Next Routine] [List of Routines]
       switch to postscript file for output
    
       format: x2ps
            sets the output device to postscript
            File must have been opened with STARTPOST
    

    (See ../pfidl/pfidl_1d/x2ps.pro)


    XCUR

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
    	XCUR 
    
     PURPOSE:
           Select values at a finite number of points in a window
           Procedure will continuously display the (x,y) location of the cursor
             and store the values when the mouse button is depressed.
           The full screen cursor can be set at a specific location by editing
              the displayed values of X and Y and hitting a carriage return in
              the X or Y display.
    
           Note: XCURW is a similar routine which will snap to waveform data.
                 
           Note: MX, MN, FWHM and GET_VALUE often provide the desired information
                 more accurately and quicker.
    
     CALLING SEQUENCE:
    	XCUR [, X , Y] [, dx, dy]
    
           X and Y are the values when the mouse button is depressed.
             By default, a symbol will be placed on the plot at these values.
           DX and DY are the delta values between adjacent values of X, Y
             Note: If data is sorted then dx and dy will be recalculated.
    
     KEYWORD PARAMETERS:
    	SORT:	  If present and not zero, then data will be sorted in X
                     Default is SORT = 0
           WDFARRAY: Store X and Y in a WDFarray given by WDFARRAY
                     If a valid array is not specified, then the data will be
                     stored in an empty array if one is available or in
                     MAXwdfarray if no arrays are empty.
                     Must have more than 2 points.
    	NOSYMBOL: If present and not zero, no symbols will be plotted.
    
     EXAMPLE:
    	Take values off a curve stored in waveform array 1 and plot the points
             Before plotting sort the points in abscissa values
          NOTE: XCURW will do this more efficiently.
              plo, 1
              xcur, x, y, /sort
              plot, x, y
           Note: To refine the y-values use the following:
              plo, 1
              xcur, x, y, /sort
              nel = n_elements(x)
              if nel gt 0 then for i = 0, nel-1 do y(i) = get_value(1, x(i))
              plot, x, y
    
          Take values from a visual average of arrays 1 and 2 and store the points
            in wdf array 3.
              plo, 1, 2, /ov, /nl, /ns
              xcur, /sort, wdf=3
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, October 7, 1994
    

    (See ../pfidl/pfidl_1d/xcur.pro)


    XCURW

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
    	XCURW
    
     PURPOSE:
           Select values at a finite number of points in a window from a specified
             waveform.
           Procedure will continuously display the (x,y) location of the cursor
             and store the values when the mouse button is depressed. Unless
             SNAP = 0 then the values moved to the line between the two nearest 
             points on the curve.
           The full screen cursor can be set at a specific location by editing
              the displayed values of X and Y and hitting a carriage return in
              the X or Y display.
           Note: MX, MN, FWHM and GET_VALUE often provide the desired information
                 more accurately and quicker.
    
     CALLING SEQUENCE:
    	XCURW, WDF, [, X , Y] [, dx, dy] , _extra= extrastuff
    
           WDF   Waveform array from which values to be obtained.
           X and Y are the values when the mouse button is depressed.
             By default, a symbol will be placed on the plot at these values.
           DX and DY are the delta values between adjacent values of X, Y
             Note: If data is sorted then dx and dy will be recalculated.
           extrastuff - Any keywords available for the plo command
    
     KEYWORD PARAMETERS:
           SNAP:     If present and zero, then X and Y will be actual cursor
                     positions. 
                     SNAP=1; Snap to X value of waveform at current Y.
                             If outside the range, go to minimum or maximum Y.
                     SNAP=2; Snap to Y value of waveform at current X.
                             If outside the range, go to maximum or minimum X.
                     SNAP=3; Snap to waveform 
                     SNAP=4; Snap to nearest point in the waveform.
                     Default is SNAP=3
    	SORT:	  If present and not zero, then data will be sorted in X
                     Default is SORT = 0
           WDFARRAY: Store X and Y in a WDFarray given by WDFARRAY
                     If a valid array is not specified, then the data will be 
                     stored in an empty array if one is available or in 
                     MAXwdfarray if no arrays are empty.
    	NOSYMBOL: If present and not zero, no symbols will be plotted.
           X/Ysize:  Size of the graphics window
    
     EXAMPLE:
    	Take values off a curve stored in waveform array 1 and plot the points
             Before plotting sort the points in abscissa values
              xcurw, 1, x, y, /sort
              plot, x, y
    
           Same as first example but store XY in WDF array 2
              xcurw, 1, /sort, w=2
              plo, 2
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, July 7, 1996
    

    (See ../pfidl/pfidl_1d/xcurw.pro)


    XFR

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           XFR
    
     PURPOSE:
           Copies a WDF array to another WDF array number
    
    
     CALLING SEQUENCE:
           XFR, WDF1, WDF2 [, NARRAY] [, QUIET = quiet]
    
     INPUTS:
           WDF1:   WDF array number or an array of WDF array numbers
           WDF2:   WDF array number or an array of WDF array numbers
                   If NARRAY is not present, WDF2 should have either one 
                   element or the same number of as WDF1.
                   If NARRAY is present, then WDF2, should have either one
                   element or narray elements.
                   If the number of WDF1 elements is larger than the number
                   of WDF2 elements, then sequential elements are added.
                   Copies are done exactly as specified. 
    
     OPTIONAL INPUTS:
           NARRAY:	If specified, then the input value of WDF1 is replaced
                   by the following array.
                     WDF1 = WDF1[0]+indgen(naraay)
    
                   Note:
                     XFR, 1, 2, 10 
                   will make 10 new copies of WDF array 1 in arrays 2 to 11.
    
     KEYWORDS:
           QUIET:  Informational print statements are deleted when bad data 
                   is encountered.  Bad data is ignored.
                   When no WDF arrays are copied, an informational statement 
                   will always be printed.
    
                   Bad data is where WDF1 is not a valid WDF array or 
                     where WDF2 is not a valid WDF array.  
    	
     OUTPUTS:
           The specified WDF arrays are copied to their new locations.
    
     EXAMPLE:
    	Copy WDF array 4 to array 14
             XFR, 4, 14
    
           Copy WDF arrays, 1 to 10 to WDF arrays 301, to 310
             XFR, 1, 301, 10
    
           Copy WDF arrays, 1 to 3, to arrays, 301, 401, 501
             XFR, 1, [301, 401, 501], 3
    
           Copy WDF arrays, 1, 2, 4, 5 and 7 to WDF arrays, 301 to 305.
             XFR, [1, 2, 4, 5, 7], 301
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, Jr., about 1990
    	April, 3, 2007  Added NARRAY parameter
    

    (See ../pfidl/pfidl_1d/xfr.pro)


    XPLO

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           XPLO
    
     PURPOSE:
           Plot a WDF array versus a second WDF array at the same times.
     CATEGORY:
           Input/Output
     CALLING SEQUENCE:
          XPLO, WDx , WDy, [, XRange =xrange][, YRange =yrange] [, /HEADER] 
          [, TITLE =title][, /NOGRID] [, DELTA = delta] [, FILL = fill] 
          [, PSYMBOL =symbol][, LINESTYLE =linestyle][, COLOR = color] 
          [, OUT = out] [, ENGINEERING = engineering][, /OVERPLOT] [, /NO_SORT]
          [, XTITLE = xtitle] [, YTITLE = ytitle]  [, _EXTRA = extrastuff]
     INPUTS:
           WDX, WDY:      WDF array numbers to be plotted versus each other
     KEYWORD PARAMETERS:
           COLOR     Indicates the color to be used for the curve.  If /color is 
                     present the curve will be drawn in red.
                     The colors are: red(1), green(2), blue(3),
                     magenta(4), orange(5), cyan(6), yellow(7) and white(8).
           LINESTYLE Indicates the type of line to be used.  Lines specified by
                     LINESTYLE are: solid(0), dot(1), dash(2), dot-dash(3),
                     dot-dot-dot-dash(5), and long dash(5).  Default is 0.
           /NOGRID   Indicates the curve should be plotted on the exixting grid.
                     ENGINEERING is ignored if NOGRID is set
           DELTA     Indicates a symbol is to be plotted on the curve at 
                     approximate increments given by delta.
           HEADER    If specified a plot header, consisting of the current date
                     and the current file name, is displayed in the lower left
                     corner of the plot.  See the HEADER command to set default
                     HEADER parameters (character size, spacing, alignment).
                     DEFAULT is HEADER = 1
                     NOTE: For X-windows screen dumps, many will want to increase
                          the character size with the command:
                          HEADER, /set, charsize = 0.8
                          (Default is 0.6 of current size)
           FILL      If set, a filled symbol is used.
                     (only symbols 11 to 23)
           PSYMBOL   Indicates the type of symbol to be used.  If delta is zero,
                     about 40 symbols will be plotted and lines will connect the
                     points.  Values of SYMBOL are: plus sign(1), 2 (asterisk),
                     3 (period), 4 (diamond), 5 (triangle), 6 (square), 7 ("X").
                     Default is 1.
                     USER Defined is a filled circle.
                     (If the symbol value is greater than 10 then ll will be
                     subtracted from the value and MKSYMBOL will be called.)
                     (See help on SYMBOL_LIST for a description of additional
                     symbols.)
                     Note: Symbols may also be specified as names:
                       PSYM=['sq', 'ci', 'diamond', 'clover']
                       These will be converted to numbers. [11, 12, 14, 21]
                       A null or blank string('' or '  ') will result in no symbol.
           TITLE     string to be used as the title of the plot. 
           ENGINEERING If set, maximum/minimum values will be in the interval
                     (1, 1000).  For example, if maximum is 1.0e7 volts and
                     250 e-9 sec  then the y values will be multiplied by 1e-6
                     and ' x1e6' will be added to the y label and x values
                     multiplied by 1e9 and ' x1e-9' added to the x label.
           XTITLE, YTITLE  String to be used for the X and Y axes.  
                    If ENGINEERING is set, the titles will have the scaling 
                    information attached to the label.
           XRANGE, YRANGE   two element arrays with the first element equal to the 
                    minimum and the second element, the maximum value of the 
                    x-axis and y-axis, respectively.  These values will be 
                    rounded to "nice" values unless xstyle and/or ystyle have
                    been set.
           OUT      WDF array of the cross plotted data stored as X-Y data
           OVERPLOT Plot the data using the existing grid  
                    (NOGRID is set to 1)
           NO_SORT  If data is XY then it will be sorted unless NO_SORT is set.
                    If NO_SORT is set, then delta is set to zero.
           _EXTRA
                    Any other valid parameters to the plot command in IDL
    
     OUTPUTS:
           Designated datasets are plotted.
     COMMON BLOCKS:
           COM.DAT  WDF common block 
     RESTRICTIONS:
           WDX, WDY arrays must be defined and have valid data
     PROCEDURE:
           Put WDX and WDY on a common time base and plot wdy versus wdx.
           Default axis labels is the dataset comment + the y axis label
           If delta is defined then plot a symbol at increments of 
           delta along the curve.  If symbol is defined, then plot about 40 points
           at uniform spacing along the curve
     EXAMPLES:
           Plot WDF array 2 versus WDF array 3 and put a symbol every 5 ns.
                   XPLO, 2, 3, delta = 5e-9
           Plot Density vs Temperature and save the result in wdf array 67.
               XPLO, 'Density', 'Temperature', out = 67
     MODIFICATION HISTORY:
          Original version, L. P. Mix, August 15, 1992
    

    (See ../pfidl/pfidl_1d/xplo.pro)


    XRESET

    [Previous Routine] [Next Routine] [List of Routines]
     Name: Xreset
       Function: enable the cursor keys of an xterminal
     Usage: xreset
     
     Keywords:
          Verbose:  If set will indicate:
                    '% XRESET: Resetting xterm cursor keys'
    
    

    (See ../pfidl/pfidl_1d/xreset.pro)


    ZOOMW

    [Previous Routine] [List of Routines]
     NAME:
    	ZOOMW
    
     PURPOSE:
    	Provide a easy to zoom display of waveform data.
           Note: Display will not be changed unless zoom endpoint changes by 
                 more than 3%
           Note: All inputs are the same as the PLO command.  See PLO for 
                 more details.  
    
     CATEGORY:
    	Graphics 
    
     CALLING SEQUENCE:
    
    	ZOOMW, WDA, NCurve
    
     INPUTS:
    
           WDA:      WDF array number or an array of WDF array numbers
    
     OPTIONAL INPUT:
           NCURVE:   Number of curves to be plotted.  If WDA is a single WDF 
                     array number, then WDA and the following ncurve-1 arrays
                     will be plotted.  Default = 1
    	
     KEYWORD PARAMETERS:
           BIG_CURSOR: If set a full screen cursor will be used.
                     Default: BIG_CURSOR = 0
           LIMIT:    If set, Waveforms(WDA + indgen(ncurve)) will be limited 
                     to this range of values
                     LIMIT uses the LIM command:
                     LIM, WDA + INDGEN(ncurve), zoomrange[0], zoomrange[1]
           Maxzoom:  Maximum ZOOM parameter, Default = 100 
                     A factor of 3 higher magnification is obtainable by
                     adjusting endpoints on the graph; the display will only
                     read MAXZOOM
          Zoomrange: Final value of XRANGE in the right window.
                     This value can be used with PLO to plot other 
                       data with the same abscissa values
                     If Zoomrange has two values on input, these values are the 
                       initial values of the zoom.
           X/Ysize:  Size of windows, Default is set by Dualsize
                     Minimum window size is 100 x 100
                     (See SET_DRAWSIZE in PFIDL.)
           CURSOR:   Allows a display of cursor position in the right window.  
                     A Left button press will center the right window on that 
                        X-value.
                     A RIGHT button press will save the point into the keyword
                        parameters: Xcursor and Ycursor.
                     Default: Cursor = 1
                     If cursor = 0, then this function is disabled.
                     Note: Values will still be displayed in the windows
           X/YRange: Initial values for xrange and yrange in the left plot.
           X/YCursor: These values are set with the right mouse button.
                      Values can be deleted using the delete button.  
                      Designated points are shown in both windows.
                      If both XCURSOR and YCURSOR are not valid parameters, 
                      a warning will be issued when the user attempts to save
                      a value.
           NCursor:  Number of values designated in xcursor, ycursor.
    
             Note: The following 3 keywords are processed in the following 
                   order: UNSET, SetDefault, ShowDefault
    
           Unset      : Set Cursor and Maxzoom to their default values.
                        Xsize and Ysize must be set using explicit values in
                        ZOOMW or Set_DrawSize
                        Defaults values which are set are:
                                 Cursor  = 1
                                 BIG_CURSOR = 0
                                 MaxZoom = 100
                                 Xsize   = Dualsize[0]
                                 Ysize   = Dualsize[1]
           SetDefault : Use to set the default value of Cursor, Maxzoom, Xsize
                        and Ysize
                      Note: Values in Dualsize will be changed if Xsize and Ysize
                            are set.
           Showdefault: Show current default values
    
          All other keyword parameters are the same as PLO except the following
               which are set specifically for part or all of the ZoomW command.
          Legend:	Legend position for the default plot. This is set to -1 for 
                    the Zoom image
           Header:   Used for the plot header; set to 0 for the zoom image
    	Grid:	  Set to 1
           OVER:     If Ncurve gt 1 or WDA is an array, then over = 1.
           NoGrid:   Set to zero
           XSTYLE:   Set to 1 by default for all images. Original plots will used
                     specified values of Xstyle or 1 if no value is provided
           INSTRUCTIONS:  Puts up an instruction widget.
           INSTR_OFFSET:  Location for the instruction widget
                          Default OFFSET = 0.5*[Xsize, Ysize]
     Procedure:
           Sliders allow the maximum and minimum of the Zoomed image to be set.
           or 
           Sliders allow the center point and the magnification to be set.
           or 
           The center point can be set by clicking on the original image; the
              maginifcation will be taken from the slider value.
           A right click in the right window will store the values.
    
           NOTE:  A right click in the left window will replot the curves.
    
     EXAMPLE:
           Examine the details of the data in wdf array 3.
             ZOOMW, 3
    
           Compare arrays 2, 3, 4, and 5 in detail, put the legend at relative
             positions of [0.5, 0.5]
             ZOOMW, 2, 4, /ov, leg =[.5, .5]
    
     MODIFICATION HISTORY:
     	Written by:       Paul Mix, October 10, 1994
    

    (See ../pfidl/pfidl_1d/zoomw.pro)