The calibration method described in theory has been implemented in the goniometer-controlling software *STAC* (STrategy for Aligned Crystals). In practice, the calibration described above takes little time to perform on the beamline. This is especially true when combined with *STAC*, which offers a manual, guided or automatic solution for goniometer calibration. Such calibration can be performed as follows:

(i) Initialize and home the goniometer axes such that (ω, κ, ϕ) = (0°, 0°, 0°), and align the ω axis.

(ii) Perform centring (for example, using the on-axis microscope of an MD2 to avoid parallax error) on a well defined reference point that is clearly recognizable at all varieties of angles. After centring, the translation motor positions are registered such that

.

(iii) Separately perform the following steps for the κ and ϕ axes, with the other set at 0°:

(*a*) Rotate about the given axis by an arbitrary angle *α*.

(

*b*) Re-centre the reference point such that the translation position corresponding to the rotation is registered as

.

(*c*) Repeat (*a*)/(*b*) at least once more if the direction vector is not known from *a priori* rotation calibration. In automatic mode, *STAC* repeats the procedure five more times, recording a total of six unique points evenly distributed and paired with another point 180° away.

(iv) If scale factors for a given axis are not equal to unity, adjust hardware or compensate for scaling in control software to remove anisotropy from the system configuration.

The accuracy of the calculations derived from the TC procedure above is completely dependent on the ability of the operator to perform the requisite centring steps in a consistent fashion that minimizes measurement error. A special pin based on the SPINE standard (Cipriani

*et al.*, 2006

) has been designed in order to improve the centring accuracy and precision by overcoming problems related to the visualization of the point to be centred as it rotates out of the narrow focal plane at high magnification (Fig. 5). One may construct such a pin for TC by gluing a 10 µm-diameter polystyrene bead (Microbeads AS, Norway) to the tip of a borosilicate glass needle mounted on a crystal support. The capillary tube used to make the needle must have an inner diameter of around 0.8 mm to properly fit over the microtube on the support, and the needle must be pulled such that the outer diameter at the tip is around 5 µm. Conventional devices used to pull needles for

*Xenopus* oocyte microinjections work well. Altering from the SPINE standard, one can glue the base of the capillary to the microtube at a slight angle. By leaving it shorter or longer than the specification, the path traced by the bead will be larger and thus easier to fit, dramatically improving the precision with which centring can be performed. Furthermore, with a large enough difference between the diameter of the needle tip and the diameter of the bead, centring will be possible even when the κ arm is set to a large angle where a typical sample would be obscured. This is a critical shortcoming of previous standards used for calibration, such as capillary tubes or acupuncture needles affixed to a sample support base. Both types of pins often feature excellent points for visual centring, but opening the κ arm results in their obstruction by the rest of the system. The precision with which manual centring is performed is also improved by incorporating a circular-shaped reticule into the centring software which is scaled to the on-screen size of the bead. This allows for precise identification of the bead centre at all orientations and even at locations outside the focal plane of the visualization system. Automated centring is possible using edge-detection or circle-shape recognition. An algorithm to perform reliable centring has already been implemented in the crystal centring software

*C3D* (Lavault

*et al.*, 2006

).

One aspect of the TC method presented here that illustrates its versatility is the speed with which the calibration can be performed. Using automated centring, the calibration can be performed automatically in less than 15 min. Although increasing the number of points sampled around the rotational path of the sample increases the accuracy of the subsequent calculations, only three evenly distributed pairs of points separated from one another by 180° must be collected for rotations about any rotation axis for the ellipse-fit algorithm to work in a robust manner (Fig. 6). The accuracy of the ellipse fit is evaluated based on the stability with which the scale factors are provided. Collecting an additional three pairs for a total of 12 points is recommended for more precise calibration, as the influence of outlying points is decreased substantially. Outlier detection and elimination algorithms like the confidence coefficient assignment or inward procedure summarized by Ben-Gal (2005

) could reduce the number of data points needed. Calibration data for the κ axis should be collected in a similar fashion, although pairs may not be available for points over a certain interval because of possible collisions or instrument limitations. For the EMBL/ESRF MK3, points in the interval [80°, 180°] cannot have pairs, because the κ arm is limited to a maximum of 260°.

An implementation of the method described above can be used to rapidly process TC data and produces statistics similar to those presented (Table 1).

| **Table 1**Statistics returned from processing TC data collected with the mini-κ (MK3) on ID14-4 at ESRF |

Data were measured using an EMBL/ESRF mini-κ goniometer head (MK3) installed on an MD2M diffractometer on ID14-4 at ESRF (McCarthy

*et al.*, 2009

). Motor positions were recorded every 5° following the re-centring of a mounted calibration bead (see Fig. 5) while rotating about the ϕ axis over the range [0°, 360°] followed by the κ axis over the range [0°, 240°]. The measured data are shown in Fig. 7. The data for presenting statistics on a misconfigured system (Table 1

*b*) were produced by artificially introducing 10:7 anisotropy in the

*Y*-motor configuration. Note that the identical motors

*X* and

