Macros for 5ID-D Control (cabbage1)
Macros available for 5ID-D Control (cabbage1) and Microbeam Control (cider1)
Macros for Microbeam Control (cider1)
The macros that come with spec (ascan, mv, tw, dscan, mesh,
etc) are not defined here. Documentation for spec and its macros can
be found at www.certif.com/spec_manual/, the
help
command within spec, or the printed manual available at DND-CAT.
This file is called by SPECD/spec.mac
whenever spec is started fresh (spec –f
) on cabbage1.dnd.aps.anl.gov
.
It calls the other macro files and contains macros that tie the other local
macros together for running spec in the 5ID-D hutch for general use (i.e.
not microbeam).
runs a mesh type scan that is composed of multiple
ascans
Usage: meshy
mot1 s1 f1 interval1 mot2 s2 f2 intervals2 time
sets the shutter compensation time (seconds between issuing the shutter close and the detector readout commands). Default: 0.2
sets the detector compensation time (seconds between issuing the detector integrate and the shutter open commands). Default: 0.1
reads in the variables written in the *_vars.mac files. This macro is called before a scan and before each count.
writes the current values for selected variables to the *_vars.mac files. This macro is called after each count, and at the end a scan.
locks the *_vars.mac files. This is meant to prevent
an external application (gid for example) from writing new *_vars.mac files
in the middle of a scan.
The macro write_varsfile
is unaffected by the lock
unlocks the *_vars.mac files for writing.
standard spec user hook called before a scan. Used here to lock and execute the *_vars.mac files and to collect a background frame on the marccd.
standard spec user hook called before each count. Used here to lock and execute the *_vars.mac files, start detectors (eg. lsm, xawtv, marccd) and open the shutter
standard spec user hook called after each count finishes. Used here to close the shutter and stop detectors (eg. lsm, xawtv, marccd).
standard spec user hook called within a loop that will repeat the counting if chk_beam does not break. Used here to enable dezingering on the marccd.
standard spec user hook called at the end of a ct command. Used here to write the marccd header, and to write the *_vars.mac files.
standard spec user hook called at the end of each scan point Used here to write the marccd header, and write the marccd image file.
standard spec user hook called at the end of a scan. Used here to write the *_vars.mac files.
standard spec user hook called whenever a error or ^C is encontered. Used here to abort detectors, close the shutter, and unlock the *_vars.mac files.
standard spec user hook called when spec is exited. Used here to turn off control of the detectors (eg. lsm, xawtv, marccd) and the shutter.
This file contains macros for opening and closing a shutter that is controlled as a spec motor. It requires you to configure a motor with the mnenonic “s” as the shutter and optionally “smode” as the shutter mode (manual or external trigger).
enables the shutter control macros, calls user_shutteron, and closes the shutter.
disables the shutter control macros, calls user_shutteroff, and closes the shutter.
used to enable any shutter related user parameters. It is currently defined to prompt for the shutter mode and move the smode motor. If you do not have an smode motor, this can be defined as ‘’.
used to disable any shutter related user parameters. It is currently defined to return the smode moter to its pre shutteron value. If you do not have an smode motor, this can be defined as ‘’.
opens the shutter (provided that it is in manual control mode)
closes the shutter (provided that it is in manual control mode)
changes the shutter to external trigger mode.
changes the shutter to manual control mode.
Function that returns the shutter status. If smode is defined it will also output the shutter mode status. One shutter mode is manual control, in which the shutter_open and shutter_close commands will open and close the shutter for each frame (this method is not preferred because the delay time can be up to 2 seconds). In the other mode, external trigger, the shutter_open and shutter_close commands are ignored, and the signal going to an external gate is used to trigger the shutter (for this use the same gate signal as is connected to the counters).
Normally spec does step-scans, where for each point, the motors are moved; then after all motors have stopped the counts are taken. This file contains macros which allows you to use the same spec scan commands, but do an integrating scan instead. It this mode, one motor is allowed to move over a given range while the counts are integrated. The motor speed is adjusted to get the approximate desired count time.
sets up a motor to run in integrating scan mode for
any scans.
Usage: setintegscan motor fullwidth
sets the integrating motor and its width
Usage: setintegscan off
turns off integscan mode
Usage: setintegscan v
reads motor and width values from *_vars.mac file
Usage: setintegscan
prompts for motor and width values
This file contains the macros which communicate with the marccd software via its “Data Acquisition —> Remote” mode. It will allow you to take frames integrated over the count time for both scans and individual ct calls (although the ct frames are not automatically saved). It also will write much of the experimental setup, motor positions, and counters to the mar file header.
turns on the spec side of doing remote data acquisition
with the marccd detector.
It also calls setmar
and headerselect.
turns off the spec side of remote marccd data acquisition
sets parameters for the marccd frames as listed below:
host that the marccd software is running in remote control mode
port that is open for remote control
sample to detector distance
position (in mm) on the marccd image where the direct beam would hit (if not
for the beam stop)
binning mode (1x1,2x2, or 4x4)
x-ray beam energy (if an “ev” motor is defined this will be overridden)
directory on remote host where mar files are to be stored
the filename core and format statement for the frames
extra data-set notes to write the mar frame header
background frame method and update interval
dezingering on/off (takes two images and averages them)
matchplot on/off (matches segment and frame to the scan plot and point numbers)
selects which motors and counters to write to the mar header (and the xawtv image). This is limited to 100 or so characters. Only the values are written, so it is important to record which motors and counters you define as well as their order.
turns on realdark mode. In this mode, the background frames are real dark frames (i.e. integrated for the same time as the frames).
turns off realdark mode. In this mode, the background frames are bias frames (i.e. integrated for 0 seconds, only readout). This is good enough for all but the weakest data and is the only method that the marccd software uses when running in non-remote control.
sets the binning for the marccd detector (1,1 = 1x1 = 2048x2048pixels; 2,2 = 2x2 = 1024x1024pixels; 4,4 = 4x4 = 512x512 pixels)
sets the sample to detector distance (written to header)
same as mdistance
sets the position(in mm) that the direct beam would be hitting the detector face (if not for the beam-stop) as measured in the marccd software.
set the data-set note that is written to the mar frame header
sets the current segment number
sets the current frame number
sets the directory on the remote marccd computer where the frames will be stored
sets the core of the filename that is created based on the format statement and the segment and frame numbers.
This file contains macros for controlling the Stanford Research sr570 current preamplifiers (preamp). The preamps can be either be connected directly to a serial port (like on cider1) or they can be controlled through a SCIPE server (like in 5ID-B).
This sets up which preamps you wish to control. It will prompt you for number of preamps to configure, the device. What you put for device decides how the preamp is controlled. If you put a number, it will use the spec serial device (which has to be added with config) and it will ask if you want to reset the preamp or upload the values of the PREAMP array to the preamp. If you put a host:port name, it will use the SCIPE device, it will ask you for the motor prefix name (usually SR570_1_ for the first one), and it will ask if you want to reset, upload, or download the values from the SCIPE server to the PREAMP array.
steps up or down the calibrated scale for either sensitivity,
input offset, lowpass filter, or highpass filter.
Usage: preamp_step [preampnum] option direction
Where: preampnum = number of the preamp you want to configure (defaults to
0 if omitted); option = s, o, fl,or fh; and direction = up or down
sets the sensitivity, input offset, bias, filter type,
lowpass filter level, or highpass filer level to a given value.
Usage: preamp_set [preampnum] option setting units
Where: preampnum = number of the preamp you want to configure (defaults to
0 if omitted); option = s, o, b, f, fl ,or fh; setting = The value for the
option you are setting; units = p, n, u, m, or “”. Only
this multiplier part of the unit is important, if there is no multiplier (eg
Hz) then use an empty string “”.
resets the filter capacitors to clear an overload and
reset all the values to defaults
Usage: preamp_reset [preampnum] Where preampnum = number of the preamp
you want to configure (all preamps will be reset if omitted).
resets the filter capacitors to clean an overload.
Usage: preamp_freset [preampnum] Where preampnum = number of the preamp
you want to configure (all preamp filters will be reset if omitted).
uploads the current values stored in the PREAMP[] array
(which stores the preamp since the preamp has no RS232 read capability) to
the preamp.
Usage: preamp_upload [preampnum] Where preampnum = number of the preamp
you want to configure (values will be uploaded to all the preamps if omitted).
downloads the current settings of the preamp as recorded
by the SCIPE server and stores these values in the PREAMP[] array.
Usage: preamp_download [preampnum] Where preampnum = number of the preamp
you want to configure (values will be downloaded from all the preamps if omitted).
sets the preamp gain mode.
Usage: preamp_gain [preampnum] mode
Where: preampnum = number of the preamp you want to configure (defaults to
0 if omitted) and mode is 0,1,or2 for Low Noise, High Bandwidth, or Low Drift.
shows the current preamp settings.
Usage: preamp_show [preampnum]
Where: preampnum = number of the preamp you want to configure (defaults to
0 if omitted)
does a coarse (calibrated settings only) optimization
of the preamp sensitivity.
Usag:e preamp_sc [preampnum] counter
Where: preampnum = number of the preamp you want to configure (defaults to
0 if omitted); counter is the counter mnemonic for the counter with which
this preamp is in line. Note the shutter should be open for this (maximum
signal).
does a fine (uncalibrated settings only) optimization
of the preamp sensitivity.
Usag:e preamp_sf [preampnum] counter
Where: preampnum = number of the preamp you want to configure (defaults to
0 if omitted); counter is the counter mnemonic for the counter with which
this preamp is in line. Note the shutter should be open for this (maximum
signal).
optimizes the sensitivity by first calling preamp_sc and then preamp_sf
does a coarse (calibrated settings only) optimization
of the preamp input offset.
Usag:e preamp_oc [preampnum] counter
Where: preampnum = number of the preamp you want to configure (defaults to
0 if omitted); counter is the counter mnemonic for the counter with which
this preamp is in line. Note the shutter should be closed for this (minimum
signal).
does a fine (uncalibrated settings only) optimization
of the preamp input offset.
Usag:e preamp_oc [preampnum] counter
Where: preampnum = number of the preamp you want to configure (defaults to
0 if omitted); counter is the counter mnemonic for the counter with which
this preamp is in line. Note the shutter should be closed for this (minimum
signal).
optimizes the sensitivity by first calling preamp_oc and then preamp_of
This file contains the macros which enable the user
to capture snap-shots of the current video channel as part of the scan.
It makes use of a video capture card and the linux program xawtv to take an
snap-shots before counting starts, after the counts are readout, or both.
Xawtv.mac make use of ssh to run its commands (both locally and remotely).
This means that the public key for the spec user most be copied to the xawtv
host (under the same username) so that the spec user can ssh to the xawtv
host without entering a password (type man ssh
for more info).
turns on the spec side of using xawtv (locally or remotely. It also calls setxawtv and headerselect
turns off the spec side of using xawtv
sets parameters for the xawtv snap-shots as listed below:
host on which xawtv is running
final format of snapshot image
directory on the xawtv host where the snap-shots will be stored
the filename core and format statement for the snap-shots
take a snap-shot before and/or after
enable annotation and add an extra data-set note to the annotation
matchplot on/off (matches segment and frame to the scan plot and point numbers)
headerselect
same as marccd headerselect (same header will be used for both). Selects which motors and counters to write to the xawtv. This is limited to 40 or so characters. Only the values are written, so it is important to record which motors and counters you define as well as their order.
sets the data-set note that is added to the snap-shot annotation
sets the current segment number
sets the current frame number
sets the directory on the xawtv computer (local or remote) where the frames will be stored
sets the core of the filename that is created based on the format statement, the segment and frame numbers, the suffix “bfr” or “aft” and the image format extention (ppm, jpg, tif, or png)
This file is called by SPECD/spec.mac
whenever spec is started fresh (spec –f
) on cider1.dnd.aps.anl.gov
.
It calls the other macro files and contains macros that ties the other local
macros together for running the microbeam setup in 5ID-D. The macros
defined are the same at those for 5ID-D. The
only differences are calls for the different hardware, namely: the laser scanning
micrometer, digital output for the shutter and the video switcher.
This file contains macros for controlling the laser scanning micrometer (lsm). It reads out an individual “still” value at the start and end of a counting interval. It also a reading data points across the counting time. Each reading has accompanying statistics, and can assign them to lsm_* counters. The lsm can run in arithmetic or moving average mode this mode needs to be set from the front panel. Unless you have special reason, the defaults of arithmetic averaging (0), averaging 1 scan (0), and 0.25 sec for the individual “still” readings are good. In this mode the lsm will report average and variance of the approximately 700 readings/sec.
turns on the lsm macros so that commands are sent to the lsm during scans. Also calls setlsm and locks the front panel of the lsm
turns off the lsm macros so that no commands are sent to the lsm. Also unlocks the front panel of the lsm
sets the parameters for the lsm.
Usage: setlsm settingflagval
sets LSMSETTINGS to settingflafval
Usage: setlsm
prompts for averaging mode, scans to average, and time for the still measurement
turns on an initializes the video switch device controls
turns off the video switch device (disables the output)
function to select the video switching mode (n = 1-3)
1 = motion input / manual switching
2 = RS232 controlled switching
3 = timed switching
if called
with no argument it returns the current mode
same as vidmode()
function to select which camera to view when in vidmode(2)
function to mask out certain cameras when in vidmode(3)
Where: n is an 8 bit mask where 0 if unmasked and 1 masks out the channel.
For example cameramask(00011111) would allow switch betweed cameras 0, 1,
and 2 in timed switching mode.
turns on current camera mask
turns off the current camera mask (enables all cameras)
number of seconds to wait on each camera switching in timed switching mode
same as dwelltime()
This file contains macros for opening and closing a shutter that is controlled via a digital output board using spec port_put commands.
shutteron
enables the shutter control macros and closes the shutter
shutteroff
disables the shutter control macros and closes the shutter
shutter_open
opens the shutter
shutter_close
closes the shutter
shutter_status()
Function that returns the shutter status