esrf

Beamline Instrument Software Support
SPEC Macro documentation: [ Macro Index | BCU Home ]

id9eds.mac
See other macros in category: Scans Beamlines
Description:
    Macros for Energy dispersive scattering
Documentation:
    DESCRIPTION
    This macro set is used on beamline ID9 for High Pressure Work for the moment. The reciprocal space is searched for reflections. Utilities to index this reflections and find other reflections are provided

    OVERVIEW
    Initializing the macro package
    • You initialize the eds macros with edssetup
    Searching for reflections
    • Searching for reflections in the chi , theta space can be done with edssearch
    Entering the crystal parameters
    • You can enter the crystal parameters by hand with setlat
    • You can calculate the lattice and OM with autoindex
    Finding the OM
    • You can create an index file by hand with editlist
    • Calculate the OM and put it into spec with indexcell
    Another posibility is to enter the OM by hand
    • Enter the OM by hand with enterUB
    • List the OM with listUB
    Refining the OM
    • You can refine the OM with leastsquares
    Working with the OM
    • You can go to an angle specified by hkl with angles.
    • You can calculate hkl for a specific set of angles with hkl.
    • You can index a complete reflection file with indexfile
    • You can create all the accessible reflections and put them into a file with calcall
    • You can move to all these reflections easily with nextref
    File format
    The following file format for reflection files is used :
    %5d %5.2f %5.2f %5.2f %7.2f %10.4f %10.4f %10.4f %7d %6.3f %1d %3d
    <Reflection number> , <H> , <K> , <L> , <Energy in keV>, <Omega in degree>, <Chi in degree>, <Phi in degree>, <Intensity in integr. counts>, <FWHM in keV> <Flag for multiplett> <flag if selected>
    Reflections have flag=1 after search procedure, flag=16 means that the reflaction is selected.


    ATTENTION
    Do not forget to select reflections (flag set to 16), for those reflections you would like to use in the different external programs (like calculating the OM , auoindexing, ...)

    BUGS
    There are some bugs or questions to be fixed
      * Why are all the reflections ignored which can be divided by 2 or 3
        in calcall. Not all people might want to have that.
      * Autoindexing finds sometimes no suitable cr. and put metric tensor
        to 0
      * the interaction with psearch and mca has been isolated but that is
        probably not good enough
     


