esrf

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

OSCILLATION.MAC
See other macros in category: Scans
Description:
    Oscillation macros for X-ray diffractaion data collection
Documentation:
    DESCRIPTION
    Use for standard single crystal X-ray diffraction data collection. The sample is exposed to the X-ray beam rotating with constant speed on a goniometer spindle while the diffraction pattern is recorded by an area detector (X-ray image intensifier/CCD). Because of the short exposure times at a synchtrotron (down to 0.1 s) the timing of X-ray shutter and rotation has to be done with care.
    The stepper motor pulses for the spindle rotation are monitored by counting module (VME Counter-Timer 6). This card generates a gate pulse opening and closing an electromagnetical fast X-ray shutter at the begin and end of the oscillation range. Acceleration and deceleration ramp are taken into account as well.























    On ID30 the VCT6 card has to be connected the following way:

    From the Mtheta motor the "TOPMOT" signal MUST be connected to both STRT 2! (not 1) and equally IN 2! (not 1).

    This is in the little rectangle on the front of the Vct6:

              ----------------
              | O ......... O |<-
              | 1 . STRT .. 2 |   |
              | O ......... O |   |--- connect both to TOPMOT mth
              | 1 . STOP .. 2 |   |
              | O ......... O |   |
              | 1 GATE-IN . 2 |   |
              | O ......... O |<- 
              | 1 . IN .... 2 |
              | O ......... O | Sorry all the dots are just to
              | 1 GATE-OUT. 2 | make the picture look correct.
              ----------------
    
    You must also connect the fast shutter cable to the Vct6 plug 1 in the lower rectangle at the bottom of the card.
              ----------------
              | ............. |
              | ...  O. 1 ..  |< ---- fast shutter
              | ............. |
              | ...  O. 2 ..  |
              | ............. |
              | ...  O. 3 ..  |
              | ............. |
              | ...  O. 4 ..  |
              | ............. |
              ----------------
    
    Dark current substraction is done online automatically. Every time you change the exposure time a new dark current image will be read out to be substracted from the image data.

    SETUP
    Please make sure the input 1 of the VCT6 card are configured for TTL level (low = 0V, high = +5V).
    Open the file ~dserver/dbase/res/ID30/id301Vct6_1.res und check whether the following lines are present:
     
     ID30/vct301_1/1/GateLevel:       TTL
     id30/vct301_1/1/InputLevel:      TTL
     
    
    Restart the "Vct6" device server:
     
     opid30@megabar> telnet id301
     User name?: root rt
     id301[1]: procs ! grep Vct
     85   0   0.0     128   92.00k   0 s        0.21 127:00 Vct6 <>>>nil
     id301[2]: os9kill -2 85
     id301[3]: ID301Vct6_0.startup
     
    
    I hope a future release of the VCT6 device server will provide a device server call for the input level so this operation can be included in the SPEC macro.

Macros:
    oscillation
    Usage: oscillation %MDESC% (or "collect") a menu driven routine to take complete data sets


    collect
    Usage: collect %MDESC% (same as "oscillation")


    oscillsetup
    Usage: oscillsetup [gonio] [detector] [shutter] [vct6] [gate] [trigger] [timer] [ccd]
    Global setup. Define all beeamline dependent parameters. Put this line in your beamline's setup file.

    oscillation_debug
    Usage: oscillation_debug [on|off]
    use this macro to obtain more detailed information what is happening in case off problems. Informational messages will be written line by line rather than on the status line on the botton of the screen erasing each other.

    MM_mar_imagepar
    Usage: MM_mar_imagepar(__ccd_u, start_angle, stop_angle, exp_time, range, n_phi_osc, d_s_dist, \ wavelength)
    Set image parameters, detector distance and wavelength

