Extended IDL Help

  • Return to IDL Topics

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


    List of Routines


    Routine Descriptions

    D2F

    [Next Routine] [List of Routines]
     NAME:
           D2F
    
     PURPOSE:
           Converts film density to photons/micron^2 or keV/micron^2
           Density vs Energy or Density vs Wavelength is input
    
     CATEGORY:
           Analysis
    
     CALLING SEQUENCE:
    
           D2F, WDFin [, WDFout] [, FILM = film] [, TENSION = tension]
              [, ENERGY = ENERGY] [, MODIFY = modify]
    
     INPUTS:
           WDFin   Waveform array number for the input dataset
                   Unless ENERGY is set units are Density vs Wavelength(A)
           WDFout  Waveform array number for the output dataset
                   Output abscissa units are the same as the input units
                   Default: WDFout = WDFin  ; original data will be lost
    	
     KEYWORD PARAMETERS:
           FILM    Film type
                   0 - Kodak 101-07
                   1 - DEF
                   2 - SB-392 (SB-5)
                   2 - RAR 2492
                   4 - RAR 2495
                   5 - RAR 2497
                   Default:  FILM = 1
           ANGLE   Angle of incidence
                   Default: ANGLE = !pi/2
           ENERGY  Indicates input data is a function of energy rather than 
                   wavelength
                   Energy = 1 ==>> Abscissa units are eV
                   Energy = 3 ==>> Abscissa units are keV
           TENSION Tension parameter to the spline function 
           MODIFY  Interpolation scheme at edges
                   0 - Cubic Spline across all edges
                   1 - Linear Interpolation across all edges but spline where data
    
     OUTPUTS:
           The output is the photon flux from the theory of Henke
    
     PROCEDURE:
           The VIDA routine of William E. Nelson, Science and Engineering Associates
           has been modified for this PFIDL procedure.
    
     EXAMPLE:
           Convert the density versus energy(ev) in waveform array 3 to photon flux
             D2F, 3, /energy
    
     MODIFICATION HISTORY:
     	Written by:	L. Paul Mix, September 1, 2004
                           From the VIDA, D2I, routine by 
                             William E. Nelson
                             Science and Engineering Associates
                             March, 1990
    
    

    (See ../pfidl/xrd/d2f.pro)


    DIRXRD

    [Previous Routine] [Next Routine] [List of Routines]
    
         This routine prints a directory of XRD unfold files and optionally returns
           the values of the directory information in keyword arguements.
    
         DIRXRD [, P1] [, Page = Page] [, NDSET = ndset] [, TAIL = tail]
             [, TRUNCATE = truncate] [, /TERMINAL] [, /print] [, /quiet] 
             [, Reset = reset]  [, Xsize = xsize] [, COMMENT = comment]
             [, LINE = line] [, /CATHODE] [, /FILTER] [, /DETECTOR]
    
         where:
               P1       - an optional search string.
                          For example: To get all datasets with '891' use:
                            dirxrd, '891' or dirxrd, 891 
                          See GET_MATCH for allowed wild cards.
               PAGE     - the number of lines on the directory
                          default is 24
               NDSET    - the number of datasets returned 
               TAIL     - Return the last 20 datasets
                          If TAIL gt 1 then return the last TAIL datasets.
               RESET    - present and not zero, resets the directory
                          use this to put the current directory in a second window
                     Note: If the window is still open and you wish to leave it
                           open, use /reset to put the current command in a second
                           window.
                     NOTE: By using the reset qualifier, a window can be 
                           opened for each file with the filename at the top.
               XSIZE    - the width of the window in pixels (generally not set)
               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
                       Note:  The dataset comment is limited to 64 characters
               PRINT    - If set, directory will be sent to terminal
               QUIET    - If set, no outputs unless an error. 
               COMMENT  - Dataset comment for each of the datasets
               Cathode  - Directory of the cathode response file
               Filter   - Directory of the filter response file
               Detector - Directory of the combined cathode/filter response file
    
         READ funtion:
              The DIR widget can be used to read files.
              Datasets may be highlighted using the left mouse button.
              Shift-Left mouse button will select a range of datasets.
              Control-Left mouse button will toggle individual datasets.
              If a carriage return is entered in the window or if one of the
              above selections is performed with a double-click, PFIDL will read
              selected datasets.
              All seleced datasets should be either structures or waveforms.
    
         Example:
             Get a directory of the Header and return the number of datasets.
               dirxrd, ndset = ndset
             Get a directory of the cathodes.
               dirxrd, /cathode
    
    

    (See ../pfidl/xrd/dirxrd.pro)


    EDIT_HEADER

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           EDIT_HEADER
    
     PURPOSE:
           View an XRD shot description.
           Edit or generate a shot description and save to the shot_config file.
    
     CALLING SEQUENCE:
           EDIT_HEADER [, SHOT_NUMBER]  [, Line_of_Sight]
      or 
           EDIT_HEADER [, STRUCTURE]
    
     INPUTS:
           SHOT_NUMBER   - Existing shot number in the shot_config file.
           Line_of_Sight - Existing Line_of_sight diagnostic array descriptor.
                           In general this is a string variable, but it may be a 
                           number.	
           STRUCTURE     - Structure or structure array number of type 101
                           Initial values are taken from this structure.
     KEYWORD PARAMETERS:
           Structure     - Type 101 structure with final values from the session.
                           This will be stored in array number GET_MAXSTR().
           Reset         - If set, provide a blank widget form to generate a shot
                           description.  If reset is greater than 1, then the form
                           will contain "reset" detectors
                           (ie reset =5 means generate a form with 5 detectors)
           Scratch       - File ID of a scratch file
                           Default = current pff file
              
      Structure Labels
        type          - 101
        shot          - Accelerator shot number 
        LOS           - String descriptor of the diagnostic line of sight (LOS).
        Date          - String for current date
        Comment       - String comment about this diagnostic setup
        CLAB          - Comment Label for structure directory
        NDet          - number of detectors
        dist          - Distance from detectors to the source
        source        - Type of X-ray source: 0 = Hohlraum, 1= Pinch Shot
        src_area      - Source Area, Ignored for Pinch Shot
        az_ang        - Azimutha angle between LOS and surface normal
                        Ignored for Pinch Shot
        Aper_ht       - Aperature height, Ignored for hohlraum shot
        Pinch_ht      - Total pinch length, Ignored for hohlraum shot
        elevation     - Angle between a horizontal plane and the diagnostic LOS
        Signal[*]     - DAS signal name 
        cathode[*]    - Cathode identifier
        calibration[*]- Calibration identifier for cathode
        diameter[*]   - Cathode active diameter
        filter[*]     - Filter identifier
        energy_bin[*] - Energy bins boundaries for the unfold
    
     OUTPUTS:
           Diagnostic array descriptor structure 
           This is stored in the maximum structure and optionally returned with 
           the keyword, STRUCTURE.
    
     EXAMPLE:
           Edit shot 681, los 5
           edit_header, 681, 5
    
     MODIFICATION HISTORY:
           Written by:     L. P. Mix, January 22, 2001
    
    

    (See ../pfidl/xrd/edit_header.pro)


    FIT_CATHODE

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           Fit_Cathode
    
     PURPOSE:
           Fit cathode calibrations to material curves.
           Default material curves in /opt/rsi/xrd/filter_material.pff
           Assume that response = total(mat_fraction *material_stopping)
           where mat_fraction is a multiplier
    
     CATEGORY:
           XRD analysis
    
     CALLING SEQUENCE:
           FIT_CATHODE [, WDF] [, Cathode] [, ITER = iter]
              [, WEIGHTS = weights] [, SIGMA = sigma] [, CHISQ = chisq]
              [, ITMAX = itmax] [, TOLERANCE = tolerance] [, FILEID = fid]
              [, SAVE = save]  [, QUIET = quiet] [, Verbose = verbose]
              [, MINERROR= minerror] [, LOGFILE = logfile]
              [, /SETDEFAULT] [, UNSET = unset] [, SHOWDEFAULT = showdefault]
              
    
     OPTIONAL INPUTS:
           WDF:    WDF to store the fit data.
                   Default is get_maxwdf()-1.
                   Get_maxwdf() will be used as a work array.
                   The fit data on the same scale as the original data
                      is in get_maxwdf()-2
                   The difference between the calibration and fit 
                      is in get_maxwdf()-3
                   The % difference between the calibration and fit 
                      is in get_maxwdf()-4
                   The fractional error in the calibration data
                      is in get_maxwdf()-5
                   The original data will be stored in Get_maxwdf() 
    	CATHODE: File for analysis
                   If omitted, then PICKFILE will be used.
    	
     KEYWORD PARAMETERS:
          ITER:     Number of iterations performed
          Weights:  Weights used for the least squares fit.
                    Weights is missing 
                      Default - Weight = 2 
                    Weights is 0 then Weight = 1.0
                    Weights is 1 (or /weight) - Weight = 1/Yi
                    Weights is 2 - Weight = 1/Yi^2
                        where Yi = %Standard_Deviation*Transmission
                    If Weights is an array, then the values will be used.
                    If there are fewer values of weights than data points, then
                      missing values are 1.0d0
          Sigma:    Standard Deviation for the coefficients for each material
          Chisq:    Value of Chi-squared
          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 
          Fileid:   If material data is to come from a special file, this file must
                    be opened and the file id specified.
                    If fileid is missing or zero, then routine checks opened pff
                    files for a file "filter_material.pff".  If not found then 
                    the routine attempts to open: /opt/rsi/xrd/filter_material.pff
          SAVE:     If set, data will be written to the default cathode file.
                      (See WRITE_CATHODE for default definition.)
          Quiet:    If set, terminal output will be minimum.
          Verbose:  If set, terminal output will be maximum.
          MINerror: Minimum value for Yi in calculating the weights.
                    Default = 1e-6
          LOGFILE:  Unit for Verbose outputs to a log file. 
                    If LOGFILE is a positive number, the unit must be open.
                    If LOGFILE is a string, the file is opened for append.
                    IF LOGFILE is a negative number, open file with same name as 
                       the cathode calibration file with suffix = ".log"
                    If LOGFILE is set, then VERBOSE = 1
          SETDEFAULT: If set, the following parameters may be set as default.
                    LOGFILE = 0
                    WEIGHTS = 2
    
          UNSET     If present and not zero, will set all save values of keywords
                    to their default values. 
          SHOWDEFAULT: Show the present default plot values.
    
    
     OUTPUTS:
           The calibration data is stored in the maximum wdf array.
           The fit data is stored in the next lower wdf array and in the array WDF.
    
     OPTIONAL OUTPUTS:
           If SAVE is set the data is written to the cathode file.
    
     SIDE EFFECTS:
           A minimum of the last 7 wdf arrays are used.  
           The last 5 are used for the fit waveforms and the data.
           The fractional error in the calibration data is in the next array.
           One additional wdf is used for each material.
    
     PROCEDURE:
           Data is read into wdf arrays and CURVEFIT is used to perform the 
           least-squares fit.
    
     EXAMPLE:
           Fit some data.
             FIT_CATHODE
    
     MODIFICATION HISTORY:
     	Written by:     L. P. Mix, April 18, 2001
    

    (See ../pfidl/xrd/fit_cathode.pro)


    FIT_FILTER

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           Fit_Filter
    
     PURPOSE:
           Fit filter calibrations to material curves.
           Default material curves in /opt/rsi/xrd/filter_material.pff
           Assume that Transmission = exp (-Thickenss*density*material_stopping)
           Transmissions for multiple materials are the product of each material.
    
     CATEGORY:
           XRD analysis
    
     CALLING SEQUENCE:
           FIT_FILTER [, WDF] [, Filter] [, ITER = iter]
              [, WEIGHTS = weights] [, SIGMA = sigma] [, CHISQ = chisq]
              [, ITMAX = itmax] [, TOLERANCE = tolerance] [, FILEID = fid]
              [, SAVE = save]  [, QUIET = quiet] [, Verbose = verbose]
              [, MINERROR= minerror]  [, LOGFILE = logfile] 
              [, /SETDEFAULT] [, UNSET = unset] [, SHOWDEFAULT = showdefault]
              
    
     OPTIONAL INPUTS:
           WDF:    WDF to store the fit data.
                   Default is get_maxwdf()-1.
                   Get_maxwdf() will be used as a work array.
                   The fit data on the same scale as the original data
                      is in get_maxwdf()-2
                   The difference between the calibration and fit 
                      is in get_maxwdf()-3
                   The % difference between the calibration and fit 
                      is in get_maxwdf()-4
                   The fractional error in the calibration data 
                      is in get_maxwdf()-5
                   The original data will be stored in Get_maxwdf() 
    	FILTER: File for analysis
                   If omitted, then PICKFILE will be used.
    	
     KEYWORD PARAMETERS:
          ITER:     Number of iterations performed
          Weights:  Weights used for the least squares fit.
                    Weights is missing
                      Default - Weight = 1 
                    Weights is 0 then  Weight = 1.0
                    Weights is 1 (or /weight) - Weight = 1/Yi
                    Weights is 2 - Weight = 1/Yi^2
                        where Yi = %Standard_Deviation*Transmission
                    If Weights is an array, then the values will be used.
                    If there are fewer values of weights than data points, then
                      missing values are 1.0d0
          Sigma:    Standard Deviation for the coefficients for each material
          Chisq:    Value of Chi-squared
          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 
          Fileid:   If material data is to come from a special file, this file must
                    be opened and the file id specified.
                    If fileid is missing or zero, then routine checks opened pff
                    files for a file "filter_material.pff".  If not found then 
                    the routine attempts to open: /opt/rsi/xrd/filter_material.pff
          SAVE:     If set, data will be written to the default filter file.
                      (See WRITE_FILTER for default definition.)
          Quiet:    If set, terminal output will be minimum.
          Verbose:  If set, terminal output will be maximum.
          MINerror: Minimum value for Yi in calculating the weights.
                    Default = 1e-6
          LOGFILE:  Unit for Verbose outputs to a log file.
                    If LOGFILE is a positive number, the unit must be open.
                    If LOGFILE is a string, the file is opened for append.
                    IF LOGFILE is a negative number, open file with same name as
                       the cathode calibration file with suffix = ".log"
                    If LOGFILE is set, then VERBOSE = 1
          SETDEFAULT: If set, the following parameters may be set as default.
                    LOGFILE = 0
                    WEIGHTS = 1
    
          UNSET     If present and not zero, will set all save values of keywords
                    to their default values.
          SHOWDEFAULT: Show the present default plot values.
    
     OUTPUTS:
           The calibration data is stored in the maximum wdf array.
           The fit data is stored in the next lower wdf array and in the array WDF.
    
     OPTIONAL OUTPUTS:
           If SAVE is set the data is written to the filter file.
    
     SIDE EFFECTS:
           A minimum of the last 7 wdf arrays are used.  
           The last 5 are used for the fit and the data.
           The fractional error in the calibration data is in the next array.
           One additional wdf is used for each material.
    
     PROCEDURE:
           Data is read into wdf arrays and CURVEFIT is used to perform the 
           least-squares fit.
    
     EXAMPLE:
           Fit some data.
             FIT_FILTER
    
     MODIFICATION HISTORY:
     	Written by:     L. P. Mix, April 18, 2001
    

    (See ../pfidl/xrd/fit_filter.pro)


    MAKE_COMPOSITE

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           MAKE_COMPOSITE
    
     PURPOSE:
           Calculates the mass absorption coefficient of a foil
           Foil may contain multiple materials
    
     CATEGORY:
           X-ray diagnostic
    
     CALLING SEQUENCE:
    
           MAKE_COMPOSITE, WDF, MATERIAL, NUMBER
    
     INPUTS:
           WDF:    WDF array number to store the result
           MATERIAL:  Array of materials.
                      Materials may be the name as 'Copper' or symbol 'Cu'
                      The list is not case sensitive but must be an array of
                      strings.  Names must be longer than 2 characters but the
                      length may be 3 or more characters if that defines a unique
                      element or compound.
           NUMBER:    Array of material numbers of atoms in each molecule
                      Number of materials must match the number of thicknesses.
    
     KEYWORD PARAMETERS:
           FILTER: File ID of the file "filter_material.pff" or the file
                   containing the filter material mass absorption coefficient.
                   Routine will look for this file if it is not already open.
                   In most installations, this keyword is not required unless
                   the user has stored his own filter materials.
                   (See: MAKE_COMPOSITE)
           MASS_FRACTION: If set, NUMBER is in terms of mass fraction
    
     OUTPUTS:
           The mass absorption coefficient of the composite is stored in the 
           specified WDF array.
    
     COMMON BLOCKS:
           None
    
     RESTRICTIONS:
           Material must be in the file "filter_material.pff" or in a user
           specified PFF file which is opened before calling filter_material.
    
     PROCEDURE:
           The mass absorption coefficient is calculated for the composite material
    
     EXAMPLE:
           Calculate the filter transmission for a filter of equal atoms of carbon
             and hydrogen and store the result in wdf 4.
             MAKE_COMPOSITE, 4, ['c', 'h'], [1,1]
           Calculate the filter transmission for a filter of 7 atoms copper and 
             3 atoms zinc for every 10 atoms and store in wdf 5.
             MAKE_COMPOSITE, 4, ['^copper', 'zn'], [7, 3]
    
     MODIFICATION HISTORY:
           Written by:     L. P. Mix, March 9, 2001
           December, 2003  Added help file information
                           Modified location of filter material file
    

    (See ../pfidl/xrd/make_composite.pro)


    MAKE_FILTER

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           MAKE_FILTER
    
     PURPOSE:
           Calculates the transmission of a foil or stack of foils
    
     CATEGORY:
           X-ray diagnostic
    
     CALLING SEQUENCE:
    
           MAKE_FILTER, WDF, MATERIAL, THICKNESS
    
     INPUTS:
           WDF:    WDF array number to store the result
           MATERIAL:  Array of materials.
                      Materials may be the name as 'Copper' or symbol 'Cu'
                      The list is not case sensitive but must be an array of 
                      strings.  Names must be longer than 2 characters but the
                      length may be 3 or more characters if that defines a unique
                      element or compound.
           THICKNESS: Array of material thicknesses.
                      Number of materials must match the number of thicknesses.
                      Units of thickness are grams/cm^2 unless CM is set.
                      Density is the density in "filter_material.pff"
                      If CM is set, THICKNESS = THICKNESS*Density
    	
     KEYWORD PARAMETERS:
    	CM:	If set, thickness is in centimeters.
    		is shown in ALL CAPS!
           NAME:   If set this is use as the label with the components.
                   Default: NAME = 'Filter'
           FILTER: File ID of the file "filter_material.pff" or the file 
                   containing the filter material mass absorption coefficient.
                   Routine will look for this file if it is not already open.
                   In most installations, this keyword is not required unless
                   the user has stored his own filter materials.
                   (See: MAKE_COMPOSITE)
    
     OUTPUTS:
           The transmission of the filter is stored in the specified WDF array.
    
     COMMON BLOCKS:
    	MAKE_FILTER_COMMON:  Machine limit for exponentials
    
     RESTRICTIONS:
           Material must be in the file "filter_material.pff" or in a user
           specified PFF file which is opened before calling filter_material.
           For user generated composite materials, the DENSITY must be provided
           in the dataset comment if "CM" is set.
    
     PROCEDURE:
           The mass absorption coefficient is calculated for the composite material
           The filter is exp(-Mass_absorption_coefficient)
    
     EXAMPLE:
           Calculate the filter transmission for a 1 micron copper filter and
             store the result in wdf 4.
             MAKE_FILTER, 4, 'cu', .0001, /cm
       or    MAKE_FILTER, 4, 'copper', .0001, /cm
    
           Calculate the filter transmission for a filter with 0.001 inch Aluminum
             and 0.1 micron gold and store the result in 5.
             MAKE_FILTER, 5, ['Al', 'gold'], [.001*2.54, .00001], /cm
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, March 9, 2001
    	December, 2003  Added help file information
                           Modified location of filter material file
    

    (See ../pfidl/xrd/make_filter.pro)


    MAKE_MATERIAL

    [Previous Routine] [Next Routine] [List of Routines]
     Utility to make filter_material.pff
       Not for general use
    

    (See ../pfidl/xrd/make_material.pro)


    MAKE_UFO_COEF

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:  MADE_UFO_COEF
     
     PURPOSE:  Generate the coefficient for UFO or for signal synthesis.
    
     MODIFICATION HISTORY:
           Written by:     L. P. Mix, June 6, 2001
    
    

    (See ../pfidl/xrd/make_ufo_coef.pro)


    PRINT_XRD

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           PRINT_XRD
    
     PURPOSE:
           PRINT an XRD shot description.
    
     CALLING SEQUENCE:
           PRINT_XRD [, SHOT_NUMBER]  [, Line_of_Sight]
      or 
           PRINT_XRD [, STRUCTURE]
    
     INPUTS:
           SHOT_NUMBER   - Existing shot number in the shot_config file.
           Line_of_Sight - Existing Line_of_sight diagnostic array descriptor.
                           In general this is a string variable, but it may be a 
                           number.	 If missing, then SHOT_NUMBER will be used with
                           DIRXRD to select a SHOT/Line_of_SIGHT.
           STRUCTURE     - Structure or structure array number of type 101
                           Initial values are taken from this structure.
             Note:  If SHOT_NUMBER / STRUCTURE is undefined, then dirxrd will be
                    used to select a Shot/Line_of_Sight
     KEYWORD PARAMETERS:
           FILENAME      - Name of file to write data.
                           If print is set and NoDelete is not set, 
                           the default file is the scratch file used for some 
                           directory PFIDL functions.
           APPEND        - if set data will be appended to filename
           Terminal      - If set, send output to terminal
                           If less than zero then also print to file
           PRINT         - If set, file will be printed.
                           File will be deleted if unless NODELETE is set.
           NODELETE      - If set filename will not be deleted.
           DESTINATION   - Valid printer destination for the print file.
                           This destination will not be saved by LPRINT
                         Note: Default LPRINT destination must be valid if 
                               DESTINATION is not provided.
                               Use SET_PRINTER to set the destination.
              
      Structure Labels
        See XRD_HEADER for description of type 101 Labels
    
     OUTPUTS:
           Print header information to a file and spool to a printer
    
     EXAMPLE:
           Print shot 681, los 5
           print_xrd, 681, 5
    
     MODIFICATION HISTORY:
           Written by:     L. P. Mix, January 29, 2001
    
    

    (See ../pfidl/xrd/print_xrd.pro)


    PRINT_XRD_ACTUAL

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           PRINT_XRD_ACTUAL
    
     PURPOSE:
           PRINT an XRD shot description to a unit.
    
     CALLING SEQUENCE:
           PRINT_XRD, STRUCTURE, UNIT
    
     INPUTS:
           STRUCTURE     - Structure or structure array number of type 101
                           Initial values are taken from this structure.
           UNIT          - Unit for the print
     KEYWORD PARAMETERS:
           FILENAME      - Name of file to write data.
                           If print is set and NoDelete is not set, 
                           the default file is the scratch file used for some 
                           directory PFIDL functions.
           APPEND        - if set data will be appended to filename
           Terminal      - If set, send output to terminal
                           If less than zero then also print to file
           PRINT         - If set, file will be printed.
                           File will be deleted if unless NODELETE is set.
           NODELETE      - If set filename will not be deleted.
           DESTINATION   - Valid printer destination for the print file.
                           This destination will not be saved by LPRINT
                         Note: Default LPRINT destination must be valid if 
                               DESTINATION is not provided.
                               Use SET_PRINTER to set the destination.
              
      Structure Labels
        See XRD_HEADER for description of type 101 Labels
    
     OUTPUTS:
           Print header information to a file and spool to a printer
    
     EXAMPLE:
           Print shot 681, los 5
           print_xrd, 681, 5
    
     MODIFICATION HISTORY:
           Written by:     L. P. Mix, January 29, 2001
    
    

    (See ../pfidl/xrd/print_xrd_actual.pro)


    RERSP

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           ReRSP
    
     PURPOSE:
           Read a text file used for XRD cathode and filter calibrations.
           Format:  Skip first line
                    Skip any line with # as first non-blank character
                    Skip that begins with the word "END "
                    Blank lines are ignored.
                    Searches are not case sensitive.
    
                    Data is after the following two lines:
                    
           photon           trans-
           energy          mission         % error          Run #
    
                     Data is read to the end of file
    
     CATEGORY:
           XRD analysis
    
     CALLING SEQUENCE:
           RERSP, FILENAME [, WDF] 
    
     OPTIONAL INPUTS:
           FILENAME: File for analysis
                     If omitted or zero, then PICKFILE will be used.
                     If a number between 1 and get_maxwdf() it will be interpreted
                     as WDF and PICKFILE will be used.
           WDF:      WDF to store the calibration transmission data.
                     WDF must be provided.
    
     KEYWORD Parameters:
           COMMENTS:  File header lines
           NMATERIAL: Number of materials
           Materials: Materials symbol or name
           Thickness: Thickness of material in Microns
           Error:     Fractional error in the transmission expressed as a decimal 
                      number.  This is stored in a WDF array, specified by error.
                      If error is not set, the error will be stored in get_maxwdf()
           Run_number:Run number for each energy transmission measurement
                      If Run_Number is not set, the run number will be stored in 
                      get_maxwdf-1
    
     EXAMMPLE:
           Read a response file using pickfile into wdf array 2.
             ReRSP, 2
    
           Read file "Be-Va_000731-BV1_B0008.rsp" into wdf array 6
             ReRSP, 'Be-Va_000731-BV1_B0008.rsp', 6
    
     FILE FORMAT:
    
     First line is always ignored and assumed to be a comment line.
     Any line with "end" as the first 3 non-blank characters is ignored.
     Any line with "#" as the first non blank character is ignored.
       The first line and all lines beginning with a # will be saved in a 
       comment array returned with the comments keyword.
     Any line which is not ignored is assumed to be a material line.
       Material lines must have at least 2 fields delimited by white space
       (tabs or spaces).
       The first field is assumed to be an element symbol or an element name 
         or a material name.
       The second field is assumed to be the material thickness in microns.
       The third field is optional and will be ignored.
     Comments and materials will cease to be processed when the letters "photon" 
       are the first non-blank characters.
     The word "energy" will be expected to be the first word in the following line.
     The remainder fo the file is assumed to be composed of 4 columns of numbers
       representing the photon energy, the transmission, the percent error, and 
       the run number. 
    
     MODIFICATION HISTORY:
           Written by:     L. P. Mix, December 13, 2001
           
    

    (See ../pfidl/xrd/rersp.pro)


    SETXRD

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           SETXRD
    
     PURPOSE:
           Set the default XRD analysis file to a the file id of an open PFF file
    
     CALLING SEQUENCE:
           SETXRD,  FILEID
    
     INPUTS:
           FILEID   - User file id for a current PFF file
                      If zero, the current PFF file is used.
    
     KEYWORD PARAMETERS:
           
           Cathode  - Indicates FILEID is to be used for cathode response
           Filter   - Indicates FILEID is to be used for filter response
           Detector - Indicates FILEID is to be used for detector response
           Header   - Indicates FILEID is to be used for shot configuration header
    
        Example:
        Set the header configuration the file with File ID =3 
          setxrd, 3, /header
    
     MODIFICATION HISTORY:
          Original version, L. P. Mix, February 12, 2001
    

    (See ../pfidl/xrd/setxrd.pro)


    SHOWXRD

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           SHOWXRD
    
     PURPOSE:
           Show the current files for cathode, filter, and detector response and 
             the shot header configuration.
    
     CALLING SEQUENCE:
           SHOWXRD
    
     INPUTS:
           None
    
     KEYWORD PARAMETERS:
           
           Cathode  - File name to be used for cathode response
           CFID     - File id of the file to be used for the cathode response
           Filter   - File name to be used for filter response
           FFID     - File id of the file to be used for the filter response
           Detector - File name to be used for detector response
           DFID     - File id of the file to be used for the detector response
           Header   - File name to be used for shot configuration header
           HFID     - File id of the file to be used for shot configuration
    
     MODIFICATION HISTORY:
          Original version, L. P. Mix, February 12, 2001
    
    

    (See ../pfidl/xrd/showxrd.pro)


    TGS_UNFOLD

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           TGS_UNFOLD
    
     PURPOSE:
           Unfolds measured voltages to observed GW/eV/ster at each PIN diode,
           by solving at lower grating orders at higher energies, then
           finding the higher order contribution of these intensities at
           the lower energy PINs (linearly interpolating between the data
           as necessary). 
    
           Then fits the unfolded power spectrum to a 1- or 2-Planckian curve,
              by finding the best fit of kT(s) and area(s).
    
           Current version is for LOS 5/6 and LOS 17/18.
    
    
     CALLING SEQUENCE:
    
           TGS_UNFOLD [, SHOT_NUMBER] 
    
     OPTIONAL INPUTS:
           SHOT_NUMBER - Shot Number
    
     KEYWORD PARAMETERS:
           RERUN       - If set, dataset beginning with WORK will be read used for 
                         the analysis.  The dataset comment for WORK must begin with
                         "tgs"+"LOS Number" ie tgs5, or tgs17 or tgs29
                         If rerun is set, waveforms are not filtered or baselined unless
                           specifically requested with the BLINE and FILTER keywords.
           ZOOMW       - If set, ZOOMW will be used to select waveforms
           PIN_OFFSET  - Offset of the zero order from the design position.
                         Default: PIN_OFFSET = 0.0
                         PIN POSITIONS are:
                         [15.055,12.043,10.035,8.601,7.526,6.689,6.020, $
                         5.017, 4.3,   -3.763, -3.345,3.010,2.617,-2.315,-2.007,1.672]+ PIN_OFFSET
                         ENERGY = 12398.42/4000/sin(atan(abs(xpin)/Slit_To_Detector))
           KEEP_PARAM  - If set the calculated energies will be used in the calculation.
                         Default: Keep_param = 1
           DELTA_T     - If greater than zero, this will be used as the spacing 
                         for the TGS unfold.
                         Default:  DELTA_T = 0.5E-9
           BLINE       - If set, a baseline adjustment will be made to the signals
                         If bline eq -1, baseline will not be interactive.  The range 
                         used for the first signal will be used for all of the remaining
                         signals.
                         Default: BLINE = 0  : KEYWORD_SET(RERUN)
                                  BLINE = -1 : otherwise (use same range for all waveforms)
           Filter      - If not equal to zero, filter signals with a fourier 
                         filter with DELTA = FILTER
                         DEFAULT: Filter = 0     : KEYWORD_SET(RERUN)
                                  Filter = 1e-9  : otherwise
           LOS         - Line of sight
                         LOS options = [ 5, 17, 29]
                         Default: LOS = 5
                         Note: LOS 5/6, 17/18, 29/30 are true options.
                         LOS_TYPE = [0, 1, 2] according to the 3 LOS options
           HOHLRAUM    - If set, assume emission from an aperature or disk source
           FRAC_PINCH  - Fraction of the pinch in view
           THETA       - Viewing angle in the length direction, measured from 
                         normal to cylinder surface in degrees
           PHI         - Viewing angle in the azimuthal direction
                         Not used for a pinch source
           QE          - Internal quantum efficiency
                         Default: QE = 1
                         Sensitivity is QE/3.63
           MAX_POWER   - Maximum Power
                         Maximum calculated power
           FDS_WRITE   - Frequency dependent write flag.
                         If set, write a frequency dependent file for LASNEX
           TMAXIMUM    - Time at maximum power
           TFIT        - Temperature fit parameter - Meaning depends on value of WDFarea
                         (WDFarea allows a specified area vs time.)
                         If WDFarea is absent:
                           1 - Fit to source temperature and area
                           2 - Fit to two temperature distribution with 2 variable areas
                         Default: FIT = 2 if WDFarea is undefined or zero.
                         IF WDFarea is present, then 
                           TFIT is not set (ie, absent or zero) then the specified area 
                             will be used with a one temperature fit
                           TFIT is set then the specified area will be used with temperature A
                             and a temperature B and area B will also be used.
           WDFarea     - If this keyword is set, the area will be set and a temperature varied
                         If WDFarea is a float or a double, then its value will be used as a
                           constant area.
                         If WDFarea is an integer or a long and then it will be taken as a 
                           WDF array number.  The WDF array is assumed to be the area vs time.
    
                         AREA is in CM^2
                         Note:  A single temperature is fit unless TFIT is defined.
                                If KEYWORD_SET(TFIT), a three parameter fit is performed
                                                     (T1, T2, A2) and A1 from the WDFarea
           TAinit      - Initial temperature A value used for CURVEFIT
                         Default = 75
           AAinit      - Initial Area A value used for CURVEFIT
                         Default = .18
           TBinit      - Initial temperature B value used for CURVEFIT
                         Default = 300
           ABinit      - Initial Area B value used for CURVEFIT
                         Default = .001
           DEADLAYER   - Thickness of SiO2 surface layer in Angstroms
                         Enter negative value to use tabulated DETSENS
                         Default: DEADLAYER = 60
           ABSORBT     - Thickness of the silicon absorbing layer in microns
                         DEFAULT: SILICON = 15
           DETSENS     - Detector sensitivity in ASCII file.
                         First row is ignored - use for comments or leave blank
                         Second and following records have two columns: energy vs sensitivity
           GRATEFF     - Grating efficiency
                         Only unique values for energy are used.
                         ASCII file NP rows of 12 values where np defined by ENERGY
                         First two rows are ignored - use for comments or leave blank
                         First 4 rows are:
                        "Kirchoff Efficiency Curves for Data from File hs16_data.txt
    
                         Energy(eV)   m=1/m=0   m=2/m=1   m=0 (%)   m=1 (%)   m=2 (%)   m=3 (%)   m=4
                         (%)   m=5 (%)   m=6 (%)   m=7 (%)   m=8 (%)
                           "
                         The third row is actually wrapped and is used to determine if 
                         the format has changed.  The number of "%" are counted and used
                         to determine the number of orders.  The total number of columns 
                         counted by looking for multiple spaces.
                         Energy must be first.  
           SILICON     - File with SILICON optical constants
                         ASCII File with 3 columns: energy, rn and rk
                         Default:  SILICON = 'si.txt'
                         First row is ignored - use for comments or leave blank
           SAND        - File with Silicon Dioxide optical constants
                         ASCII File with 3 columns: energy, rn and rk
                         Default:  SAND = 'si02.txt'
                         First row is ignored - use for comments or leave blank
           WORK        - First WDF work array number
                         Work must be greater than 0 and less than (get_maxwdf()-16)
                           or it is set to DEFAULT
                         DEFAULT:  WORK = get_maxwdf()-36
           OUT         - First Output WDF array
                         Note: OUT can overwrite some of the WDF work arrays.
                         Note: If out LE 0 or GT (get_maxwdf()-16) then it is set to default.
                         Default: OUT = get_maxwdf()-16
           STRUCT      - First Structure output array.
                         Default: STRUCT = get_maxstr()-5
           ENERGY      - Energy of the PINs - Vector of NP values
                         Note:  NP must be less than or equal to the number of rows in 
                                GRATEFF and DETSENS
                         Default:  LOS 5, NP = 15
                          Energy =[ 250.0, 313.0, 375.0, 438.0, 500.0, 563.0, 625.0, $
                            750.0, 875.0, 1000.0, 1125.0, 1250.0, 1625.0, 1875.0, 2250.0]
    
                         LOS 17, NP= 14
                         Energy =[ 156.250, 187.5, 218.750, 250.0, 281.250, 312.50, 375.0, 437.500, $
                            500.0, 562.50, 718.750, 812.50, 937.50, 1125.0]
           
     OUTPUTS:
           Unfold the pins and calculate power, temperature, and source area.
           Store in waveforms (various depending on solution type):
             Temperature 1 and error estimate
             Area 1 and error estimate
             Temperature 2 and error estimate
             Area 2 and error estimate
             Power 1
             Power 2
             Total Power
             Fit Standard deviation
             Measured B value at peak power
             Fit B value at peak power
           Store in structures (3):
             Measured spectrum (B-value), calculated spectrum(B-value), diffence
    
     RESTRICTIONS:
           Top 20 waveforms are available to use in selecting waveforms.
    
     PROCEDURE:
           The effective solid angle is given by
           OMEGA = !pi*!pi/frac_pinch/cos(theta) ; PINCH configuration
                 = !pi/cos(theta)/cos(phi)       ; HOHLRAUM configuration
           Power = OMEGA*AREA*(sigma/!pi)*(T^4)
                   where T is the fit temperature
    
     EXAMPLE:
    
    		F = PICKFILE(/READ, FILTER = ['pro', 'dat'])
    
     MODIFICATION HISTORY:
     	Written by:	L. P. Mix, February 5, 2004
    	March 2, 2007	Added hohlraum source, fds write, and other functions
    

    (See ../pfidl/xrd/tgs_unfold.pro)


    UFO

    [Previous Routine] [Next Routine] [List of Routines]
     NAME:
           UFO
    
     PURPOSE:
           Unfold XRD data.  The XRD channels are unfolded as a function of time
           to generate a curve of output power vs time and temperature vs time.
           The power output vs energy is saved for the highest output power.
           This routine must be run on Sonic or Luigi
    
     CALLING SEQUENCE:
           UFO [, SHOT_NUMBER]  [, Line_of_Sight]
      or 
           UFO [, STRUCTURE]
    
     INPUTS:
           SHOT_NUMBER   - Existing shot number in the shot_config file.
           Line_of_Sight - Existing Line_of_sight diagnostic array descriptor.
                           In general this is a string variable, but it may be a 
                           number.	
           STRUCTURE     - Structure or structure array number of type 101
                           Initial values are taken from this structure.
             NOTE:  If a valid shot description is not provided, a directory
                    of the shot configuration file will be provided for selection
     KEYWORD PARAMETERS:
    
           ReCalculate-Use the current matrix coefficient to calculate the unfold
           Pinch_Area - Area of pinch for BB equivalent temperature.
                        Default = 1 cm2 = 1e-4 m2
                       
           WDFarray -  Use WDF arrays for the XRD signals, cathode sensitivity,
                       and filter transmission.
    
           XRDSignal-  Starting storage location for storing XRD signals read
                       from the shot data PFF file.
                       Ignored if WDFarray is set
                       Default is GET_MAXWDF() - 10*NDet
                       XRD signals are assumed to have units: Volts into 50 ohms
                       Selected signals are stored in GET_MAXWDF() - 6*NDet
           Cathode  -  WDF array number to store the the cathode sensitivities.
                       Default is next number after the last XRD.
                       Ignored if WDFarray is set
                       Copies are placed in GET_MAXWDF() - 5*NDet and above
                       Cathodes are assumed to have units: Amps/Megawatt
           Filter   -  WDF array number to store the the filter transmission
                       Default is next number after the last Cathode
                       Ignored if WDFarray is set
                       Copies are placed in GET_MAXWDF() - 4*NDet and above
                      Detector response is calculated in GET_MAXWDF() - 2*NDet 
           Time     -  If time is a scalar then the unfold is only performed at
                       the specified time.  If time is a vector with two elements,
                       the unfold is performed between time[0] and time[1].
                       If time has a third element, it is used as a skip factor.
                       Default is start when the first signal exceeds 4% of peak
                       ends when the last signal is less than 4% of peak.
                       Default skip factor is 0.2 ns
           Ntime    -  Number of time steps.
                       Ignored if Time has three elements.
           SaveStr  -  Structure with X-ray energy  as a function of 
                       time and photon energy.
                       Default = 1 (First structure)
           Delta    -  FFT smoothing interval.  Default is 1.5 ns.
           Width    -  Width used to calculate baseline.
                       The following is used to handle baseline
                          Assume signal in n
                          m = mx(n, time = t)
                          sub, n, 0, ave(n, right = t-width, /quiet)
                       Default: Width = 50e-9
    
           Quiet    -  If set, no output to the screen.
                       Note:  All parameters must be uniquely defined.
                              This will generally only work if WDFarray is set.
    
       Solution Keywords:
           Coefficient - Coefficient matrix where 
                         Coefficient x Xrays = Voltages
           SingleValues - Single values from the SVD of the coefficient matrix
           Inverse     - Inverse of the coefficient matrix.
    
     INTERACTIONS:
           If get_maxwdf() is less than 200 then "SET_MAXWDFARRAY, 200" is run, 
             that is, the maximum number of wdf arrays is set to 200.
           This routine uses the arrays [(get_maxwdf()-2-Ndet): get_maxwdf()]
           as work arrays where NDet is the number of detectors being analyzed.
           If WDFarray is not set UFO uses WDF arrays beginning with 85 to store
           the XRD waveforms, cathode sensitivities, and filter transmissions.
           
     OUTPUTS:
           SaveSTR: Structure with Time/Energy X-ray unfold.
                    Default value = 1
           WDF = get_maxwdf()-3 : Equivalent Temperature vs Time assuming area
                                  (eV)
           WDF = get_maxwdf()-2 : Energy output at peak XRD signal.
                                  (W/sr/ev)
           WDF = get_maxwdf()-1 : Energy output at peak output.
                                  (W/sr/ev)
           WDF = get_maxwdf()   : Total power output vs time
                                  (Watts)
    
     PROCEDURE:
           1. Obtain shot header
           2. Open shot file and read XRD signals
           3. Read Cathode sensitivity signals
           4. Read Filter transmisson data
           5. Subtract baseline from xrd signals, Filter, and determine one to use
           6. Scale signals by dividing by the square of the diameter
           6. Calculate Coefficient matrix
           7. Calculate SVD
           8. Get time steps
           9. Calculate spectrum at each time step
    
     EXAMPLE:
           Unfold data from shot 681, los 5
           ufo, 681, 5
    
     MODIFICATION HISTORY:
           Written by:     L. P. Mix, March 22, 2001
    
    

    (See ../pfidl/xrd/ufo.pro)


    WRITE_CATHODE

    [Previous Routine] [Next Routine] [List of Routines]
      This procedure writes a WDF array to a PFF file.
      Format: WRITE_CATHODE, WD1 [, FILEID] [, FILEID = FID] [, QUIET = quiet]
              [, Name = Cathode_Name] [, IDENTIFIER = cathode_ID]
              [, CALIBRATION = calibration] [, DATE= fit_date]
                 
      where:
        WD1    - WDF array number
        FILEID - PFF file ID (Keyword is ignored if this parameter is present.
      Keywords:
        FILEID - PFF file id.  If fileid  is 0, the current PFF 
                 file is used. If fileid is not specified, then the file
                 1. If the unfold routine has been initialized, use the cathode
                    response file.
                 2. Use the file 'cathode_resp.pff' that is open, in the current
                    directory, or in the directory, !dir/../xrd
                 Keyword is ignored if parameter is provided.
        QUIET  - If set, file will be written with no interaction.
                 Default: quiet = 0
                 Note:  If quiet is set, dataset comment must contain a string:
                 "Cathode: cathode_id," where cathode ID is the cathode id for the
                 cathode.
        Name        - Name of the cathode
                      Example: XRD
        IDENTIFIER  - Cathode identification
                      Example: C20
        Calibration - Calibration name or identifier
                      Example: B0008
        DATE   - Fit date
                 Example: Jan 17 2002
    
      Examples:
      Write WDF array 1 to the current PFF file.
        write_cathode, 1 , 0
      Write WDF array 5 to the current PFF file with a cathode name of C26 and 
      a calibration identifier of 9906
        write_cathode, 5, name ='c26', cal=9906, fid = 0
     or
        write_cathode, 5, 0, name ='c26', cal='9906'
    
    

    (See ../pfidl/xrd/write_cathode.pro)


    WRITE_FILTER

    [Previous Routine] [List of Routines]
      This procedure writes a WDF array to a PFF file.
      Format: WRITE_FILTER, WD1 [, FILEID] [, FILEID = FID] [, QUIET = quiet]
              [, Name = Filter_Name] [, IDENTIFIER = filterid]
              [, CALIBRATION = calibration] [, DATE= fit_date]
                 
      where:
        WD1    - WDF array number
        FILEID - PFF file ID (Keyword is ignored if this parameter is present.
    
      Keywords:
        FILEID - PFF file id.  If FILEID  is 0, the current PFF 
                 file is used.  If FILEID is not specified, then the file 
                 1. If the unfold routine has been initialized, use the filter     
                    response file.
                 2. Use the file 'filter_resp.pff' that is open, in the current
                    directory, or in the directory, !dir/../xrd
                 Keyword is ignored if parameter is provided.
        QUIET  - If set, file will be written with no interaction.
                 Default: quiet = 0
                 Note:  If quiet is set, dataset comment must contain a string:
                 "Filter: filter_id," where filter ID is the filter id for the 
                 filter.
        NAME   - Filter name 
                 Example: Kimfol
        IDENTIFIER - Filter identification
                 Example: 961001-B5
        CALIBRATION - Calibration identifier
                 Example: B0008
        DATE   - Fit date
                 Example: Jan 17 2002
      
      Examples:
      Write WDF array 1 to the current PFF file.
        write_filter, 1 
      Write WDF array 5 to the current PFF file with a filter name of pary3.5
        and an id of 990406-4c.
        write_filter, 5, name ='pary3.5', ID = '990406-4c'
    
    

    (See ../pfidl/xrd/write_filter.pro)