Preparing scan devices

When the routine sm_scan.prepare_scan_devices() is called, we assume that A) the programmer has already called sm_scan.prepare_scan_parameters() to check the validity of the scan, and B) we are about to actually carry out the scan. We first interrogate all scan devices to get their present positions and record them in parameters like sm_par.f32_x_stg_um, and also the present interferometer position in sm_par.f64_x_center_um and its $x$ and $y$ equivalents (in the case of CryoSTXM we simply record the sum of x_stg and x_pzt positions).

We now update the monochromator position. We first call x1a_mot.read_sgmcal() to update sm_par.f32_sgm_zero_order_steps and sm_par.f32_sgm_steps_per_angstrom, even though this may have been done already by sm_scan.prepare_sgm_scan() as called by sm_scan.prepare_scan_parameters(). We then read the present position of the monochromator and store it as the private variable f32_sgm_ev. If this is a SGM scan, we assume that the values sm_par.f32_start_ev and sm_par.f32_stop_ev as determine by sm_scan.prepare_sgm_scan() are correct; if not, we set both of these variables to the present monochromator energy.

Information on which detector is in place is found from the present position of the XDET stage, after which sm_par.i32_detector can be set.

We then set the private variables i8_fast_direction and i8_slow_direction. When +1, we move the scanned device to large position values first, and then decrease the position value as we scan (and vice versa for -1; and note that we tend to prefer moving ZSTG from safer/more distant values to closer values). We also set the private variables i8_fast_is_servo and i8_slow_is_servo to indicate whether each axes is controlled by the Delta Tau servo controller, or a more conventional motor controller. For the fast axis in non-servo mode, we also obtain the private variable f32_fast_max_um_per_msec (normally the default speed of the device) and thus use it to calculate f32_flyback_msec_per_step for unidirectional scans. In addition, we also calculate f32_fast_scan_msec_per_step which is the target scan speed (the clock signal will record the actual scan speed on a pixel-by-pixel basis). We then call the routine sm_scan.clock_configure() which configures multiplexers on the clock/connect electronics board to use the correct clock source and divide-by values as described in Secs. 8.1 and 8.2 (also keep in mind the non-scanning call to sm_scan.clock_configure() described in Sec. 13.3).

Piezo scans: calculate flyback speed and velocity, such as would be used for building the waveform.

For stepper scans, we will ``lock'' the XPZT and YPZT devices by asking the Delta Tau board to maintain a constant voltage output to the piezo amplifiers.

Holger Fleckenstein 2008-07-08