B.2 Some IMD functions and procedures


Described below (using standard IDL documentation formatting), are several IMD procedures and functions that you may wish to use directly in IDL. In the documentation for the Graphics routines, you'll find an example of how to create a plot showing computations stored in separate IMD data files.


;+
; NAME:
;
;       FRESNEL
;
; PURPOSE:
;
;       Compute specular optical functions and electric
;       field intensity for a multilayer stack.
;
; CALLING SEQUENCE:
;
;       FRESNEL, THETA,LAMBDA,NC,Z[,SIGMA,INTERFACE,F,Q]
; 
; INPUTS:
;
;       THETA - Scalar or 1-D array of incidence angles, in degrees,
;               measured from the normal.
;
;       LAMBDA - Scalar or 1-D array of wavelengths.  Units for LAMBDA
;                are the same as for Z and SIGMA.
;
;       NC - Complex array of optical constants.  The dimensions of NC
;            must be (N_ELEMENTS(Z)+2,N_ELEMENTS(LAMBDA)).
; 
;       Z - 1-D array of layer thicknesses. Units for Z are the same
;           as for SIGMA and LAMBDA.
;
;
; OPTIONAL INPUTS:
;
;
;       SIGMA - Scalar, 1D or 3D array of interface widths.  If SIGMA
;               is a scalar, then the same roughness value is applied
;               to each interface.  If SIGMA is a 1-D array, it must
;               have (N_ELEMENTS(Z)+1) elements, corresponding to the
;               number of interfaces in the stack.  If SIGMA is a 3-D
;               array, it must have
;               (N_ELEMENTS(THETA),N_ELEMENTS(LAMBDA),N_ELEMENTS(Z)+1)
;               elements. Units for SIGMA are the same as for LAMBDA
;               and Z.
;
;       INTERFACE - scalar, 1-D array, or 3-D array of interface
;                   roughness profile types.
;
;                   INTERFACE=0 corresponds to an error-function
;                   interface profile;
;
;                   INTERFACE=1 corresponds to an exponential
;                   interface profile;
;
;                   INTERFACE=2 corresponds to a linear interface
;                   profile;
;
;                   INTERFACE=3 corresponds to a sinusoidal interface
;                   profile;
;
;                   INTERFACE=4 corresponds to a step functoin
;                   interface.

;                   If INTERFACE is a scalar, then the same roughness
;                   profile is applied to each interface.  If
;                   INTERFACE is a 1-D array, it must have
;                   (N_ELEMENTS(Z)+1) elements, corresponding to the
;                   number of interfaces in the stack.  If INTERFACE
;                   is a 3-D array, it must have
;                   (N_ELEMENTS(THETA),N_ELEMENTS(LAMBDA),N_ELEMENTS(Z)+1)
;                   elements.
;
;       F - Incident polarization factor, defined as the ratio
;           (I(s)-I(p)) / (I(s)+I(p)), where I(s) and I(p) are the
;           incident intensities of s and p polarizations. So for pure
;           s-polarization specify F=+1; for pure p-polarization
;           specify F=-1, or for unpolarized incident radiation,
;           specify F=0.
;
;       Q - Polarization analyzer sensitivity, defined as the
;           sensitivity to s-polarization divided by the sensitivity
;           to p-polarization.  Specifying a value of q other than 1.0
;           could be used to simulate, for example, the reflectance
;           you would measure using a detector that (for whatever
;           reason) was more or less sensitive to s-polarization than
;           to p-polarization.
;
;           NOTE: The values of F and Q that you specify only affect
;           the 'average' optical properties; the optical properties
;           for pure s and pure p polarization are unaffected.
;
; KEYWORD PARAMETERS:
;
;       INPUTS:
;
;              MFC_MODEL - an integer specifying the form of the modified
;                          Fresnel coefficients to be used to account for
;                          interface imperfections.  See Section 2.2 for
;                          details.
;               
;              COMPUTE_TA - Set to compute reflectance, transmittance
;                           and absorptance.
;
;              COMPUTE_FIELD - Set to compute fields, reflectance,
;                              transmittance and absorptance.
;
;              Note: if neither COMPUTE_TA nor COMPUTE_FIELD is set,
;              then only reflectance is computed.
;                    
;
;              ARES - Instrumental angular resolution, in degrees. The
;                     optical properties (R, T, A) vs. angle will be
;                     convolved with a Gaussian of width ARES, in
;                     order to simulate a finite instrumental
;                     resolution.  You must specify three or more
;                     THETA values to use ARES.
;
;
;              PRES - Instrumental spectral resolution, in the same
;                     units as LAMBDA. The optical properties (R, T,
;                     A) vs. wavelength will be convolved with a
;                     Gaussian of width PRES, in order to simulate a
;                     finite instrumental resolution. You must specify
;                     three or more LAMBDA values to use PRES.
;
;       INPUTS FOR FIELD COMPUTATIONS ONLY (i.e., with COMPUTE_FIELD set):
;
;              PT_SPACING - The spacing (in same units as Z) between
;                           field intensity points.  If not specified,
;                           default value of 1 is used.
;
;                           Note that the actual spacing between
;                           points will not be regular, as it is
;                           necessary to compute the field intensities
;                           precisely at the interfaces between
;                           layers.  See DEPTH below.