*Y* are from the two-dimensional centring stage, while the motor

*Z* translating along the ω axis is part of the three-dimensional alignment carriage.

The plane fit shows submicron deviations of the data from an ideal planar rotation in all cases. The error is even less pronounced in the case of the ϕ axis, as it is mechanically less strained than the κ axis and mainly rotates in the *XY* plane (see Fig. 7). Hence, the errors contributed from the independent *Z* motor are insignificant. The normal vectors of the best-fit planes are (−0.0094, 0.0045, −0.9999) and (−0.2903, −0.2887, 0.9123) for ϕ and κ, respectively. The angle between these normal vectors should always be around 24° in the case of the MK3. Deviation from such nominal value (Fig. 2) can indicate the presence of a scaling problem in the translation motor configurations. Note that MK3 is designed as a re-mountable goniometer head, and as such does not have additional nominal parameters for the location and orientation of axes. In contrast, comparison to previous calibration results can help in identifying potential problems.

Before the ellipse fit, data are orthogonally projected onto the fit plane and converted to a set of two-dimensional points. The origin of the coordinate system in the plane is chosen to be at the mean of the data. By measuring pairs 180° apart, the mean of the data should fall close to the centre of the ellipse fit. Large distances of almost 400 µm in the case of the κ axis result from the fact that the data points were not collected in such pairs (see Fig. 7). While the difference between the radii of the ellipse fit in Table 1(*b*) suggests a potential misconfiguration of the motors, data in Table 1(*a*) illustrate a more balanced system.

Projecting the ellipse back to the original three-dimensional space, scale factors are calculated to stretch the ellipse onto a circular path. Scale-factor calculation reveals the strong anisotropy introduced into the system in Table 1(*b*). Note that even a small inherent anisotropy is precisely computed for the *Z* axis using the data about κ. The calculated 2.4% scale correction along the *Z* axis shows a slight error in the configuration of the *Z* motor belonging to the alignment carriage (see Fig. 1
*b*), but differing from the *X* and *Y* motors of the centring stage. Also note that data collected about the ϕ axis do not provide any information regarding the *Z* axis. As such, the calculation does not provide a solution in this degenerate case. After correcting the data for misconfigured scaling, a simple geometric circle-fit algorithm identifies the correct circular path in both isotropic and anisotropic cases.

The calculated angular and linear distance errors are also realistic and consistent with one another in both the isotropic and anisotropic cases. The angular reproducibility of the MK3 motors has been measured as 0.1° for κ and 0.04° for ϕ, while the diameter of the maximum sphere of confusion (SOC) for the whole goniometer including the MK3 head was determined to be less than 6 µm. Opening the κ arm results in a larger SOC owing to the increased mechanical strain on the MK (Fig. 2). The distribution of the linear distance errors is an indication of the precision expected from a translation correction derived from a TC. Here, their magnitude, as presented in Table 1, is close to the diameter of the SOC. In such a setup with precision mechanics, the primary source of error is due to the centring governed by the SOC. A vertical goniometer setup resolves this issue, and the SOC of the same MK3 can be reduced to submicron levels, as demonstrated on the ID29 and ID23-2 beamlines at ESRF (data not shown).

Although goniometer systems such as the MK3 are quite robust and undergo very little drift over weeks of activity, the ease with which TC can be performed makes it an excellent way to detect occasional instrumentation problems that arise in hardware or software. The biggest source of such errors relates not to protracted data collection and general wear and tear, but rather to the different incremental changes made intentionally and unintentionally to the sample-positioning system by users and support staff. Updates to device control software could also potentially reset previously established configurations.

The TC procedure yields valuable information which can be used to address many of these problems. First, the plane fit can be used to visualize the ideality of sample rotation as it should always move in a plane. Furthermore, the calculated scale factors may be used to detect anisotropy in the reference frame caused by the sample-positioning motors. Note that in the case of the ϕ axis the direction vector of the rotation is normally set orthogonal to the two-dimensional centring-stage axes. Incompatible scaling configuration of the two motors can be directly read out from the ellipse-fit radii. This simple relationship does not hold in the case of the third axis, for which a separate step of scale-factor calculation must be performed from data around κ.

The potential problem of a non-orthogonal centring stage can also arise, especially in systems where the translation stages are not directly coupled. The combined use of the re-purposed alignment carriage and a two-dimensional centring table is such a case. Although the least-squares error determined during a scale-factor calculation can be indicative of such a situation, we have not experienced a problem like this on any of the ESRF MX beamlines equipped with MD2 or MD2M diffractometers.

In most cases, the system should be sufficiently isotropic with proper scaling performed by the software, yielding a sample path that is circular. Once a circle fit has been performed, additional statistics about the linearity of the system can be analysed. The linear reconstruction error for a given axis reveals the accuracy with which the point can be automatically re-centred in microns, while the angular uncertainty relates to the accuracy with which the rotation is being performed. These metrics, when compared with the expectations for a given hardware setup, can highlight underlying problems, like losing steps, or having a mechanical flaw which may even vary slightly under different physical constraints.