Internal Macros:
    oscillation_data_collection_menu
    Usage: oscillation_data_collection_menu
    setup all needed parameters to acquire a full data set, such as angular step, rotation range, exposure time and filenames

    oscillation_setup
    Usage: oscillation_setup


    data_set
    Usage: data_set (arg[,param])
    print inforation about the number of images in the data set warn if files may be overwritten
    arg = "filename", param = image_number
    Return full absolute path name for image data
    arg = "info"
    Return informational message string about number of images beeing collected and file risking to be overwritten.
    arg = "overwrite?"
    prompt the user to comfirm overwriting of files (one for all files in a data set). Returns 1 or 0.


    data_set_check
    Usage: data_set_check
    used by the "data_set()" macro

    data_file
    Usage: data_file (image_number) %MDESC% Return full absolute path name for image


    oscillation_initialize
    Usage: oscillation_initialize
    Set the user configurable parameters to some resoable defaults when the "oscillation" macro is invoked the first time. The parameters wont be reinitialized in subsequent calls Since they are stored on global variables, which keep their values from one SPEC session to the next. Only if the parameters seem to be cleared, because of a SPEC restart with the -f (from fresh) option or a crash, they will be reloaded from the ASCII file, where the "save_oscillation_parameters" macro saves them.

    save_oscillation_parameters
    Usage: save_oscillation_parameters
    Save all user configurable parameters into an ASCII file so they are not not lost when SPEC is restarted with the -f (from fresh) option, clearing all global variables. The parameters are hold in 2 global arrays, OSCILL and OSC_DATA.

    oscillation_data_collection
    Usage: oscillation_data_collection
    Acquire a complete data set. parameters such as angular step, rotation range, exposure time and filenames are passed in the global array "OSCILL"

    single_oscillation_image
    Usage: single_oscillation_image %MDESC% useful for sample screening and optimizing the exposure time


    rotate_spindle_to
    Usage: rotate_spindle_to <new_position>
    manages absolute motions of the goniometer axis.

    rotate_spindle_by
    Usage: rotate_spindle_by <amplitude>
    manages relative motions of the goniometer axis.

    oscillation_log
    Usage: oscillation_log filename angle
    Append data collection information to the log file as defined by OSC_DATA ["log_file"].

    data_collection_info
    Usage: data_collection_info
    Display progres info at bottom of screen This macro allows subroutine to display messages keeping a clear screen layout

    open_safety_shutter
    Usage: open_safety_shutter open_safety_shutter
    replaces "shopen" macro, which causes problems because it messes up the sceen by unnessary messages and does not wait until the shutter is actually open.

    close_safety_shutter
    Usage: close_safety_shutter


    take_oscillation_image
    Usage: take_oscillation_image [range [exposure-time [no-of-oscillations] ] ]
    Takes a single oscillation image oscillating by <range> degrees in positive direction from the current position. <exposure-time> is the total accumulated exposure time the X-ray shutter is openend. The actual time used may be longer.

    take_still_image
    Usage: take_still_image %MDESC% Used instead of "take_oscillation_image" when the oscillation range is set to 0. If the spindle axis is not rotated the synchronziation of the X-ray shutter must be done in a different way.


    check_oscillation_parameters
    Usage: check_oscillation_parameters
    There are hardware constraints which limit the allowed combinations of oscillation range, exposure time and number of oscillations. This routine will try to find the closest possible set of parameters to a given set first modifying the number of oscillations if the rotation speed is too low or too high, then exposure time, but leaving constant the rotation angle. The minimum stepping speed of the gonio-rotation is 15 steps/s ,as for all stepper motors controlled by an ESRF VPAP card. In principle there is no minimum rate for a stepping motor, but unfortunatly the value of 15 Hz is hard coded in the CY550 microcontroller the VPAP is based on. The maximum stpping is taken as the one preconfigured by SPEC at startup. You may increase it using "config" if you feel confident about this. The parameters oscillation range, exposure time and number of oscillations are passed and returned in a global array called "OSCILL".

    oscillation_cleanup
    Usage: oscillation_cleanup()
    This Macro is executed when an oscillation image is cancelled by Control-C. It closes the ms shutter, sets the original values for the speed of the rotation motor gonio and rotates it back to the starting position.

    oscillation_restore
    Usage: oscillation_restore()
    restore default settings of the VCT6 and of the spindle motor

    oscillation_detector_setup
    Usage: oscillation_detector_setup


    oscillation_prepare_detector
    Usage: oscillation_prepare_detector


    oscillation_readout_detector
    Usage: oscillation_readout_detector


    save_oscillation_image
    Usage: save_oscillation_image(filename)


    ccd
    Usage: ccd (parameter,value)
    General setup for CCD detector (Princeton or FRELON)

    prepare_ccd
    Usage: prepare_ccd()
    Configure the detector and start the exposure. Works for both FRELON and Princeton CCD.

    readout_ccd
    Usage: readout_ccd()
    Stops the exposure and waits for the data transfer to the workstation's memory to finish. The image content will be in the global array image_data. The image is not save as a file. You have to call "save_ccd_image" to do this. Works for both FRELON and Princeton CCD.

    save_ccd_image
    Usage: save_ccd_image(filename)


    oscillation_bruker_setup
    Usage: oscillation_bruker_setup()
    Setup menu

    prepare_bruker
    Usage: prepare_bruker()
    Configure the Bruker CCD detector and start the exposure.

    readout_bruker
    Usage: readout_bruker()
    starts the acquisition in the Bruker detector PC.

    oscillation_mar_setup
    Usage: oscillation_mar_setup()
    Setup menu

    prepare_mar
    Usage: prepare_mar()
    Configure the MAR image plate scanner and start the exposure.

    readout_mar
    Usage: readout_mar()
    Scans and erase the MAR IP scanner

    fsds_osc_setup
    Usage: fsds_osc_setup()
    Setup menu

    fsds_osc_prepare
    Usage: fsds_osc_prepare()


    fsds_osc_readout
    Usage: fsds_osc_readout()


    fsds_osc_save
    Usage: fsds_osc_save(filename)


    ceil
    Usage: ceil(x)
    round up to the next larger or equal integer, as opposed to int() which rounds down

    round
    Usage: round(x)
    round up to the next integer, as opposed to int() which rounds down

    info
    Usage: info <message> ...
    "info" used to display informational messages which can be helpful for debugging. The reason not simply to use "print" is to the collect macro can redirect or supress these messages by redefining "info"

    notice
    Usage: notice(message)


    key
    Usage: key ([prompt])
    Utility for keybard input in single character no-echo mode. The prompt string is optional.

    edit
    Usage: edit <variable> [<max length>]


    editline
    Usage: editline (template-text[,max_length])
    Prompts the user for test input, providing a template, like SPEC's built-in getval(), but you do not have to retype it but can modify it using the cursor keys. Note: The cursor keys work only on VT100 terminal emulators, "xterm" and "dtterm" are compatible with VT100, however "hpterm" is not.

    update_line
    Usage: update_line
    used by "editline"

    scroll
    Usage: scroll
    used by "editline". Scroll text so cursor is within bounds

    escape_sequence
    Usage: escape_sequence
    used by "editline". Decode VT100 escape sequences generated by the cursor keys

    cursor_left
    Usage: cursor_left
    used by "editline"

    cursor_right
    Usage: cursor_right
    used by "editline"

    insert_char
    Usage: insert_char(c)
    used by "editline"

    delete_char
    Usage: delete_char
    used by "editline"

    save_array
    Usage: save_array <array>
    Useful for save global variables across a "spec -f". Writes the contents of all members of an array to an ASCII file, so they can be reloaded later by the "restore_array" macro. The file is in the directory ~specadm/local/userconf and has the same name as the array (no extension).

    restore_array
    Usage: restore_array <array>
    Loads back saved values from an ASCII file from a previous "save_array" call.

    sign
    Usage: sign (x)
    returns 1 if x>0 -1 if x<0 0 if x=0

    tail
    Usage: tail (string,n)
    returns the last n characters of a string. If the sting length is less the n then the full string is returned

    oscillation_prepare_diode
    Usage: oscillation_prepare_diode %MDESC% Beam intensity measurement macro, called once before the exposure (ie before the set of half-oscillations).


    oscillation_read_diode
    Usage: oscillation_read_diode %MDESC% Beam intensity measurement macro, called during the exposure after each half-oscillation.


    oscillation_log_diode
    Usage: oscillation_log_diode %MDESC% Beam intensity measurement macro, called during the exposure after each half-oscillation.


    enter_speed_parameter
    Usage: enter_speed_parameter %MDESC% Enter the speed parameter with some value check.


    calculate_speed
    Usage: calculate_speed %MDESC% Calculate the motor speed according to the range parameter and the motor parameters.


Filename: oscillation.mac
Author: by Friedrich Schotte, Manu Perez, Holger Witsch with bits from L. Claustre and D. Fernandez last changes March 2001
Last mod.: 05/06/2012 11:33 by witsch