; 
;              AMBIENT_DEPTH - The depth (in same units as Z) into the
;                              ambient material (the material above
;                              the multilayer) for which the field
;                              intensities are to be calculated.
;                              If not specified, a default value of 0
;                              is used.
;
;
;              SUBSTRATE_DEPTH - The depth (in same units as Z) into
;                                the substrate material (the material
;                                below the multilayer) for which the
;                                field intensities are to be
;                                calculated.  If not specified, a
;                                default value of 0 is used.
;
;       OUTPUTS:
;
;              RS - Reflectance for s-polarization.  
;
;              RP - Reflectance for p-polarization.
; 
;              RA - Average reflectance, =
;                   (RS*Q*(1+F)+RP*(1-F))/(F*(Q-1)+(Q+1))
;
;              PRS - Phase of reflected wave for s-polarization.  
;
;              PRP - Phase of reflected wave for p-polarization.
; 
;              CRS - Complex reflected amplitude for s-polarization.
;
;              CRP - Complex reflected amplitude for p-polarization.
; 
;              RHO - Ratio of CRP/CRS
; 
;              PSI - Ellipsometric Psi function = ATAN(RHO*CONJ(RHO))
;  
;              DELTA - Ellipsometric Delta function =
;                      ATAN(IMAGINARY(RHO),DOUBLE(RHO))
; 
;              FUNC_USER1,
;              
;              FUNC_USER2,
;              
;              FUNC_USER3 - Strings specifying the USER1, USER2 and
;                           USER3 functions.  The IDL EXECUTE function
;                           is used to compute these functions, as in:
;                           ee=EXECUTE('user1='+func_user1).  Thus,
;                           these strings must use valid IDL syntax,
;                           and must be valid functions of any of the
;                           variables and functions internal to the
;                           FRESNEL procedure. See Section 2.3 for details.
;
;              USER1,
;
;              USER2,
;
;              USER3 - The user functions determined by the values of
;                      associated FUNC_USER* strings described above.
;
;
;       ADDITIONAL OUTPUTS when COMPUTE_TA or COMPUTE_FIELD keywords are set:
;
;              TS - Transmittance for s-polarization.  
;
;              TP - Transmittance for p-polarization.
; 
;              TA - Average transmittance, =
;                   (TS*Q*(1+F)+TP*(1-F))/(F*(Q-1)+(Q+1))
;
;              PTS - Phase of transmitted wave for s-polarization.  
;
;              PTP - Phase of transmitted wave for p-polarization.
;
;              AS - Absorptance for s-polarization.  
;
;              AP - Absorptance for p-polarization.
; 
;              AA - Average absorptance, =
;                   (AS*Q*(1+F)+AP*(1-F))/(F*(Q-1)+(Q+1))
; 
;        The dimensions of RS, RP, RA, PRS, PRP, TS, TP, TA, PTS, PTP,
;        AS, AP, and AA are (N_ELEMENTS(THETA),N_ELEMENTS(LAMBDA).
;
;        ADDITIONAL OUTPUTS WHEN COMPUTE_FIELD IS SET:
; 
;              DEPTH - 1-D array of depth values. The number of depth
;                      values is
;
;                      1+FIX(TOTAL(Z)+AMBIENT_DEPTH+SUBSTRATE_DEPTH)/PT_SPACING
;
;                      The depth values are not equally spaced, as it
;                      is necessary to calculate the field intensities
;                      precisely at the interfaces between layers.
;                      If you need an equally spaced DEPTH array,
;                      you can interpolate the DEPTH, and INT values.
;
;             INTS - Field intensity for s-polarization. 
;
;                    Dimensions for INTS, INTP, and INTA are
;                    (N_ELEMENTS(DEPTH),N_ELEMENTS(THETA),N_ELEMENTS(LAMBDA))
;
;             INTP - Field intensity for p-polarization. 
;
;             INTS - Average field intensity, 
;                   =(INTS*Q*(1+F)+INTP*(1-F))/(F*(Q-1)+(Q+1))
;
;             FPS  - Electric field amplitude, positive-going 
;                    (i.e., towards the substrate), s-polarization.
;
;             FMS  - Electric field amplitude, negative-going 
;                    (i.e., away from the substrate), s-polarization.
;
;             FPPN - Electric field amplitude, positive-going 
;                    (i.e., towards the substrate), p-polarization, normal component
;
;             FMPN - Electric field amplitude, negative-going 
;                    (i.e., away from the substrate), p-polarization, normal component
;
;             FPPT - Electric field amplitude, positive-going 
;                    (i.e., towards the substrate), p-polarization, tangential component
;
;             FMPT - Electric field amplitude, negative-going 
;                    (i.e., away from the substrate), p-polarization, tangential component
;
;                    Dimensions for FPS, FMS, FPPN, FMPN, FPPT and FMPT are
;                    (N_ELEMENTS(DEPTH),N_ELEMENTS(THETA),N_ELEMENTS(LAMBDA))
;
;
; COMMON BLOCKS:
; 
;       COMMON IMD,IMD 
;
; PROCEDURE:
;
;       As the names suggest, this procedure uses the Fresnel
;       equations to compute the optical properties of a multilayer as
;       a function of angle and wavelength.  All computations are
;       performed in double precision.  A straightforward recursion
;       algorithm is used, which is to say that no shortcuts are
;       employed to take advantage of situations in which the
;       multilayer is purely periodic.  As such, other algorithms
;       might be faster, but this one is more general.
;
;       If the COMPUTE_TA keyword is set, to compute transmittance and
;       absorptance in addition to reflectance, then the procedure is
;       significantly slower, due to the extra computation required.
;       If the COMPUTE_FIELD keyword is set, the computation time is
;       longer still.
; 
;       Scattering losses due to interfacial roughness or diffuseness
;       are handled according to the methods described in Section 2.2 of
;       of the hypertext IMD documentation.
;
;       Polarization averaging is performed using the function SP2A,
;       usage:
;
;       Result=SP2A(XS,XP,F,Q),
;
;       where F and Q are as defined above, XS and XP are the optical
;       functions for pure s and p polarizations, and Result is the
;       average function. For example, the average reflectance RA is
;       given by:
;
;       RA=(RS*Q*(1+F)+RP*(1-F))/(F*(Q-1)+(Q+1))
;
;       Instrumental resolution is computed by convolution with a
;       gaussian, using the function INSTRUMENT_RES, usage:
;
;       Result=INSTRUMENT_RES(X,Y,RES,ANGLE=ANGLE,
;                             WAVELENGTH=WAVELENGTH,ENERGY=ENERGY),
;
;       where RES is the width of the gaussian, and X and Y are the
;       independent and dependent variables (e.g., X=THETA, Y=RA).
;       Set ANGLE to convolve reflectance, transmittance, or
;       absorptance vs. angle, WAVELENGTH to convolve r/t/a vs.
;       wavelength, or ENERGY, to convolve r/t/a vs. energy. In the
;       case of ENERGY, both X and RES must be specified in angstroms,
;       but are converted to eV before doing the convolution.
;
; EXAMPLE:
;
;       Compute the reflectance of a gold film, 500 A thick, vs angle,
;       at a wavelength of 4000 A:
;
;       Define THETA=VECTOR(0.,90.,91), an array of angles from 0 to 90
;       degrees, in 1 degree steps.
;
;       Define LAMBDA=4000.
;
;       Using the optical constants for Au at 4000 A, we define
;       NC=[complex(1.,0.),complex(1.658,1.956),complex(1.,0.)],
;       assuming the Au film is surround by vacuum on either side.
;
;       Define Z=[500.]
;
;       FRESNEL, THETA, LAMBDA, NC, Z, RA=RA
; 
;       The value for RA we compute in this example corresponds to
;       unpolarized light.
;
; MODIFICATION HISTORY:
;
;       David L. Windt, Bell Labs, May 1997
;
;       Updated to IMD V4.0, April, 1998
;       
;       windt@astro.columbia.edu
;
;-


;+
; NAME:
;
;       NS_BA
;
; PURPOSE:
;
;       Procedure to compute the non-specular reflected intensity for
;       a multilayer film, using the Born approximation theory
;       developed by D. Stearns, as described in reference [4].
;
; CALLING SEQUENCE:
;
;       NS_BA, THETA_IN,THETA_OUT,LAMBDA,NC,Z [,F,Q]
; 
; INPUTS:
;
;       THETA_IN - Scalar or 1-D array of incidence angles, in
;                  degrees, measured from the normal.
;
;       THETA_OUT - Scalar or 1-D array of scattering angles, in
;                   degrees, measured from the normal.
;
;       If THETA_IN is a scalar, then the same value of THETA_IN will
;       be used for every value of THETA_OUT.  Similarly, if THETA_OUT
;       is a scalar, then the same value of THETA_OUT will be used for
;       every value of THETA_IN.  If THETA_IN and THETA_OUT are both
;       1D arrays, then they must have the same number of elements.
;       In any case, the non-specular reflected intensity is computed
;       for pairs of THETA_IN, THETA_OUT values.
;
;       LAMBDA - Wavelength (scalar).
;
;       NC - Complex array of optical constants.  The dimensions of NC
;            must be (N_ELEMENTS(Z)+2)
; 
;       Z - 1-D array of layer thicknesses. Units for Z are the same
;           as for SIGMA and LAMBDA.
;
; OPTIONAL INPUTS:
;           
;
;       F - Incident polarization factor, defined as the ratio
;           (I(s)-I(p)) / (I(s)+I(p)), where I(s) and I(p) are the
;           incident intensities of s and p polarizations. So for pure
;           s-polarization specify F=+1; for pure p-polarization
;           specify F=-1, or for unpolarized incident radiation,
;           specify F=0.
;
;       Q - Polarization analyzer sensitivity, defined as the
;           sensitivity to s-polarization divided by the sensitivity
;           to p-polarization.  Specifying a value of q other than 1.0
;           could be used to simulate, for example, the reflectance
;           you would measure using a detector that (for whatever
;           reason) was more or less sensitive to s-polarization than
;           to p-polarization.
;
; KEYWORD PARAMETERS:
;
;       INPUTS:
;
;       PHI - Scattering plane azimuthal angle. (Scalar.) Default is 0 deg.
;
;       MFC_MODEL - an integer specifying the form of the modified
;                   Fresnel coefficients to be used to account for
;                   interface imperfections.  See Section 2.2 for
;                   details.
;               
;       PSD_MODEL - Set PSD_MODEL=0 to use the sigma_r/xi_par/H PSD model.
;                   Set PSD_MODEL=1 to use the Omega/nu/n PSD model.
;               
;
;       If PSD_MODEL=0, then the following three parameters must be
;       supplied:
;
;       SIGMA_R - 1D array of interface roughnesses. N_ELEMENTS(Z)+1
;                 elements.
;
;       XI_PAR - 1D array of interface correlation lengths. N_ELEMENTS(Z)+1
;                 elements.
;
;       H - 1D array of interface jaggedness factors. N_ELEMENTS(Z)+1
;           elements.
;
;       In addition, you can also specify:
;
;       XI_PERP - Perpendicular correlation length (scalar).
;                 
;
;       If PSD_MODEL=1, then the following three parameters must be
;       supplied:
;
;       OMEGA - 1D array of interface volumen
;               elements. N_ELEMENTS(Z)+1 elements.
;
;       NU - 1D array of interface relaxation
;            coefficients. N_ELEMENTS(Z)+1 elements.
;
;       N_ - 1D array of PSD exponents. N_ELEMENTS(Z)+1 elements.
;
;       You can also specify:
;
;       SUBSTRATE_Z - The Z value of the 'substrate', needed to
;                     compute the PSD of the bottom-most interface
;                     when using the Omega/nu/n PSD model.
;
;       Diffuse interfaces can be used when computing the electric
;       field intensities (needed to compute the scattered intensity)
;       by specifying values for SIGMA_D and INTERFACE.  The electric
;       fields will be computed from modified Fresnel coefficients,
;       as described in Section 2.2.
;
;              SIGMA_D - 1D array of interface diffuseness factors.
;                        SIGMA_D must have N_ELEMENTS(Z)+1 elements.
;
;
;              INTERFACE - 1D array of interface profiles
;                          functions. INTERFACE must have
;                          N_ELEMENTS(Z)+1 elements.
;
;                          INTERFACE=0 corresponds to an
;                          error-function interface profile;
;
;                          INTERFACE=1 corresponds to an exponential
;                          interface profile;
;
;                          INTERFACE=2 corresponds to a linear
;                          interface profile;
;
;                          INTERFACE=3 corresponds to a sinusoidal
;                          interface profile;
;
;                          INTERFACE=4 corresponds to a step functoin
;                          interface.
;
;
;
;              ARES - Instrumental angular resolution, in degrees. The
;                     non-specular reflected intensity vs. angle will
;                     be convolved with a Gaussian of width ARES, in
;                     order to simulate a finite instrumental
;                     resolution.  You must specify three or more
;                     THETA_IN or THETA_OUT values to use ARES.
;
;       OUTPUTS:
;
;              DIDOMEGA_S - s-polarized component of reflected
;                           intensity.
;
;              DIDOMEGA_P - p-polarized component of reflected
;                           intensity.
;                           
;              DIDOMEGA_A - polarization-averaged reflected intensity.
;
;              See Section 2.3 for a complete description of these
;              three functions, and how they depend on f and q.
;
;
; COMMON BLOCKS:
; 
;       COMMON IMD,IMD 
;
; PROCEDURE:
;
;       Instrumental resolution is computed by convolution with a
;       gaussian, using the function INSTRUMENT_RES, usage:
;
;       Result=INSTRUMENT_RES(X,Y,RES,/ANGLE)
;
;       where RES is the width of the gaussian, and X and Y are the
;       independent and dependent variables (e.g., X=THETA,
;       Y=DIDOMEGA_S).  Set ANGLE to convolve didomega vs. angle.
;
; MODIFICATION HISTORY:
;
;       David L. Windt, Bell Labs, April, 1998
;
;       windt@astro.columbia.edu
;
;-


;+
; NAME:
;
;       NS_DWBA
;
; PURPOSE:
;
;       Procedure to compute the non-specular reflected intensity for
;       a multilayer film, using the distorted-wave Born approximation
;       theory developed by Sinha/Holy/de Boer, described in
;       references 5,6,7 and 8.
;
; CALLING SEQUENCE:
;
;       NS_DWBA, THETA_IN,THETA_OUT,LAMBDA,NC,Z
; 
; INPUTS:
;
;       THETA_IN - Scalar or 1-D array of incidence angles, in
;                  degrees, measured from the normal.
;
;       THETA_OUT - Scalar or 1-D array of scattering angles, in
;                   degrees, measured from the normal.
;
;       If THETA_IN is a scalar, then the same value of THETA_IN will
;       be used for every value of THETA_OUT.  Similarly, if THETA_OUT
;       is a scalar, then the same value of THETA_OUT will be used for
;       every value of THETA_IN.  If THETA_IN and THETA_OUT are both
;       1D arrays, then they must have the same number of elements.
;       In any case, the non-specular reflected intensity is computed
;       for pairs of THETA_IN, THETA_OUT values.
;
;       LAMBDA - Wavelength (scalar).
;
;       NC - Complex array of optical constants.  The dimensions of NC
;            must be (N_ELEMENTS(Z)+2)
; 
;       Z - 1-D array of layer thicknesses. Units for Z are the same
;           as for SIGMA and LAMBDA.
;
; KEYWORD PARAMETERS:
;
;       INPUTS:
;
;       PHI - Scattering plane azimuthal angle. (Scalar.) Default is 0.
;
;       MFC_MODEL - an integer specifying the form of the modified
;                   Fresnel coefficients to be used to account for
;                   interface imperfections.  See Section 2.2 for
;                   details.
;               
;       PSD_MODEL - Set PSD_MODEL=0 to use the sigma_r/xi_par/H PSD model.
;                   Set PSD_MODEL=1 to use the Omega/nu/n PSD model.
;               
;
;       If PSD_MODEL=0, then the following three parameters must be
;       supplied:
;
;       SIGMA_R - 1D array of interface roughnesses. N_ELEMENTS(Z)+1
;                 elements.
;
;       XI_PAR - 1D array of interface correlation lengths. N_ELEMENTS(Z)+1
;                 elements.
;
;       H - 1D array of interface jaggedness factors. N_ELEMENTS(Z)+1
;           elements.
;
;       In addition, you can also specify:
;
;       XI_PERP - Perpendicular correlation length (scalar).
;                 
;
;       If PSD_MODEL=1, then the following three parameters must be
;       supplied:
;
;       OMEGA - 1D array of interface volumen
;               elements. N_ELEMENTS(Z)+1 elements.
;
;       NU - 1D array of interface relaxation
;            coefficients. N_ELEMENTS(Z)+1 elements.
;
;       N_ - 1D array of PSD exponents. N_ELEMENTS(Z)+1 elements.
;
;       You can also specify:
;
;       SUBSTRATE_Z - The Z value of the 'substrate', needed to
;                     compute the PSD of the bottom-most interface
;                     when using the Omega/nu/n PSD model.
;
;       Diffuse interfaces can be used when computing the electric
;       field intensities (needed to compute the scattered intensity)
;       by specifying values for SIGMA_D and INTERFACE. The electric
;       fields will be computed from modified Fresnel coefficients,
;       as described in Section 2.2.
;
;              SIGMA_D - 1D array of interface diffuseness factors.
;                        SIGMA_D must have N_ELEMENTS(Z)+1 elements.
;
;
;              INTERFACE - 1D array of interface profiles
;                          functions. INTERFACE must have
;                          N_ELEMENTS(Z)+1 elements.
;
;                          INTERFACE=0 corresponds to an
;                          error-function interface profile;
;
;                          INTERFACE=1 corresponds to an exponential
;                          interface profile;
;
;                          INTERFACE=2 corresponds to a linear
;                          interface profile;
;
;                          INTERFACE=3 corresponds to a sinusoidal
;                          interface profile;
;
;                          INTERFACE=4 corresponds to a step functoin
;                          interface.
;
;
;
;              ARES - Instrumental angular resolution, in degrees. The
;                     non-specular reflected intensity vs. angle will
;                     be convolved with a Gaussian of width ARES, in
;                     order to simulate a finite instrumental
;                     resolution.  You must specify three or more
;                     THETA_IN or THETA_OUT values to use ARES.
;
;       OUTPUTS:
;
;              DIDOMEGA - non-specular reflected intensity.
;
;
; COMMON BLOCKS:
; 
;       COMMON IMD,IMD 
;
; PROCEDURE:
;
;       Instrumental resolution is computed by convolution with a
;       gaussian, using the function INSTRUMENT_RES, usage:
;
;       Result=INSTRUMENT_RES(X,Y,RES,/ANGLE)
;
;       where RES is the width of the gaussian, and X and Y are the
;       independent and dependent variables (e.g., X=THETA,
;       Y=DIDOMEGA_S).  Set ANGLE to convolve didomega vs. angle.
;
; MODIFICATION HISTORY:
;
;       David L. Windt, Bell Labs, April, 1998
;
;       windt@astro.columbia.edu
;
;-


;+
; NAME:
;
;           IMD_F1F2TONK (procedure)
;
; PURPOSE:
;
;           This procedure is a widget interface to the IMD_F1F2TONK
;           function, and is used to compute optical constants (n,k)
;           from atomic scattering factors for a compound specified by
;           composition and density.  The resulting optical constants are
;           plotted (using xnkplot; the plot can then be printed using
;           plot_print,) and can be saved to a text file (.nk format).
;
; CALLING SEQUENCE:
;
;           IMD_F1F2TONK
;           
; COMMON BLOCKS:
;
;           IMD
;           IMD_F1F2TONK
;
; RESTRICTIONS:
;
;  See the restrictions for the IMD_F1F2TONK function.
;
;
; PROCEDURE:
;
;  In this program, the optical constants are computed over a grid of
;  1000 energies, logarithmically spaced from 30 eV to 100 keV.
;
; MODIFICATION HISTORY:
;
;   David L. Windt, Bell Labs, May 1997.
;
;   windt@astro.columbia.edu
;
;   November 1997: renamed from F1F2TONK; brand new widget interface.
;
;   April 1998: Default grid is now 1000 energies from 30 eV to 100
;   keV.
;
;-

;+
; NAME:
;
;           IMD_F1F2TONK (function)
;
; PURPOSE:
;
;           This function computes optical constants (n,k) from
;           atomic scattering factors for a compound specified
;           by its composition and density.
;
; CALLING SEQUENCE:
;
;           Result=IMD_F1F2TONK(DENSITY,NUMBER,ELEMENT[,WAVELENGTH])
; 
;                      
; INPUT PARAMETERS:
;
;           DENSITY - compound density, in gm/cm3.
;           
;           NUMBER - scalar or array of relative concentrations. For example,
;                    to compute the optical constants for Al2O3, set 
;                    NUMBER=[2.,3.]
;         
;           ELEMENT - scalar or array of chemical element symbols. For example,
;                     to compute the optical constants for Al2O3, set 
;                     ELEMENT=['Al','O'].
;               
;           WAVELENGTH - vector of wavelengths. If omitted, the optical
;                        constants are computed over a logarithmically-spaced
;                        grid of 500 wavelengths from 0.413 to 413 A (i.e.,
;                        from 30 eV to 30 keV.)
;                                      
; OUTPUTS:
;
;       Result - A complex scalar or 1-D array (the same length
;                as WAVELENGTH) containing the optical constants (n,k).
; 
; KEYWORD PARAMETERS:
;
;     F1F2 - optional input or output array of atomic scattering factors.  
;            Dimensions=[2,N_ELEMENTS(NUMBER),N_ELEMENTS(WAVELENGTH)]; Thus
;            F1F2(0,0,*) are the F1 values for the first element, and 
;            F1F2(1,0,*) are the F2 values for the first element, and so on.
;            If F1F2 is dimensioned correctly, then the atomic scattering
;            factors are not read from the files corresponding to the elements
;            of the ELEMENT array, but rather the passed values are used.
;            (So be sure that the F1F2 values are correct!)
;            Conversely, if F1F2 is undefined (or ill-defined) then the
;            returned value of F1F2 will contain the F1 and F2 values read
;            from the atomic scattering factors files.
;                 
; COMMON BLOCKS:
;
;           IMD
;           IMD_F1F2TONK
;
; RESTRICTIONS:
;
;  The program uses atomic scattering factors compiled from the CXRO
;  and LLNL websites. (See Section A.3.)
;
;  The atomic scattering factor files must be located in the directory
;  specified in the file IMDSITECONFIG.PRO, located in the IMD
;  directory.  However, if the files are not found, the user will be
;  prompted to enter the path leading to these files.
;
; PROCEDURE:
;
;  The optical constants are computed according to the principles
;  described in the paper "X-ray interactions: photoabsorption,
;  scattering, transmission, and reflection at E=50-30,000 eV,
;  Z=1-92", B.L. Henke, E. M. Gullikson, and J. C. Davis, Atomic
;  Data and Nuclear Data Tables, Vol. 54, No. 2, July 1993. (See
;  especially equations (17) and (18).)
;           
; MODIFICATION HISTORY:
;
;   David L. Windt, Bell Labs, Nov 1997.
;   windt@astro.columbia.edu
;
;-

;+ ; NAME: ; ; IMD_NK ; ; PURPOSE: ; ; A function used to read IMD optical constant files (.nk files). ; ; ; CALLING SEQUENCE: ; ; Result=IMD_NK(MATERIAL,WAVELENGTH) ; ; INPUTS: ; ; MATERIAL - A string specifying the name of a valid ; optical constant file, without the .nk extension. ; ; WAVELENGTH - A scalar or 1-D array specifying the wavelength ; in angstroms. ; ; OUTPUTS: ; ; Result - A complex scalar or 1-D array (the same length ; as WAVELENGTH) containing the optical constants (n,k). ; ; COMMON BLOCKS: ; ; IMD ; IMD_WIDGET ; ; PROCEDURE: ; ; The optical constant file is read, and the data are interpolated ; (using FINDEX and INTERPOLATE) to get n and k at the specified ; wavelengths. ; ; MODIFICATION HISTORY: ; ; David L. Windt, Bell Labs, April 1997 ; windt@astro.columbia.edu ;-


;+
; NAME:
;
;           XNKPLOT
;
; PURPOSE:
;
;           This procedure plots optical constants n,k versus
;           wavelength, and allows the user the ability to adjust some
;           of the plot settings, and print the plot, through a GUI.
;
; CALLING SEQUENCE:
;
;           XNKPLOT[,LAMBDA,N,K]
; 
; OPTIONAL INPUTS:
;
;           LAMBDA - A 1D vector of wavelength values, in Angstroms
;
;           N, K - 1D vectors of n and k values
;
;           Note: if no inputs are supplied, the use can open a new
;           optical constant file from the File->Open menu option.
;
; RESTRICTIONS:
;
;           Requires widgets; uses lots of stuff in the
;           ~idl/user_contrib/windt directory.
;
; PROCEDURE:
;
;           Note that the procedure called NKPLOT (usage:
;           NKPLOT,LAMBDA,N,K) is the one that actually creates the
;           plot.  NKPLOT can be used on it's own if desired:
;
;           KEYWORDS to nkplot (in addition to most IDL keywords
;           accepted by the plot command):
;
;           XAXIS, NAXIS, KAXIS - 4-element vectors specifying the IDL
;                                 [type,range(0),range(1),style] axis
;                                 values. i.e., type=1 for log plots,
;                                 etc.  For example, to plot n on a
;                                 linear scale from 0 to 2, and k on a
;                                 log scale from .1 to 10, specify
;                                 naxis=[0.,0.,2.,0.],kaxis=[1.,.1,10.,0.]
;                                 
;
;           NSTYLE, KSTYLE - 5-element vectors specifying the IDL
;                            [color,linestyle,thick,psym,symsize]
;                            values for the n and k curves. For
;                            example, to plot n using a red dashed line,
;                            specify nstyle=[2,1,0,0,0]
;                   
;           LABEL_POSITION - a scalar, in the range 0. to 1.,
;                            specifying the position along the xaxis
;                            for the 'n' and 'k' curve labels. (See
;                            the CURVE_LABEL procedure for more
;                            details.)
;
;           BANGY_N - the value of the !y system variable set after
;                     creating the n-vs-lambda plot.  the only reason
;                     to use this keyword is to enable subsequent use
;                     of the overplot keyword.
;
;           BANGY_K - the value of the !y system variable set after
;                     creating the k-vs-lambda plot.  the only reason
;                     to use this keyword is to enable subsequent use
;                     of the overplot keyword.
;
;           OVERPLOT - set this to overplot n and k vs lambda on an
;                      existing plot made with nkplot.  this keyword
;                      must be used with the bangy_n and bangy_k
;                      keywords.
;
;           Example:  plot two sets of n,k values on the same plot:
;
;
;                     NKPLOT,lambda1,n1,k1, $
;                            bangy_n=bangy_n,bangy_k=bangy_k
;                     NKPLOT,lambda2,n2,k2, $
;                            bangy_n=bangy_n,bangy_k=bangy_k,/overplot
;
; SIDE EFFECTS:
;
;           TEK_COLOR is used to set the color tables. 
;
; COMMON BLOCKS:
;
;           IMD
;           PLOT_PRINT (see ~windt/plot_print.pro)
;
;
; RESTRICTIONS:
;
;  The program uses many procedures found in the
;  ~idl/user_contrib/windt directory.
;
; MODIFICATION HISTORY:
;
;  David L. Windt, Bell Labs, April 1997
;  windt@astro.columbia.edu
;-


;+
;
; NAME:
;
;     IMD_RD
;
; PURPOSE:
;
;     A function used to open IMD files.
;
; CALLING SEQUENCE:
;
;     Result=IMD_RD([FILE=FILE])
; 
; KEYWORD PARAMETERS:
;
;     FILE - The name of the IMD file to open.  If omitted, PICKFILE
;            will be used to get a file name.
;
; OUTPUTS:
;
;     Result - 0 or 1, depending on whether the file was opened
;              successfully or not.
;
; COMMON BLOCKS:
;
;     IMD
;     IMD_PARS
;     IMD_VARS
;     IMD_FPARS
;     IMD_FVARS
;     IMD_NSVARS
;
; RESTRICTIONS:
;
;     Must be used in the IMD environment.
;
;     New versions of IMD will probably not be able to open old IMD
;     files.
;
; PROCEDURE:
;
;     IMD files are saved and opened using the IDL SAVE and RESTORE
;     commands.  The IMD_RD procedure does a few more things than just
;     calling RESTORE, so you should not try to open IMD files using
;     RESTORE directly.
; 
; MODIFICATION HISTORY:
;
;   David L. Windt, Bell Labs, April 1997.
;   windt@astro.columbia.edu
;-


;+ ; ; NAME: ; ; IMD_M_RD ; ; PURPOSE: ; ; A procedure to open a measured data file and define the IMD ; variables X_M, Y_M, and SIGY_M, as well as the pointers X_M_PTR ; and Y_M_PTR and some other important internal IMD variables. ; ; CALLING SEQUENCE: ; ; IMD_M_RD,X_M_PTR=X_M_PTR,Y_M_PTR=Y_M_PTR, ; RD_M_CMD=RD_M_CMD, ; X_M_SCALE=X_M_SCALE, ; Y_M_SCALE=Y_M_SCALE, ; X_M_OFFSET=X_M_OFFSET, ; Y_M_OFFSET=Y_M_OFFSET ; ; ; INPUTS: ; ; X_M_PTR - An integer that tells IMD to which independent variable ; the X_M data refer. X_M_PTR=0 indicates incidence ; angle data and X_M_PTR=1 indicates wavelength (or ; energy) data. If other independent variables are ; already defined in the IMD environment, then larger ; values of X_M_PTR can be set. The order of the ; variables listed in the Independent Variables List, on ; the main IMD widget, correspond to X_M_PTR values. ; ; If X_M_PTR is omitted, then the data will be assumed ; have an independent variable corresponding to the ; current value if IMD.X_M, i.e., if measured data has ; already been defined, the new data will be assumed to ; have the same independent variable, or if no data has ; been read, IMD.X_M=0, indicating incidence angle data. ; ; Y_M_PTR - An integer that tells IMD which dependent variable the ; Y_M data refer to. Set ; ; Y_M_PTR=0 for reflectanc ; Y_M_PTR=1 for transmittance ; Y_M_PTR=2 for absorptance ; Y_M_PTR=3 for psi ; Y_M_PTR=4 for delta ; Y_M_PTR=5 for user1 ; Y_M_PTR=6 for user2 ; Y_M_PTR=7 for user3 ; Y_M_PTR=8 for non-specular reflected intensity ; ; ; RD_M_CMD - A string specifying the command to actually read the ; data file. The command string must obey IDL syntax ; rules. ; ; OPTIONAL KEYWORD PARAMETERS: ; ; LIMIT_M - Set this keyword to 1 to cause IMD_M_RD to ignore measured ; data values outside the range specified by the X_M_RANGE ; keyword if it is set, or by the current value of the ; IMD.X_M_RANGE. Set this keyword to 0 to use the entire data ; set. If LIMIT_M is not explicitly set, then the current ; value of IMD.LIMIT_M is used. ; ; X_M_RANGE - A 2-element array specifying the range of X_M values outside ; of which the measured data is to be ignored. For example, ; if the measured data file contains incidence angle data from ; 0 to 90 degrees, but you wish to ignore data from 0 to 5 degrees ; and from 85 to 90 degrees, then set X_M_RANGE=[5.,85.]. ; If X_M_RANGE is not set, then the current value of IMD.X_M_RANGE ; is used. Note that X_M_RANGE (and/or IMD.X_M_RANGE) is only ; used if LIMIT_M (or IMD.LIMIT_M) is set to 1. ; ; X_M_OFFSET - An offset of X_M_OFFSET will be added to the X_M data. ; Default value is 0. ; ; X_M_SCALE - The X_M data will be multiplied by X_M_SCALE. ; Default value is 1. ; ; Y_M_OFFSET - An offset of Y_M_OFFSET will be added to the Y_M data. ; Default value is 0. ; ; Y_M_SCALE - The Y_M data will be multiplied by Y_M_SCALE. ; Default value is 1. ; ; COMMON BLOCKS: ; ; IMD ; IMD_VARS ; IMD_PARS ; IMD_NSVARS ; IMD_M ; ; RESTRICTIONS: ; ; If your data does not include experimental uncertainties, SIGY_M, ; the uncertainty in Y_M, will be set to zero. (In this case, you ; will not be able to use instrumental weighting when performing ; curve-fits in IMD.) ; ; NOTE: You should always use IMD_M_RD to open a measured data file from ; the IDL command line, even if you have written a procedure that defines ; X_m, Y_m, and SIGY_m directly. ; ; PROCEDURE: ; ; IMD_M_RD will read your data file, and it will set the IMD ; measured-data-valid flag (IMD.M_VALID) accordingly. ; ; The measured data file is opened, by using the EXECUTE function ; with RD_M_CMD as an argument. If RD_M_CMD does not include ; X_M, Y_M, and optionally SIGY_M explicitly, than the procedure ; to read the data must contain the IMD_M common block, and ; these variables must be set inside the procedure. ; ; Note: The X_M data will be converted to angstroms if X_M refers to ; wavelengths or lengths, or to degrees from the normal if X_m refers ; to angles. The conversion will depend on the current values of the ; IMD internal pointers (IMD.ANGLEUNITS, IMD.PHOTONUNITS_PTR and ; IMD.LAYERUNITS_PTR; see Appendix B4), so it's important that these ; pointers are 'pointing' correctly BEFORE READING THE DATA. You should ; NEVER attempt to set these pointers yourself. ; ; For example, to read a measured data file containing three ; columns of data - incidence angle, reflectance, and uncertainty ; in reflectance - the EROM command could be used, so that the ; value of RD_M_CMD would be set to ; ; RD_M_CMD='EROM,X_M,Y_M,SIGY_M' ; ; Alternatively, if you have an IDL procedure that you have written ; to read you own measured data files, you would include the IMD_M ; common block in your procedure (or function) and define X_M, Y_M, ; and optionally SIGY_M explicitly: ; ; RD_M_CMD='MY_PRO_TO_READ_MY_DATA' ; ; where: ; ; PRO MY_PRO_TO_READ_MY_DATA ; ; COMMON IMD_M ; ; ;; IDL code to read your data goes here ; ; X_M=my_x_data ; Y_M=my_y_data ; ; ;; and optionally ; SIGY_M=my_sigy_data ; ; return ; end ; ; MODIFICATION HISTORY: ; ; David L. Windt, Bell Labs, April 1997. ; windt@astro.columbia.edu ; ; November 1997: added the LIMIT_M and X_M_RANGE keywords. ; ; April 1998: added the Y_M_SCALE keyword. ; ;-
;+ ; NAME: ; ; IMDSPLOT ; IMDNPLOT ; IMDFPLOT ; IMDCPLOT ; ; PURPOSE: ; ; These four procedures produce 1D and/or 2D plots of specular ; optical properties (reflectance/transmittance/absorptance ; etc. ), non-specular reflected intensity, field intensity, and ; confidence levels, respectively. ; ; See the KEYWORD and PROCEDURE sections below for details. ; ; CALLING SEQUENCE: ; ; IMDSPLOT ; IMDNPLOT ; IMDFPLOT ; IMDCPLOT ; ; KEYWORD PARAMETERS: ; ; IVINDICES - (IMDSPLOT,IMDNPLOT, IMDFPLOT only) Array indicating ; the array indices of independent variables. The ; length of IVINDICES is equal to the number of ; independent variables that are defined (as indicated ; in the Independent Variables list on the IMD ; widget). There are always at least two independent ; variables - angle and wavelength; in the case of ; IMDFPLOT, there are at least three: depth, angle, ; and wavelength; in the case of IMDNPLOT, there are ; at least four: angle, wavelength, scattering angle, ; and scattering plane azimuthal angle (phi). ; ; This keyword only has an effect if you're plotting ; data that involve more than one multi-valued ; independent variable. See the PROCEDURE section ; below for details. ; ; FPINDICES - (IMDCPLOT only) Array indicating the array indices ; of fit parameters. Similar to IVINDICES (above.) ; ; LEVEL - (IMDCPLOT only) the Chi^2 confidence level (from 0-100). ; ; JOINT - (IMDCPLOT only) 0 for independent confidence intervals, ; 1 for joint confidence intervals. ; ; OVERPLOT - Don't draw plot axes, just overplot the data. ; ; S_LABEL_POS - An integer from 0 to 12, indicating the position ; for the Structure label. See the PLOT_TEXT ; procedure for details. ; ; FP_LABEL_POS - An integer from 0 to 12, indicating the position ; for the Fit Parameters label (IMDSPLOT and ; IMDCPLOT only). See the PLOT_TEXT procedure for ; details. ; ; APFQ_LABEL_POS - An integer from 0 to 12, indicating the ; position for the Angular Resultion/Spectral ; Resolution/ Polarization label. See the ; PLOT_TEXT procedure for details. ; ; CURVE_LABEL_POS - A floating point number from 0 to 1 indicating ; the position for curve labels. See the ; CURVE_LABEL procedure for details. This ; keyword only has an effect if ; IMDSPLOT.LEGEND=0 (for IMDSPLOT), ; IMDNPLOT.LEGEND=0 (for IMDNPLOT), ; IMDFPLOT.LEGEND=0 (for IMDFPLOT), or ; IMDCPLOT.LEGEND=0 (for IMDCPLOT). ; ; LEGEND_POS - An integer from 0 to 12, indicating the position ; for the plot legend. See the LEGEND procedure for ; details.This keyword only has an effect if ; IMDSPLOT.LEGEND=1 (for IMDSPLOT), IMDFPLOT.LEGEND=1 ; (for IMDFPLOT), or IMDCPLOT.LEGEND=1 (for ; IMDCPLOT). ; ; CLABEL - String array to label curves using CURVE_LABEL or ; LEGEND. If non-null, then the values supplied will be ; used on the plot. Otherwise, the program will return ; the values automatically generated. These returned ; values can then be used to label the plot later. This ; latter behavior is useful when you want to include ; multiple variables using the OVERPLOT keyword, and you ; wish to label all the curves using LEGEND; Use of the ; NO_CLABEL keyword would thus be appropriate. ; ; NO_CLABEL - Don't actually draw the curve labels. (But CLABEL ; will still contain the strings that would have been ; labelled.) ; ; FORCE_CLABEL - Force the curve labels to include the independent ; variable (or fit parameter) values that would ; otherwise wind up in the subtitle. ; ; LEGEND_STYLE - An N x 5 array, where N is the number of ; dependent variables on the plot, containing the N ; values of COLOR, LINESTYLE, THICK, PSYM, and SYMSIZE ; for each curve. These values can thus be used ; to instruct LEGEND on how to create a legend ; to correspond with what was plotted. ; ; DCHI2_LABEL_POS - (1D IMDCPLOTs only) A floating point number from 0 ; to 1 indicating the position for the Chi^2 ; curve label. See the CURVE_LABEL procedure ; for details. ; ; DCHI2LABEL - (1D IMDCPLOTs only) A string specifying the label ; to use for the Chi^2 label. ; ; XTITLE ; YTITLE ; PYTITLE (IMDSPLOT only; phase axis) ; ZTITLE (IMDSPLOT, IMDNPLOT, IMDFPLOT only) ; SUBTITLE ; TITLE - The usual graphics keywords. If non-null, then these ; values will appear on the plot. Otherwise, the program ; will return the values automatically generated. ; ; XTYPE, XRANGE, XSTYLE ; YTYPE, YRANGE, YSTYLE ; PYTYPE, PYRANGE, PYSTYLE, PYTICKS (IMDSPLOT only; phase axis) ; ZTYPE, ZRANGE, ZSTYLE (IMDSPLOT, IMDNPLOT, IMDFPLOT only) ; The usual graphics keywords. ; ; YMARGIN0 - Set this to make extra space below a plot to allow ; for PLOT_TEXT boxes and LEGEND boxes. ; ; HORIZONTAL - The HORIZONTAL keyword for surface plots. ; ; STATS_FLAGS - (IMDSPLOT, IMDNPLOT only) a six-element array of ; flags indicating which statistics are to be ; computed and displayed (overrides IMDSPLOT.STATS_FLAGS ; or IMDNPLOT.STATS_FLAGS) ; ; STATS_FLAGS(0): set to compute min ; STATS_FLAGS(1): set to compute max ; STATS_FLAGS(2): set to compute average ; STATS_FLAGS(3): set to compute integral ; STATS_FLAGS(4): set to compute fwhmax ; STATS_FLAGS(5): set to compute fwhmin ; ; STATS_FUNCTION - (IMDSPLOT, IMDNPLOT only) an integer specifying ; which function is to be used when computing ; statistics (overrides IMDSPLOT.STATS_FUNCTION ; or IMDNPLOT.STATS_FUNCTION) ; ; for IMDSPLOT: ; ; STATS_FUNCTION = 0 for average reflectance ; STATS_FUNCTION = 1 for s-reflectance ; STATS_FUNCTION = 2 for p-reflectance ; STATS_FUNCTION = 3 for s-reflected phase ; STATS_FUNCTION = 4 for p-reflected phase ; STATS_FUNCTION = 5 for psi ; STATS_FUNCTION = 6 for delta ; STATS_FUNCTION = 7 for average transmittance ; STATS_FUNCTION = 8 for s-transmittance ; STATS_FUNCTION = 9 for p-transmittance ; STATS_FUNCTION = 10 for s-transmitted phase ; STATS_FUNCTION = 11 for p-transmitted phase ; STATS_FUNCTION = 12 for average absorptance ; STATS_FUNCTION = 13 for s-absorptance ; STATS_FUNCTION = 14 for p-absorptance ; STATS_FUNCTION = 15 for user1 ; STATS_FUNCTION = 16 for user2 ; STATS_FUNCTION = 17 for user3 ; ; for IMDNPLOT: ; ; STATS_FUNCTION = 0 for didomega_baa ; STATS_FUNCTION = 1 for didomega_bas ; STATS_FUNCTION = 2 for didomega_bap ; STATS_FUNCTION = 3 for didomega_dwba ; ; ROI_FLAG - (IMDSPLOT, IMDNPLOT only) set to 1 to display ; region-of-interest lines. ; ; ROI_RANGE - (IMDSPLOT, IMDNPLOT only) a two-element array ; specifying the region-of-interest array indices of ; the X-axis plot variable. ; ; TD_PARS - a 2-element array indicating what type of 2D plot ; draw: For a surface plot, set TD_PARS(0)=0; for a ; contour plot, TD_PARS(0)=1; for a filled contour ; plots, set TD_PARS(0)=2; and for a cont_image plot ; (using the CONT_IMAGE procedure in the windt library), ; set TD_PARS(0)=3. TD_PARS(1) is the number of contour ; levels to draw when TD_PARS(0) is greater than 0. ; ; ; QSPACE - a scalar flag indicating that an angle axis or axes are ; to be plotted in momentum space instead of real ; space. ; ; For IMDNPLOT, ; ; QSPACE=1 => 1D plot vs. q_x ; QSPACE=2 => 1D plot vs. q_y ; QSPACE=3 => 1D plot vs. q_z ; QSPACE=4 => 2D plot vs. q_x vs q_y ; QSPACE=5 => 2D plot vs. q_x vs q_z ; QSPACE=6 => 2D plot vs. q_y vs q_z ; ; For IMDSPLOT, IMDFPLOT and IMDCPLOT, a QSPACE value ; greater than one results in a 1D or 2D plot vs. q_z. ; ; If lambda (or phi) are plot variables, momentum space ; plots are not possible. ; ; The following keywords determine which dependent variables ; are plotted ; ; IMDSPLOT only: ; ; PLOT - an array of flags indicating which functions to plot: ; ; PLOT(0) - Plot average reflectance (overrides IMDSPLOT.RA) ; PLOT(1) - Plot s-reflectance (overrides IMDSPLOT.RS) ; PLOT(2) - Plot p-reflectance (overrides IMDSPLOT.RP) ; PLOT(3) - Plot reflected s-phase (overrides IMDSPLOT.PRS) ; PLOT(4) - Plot reflected p-phase (overrides IMDSPLOT.PRP) ; PLOT(5) - Plot ellipsometric psi (overrides IMDSPLOT.PSI) ; PLOT(6) - Plot ellipsometric delta (overrides IMDSPLOT.DELTA) ; PLOT(7) - Plot average transmittance (overrides IMDSPLOT.TA) ; PLOT(8) - Plot s-transmittance (overrides IMDSPLOT.TS) ; PLOT(9) - Plot p-transmittance (overrides IMDSPLOT.TP) ; PLOT(10) - Plot transmitted s-phase (overrides IMDSPLOT.PTS) ; PLOT(11) - Plot transmitted p-phase (overrides IMDSPLOT.PTP) ; PLOT(12) - Plot average absorptance (overrides IMDSPLOT.AA) ; PLOT(13) - Plot s-absorptance (overrides IMDSPLOT.AS) ; PLOT(14) - Plot p-absorptance (overrides IMDSPLOT.AP) ; PLOT(15) - Plot user1 function (overrides IMDSPLOT.USER1) ; PLOT(16) - Plot user2 function (overrides IMDSPLOT.USER2) ; PLOT(17) - Plot user3 function (overrides IMDSPLOT.USER3) ; ; IMDNPLOT only: ; ; PLOT - an array of flags indicating which functions to plot: ; ; PLOT(0) - Plot didomega_baa (overrides IMDNPLOT.BAA) ; PLOT(1) - Plot didomega_bas (overrides IMDNPLOT.BAS) ; PLOT(2) - Plot didomega_bap (overrides IMDNPLOT.BAP) ; PLOT(3) - Plot didomega_dwba (overrides IMDNPLOT.DWBA) ; ; IMDFPLOT only: ; ; PLOT_FA - Plot average field intensity (overrides IMDFPLOT.FA) ; PLOT_FS - Plot s-field intensity (overrides IMDFPLOT.FA) ; PLOT_FP - Plot p-field intensity (overrides IMDFPLOT.FA) ; ; The following keywords are all 5-element arrays, specifying ; how the dependent variables are to appear. The 5-elements ; correspond to the [COLOR, LINESTYLE, THICK, PSYM, SYMSIZE] ; graphics keywords. ; ; IMDSPLOT only: ; ; RASTYLE - average reflectance style ; RSSTYLE - s-reflectance style ; RPSTYLE - p-reflectance style ; PRSSTYLE - s-reflected phase style ; PRPSTYLE - p-reflected phase style ; TASTYLE - average transmittance style ; TSSTYLE - s-transmittance style ; TPSTYLE - p-transmittance style ; PTSSTYLE - s-transmitted phase style ; PTPSTYLE - p-transmitted phase style ; AASTYLE - average absorptance style ; ASSTYLE - s-absorptance style ; APSTYLE - p-absorptance style ; ; IMDFPLOT only: ; ; FASTYLE - average field intensity style ; FSSTYLE - s-field intensity style ; FPSTYLE - p-field intensity style ; ISTYLE - interface line style (PSYM and SYMSIZE are ignored) ; ; NOINTERFACE - Set to inhibit IMDFPLOT from drawing the interface ; lines. ; ; IMDCPLOT only: ; ; CSTYLE - Chi^2 style (PSYM and SYMSIZE are ignored for contour ; plots) ; ; PTSTYLE - Best fit point style (only PSYM and SYMSIZE are used.) ; ; ; PROCEDURE/EXAMPLES: ; ; If you have calculated optical properties, field intensities or ; chi^2 values for only one independent variable (or fit ; parameter), then you need not worry about the following ; discussion. Just type IMDSPLOT, IMDFPLOT, or IMDCPLOT at the ; command line and a plot will appear. ; ; On the other hand.... ; ; In the case of IMDSPLOT and IMDFPLOT, if more than one ; (muti-valued) independent variable is available, or in the case ; of IMDCPLOT, if more than one (multi-valued) fit parameter is ; available, the value of the IMD common block variable ; IMDSPLOT.IV, IMDFPLOT.IV, or IMDCPLOT.FP determines what is ; actually plotted. These three variables are bit-wise flags that ; indicate whether or not an independent variable (or fit ; parameter) is to be used as a continuous plot variable, or as a ; discrete plot variable. That is, if bit 0 of IMDSPLOT.IV is ; set, then the optical functions will be plotted versus incidence ; angle; if bit 1 is set, then the optical functions will be set ; versus wavelength (or energy). If other independent variables ; are available (as listed in the Independent Variables List on ; the main IMD widget), then other bits can be set as well. ; Similarly for IMDFPLOT.IV, except bit 0 now refers to depth, bit ; 1 to incidence angle, bit 2 to wavelength, etc. IMDCPLOT.FP ; works the same way, except each bit corresponds to an available ; fit parameter that has been varied to construct the Chi^2 array. ; ; If two bits of IMDSPLOT.IV, IMDFPLOT.IV or IMDCPLOT.FP are ; set, then a surface plot (or a contour plot in the case of ; IMDCPLOT) will be created. ; ; You will also need to set the value of IVINDICES (or FPINDICES ; in the case of IMDCPLOT), in order to specify discrete independent ; variables or fit parameters. ; ; EXAMPLE 1 ; ; Suppose you've computed reflectance vs incidence angle vs ; wavelength, for 20 incidence angles and 30 wavelengths. The IMD ; reflectance variable (R) will thus be a 20x30 element array. To ; plot Reflectance vs Incidence Angle, for the wavelength ; corresponding to the 12th element of the wavelength array, ; use the following commands: ; ; IMD> imdsplot.iv=1 ; IMD> imdsplot,ivindices=[0,12] ; ; Alternatively, to plot reflectance vs. wavelength, for the ; angle corresponding to the 9th element of the angle array, ; type: ; ; IMD> imdsplot.iv=2 ; IMD> imdsplot,ivindices=[9,0] ; ; Finally, to produce a surface plot of reflectance vs angle vs ; wavelength: ; ; IMD> imdsplot.iv=3 ; IMD> imdsplot ; ; EXAMPLE 2 ; ; Here's how to plot the results from two separate IMD calculations ; on the same plot: ; ; IMD> rd=imd_rd(file='file1.dat') ; IMD> imdsplot ; IMD> rd=imd_rd(file='file2.dat') ; IMD> imdsplot,/overplot ; ; Of course you'll probably want to make use of some of the other ; keywords, in order to properly label and distinguish between ; the two data sets. For example, instead of the above, you ; might try something like: ; ; IMD> rd=imd_rd(file='file1.dat') ; IMD> imdsplot,clabel=['File 1'],s_label_pos=0 ; IMD> rd=imd_rd(file='file2.dat') ; IMD> imdsplot,/overplot,clabel=['File 2'],rastyle=[2,0,0,0,0] ; ; MODIFICATION HISTORY: ; ; David L. Windt, Bell Labs, April 1997. ; ; Many changes to IMD V4.0 - April, 1998. ; ; windt@astro.columbia.edu ;-

;+ ; ; NAME: ; ; IMDMPLOT ; ; PURPOSE: ; ; Produce plots of measured data. ; ; CALLING SEQUENCE: ; ; IMDMPLOT ; ; KEYWORD PARAMETERS: ; ; The XTITLE, YTITLE, SUBTITLE, TITLE, CHARSIZE, OVERPLOT, ; CURVE_LABEL_POS, LEGEND_POS, NO_LABEL, CLABEL and QSPACE ; keywords work the same way as for IMDSPLOT/IMDNPLOT. ; ; In addition, the MSTYLE keyword is an array specifying [COLOR, ; LINESTYLE, THICK, PSYM, and SYMSIZE values for the measured ; data. ; ; EXAMPLE: ; ; Here's how to open an IMD data file, open a measured data file ; containing reflectance vs. incidence angle data, plot the IMD ; data, and overplot your measured data: ; ; IMD> rd=imd_rd(file='file.dat') ; IMD> imdsplot ; IMD> imd_m_rd,rd_m_cmd='erom,x_m,y_m,sigy_m',x_m_ptr=0,y_m_ptr=0 ; IMD> imdmplot,/overplot ; ; ; MODIFICATION HISTORY: ; ; David L. Windt, Bell Labs, April 1997. ; ; April, 1998: Many changes upgrading to IMD V4.0. ; ; windt@astro.columbia.edu ;-
;+ ; NAME: ; ; IMD_PLOT_LBL ; ; PURPOSE: ; ; A procedure to add labels to a plot. ; ; CALLING SEQUENCE: ; ; IMD_PLOT_LBL,/SPLOT or /FPLOT or /CPLOT ; ; INPUTS: ; ; SPLOT, FPLOT, CPLOT - indicates what type of plot to label. ; ; KEYWORD PARAMETERS: ; ; S_LABEL_POS ; FP_LABEL_POS ; APFQ_LABEL_POS ; ; See the description of these keywords in the ; IMDSPLOT/IMDFPLOT/IMDCPLOT documentation above. ; ; Setting these keywords overrides the current value of the ; corresponding flags: ; ; IMDSPLOT.S_LABEL,IMDFPLOT.S_LABEL, IMDCPLOT.S_LABEL; ; ; IMDSPLOT.FP_LABEL, IMDCPLOT.FP_LABEL; ; ; IMDSPLOT.APFQ_LABEL,IMDFPLOT.APFQ_LABEL, IMDCPLOT.APFQ_LABEL; ; ; ; MODIFICATION HISTORY: ; ; David L. Windt, Bell Labs, April 1997. ; windt@astro.columbia.edu ;-


Back | Contents | Next