Using Your Beam Efficiently: Reducing Electron-dose in the STEM via Flyback Compensation

In the scanning transmission electron microscope, fast-scanning and frame-averaging are two widely used approaches for reducing electron-beam damage and increasing image signal-noise ratio which require no additional specialised hardware. Unfortunately, for scans with short pixel dwell-times (less than 5 ${\mu}$s), line flyback time represents an increasingly wasteful overhead. Although beam exposure during flyback causes damage while yielding no useful information, scan-coil hysteresis means that eliminating it entirely leads to unacceptably distorted images. In this work, we reduce this flyback to an absolute minimum by calibrating and correcting for this hysteresis in postprocessing. Substantial improvements in dose-efficiency can be realised (up to 20 %), while crystallographic and spatial fidelity is maintained for displacement/strain measurement.


Introduction
The scanning transmission electron microscope (STEM) is a powerful instrument for probing materials down to the atomic scale. However, reliably imaging fragile samples requires the operator to consider the risk of electron-beam damage introducing artefacts into the data. Many approaches have been introduced to reduce the electron-fluence, measured in e -/Å 2 , (often referred to as electron-dose in the electron microscopy community, which is the term used hereafter) or dose-rate (e -/Å 2 s -1 ) imposed on the sample (Chen et al., 2020), or to increase a sample's durability with either fixation or cryogenic cooling (Glaeser, 1971;Elbaum, 2018). Recently, novel approaches such as compressed sensing (CS) have been proposed to reduce the fraction of pixels illuminated and so reduce the electron exposure (Anderson et al., 2013;Stevens et al., 2014Stevens et al., , 2018. However, CS requires additional fast (and expensive) hardware to be introduced that may not be available to all microscopists (Kovarik et al., 2016;Béché et al., 2016). Moreover, where readout noise is not the limiting factor, such as with digital read-out approaches (Jones & Downing, 2018;Mullarkey et al., 2020) CS may not offer any appreciable benefit over conventional (Shannon) scanning (Sanders & Dwyer, 2018; Van den Broek et al., 2019).
Instead, approaches which rely only on reducing beam-current (Buban et al., 2010), reducing scanning density (more coarse scans) (Yankovich et al., 2015), or reducing dwell-time (Mittelberger et al., 2018) may be attractive as they are available to all STEM operators without the purchase of additional hardware. With these approaches, individual frames may then exhibit a relatively poor signal-noise ratio (SNR) but a final image is reconstructed through frame alignment and averaging (Kimoto et al., 2010). By acquiring the data as a series of sometimes several hundred low-dose frames over a period of what may be some minutes, the electron dose-rate is further lowered. Moreover, the intrinsically redundant nature of the data allows for unbiased correction of time-varying scanning-distortion/drift while preserving time-invariant sample data (Jones & Nellist, 2013;Sang & LeBeau, 2014;Ophus et al., 2016). These techniques also lend themselves to extension into areas including digital super-resolution (Bárcena-González et al., 2016, 2017 and simultaneous spectrum image recording and alignment (Yankovich et al., 2016;Wang et al., 2018; but discussion of these areas is left for a later work. While appealing, reducing pixel dwell-time alone rapidly becomes insufficient as line flyback quickly dominates the electron exposure time. For conventional STEM scan rates, a relatively cautious flyback waiting time of 1000-1500 μs may be set as the default by the installing engineer (Sang et al., 2016). When this flyback time is reduced, appreciable distortions may become visible at the start of every line (typically the left half of the image), where the image appears compressed by up to 30 % (Buban et al., 2010). Fortunately, the profile of this artefact is highly reproducible and for times greater than around 10 μs appears to closely follow an exponential decay profile (Anderson et al., 2013;Kovarik et al., 2016;Buban et al., 2010;Sang et al., 2016); this suggests a route then to calibrate and correct for this in postprocessing (Sanchez et al., 2006;Buban et al., 2010).
In this work, we explore the diagnosis and compensation of these flyback artefacts whose successful mitigation allows for greatly reduced flyback times to be used, delivering a commensurate increase in STEM frame-rate and reduction in electron exposure. First, we present a numerical study exploring the potential for dose-reduction. Second, methods for modelling and correcting the flyback compression artefact are discussed through comparison with generated, artefactfree reference frames. Finally, we experimentally apply our corrections to evaluate the approach and discuss the implications for fast multi-frame image averaging, and the practicalities of the real-world usage of this technique (Ophus et al., 2016;Sang & LeBeau, 2014).

Electron-dose and Scanning Efficiency
Before developing strategies to reduce electron dose, we will first revisit the current approach to dose calculation. The most common approach to calculate sample exposure requires the user to know their beam-current, and the spacing and dwell-time of each probe position. This leads to the expression in Equation 1: where, I is the beam-current in amps, C is the Coulomb number, δt is the dwell-time at each pixel in seconds and dx is the pixel width (assuming a square pixel), this equation calculates the dose in units of electrons per unit area. For CS acquisitions, where only a fraction of pixels are illuminated, this number is then multiplied by some fraction less than one. From this equation then, we see the motivation to pursue approaches with both low beam-currents and reduced dwell-times (Buban et al., 2010).
However, this equation represents a significant oversimplification of the practical operation of a STEM instrument. A conventional approach to producing images of high SNR is to capture a single frame with a very long dwell-time to allow the accumulation of a large amount of signal, however this leaves the data vulnerable to scanning noise and distortion (Muller et al., 2006). A more contemporary approach is to capture multiple fast image frames for later averaging, as this is more robust to these environmental effects (Sang & LeBeau, 2014;. One might assume that an image derived from of 100 fast frames, and one of a single frame but with a 100 times longer dwell-time, expose the sample to equal amounts of electron radiation. However, this would only be true if the effects of two flyback times are ignored. These are the line-flyback time it takes for the electron beam to travel from the end of one image line to the beginning of the next, and the frame-flyback time, the time it takes for the beam to travel from the final pixel of an image frame to the first of the next. For large dwell-times, these flyback times represent a small fraction of the overall frame time. However, Figure 1 (b) shows the detail within a single scan frame captured with a lower dwell-time and a characteristic time frame of milliseconds. In this scenario, not only is a significant amount of time expended during flyback time, but the electron probe still impinges on the sample. During this time, the probe may be just to the side of the area being image, but secondary electrons can still cause damage within the region of interest and beam-heating also persists (Egerton, 2017).
These effects lead to potential sample damage while not delivering any useful information. Fast blanking during these times may be one solution , but again, this would require expensive hardware (Béché et al., 2016).
Knowing this motivated the creation of an expression for the efficiency with which our beam generates useful data, ƞ: where δt is the pixel dwell-time, np is the number of image pixels, nL is the number of scan-lines, TLFB is the line flyback time and TFFB is the frame flyback time. Equation 2 can be understood intuitively as the ratio of useful, information collecting time, to the total frame time (Mullarkey et al., 2020), and as ƞ is always less than 1 we can see that Equation  indicating that more than half the total number of electrons passing through/near the image-region are causing damage but yielding no useful information. Alternatively, the dose efficiency improves to nearly 70 % for the same 2 μs dwelltime but for a flyback time of 20 μs, which we later show is usable without introducing distortions with the method introduced in this article. This jump in efficiency is represented by the points A and B in the figure and is strong motivation for using shorter flyback times. To jump again to point C requires the frame flyback time to be eliminated or reduced to a very low value. Approaches to achieve this may include custom scan generators or the implementation of a different pair of scan coils with low inductance, such as in (Ishikawa et al., 2020). These approaches are potentially costly or require dramatic modification to the instrument being used, which is generally not possible in a shared-user facility. L50 and L60 respectively. In this case the start of each scan line is locked into the phase of the mains power supply, and when using a DigiScan the dwell-time is increased such that sequential scan-lines begin at the same phase. In both of these scenarios the efficiencies are very high at over 90 %, and the common use of line-syncing may explain why this topic has received little attention to date.
There have been approaches that seek to eliminate line flyback time entirely using either serpentine or spiral scans, but these approaches are somewhat complex to implement, require additional hardware, or result in circular images less convenient for onward processing (Wang et al., 2010;Sang et al., 2016). Here we focus on square (Shannon) scans available to all existing operators without the need to purchase new hardware. What remains then is to decrease the line flyback time as much as possible, but doing so begins to introduce artefacts into images due to the unavoidable hysteresis of the scan coils.

Scan Coil Hysteresis
As the scan-coils are electromagnets of finite inductance there is a non-zero response time of the coil current to changes in the driving voltage (Anderson et al., 2013). Due to this there is an appreciable lag between the expected position of the electron beam and its achieved position until the beam reaches a constant velocity (Velazco et al., 2020). This is analogous to inertia in a physical system, and leads to distortions in images captured at low flyback times (Sang et al., 2016;Buban et al., 2010). It has been observed that the scan-coil rise time follows a characteristic exponential shape, as to be expected from a system with inductance effects (Buban et al., 2010;Anderson et al., 2013). In extreme cases where the flyback time is eliminated, and direct or indirect measures of the deflection rise-time can be measured, 90 % rise-time values between 10-100 μs have been obtained (Anderson et al., 2013;Kovarik et al., 2016). At typical scanning speeds this rise-time would be confined in only the first few pixels of a line. However at shorter dwell-times, this artefact becomes more apparent and may cover half the width of the frame (Buban et al., 2010;Sang et al., 2016).

Methods
The experimental results presented here were recorded using a Nion UltraSTEM 200 at 200 kV controlled through a Gatan DigiScan II, unless stated otherwise. Similar, though not identical, effects were seen on our ThermoFisher Titan STEM with its own PIA scan-generator, but for clarity we focus on results from the common DigiScan controlled system.

Automated Flyback Diagnosis
Various approaches may be followed to measure the flyback distortion when using a single-crystal reference sample. For example geometric-phase analysis (GPA) can be used to diagnose distortions, where the exx term from a perfect singlecrystal image natively captures flyback distortion Zhu et al., 2013). However, owing to Fourier truncation, this technique always exhibits some edge effects around the image in the measured distortion fields (unfortunately the region of most interest). Moreover, depending on the radius, x-y position, and edge-smoothing of the manually selected Fourier masks (minimum 2 masks leads to a minimum of 6 adjustable parameters), other systematic artefacts may be introduced (Peters et al., 2015).
Alternatively, a manual analysis extracting the position of fiducial features (Anderson et al., 2013), or the relative compression of crystal unit-cells (Buban et al., 2010) may be performed. However, this again requires manual intervention and/or special sample orientation.
What is ideally needed then, for this to be readily deployable to a general STEM user, is some fully automated method (e.g. without manual selection of Fourier masks), and which does not intrinsically have additional image-edge artefacts.
The solution to both these problems is to work in real-space (rather than reciprocal-space) and use a readily available single-crystal reference material (e.g., Si, SrTiO3). The regular atomic spacings of such a material can be used to optimise any parameters to define the exponential decay.
Using the prior knowledge that the flyback hysteresis causes each scan-line to be compressed, which can be approximated with an exponential form, we can then write the distortion as a function of just two unknown parameters (Buban et al., 2010) : where x are the measured x-positions and A and b are to be determined. Calculating the exponential compression and subtracting it from the measured positions will correct this compression artefact, restoring the true positions, xcorrected (equation (3)). Working with units of time in the exponential has the advantage that we can deal explicitly with the flyback time: This simple distortion then is a function described by two parameters, A and b, and can be removed from an image using bilinear interpolation. The instrument-specific parameters can be obtained from non-linear least squared fitting with respect to a distortion free reference image, sometimes referred to as a quasi-static reference image (Rečnik et al., 2005;Sanchez et al., 2006). This reference can be generated in two ways. Either an image is acquired with large flyback (e.g. during calibration when the microscope is first installed) or we can use the fact that the furthest right half of an image will have negligible distortion due to flyback (Supplementary Figure S3). In either case, the reference needs to be made with the same crystallographic phase as the image to be diagnosed. The method here uses autocorrelation to perform self-same tiling and generate an oversized image, from which an appropriately positioned reference can be extracted (Supplementary Figure S4).
The fitting process can be repeated for images of varying line flyback and dwell-time combinations with the calculated values for A and b tabulated for each. With the observation that these parameters remain constant for the same imaging settings at the same operating voltages, even across a timespan of weeks (Supplementary Figure S5), these values can then be used to correct any future images taken at the same settings.
An expansion of this, is to generalise the recorded values of A and b and to use these values to generate an empirical equation to describe the behaviour of the scan coils. This instrument-specific equation can then be used to determine the correct values of A and b which eliminate the hysteresis artefact in an image for all combinations of flyback-time and dwell-time. This is the approach taken in this article as a given instrument can be characterised (say by core staff) and then be available to all users. It should be noted that, in the same way that magnification is calibrated on a per-instrument basis, so too this inductance descriptor equation should be done on a per-instrument basis.
The model here assumes a single time constant b for the system. Although this is unlikely to be the case due to different elements of the scan system such as the waveform generator, filter boards, and coil magnetisation each having their own time constants, it is seen here that this approximation leads to satisfactory results for a practical range of line flyback and pixel dwell times.

Measuring TFFB
Although the line flyback time can be set by the user using a DigiScan II, the frame flyback time, TFFB, cannot. This is the time taken for the electron beam to travel from the final pixel of an image frame to the first pixel of the next. To measure this, an acquisition was run for 60 seconds with known imaging conditions. Assuming a TFFB of zero, the frametime, and therefore expected number of frames in one minute can be calculated. This can then be compared to the experimentally achieved number of frames, with the difference being explained by any unaccounted-for time, in this case the frame flyback time.

Samples
The samples used in this article are lamellae of strontium titanate (SrTiO3) and silicon. These were chosen as they are readily available single crystals whose real-space periodicity is exploited in our method as described above. Any sample can be used if a long flyback quasi-static image is chosen as a reference, however this requires minimal sample drift for the duration of the data-capture for best performance. In practice a sample with periodic features that can be tiled, as shown in Supplementary Figure S4, is more suitable and is recommended.

Results & Discussion
Averaging a series of frames of an object is a common means of improving image SNR. Recently, more advanced tools for correcting for non-rigid distortions before this averaging have been shown to improve performance further (Berkels et al., 2014;Ophus et al., 2016). The algorithms in these previous studies work in slightly different ways, but all rely on one assumption; that the multiple observations provide a mathematically redundant set from which the time-varying distortions can be separated from the time-invariant ground-truth. Additional redundancy can be encoded into the dataset by varying the scan-orientation during the acquisition, either as perpendicular pairs (Ophus et al., 2016) or with images recorded with a 90° increment between successive frames (Sang & LeBeau, 2014;. Data from both single-orientation series and rotating-scan frame series are presented in our results, with the former presented first.

Hysteresis Correction of a Single-orientation Series
For a qualitative visual comparison excerpts from images of strontium titanate (STO) with increasingly shorter flyback waiting times are shown in Figure 3 (a).  Figure S3). Equally, at all flyback-delays the latter half of each scan-line (right-hand half) is also in alignment with the 1 ms frame, which is good justification for using this region to generate a reference image to compare against.
At shorter flyback-delays the leftmost region of the image is increasingly distorted (compressed). Using the determined hysteresis parameters, the flyback distortion is corrected in all raw-frames prior to any alignment and non-rigid registration. Figure 3 (b) shows the same data to Figure 3 (a) but after flyback correction. Figure S6 this is reduced to below 0.1 % After applying this correction these distortions are eliminated for flyback times as low as 20 μs. In the case of 0 μs line flyback time only a very small region at the beginning of the line still retains some distortion. This is because the beam cannot achieve a 0 μs flyback time as it takes a finite amount of time. The remaining distortion then is what is captured while the beam is still flying back.

As shown in Supplementary
For a quantitative comparison the diagnosis of the compression using the proposed automated method and also manually following the method in (Buban et al., 2010), before and after correction are presented in Figure 4.  shows an example analysis for the 20 μs flyback-delay acquisition with both the results of the automated parametric diagnosis and the manual unit-cell based analysis. While both methods give nominally identical results, the manual method is limited in its precision because of human intervention and a small random scatter due to the finite pixilation of the peak position identification. The automated approach however uses a smoothly varying mesh as opposed to pixels, uses the entire field-of-view, and does not rely on any particular scan orientation. Due to this the automated approach is used going forward.

Diagnosing the Hysteresis Compression Artefact
The method described above was used to then diagnose the compression for a wide range of dwell-times and line flyback times with fixed scan rotation angle. Figure 5 shows the experimentally determined A and b values for a range of dwell times and line flyback times. Clear trends with dwell time are present for both parameters, but noticeable the use of equation (4)   From this we can see that a relatively simple set of equations (one linear, one inverse) can be used to determine the parameters needed in equation (3)  The physical origin of these functions is obfuscated by each manufacturer's choice of the microscope control hardware and the scan generator itself. For example, the DigiScan II produces a pure sawtooth waveform, even during line flyback wait time, that modifies the coil current of the left side of the image dependent on the scan speed (and therefore dwell time). To avoid unnecessary discussion that is specific to our particular microscope, and to maintain generality, we do not attempt to reduce the number of fit parameters further. Nevertheless, though we might expect the exact form of the trends to vary between microscopes, the observed trends are consistent can be used to diagnose and correct the compression.
Due to the limited range of fields-of-view which can be used on the Nion UltraSTEM 200 a full characterisation of the effects of magnification on this process could not be carried out. However, magnification is linearly related to the current in the scan coils, and we predict that the effect of the visible hysteresis within the image will also scale linearly. We therefore expect that fractionally, the compression artefact will appear the same within any image at different magnifications. However, when changing from very high to very low magnifications the current in the scan coils can change by an order of magnitude and this assumption may not hold, and so we recommend operators investigate this on their own instruments where necessary. Similarly, as most operators choose between a small set of fixed voltages we do not fit the voltage dependence and instead, for simplicity, recommending characterising each voltage separately.

Correction of Rotating Scan Frame-series
Where flyback hysteresis is present in each frame of a scan-rotated series, one edge will be corrupted for each of the principal scan-orientations; this has significant effects for both rigid and non-rigid registration. For rigid registration (correction of simple stage drift translation) the differing artefact profiles in each scan-orientation reduces the quality of the cross-correlation (or other correlation) used to align the data and may lead to poorer drift diagnosis. For non-rigid registration algorithms, where the average frame is used as a starting estimate , the degraded starting average frame may reduce the quality and speed of the registration convergence. Instead, by pre-treating the multi-frame data to first correct for the now calibrated flyback hysteresis, the speed and precision of the non-rigid correction can be improved. After pre-treatment, the fast-flyback multi-frame series, can be processed as if a conventional series and corrected for rigid-offsets (Bárcena-González et al., 2016), affine-shears (Dycus et al., 2015;Sang & LeBeau, 2014), and non-linear distortions Ophus et al., 2016;Wang et al., 2018) as necessary.
A series of 100 images of SrTiO3, each with a 20 μs line flyback time and a scan rotation of 90° between consecutive frames was captured to demonstrate the ability of this technique to correct flyback hysteresis artefacts for rotating image series. This image series was aligned and then averaged with, and without, hysteresis correction applied as the first step, with the results shown in Figure 6. The image comparison in Figure 6 shows the same image series both with and without flyback hysteresis correction applied as the first post-processing step before the usual aligning and averaging.
While the flyback-uncorrected average image (Figure 6 (a)) shows the distortions on all edges, the flyback-pretreated average image (Figure 6 (b)) maintains fidelity across the entire field of view. Averaging multiple frames is an important approach to increase the SNR where it is too low in a single frame, and also to encode redundancies into our datasets to aid in future processing. One reason the SNR can be too low in a single frame is when low dwell-times are being used, which is the region where the largest jumps in scanning efficiency are seen when the line flyback time is reduced (Figure 2). It is therefore of key importance that the method presented here is compatible with multiframe imaging, as is shown.  sinusoidally with rotation angle. The variation could be explained by factors such as different coil windings in the x and y scan-coils. Another feature to note is that the cosine function is not at a maximum at a rotation angle of zero, i.e., there is an offset. This was allowed as a parameter in the fit and could be explained by a physical assembly misalignment or a manufacturer firmware offset (e.g. for the orientation of the stage to the Ronchigram camera). Although the exact physical origins of these effects are not exactly known, reassuringly it can be seen that there are two cycles of the sinusoid in a full 360° rotation, corresponding to the two-fold rotation symmetry of the scan coils.
Having established the variations of A and b with rotation angle, dwell-time, and line-flyback time we now have all the empirical coefficients to fully describe the flyback hysteresis effects in our microscope. Simply knowing these three imaging parameters will allow the automatic correction of any future image captured and could even be applied retroactively to any previously captured data.

Conclusions
In this paper we introduce the concept of scanning efficiency and lay bare the unfortunate reality that it can be surprisingly low for increasingly commonplace fast-frame imaging conditions. To increase the efficiency without also increasing the electron dose, the path to take is to decrease the line-flyback time as much as is possible. Unfortunately, at low flyback times a compression artefact due to hysteresis in the scan coils appears.
We have demonstrated the simple characterisation of flyback distortions and the subsequent correction for this on single image frames, and multi-frame datasets with or without scan rotation on subsequent frames. Not only is precision retained across the full field-of-view, ensuring techniques such as strain-mapping remains precise even when using low flyback times, but the scanning efficiency is increased (Supplementary Figure S6). This paper describes the jump in efficiency from 48 % (Figure 2, point 'A') to 67 % (Figure 2, point 'B'), an increase of almost 20 %. This figure also indicates that to achieve very high efficiencies, such as labelled 'C', we need a separate approach to control the frame flyback time, such as a custom scan generator.
Furthermore, we have shown that it is possible to form a semi-empirical model of the hysteresis effect to be created, whereby any image captured with any arbitrary combination of line-flyback time, dwell-time, and scan rotation can be corrected. Although this model is expected to vary by instrument, the method presented in this manuscript can, and should be, repeated by operators for their own instruments. This will enable the entire community of STEM operators to reduce electron-dose, sample-damage, and increase frame-rates without any additional hardware purchase.

Code & Data Availability
The code which is used to measure and correct flyback distortions can be found at our Github repository https://github.com/TCD-Ultramicroscopy/STEM-Flyback-correction . The data used in this paper can be found at doi.org/ 10.5281/zenodo.5713336.

Reference generation
In order to determine the parameters used for correcting the flyback distortion, comparison with an undistorted reference is required. We propose two choices for a reference image: an image with large flyback time (e.g. 1 ms) or the right half of the image with flyback hysteresis effects. Figure S3  As dwell times are reduced, it may be expected that the distortion free area may reduce and become unsuitable for use as a reference. However, within the capabilities of the Gatan Digiscan II and Nion UltraSTEM, we did not find this to be the case. Use of a reference from the same image that need to be corrected does however have some advantages, particularly when considering stability of the imaging system. Any aberrations within the image will also be present in the reference as well as any constant drift effects (i.e. as given by an affine transformation). Similarly, for short dwell time images there is often a poor signal to noise ratio and frame averaging may need to be used. As the use of registration will alter the perceived hysteresis effects, direct summing must be used and will lead to image blurring for any amount of stage drift. These effects reduce error in the least squares fitting calculation and can increase the quality of the fit.
However, for both choices of reference image, the crystallography needs to be aligned with the image to be corrected.
The generation of an aligned reference is performed by generating an oversized reference from self-tiling (similar to the template matching algorithms in Smart Align ). Here we take the choice of undistorted image and use cross correlation to find two non-colinear, non-zero vectors that map the image onto itself. This can easily be achieved by cross correlating the top and bottom halves of the undistorted image to obtain one vector, then repeating with the left and right halves to obtain another. The image is then tiled and averaged until an area larger than the original image is formed, with an added advantage that this reduces noise in the reference and minimises any small strain that is present. This oversized image is then cross correlated with the undistorted image so that an aligned image can be extracted from the oversized image. This then forms a reference suitable for use within non-linear least squares fitting.

Strain precision
To verify the strain precision of the flyback corrected image, GPA analysis was performed in pre-and post-corrected images, shown in Fig S6. Si was used a known specimen with negligible strain, and before corrected there is a clear compressive strain, as seen in Fig. S6 (d). Post correction this strain has been removed, with average strain values of the left half of the image reducing from −2.420 ± 0.004 % before correction to −0.309 ± 0.001 % afterwards. There is similarly a small decrease in measured strain in the right half of the image, going from 0.136 ± 0.001 % to 0.066 ± 0.001 %.    Figure S4. (a) shows a starting undistorted image. The image is split horizontally, (b), and vertically, (c), and a tiling vector (red arrow) is found from cross correlations for self-tiling. (d) shows the resulting oversized image with an area (green box) shown for use as a reference. Figure S5. The data from Figure 5 separated by the date the data was captured. The same trend can be seen three months apart, indicating that the diagnosis performed here remains stable over long periods of time and should not need to be repeated regularly. At longer dwell times the compression artefact is confined to fewer pixels and so obtaining a good fit becomes more difficult, and so we see a larger scatter in the data. This contrasts with short dwell times where the compression can affect up to half of the image. As more crystallography appears deformed the fitting algorithm produces a better fit, and we see less scatter in the data. Thankfully we see better fits with shorter dwell times as this is when the image is most affected. At longer dwell times the compression is confined to very few pixels, and although the variation may seem worrying it has little effect on the correction, and the compression artefact has been reliably corrected under these conditions.   Table S1. Error estimates and goodness-of-fit parameters for the fitted lines shown in Figure 5, here parametrised by u, v, and w. The observed linear relationship between 'b' and dwell time shows that their ratio can be considered a constant of the system.