esrf

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

KB_FOCUS.MAC
See other macros in category:
Description:
    KB_FOCUS
Documentation:
    DESCRIPTION
    KB_FOCUS is a set of macros designed to focus a kb mirror. Two iteratives methdos of focusing are provided : parabolic fitting and interaction matrix.
    The principle is to change the bending of the mirror and to control the gain in terme of focusing. The quality of focusing is depicted by a minimal movement of the beam (bpm counters) during a scan (rel_start rel_end) of slits. Once a correction has been done, we try to evaluate the next correction to apply considering the previous one and the gain. %DEPENDANCIES% spec_utils.mac hg.mac

    EXAMPLE
    kbf_focus <bender_inc> <"horiz"|"vert"> <"asym"|"sym"|"both"|"intm"> <rel_start> <rel_end> <nb_pts> <counting_time>

    <bender_inc> : Bender motors increment.
    <"horiz"|"vert"> : Horizontal or vertical focalization.
    <"asym"|"sym"|"both"|"intm"> : Focalization mode.
    <rel_start> : Relative start of the SLITS scans. (V and H)
    <rel_end> : Relative end of the SLIT scans. (V and H)
    <nb_pts> : Number of points of scans.
    <counting_time> : Counting time per point time (must be bigger
    than exposure time for the bpm counters).
    • "asym" : Asymetric correction : the two bender motors are actuated in opposite directions. This allows to correct quadratic term of focusing error.
    • "sym" : Symetric correction : The two bender motors are actuated in the same direction. This allows to correct linear term of focusing error.
    • "both" : Correct both terms.
    • "intm" : Use interaction matrix + quadratic fit.


    SETUP
    3 setup commands are needed:
    1) kbf_setup_slits_positions <horiz_gap_open> <horiz_gap_closed> <vert_gap_open> <vert_gap_closed> <horiz_offset_max> <vert_offset_max>

    Sets the limits position checked for gap/offsets before doing a scan.
    • <horiz_gap_open> : Value of horizontal gap to be used for a vertical scan. (big)
    • <horiz_gap_closed> : Value of horizontal gap to be used for an horizontal scan. (small)
    • <vert_gap_open> : Value of vertical gap to be used for an horizontal scan. (big)
    • <vert_gap_closed> : Value of vertical gap to be used for a vertical scan. (small)
    • <horiz_offset_max> : Value of horizontal offset to not exceed for a scan.
    • <vert_offset_max> : Value of vertical offset to not exceed for a scan.
    example : kbf_setup_slits_positions 0.4 0.02 0.2 0.02 0.1? 0.1? If gaps are not inside good limits, the macro ask to open/close them. If offsets are bigger than _offset_max, macro ask to center them.
    2) kbf_setup_motors <horiz_ct> <vert_ct> <hor_gap> <ver_gap> <hor_off> <v_off> <hor1> <hor2> <ver1> <ver2>

    Sets counters and motors names.
    You have to define 2 bpm counters and 8 motors for slits and KB benders.
    • <horiz_ct> : Horizontal BPM position counter.
    • <vert_ct> : Vertical BPM position counter.
    • <hor_gap> : Horizontal Slits Gap motor mnemonic.
    • <ver_gap> : Vertical Slits Gap motor mnemonic.
    • <hor_off> : Horizontal Slits Offset motor mnemonic.
    • <v_off> : Vertical Slits Offset motor mnemonic.
    • <hor1> : 1st bender of horizontal mirror (upstream motor relative to the beam)
    • <hor2> : 2nd bender of horizontal mirror (downstream motor relative to the beam)
    • <ver1> : 1st bender of vertical mirror (upstream motor relative to the beam)
    • <ver2> : 2nd bender of vertical mirror (downstream motor relative to the beam)
    example : kbf_setup_motors metx mety kshg ksvg ksho ksvo pmh1 pmh2 pmv1 pmv2
    3) kbf_setup <sleep_time>

    • <sleep_time> : the time to wait for KB stabilization after a move.
    example : kbf_setup 0.2 (Spec fitting. (recommanded))


Macros:
    kbf_setup
    Usage: kbf_setup <sleep_time>
    -Waits <sleep_time> seconds after a movement for stabilization of the KB.

    kbf_setup_slits_positions
    Usage: kbf_setup_slits_positions <horiz_gap_open> <horiz_gap_closed> <vert_gap_open> <vert_gap_closed> <horiz_offset_max> <vert_offset_max>
    Defines the values to use by safety macros to prevent a scan with bad slit gap or offset. Using theses values, the scan macro will propose to reduce or increase the gap/offset before doing the scans.

    kbf_setup_motors
    Usage: kbf_setup_motors <horiz_ct> <vert_ct> <horgap> <vergap> <horoff> <voff> <hor1> <hor2> <ver1> <ver2>
    Defines counters and motors mnemonnics to use for focusing. Checks if motors are well defined.

    kbf_setup_motor_type
    Usage: kbf_setup_motor_type <motor type>
    Allow to define <motor type> : pico | <NONE>

    kbf_unsetup
    Usage: kbf_unsetup
    Remove KFFocusing globals.

    kbf_info
    Usage: kbf_info
    Display some info about kbf coinfiguration

    kbf_check_motor
    Usage: kbf_check_motor (<motmne>)


    kbf_check_counter
    Usage: kbf_check_counter (<cntmne>)


    kbf_check_h_slits
    Usage: kbf_check_h_slits ()
    Checks needed for an HORIZONTAL scan.

    kbf_check_v_slits
    Usage: kbf_check_v_slits []
    Checks needed for a VERTICAL scan.

    kbf_parabola
    Usage: kbf_parabola (cnt_number)
    Fits data of counter cnt_number with a parabola. Displays the fitted parabla. Results are put in KBF_FIT_PARAM

    kbf_spec_fit
    Usage: kbf_spec_fit []


    kbf_intm_fit
    Usage: kbf_intm_fit []
    Fit function for interaction matrix mode. ( for ABA method 5 ?) ???

    kbf_plotParabola
    Usage: kbf_plotParabola []
    Plots the parabola resulting of fitting.

    pico_mvr
    Usage: pico_mvr <parma>


    pico_mv
    Usage: pico_mv <parma>


    kbf_disp_stat
    Usage: kbf_disp_stat (<counter_num>)
    Display statistics about previous scan. Raw data and fitted data.

    kbf_focus
    Usage: kbf_focus []


    kbf_parab
    Usage: kbf_parab []


Internal Macros:
    kbf_disp_history
    Usage: kbf_disp_history


    kbf_fformat
    Usage: kbf_fformat(val)


    kbf_test_stat_display
    Usage: kbf_test_stat_display


    _kbf_usage
    Usage: _kbf_usage ()


    _kbf_cleanup
    Usage: _kbf_cleanup


    kbf_print
    Usage: kbf_print (<title>, <message>)
    Prints title in bold and message in regular font.

Filename: kb_focus.mac
Author:
Last mod.: 10/07/2020 11:17 by guilloud