Macros:
    edssetup
    Usage: edssetup [two-theta minth maxth]
    This macro initializes the global variables and ask the user for some values which will not change later. It has to be called before doing anything else. The user is asked to enter the two-theta angle, where he would like to carry out the measurement and limits for the theta movement.

    edssearch
    Usage: edssearch
    This macro initiates the actual search procedure. The user is asked to specify the necessary parameters and the search is started. The following questions are asked:
     Filename of the search result file        All output will go to this file
     Theta scan speed in seconds per degree 
       FWHM = sqr[a^2 + b*E + (c*E)^2]        These parameters are used for
         Term (a) in keV                      the peak search (in the Energy
         Term (b) in keV                      spectrum).
         Term (c) 
     Minimum Energy to save                   These parameter allow to
     Maximum Energy to save                   restrict the peaks which will
     Minimum Intensity to save                be accepted
        and for every angle
     From <angle>                             A step scan in chi and a continous
     To <angle>                               scan in theta will be carried 
     Step size <angle>                        out.
     
    The following procedure is used to search for scans :
    • Move two theta angle to the user specified value
    • Make a step scan in chi
    • At every point in chi move theta slowly (speed asked above) to the next theta point. During this time acquire on the MCA.
    • If peaks in the energy spectrum are found which satisfy the user conditions, they are written to the file


    hkl
    Usage: hkl [E chi th]
    This macros calculates the HKL for a given E,th,chi pair.

    indexlist
    Usage: indexlist
    Indexes a reflection list by using spec`s orientation matrix. The old hkl from the reflection list will be deleted from the file.

    enterUB
    Usage: enterUB
    Asks user to enter the Orientation matrix in the UB array Rows have to be entered, separated by space.

    listUB
    Usage: listUB
    Prints the UB matrix on the screen

    leastsquares
    Usage: leastsquares
    This macro calls the external program refine_cell_spec to do a least square fit on all the selected (with flag bit 0x10 set to 1) reflections in a file.

    autoindex
    Usage: autoindex
    This macro calls the external program autoindex_spec to try to find the indexes of the selected (with flag bit 0x10 set to 1) reflections in a file.

    indexcell
    Usage: indexcell
    The macro calls the external program calc_om_spec to calculate the orientation matrix from reflections in a file (default EDSINDEXFILE). The user selects the reflections and enters at the keyboard the hkl values. The orientation matrix is calculated and inserted into spec.

    angles
    Usage: angles <h> <k> <l>
    Calculates E, theta (omega), chi for the given h k l and offers the user a choice to move the motors to this position

    editlist
    Usage: editlist
    Add reflections to a list of reflection, edit reflection list. Very primitive for the moment. Should be replaced with an editor later. For the moment you can enter the following commands:
    L
    List all reflections. This is the default action when you just type ENTER.
    D
    Delete one reflection. You will be asked for a reflection number. The reflections will be renumbered only when written to disk.
    A
    Add a reflection by hand. You will be asked to enter the energy, th and chi where you found the reflection.
    M
    Mark a reflection so it will be used by further programs (like autoindexing, least square fitting or index cell). Marked lines will have a 16 in the last column.
    M
    Restore all reflections from the index file. All your changes will be lost.
    E
    Call the editor (specified in the global variable EDITOR) to edit the reflection list. You will not be editing the index file directly , but a temporary file. Only when you write the changes back to the index file when you quit, will you make your changes permanent.
    Q
    Quit the editor. You will be asked if you want to save your changes. The default answer is yes. If you do not save your changes, then they will be lost.


    calcall
    Usage: calcall
    Calculates all possible reflections up to a certain energy. Only reflections are included which can not be divided by 2 or 3. (These reflections are at the same chi/th with twice (three times) the energy)

    nextref
    Usage: nextref [force_new_file_flag]
    This macro goes to the next reflection from a user specified reflection file. The angles are calculated from (hkl) in the file. If a parameter is given, it will ask the file name , otherwise it will ask the file name only the first time it is called.

Internal Macros:
    edssearchinput
    Usage: edssearchinput
    This macro is called from edssearch to ask the user for the parameters of the search to be carried out.

    eds_movetth
    Usage: eds_movetth
    Move eds two theta motor to EDS_TTH

    eds_movechi
    Usage: eds_movechi
    Move eds theta motor to EDS_AN0[1] and chi to EDS_AN0[0]+nchi*chistep

    eds_startmoveth
    Usage: eds_startmoveth
    Starts the theta motor

    eds_getthdth
    Usage: eds_getthdth
    Calculates thcen and thdelta. In the old version the search subdivided the th steps to get better resolution. As this was not used it is removed in this version

    eds_getangles
    Usage: eds_getangles
    A get_angles with printing the motor positions on the screen.

    eds_searchth
    Usage: eds_searchth
    Moves theta motor slowly and aquires data on the mca

    eds_findpeak
    Usage: eds_findpeak
    Searches for peaks in the energy spectrum, plots the spectrum and writes the result into the file and on the screen.

    eds_fast
    Usage: eds_fast
    Sets the velocity and base rate of the theta motor to the saved normal speeds EDSOLDSPEED and EDSOLDBASE

    eds_slow
    Usage: eds_slow
    Sets the velocity and base rate to the slow EDSSPEED (in s/degree)

    eds_mcaacqstart
    Usage: eds_mcaacqstart


    eds_mcaacqstop
    Usage: eds_mcaacqstop


    eds_initmca
    Usage: eds_initmca


    eds_plotspectrum
    Usage: eds_plotspectrum


    eds_psearch
    Usage: eds_psearch


    eds_getpeakvalue
    Usage: eds_getpeakvalue


    eds_writeinfile
    Usage: eds_writeinfile
    Writes the result from the peak search together with the current angles to the search file

    edsreadfile
    Usage: edsreadfile [filename] [print-flag]
    Reads file with EDS_IPR items per line and comment lines in the array EDS_RES. If print-flag is true, every line will be printed on the screen.
    EDS_LINES will hold the number of data lines and EDS_MAXNO will have the maximum value in the first column (The peak number).

    edswritefile
    Usage: edswritefile [filename] [macro name for comment]
    Writes file with reflections with data from EDS_RES EDS_LINES holds the number of data lines.

    eds_listrefl
    Usage: eds_listrefl


    eds_fileheader
    Usage: eds_fileheader <filename> <macro name for comment> [no geo parameters]
    Saves information in the file header for reflection list and other files, The header includes USER, SPEC, date(), EDS_COMMENT, lattice const, UB. The third parameter can be set to 1 if no geometric parameters like OM and lattice should be in the header.

    eds_preloadmatrix
    Usage: eds_preloadmatrix
    This macro does something very tricky be able to load the OM into SPEC. The problem is that SPEC has a Flag set either if it starts up or if somebody calls calcG that the OM should be recalculated on the next calcA from the primary and secondary orientations. So all what I can think of is to force a recalculation before loading the matrix.

    eds_eds2fourc
    Usage: eds_eds2fourc <E> <omega> <chi>
    This macro calculates the fourc angles from the eds "angles" E omega chi. The fourc values are returned in the variables ftth, fth, fchi, and fphi. It uses the LAMBDA and EDS_ED.

    eds_eds2hkl
    Usage: eds_eds2hkl <E> <omega> <chi>
    This macro calculates hkl given in H K L from the eds "angles" E omega chi

    eds_multUB2PI
    Usage: eds_multUB2PI
    Multiplies Spec UB by 2 * PI

    PI2
    Usage: PI2


    eds_savegroup
    Usage: eds_savegroup
    Saves group into file if EDS_GR_MOD is true. Will be called from cleanup. Used in editlist.

    eds_calcangles
    Usage: eds_calcangles h k l
    Used to calculate chi, omega, and theta from h k l The output variable names are fixed to v_chi, v_omega v_theta v_energy

Filename: eds.mac
Author: Larry Finger, Jorg Klora 93/94/95/96
Last mod.: 27/02/2008 18:16 by rey