esrf

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

GHSCANS.MAC
See other macros in category: All
Description:
    Macros implementing ghost scans.
Documentation:
    OVERVIEW
    Ghost scans are motor scans that don't make use of any of the resources employed by the standard spec scans. They don't write neither in the data file nor on the screen, they don't modify the variables used by the standard scans and if they plot, that is optional, they do it in a different window.
    The purpose behind ghost scans is to provide a method to perform motor scans during the execution of other scans without perturbing them. By using ghost scans one can trigger alignement operations when a ordinary scan is running. The typical application is to realign some critical component, like a monochromator, either periodically or when an intensity drop is detected.

    The scanning macros require the same parameters that the equivalent standard scans. One exception is the ghlineup macro that in addition to the parameters of the standard %dscan% macro accepts an optional threshold value. One can set other options (counters to record, plotting window, etc.) by using the ghopt and ghoptadd macros. Once some options are set in this way they affect all the following ghost scans until they are reset or modified. The available options are:
    • counters=<cnt_list> - comma separated list of counters to record.
    • plot or plot=<n> - plots the scan data in window <n>.
    • title=<string> - sets plot title to <string>.
    • verbose - sets verbode mode.

    One can retrieve information about the last ghost scan in the global array GHRES[]. The information that is generally available is the following:
    • GHRES["npoints"] - Number of points actually measured.
    • GHRES["ncounters"] - Number of counters.
    • GHRES["aborted?"] - flag indicating if the scan was aborted or not.
    • GHRES["cnt_mne"][0:ncounters] - counter mnemonics.
    In addition to the previous values, GHRES[] may contain other information specific to the particular scan.
    The scan data is stored in the global array GHDATA[npoints][1+ncounters].

    These macros are intended to be used inside other macros and not from the command line. However they should work if used from the command line for testing purposes (see the "verbose" option). They could be also used by people who want to do some alignment without modifying the current data file.

    EXAMPLE
    ghopt counters=det,mon plot
    Activates the counters `det' and `mon' and activates plotting.
    ghdscan slit -5 5 20 1
    performs a dscan in ghost mode.
    ghadd plot=3 peak=COM ; ghlineup mono -.01 .01 40 1 .8
    Selects the window 3 for plotting, sets the peak criterium to the center of mass (COM) and performs a line up monochromator scan with a threshold of 80%.


Macros:
    ghascan
    Usage: ghascan <motor> <star> <finish> <intervals> <time>
    Ghost version of ascan.

    ghdscan
    Usage: ghdscan <motor> <rel_star> <rel_finish> <intervals> <time>
    Ghost version of dscan.
    If the macro is interrupted with Ctrl-C, the motor is not moved to the initial position. The initial motor position is stored in GHRES["prev_pos"].

    ghlineup
    Usage: ghlineup <motor> <rel_star> <rel_finish> <intervals> <time> [<threshold>]
    Ghost version of lineup. The scan runs as a dscan but if a peak is found when the scan is completed, the motor is moved to the peak position. The definition of the peak position can be selected with ghopt or ghoptadd among the following:
    • peak=PK - peak value (this is the default).
    • peak=CEN - center of the FWHM.
    • peak=COM - center of mass.
    A threshold level can be optionally defined with a fifth parameter. The macro considers that a peak is found when the intensity is above such a threshold. If not, the motor is moved to the initial position as if it were a dscan.
    If <threshold> is set to a positive value is it is interpreted as a relative value and the actual threshold is calculated as this value multiplied by the counts at the current position (the counters are run once before starting the scan). If <threshold> is a negative value, its absolute value is taken as actual threshold. If not specified, the threshold is set to zero.

    The macro provides information about the alignment in the global array GHRES. The following elements are available:
    • GHRES["counter"] - mnemonic of the counter used for the alignment.
    • GHRES["prev_pos"] - initial motor position.
    • GHRES["prev_count"] - initial counts (only if a relative threshold is set).
    • GHRES["threshold"] - absolute threshold value.
    • GHRES["peak"] - peak definition (PK, CEN or COM).
    • GHRES["peak_found"] - flag.
    • GHRES["peak_pos"] - peak position.
    • GHRES["peak_count"] - intensity at the peak position.


    ghopt
    Usage: ghopt [<option> | <option>=<value>] ...
    Initializes the current option set to the options in the parameter list. Previously defined options are deleted.
    The available options are:


    ghoptadd
    Usage: ghoptadd [<option> | <option>=<value>] ...
    Adds options the parameter list to the current set.

    ghoptremove
    Usage: ghoptremove [<option>] ...
    (Not yet implemented).

Internal Macros:
    _ghcheck0
    Usage: _ghcheck0 <motor>
    this is here to complie with _check0 redefinition on id28 that is used for hexapode mihexz backlash correction.

    _ghchkopt
    Usage: _ghchkopt ()
    Checks the options in the current option set and initializes some values.

    _ghscan
    Usage: _ghscan (<motor_mne>, <start>, <finish>, <inetrvals>, <time>)
    The macro that does the actual scan.

    ghplot
    Usage: ghplot (<motor>, <start>, <finish>, <npts>, <label>)


    _ghoptadd
    Usage: _ghoptadd (<option_string>)
    Adds the options in <option_string> to the current set.

    gh_MIN
    Usage: gh_MIN


    gh_MAX
    Usage: gh_MAX


    gh_xMIN
    Usage: gh_xMIN


    gh_xMAX
    Usage: gh_xMAX


    gh_SUM
    Usage: gh_SUM


    gh_SUMSQ
    Usage: gh_SUMSQ


    gh_FWHM
    Usage: gh_FWHM


    gh_CFWHM
    Usage: gh_CFWHM


    gh_COM
    Usage: gh_COM


    gh_LHMX
    Usage: gh_LHMX


    gh_UHMX
    Usage: gh_UHMX


    gh_plot_res
    Usage: gh_plot_res(lab_len)


Filename: ghscans.mac
Author: P.Fajardo, (Original 6/97). $Revision: 3.5 $ / $Date: 2013/02/08 18:29:39 $
Last mod.: 08/02/2013 19:30 by homsrego