On central focusing for contrast optimization in direct electron ptychography of thick samples

Ptychography provides high dose efficiency images that can reveal light elements next to heavy atoms. However, despite ptychography having an otherwise single signed contrast transfer function, contrast reversals can occur when the projected potential becomes strong for both direct and iterative inversion ptychography methods. It has recently been shown that these reversals can often be counteracted in direct ptychography methods by adapting the focus. Here we provide an explanation of why the best contrast is often found with the probe focused to the middle of the sample. The phase contribution due to defocus at each sample slice above and below the central plane in this configuration effectively cancels out, which can prevent contrast reversals when dynamical scattering effects are not overly strong. In addition we show that the convergence angle can be an important consideration for removal of contrast reversals in relatively thin samples.


Introduction
The phase images produced by electron ptychography in scanning transmission electron microscopy (STEM) provide significant advantages over conventional high resolution electron microscopy, such as higher dose efficiency [1,2], post-collection aberration correction [3] and superresolution [4,5].The wide variety of ptychographic methods all have their advantages and disadvantages, but broadly speaking we can divide them into direct [1,6] and iterative methods [7,8] of solving the phase.Although superresolution, one of the original motivations for ptychography, was first demonstrated using the direct Wigner distribution deconvolution (WDD) method [9], it is now simpler to achieve superresolution for general samples with iterative methods such as ePIE [7].The adaption of iterative methods in electron microscopy has also been motivated by the fact that the cameras available to collect the 4D STEM data required for ptychography introduced a severe bottleneck in the speed at which the data could be collected [10,11,12].In practice this meant that extremely long dwell times had to be used, resulting in both undesirable amounts of drift and high doses using probe position samplings such as required for a typical atomic resolution STEM image.With a defocused probe and an iterative method a much lower probe position sampling can be used to obtain a high resolution image [4], but at the cost of retaining useful signals from imaging modes requiring a focused probe, such as the Z-contrast annular dark field (ADF) signal.Practically speaking iterative methods also require longer processing times after data acquisition and greater care to obtain meaningful convergence and results.Direct methods on the other hand avoid the problems involved with iterative convergence and are fast enough to enable live imaging [13,14].
The bottleneck to scan speed imposed by cameras in 4D STEM has now been greatly reduced.Frame based cameras [15,16,12,17] continue to increase in speed and event driven cameras [18] have now completely removed the speed bottleneck compared to the most rapid of conventional STEM imaging.Focused probe ptychography can now be performed with very little drift and very low doses indeed, and the ADF workflow that has made STEM so popular in materials science can now be complemented with simultaneously acquired ptychography.A common criticism of the direct ptychography methods has been the approximations used in the theory motivating them.The WDD method invokes the multiplicative approximation [3,6] and the single side band (SSB) [1,19] method invokes the weak phase approximation.However the fact that these approximations are used to motivate the methods does not necessarily mean the methods are not useful well beyond the validity of these approximations, and various experiments now show that they can indeed provide very valuable information about samples that are of thicknesses typical for materials science.This includes clearly locating the light elements that are generally hidden by nearby heavy columns in conventional STEM imaging [6,20,21].
However the contrast of the ptychographic images is not always without complication as contrast reversals can appear with both direct and iterative methods, often with the columns taking on what can be described as a donut or caldera shape [6,20,21].Such contrast reversals have also been observed in integrated Center of Mass (iCoM) images [21].Recent investigations have revealed that for direct ptychography, as in iCoM, optimal contrast often occurs with the probe focused to the center of the sample for quite a range of thicknesses [20,21].Here we explain how the equal and opposite phase contributions of the defocus at sample slices above and below the central slice effectively cancels out when the probe is focused to the central slice of the sample.This explains why focusing to the middle of a sample often provides the best contrast, at least in samples in which strong dynamical scattering does not overly unbalance the contributions from above and below the central plane.We also show how the convergence angle can be an important consideration for avoiding contrast reversals, particularly in thinner samples with significant projected potentials.

Theory
In both SSB and WDD ptychography, the intensity captured by the camera is Fourier transformed with respect to probe position resulting in where Q p is the spatial frequency, Ψ s denotes the Fourier transform of the specimen transmission function, and ] is an aperture function describing both the extent of the aperture via the top hat function a(K f ) and any lens aberrations present via the aberration function χ(K f ).To motivate the SSB ptychography method, the WPO approximation is applied to simplify the expression to (2) from which the object transmission function Ψ s (Q p ) at spatial frequency Q p can be obtained by integrating the phase and amplitude contained in regions passed by both A * (K f ) and A(K f + Q p ), excluding those regions in which Ψ * s (−Q p ), is also passed by A * (K f + Q p ) and destructive interference occurs due to Ψ * s (−Q p ) being out of phase with Ψ s (Q p ).The contrast transfer function (CTF) is therefore linked to the double A functions, A * (K f )A(K f − Q p ), or equivalently in the A(K f )A(K f + Q p ) by the same argument, via the frequency dependent size of the double overlap regions [19,22].In the absence of aberrations these double A functions, the multiplied pairs of aperture functions, are purely real, and the phase measured is entirely due to the specimen transmission function.However defocus is only zero at the focal point of the probe and if the sample is many nanometers thick, as is common, the probe will not be focused throughout the sample, as illustrated in figure 1.The defocus will then vary significantly throughout the thickness of the sample introducing phase that is not purely from the object function.If we take the z-axis as corresponding to that along which the probe propagates and explicitly insert z-dependent defocus into one of the double A functions we obtain, in the absence of other aberrations, where and ∆z is the z-distance from the focal plane of the probe.
We now adapt the concept of the integrated CTF (iCTF) introduced for ABF [23] for SSB ptychography.For a sample with thickness of t, if we take the middle plane of the sample as the reference plane for the probe, the zero defocus point, the range of defocus value is from −t/2 to t/2, where positive values denote underfocus and negative values denote overfocus.If instead the probe is defocused from the central plane an amount ∆ f , then the integrated double A function Note that the iAA remains a function of Q p , K f and the thickness t, and is a complex object retaining phase due to defocus.The complex iCTF is then the same as the iAA with the triple overlapped area excluded.

Results and Discussion
Figure 2 shows noise free SSB ptychography images of 24 nm thick STO simulated using the multislice algorithm with the probe focused to different distances from the entrance surface.The simulations were performed using abTEM [24] in combination with pyPtychoSTEM [25].A 200 kV accelerating voltage, a 20 mrad convergence angle, and a scan step size of 0.2 Å were used.The entrance surface of the sample is generally the optimal focal plane for ADF imaging, but this focus produces contrast reversals in every atomic column of the STO in the SSB image with this thickness of STO.Furthermore, the overall contrast in the SSB image is much lower compared to focusing the probe more into the middle of the sample.Consistent with our previous simulations of other STO thicknesses up to 28 nm [20], the optimum contrast occurs with the focal point of the probe midway through the sample.Furthermore, from the images shown using the same grayscale rendering, this central focal point clearly produces both contrast reversal free images and the strongest contrast overall.
Figure 3 compares SSB, iCoM, ABF and ADF images simulated for the same STO projection as figure 2, again as a function of how far within the sample the probe is focused, but now with the finite dose of 2000 e − /Å 2 .The ABF, iCoM and SSB ptychography are all sensitive to the light atoms, with the iCoM and SSB signals capable of providing far stronger signal than the ABF.However it is only with the probe focused more towards the center of the sample that iCoM and SSB provide the strongest contrast.With the probe focused to the entrance surface, with this particular sample configuration, the ABF actually provides stronger contrast.It can also be seen here how the ADF contrast reduces as the focus is moved further into the sample from the entrance surface.While this focal dependence has been explained for ABF [23] and iCoM [26], so far relatively little has been published on this for direct ptychography beyond observation [20,21].In the absence of other aberrations, at the plane at which the probe is focused there is no defocus contribution and phase only comes from the object function.For a thin weak object the phase is flat across the double disk overlap regions.However defocus induces phase variation within the double disk overlaps such as that illustrated in figure 4. As sample thickness increases so too does the amount of defocused probe interacting with the sample, as shown schematically in figure 1 and mathematically in equation 3.For a focused probe configuration this means a much increased amount of defocus contributing to direct ptychography images from sample planes away from the focal plane of the probe.From equation 3 it can also be appreciated that how the defocus weights the different depths of the sample depends on how the probe is focused relative to the sample, as this will change the defocus at each plane within the sample.
To illustrate the effect of the defocus as a function of the distance from the focal point of the probe we plot the phase and amplitude of a double A function vs spatial frequency in Figure 5 for defocus values from -12 to 12 nm for the same conditions used previously.This corresponds to the range of defocus values that contribute to the SSB image of the 24 nm thick STO sample with the probe focused to the central plane.Positive defocus values denote underfocus and negative values denote overfocus.Although the complexity of the phases increases with the magnitude of the defocus, it can be seen that equal and opposite values of defocus induce equal and opposite phases over the whole range of spatial frequencies.The amplitudes shown in the figure include the exclusion of the triple overlap regions as required in the SSB method, and thus reflect both the size of the pure double overlap regions in probe reciprocal As can be seen, the contributions from planes equally above and below the focus of the probe contribute with equal magnitude but opposite phase.Note there is no object function here, and the lack of any phase at the central plane means there will be no defocus contribution to the phase here and only the phase due to an object function would contribute here to the SSB image.
Figure 6: Integrated defocus induced phase and amplitude plotted vs spatial frequency with the probe focused to different points within the 24 nm integration interval.Here defocus (df) indicates the distance from the center of that 24 nm region.Note again there is no object function here, so the lack of phase shown here when the probe is focused to the central plane (df= 0) means the object function phase is transferred without a phase contribution from defocus.
space at each spatial frequency as well as the influence of the defocus.When defocus induced phase variations inside the double disk overlaps are integrated destructive interference occurs, diminishing the amplitude of the spatial frequencies as seen in figure 5 for increasing levels of defocus.This is the effect that enables optical sectioning [3], but it must be noted that the contribution of slices away from focus is not zero even if diminished.Now consider two slices of sample with the same object function, equal amounts above and below the central plane of the sample.With the probe focused to the central plane of the sample, the defocus of the two slices is equal and opposite.Therefore, if we neglect multiple scattering, and the sample is the same in these two slices, the contribution of defocus on these two planes will cancel out.This is illustrated for a single spatial frequency in figure 4.
If we consider the effect on the electron beam as the coherent summation of the effect of each slice of the sample, as in the iCTF concept used to explore the optimal focus of ABF imaging [23], when the probe is focused to the central plane of the sample, the defocus phase contribution to every other plane has a matching plane in which the defocus is exactly the opposite.Thus the cancellation of the phases illustrated in figure 4 occurs for each spatial frequency through the whole thickness of the sample, cancelling out the defocus phase contributions to the final phases reaching the detector.Additionally, the optical sectioning effect means that total contribution of planes away from the focal point of the probe are diminished.
When the probe is not focused to the central plane of the sample, not all planes of the sample will have matching planes with the opposite value of defocus, and there will remain a significant defocus phase contribution to the final image.We can illustrate this using the iCTF concept adapted for SSB ptychography and integrate the double A function over the sample thickness to observe the cumulative effect of defocus over all the slices in a sample on the total extracted phase and amplitude.The iCTF for SSB ptychography is derived as shown in the supplementary information.The results are shown in Figure 6 for the probe focused from the entrance surface though to the exit surface for the 24 nm thick STO.Keeping in mind no influence of the object function is included in these plots, when the probe is focused to the central plane of the sample, the defocus contributions to the phase from slices above and below the central plane cancel out resulting in a net zero phase in the double A functions, as seen in the figure.When the probe is instead focused away from the center of the sample the defocus contribution becomes increasingly asymmetric across the sample thickness with increasing distance from the central sample plane, resulting in sig-nificant phase influence from the defocus itself in the final image.
These effects can explain why the optimal focal plane of the probe for direct ptychography is often in the centre of the sample for intermediate thickness samples.When there exist slices with a defocus not balanced with a slice elsewhere in the sample, the defocus effect on the phase contribution of these slices is significant.The greater the amount of sample thickness without identical slices of sample at an equal and opposite defocus, the greater the overall contribution of defocus phase to the final phase image.When the probe is centered exactly at the central plane the defocus contributions cancel at every plane of the sample away from the central slice, again assuming the sample is uniform.If the sample is not uniform then the interaction with the defocused probe will alter somewhat even if the overall effect is likely often similar in terms of optimal focus being relatively near the central plan of the sample.
We emphasise that this analysis of the defocus influence across the thickness of the sample and the cancellation of the defocus phase in the slices above and below the probe focus ignores the effects of dynamical scattering.Dynamical effects will be sample dependent, and it is interesting to note that while with STO central focusing has been observed to be optimal for 16, 20, 24 and 28 nm [20], Clark et al. observed a band of thicknesses for GaN in which central focusing did not remove the caldera shaped contrast reversals [21].It seems noteworthy that this band of thickness was within the range one would consider quite thin samples and are within the 17 nm depth of field for the 14.4 mrad convergence angle and 300 kV conditions they used.This is in contrast to the results here and all the thick samples examined in Gao et al., where the samples are all thicker than the depth of field.
We therefore now test what happens with much thinner 5 nm thick STO as a function of both physical probe focus and convergence angle in figure 7.For reference Ga is atomic number 31 while Sr is 38 and Ti 22, and on the lighter side N is atomic number 7 while O is 8.This thickness of STO is therefore similar to the range of thickness of GaN which Clark et al. found continued to exhibit caldera with central focusing.We also find that central focusing makes relatively little difference with such a thin sample, when smaller convergence angles are used such that the depth of field is significantly larger than the sample thickness.Donuts appear on the heavier Sr and Ti columns regardless of which plane within the sample is focused exactly.However, when the convergence angle is increased the donuts close up and we again find central focusing becomes optimal.At the 200 kV we used, a 30 mrad convergence angle puts the depth of field at just under the 5 nm thickness and at 40 mrad the depth of field is significantly less than the thickness of the sample.At 30 mrad there remains a very slight dip in the heaviest columns with the probe at the entrance surface.At 40 mrad this dip has disappeared, but for both 30 mrad and 40 mrad the strongest contrast is still seen with the probe focused to the center of the sample.
With the whole sample in focus the effect of defocus within the sample seems natural to make less difference than when the sample thickness exceeds the depth of field.Even though the defocus values are not by themselves different when the probe is focused to different points within the sample with different convergence angles, the effect on the double disk overlaps as a whole should be reduced with the sample entirely within the depth of field, as can be understood in terms of the optical sectioning effect.
At 200 kV the 20 mrad convergence angle we used earlier, the depth of field is 11 nm.So one might think that 5 nm of STO, with less sample potential within the depth of field, would show less contrast reversals than 16 nm or more of STO with the same conditions.Interestingly, this is not what is observed.To further explore this we turned to 12 nm thick STO simulations.As shown in figure 8, regardless of if the convergence angle produces a depth of field similar to, much greater than or much less than the 11 nm thickness of the material, central focusing is again optimal.
Dynamical effects are generally more associated with thicker samples, and 5 nm is certainly on the thin side, so one would expect dynamical scattering to effect the contrast of samples thicker than 5 nm more.Indeed, the divergence from central focusing being optimal seen at 50 nm of STO, where focusing to the exit surface was instead found to be optimal, seems more naturally a result of strong dynamical effects being balanced by defocus.The convergence angle of course weights the frequencies differently, as is already usually considered when optimizing the contrast transfer function without considering contrast reversals.However different frequency weightings will also naturally change where asymptotes occur in the frequency response, due to phase wrapping in probe reciprocal space, which in turn effects the appearance of contrast reversals.
Given that optimal contrast is generally obtained for ADF with the probe focused to the entrance surface and generally for both iCoM and direct ptychography methods with the probe deeper within the sample, the optimal focus for ADF and iCoM and direct ptychography methods such as SSB can increasingly deviate as the sample increases in thickness.Different strategies can therefore be employed depending on the needs of the sample.One can optimize for the iCoM and ptychography by aiming to put the probe deep within the sample at the cost of contrast in the ADF signal, or one can put the focus to the entrance surface as is best for the ADF.In practice the first option has been easier to achieve experimentally, using the ADF to guide selecting a region of interest and final tuning, including the focus.
However live processing options becoming available for both iCoM [27] and SSB [13,14] are beginning to enable the focus to be optimized for these imaging modes while scanning.It is nonetheless important to remember that the ptychographic contrast can also be adjusted significantly post collection [20] either by post collection defocus or other schemes to adjust the phases.The choice of focusing strategy will depend on the dose the sample can handle and the importance of the Z-contrast ADF signal, which remains very useful for correct interpretation when sufficient Z-contrast signal is available.The importance of Z-contrast is all the more so when contrast reversals can occur with phase imaging.Thus it is very useful to understand the overall contrast variation of direct ptychography methods with defocus and thickness as well as the convergence angle.

Conclusion
We have provided an explanation of why the overall strength of direct SSB electron ptychography is often at its maximum when the probe is focused midway through the sample.By focusing the probe to the center of a sample, equal and opposite defocus induced phase cancels out at sample planes equally far from the focal plane of the probe.This removes most of the defocus contribution from samples planes away from the focal point of the probe allowing samples to be seen most clearly when other effects such dynamical scattering are not overly strong.We demonstrated this using the iCTF concept in combination with simulations of STO, but the concept can be expected to extend to many materials typical of materials science.In addition we have demonstrated the convergence angle can be a crucial factor in determining if contrast reversals will be present at all and if central focusing will remove them.This knowledge will therefore help inform the design of focused probe ptychography experiments of thicker samples in determining where exactly to focus the probe.

Figure 1 :
Figure 1: Illustration of how different regions of the probe (yellow) interact with different slices of the sample (blue) depending on the thickness (t) of the sample.The probe defocus is therefore different for the different slices of the sample.In this case the probe is focused to the center of the sample, but in general the defocus at each slice of sample depends on both the thickness of the sample and the focal point of the probe.

Figure 2 :
Figure 2: SSB ptychography images of 24 nm thick STO simulated noise free with the probe focused to different depths of the sample from the entrance surface (0 nm of defocus) to the exit surface (24 nm of defocus).Overlaid on the bottom of the zero defocus image is a contrast boosted version to facilitate seeing the contrast reversals.The scale bar is 2 Å.

Figure 3 :
Figure 3: Probe focal point dependence (with zero defocus (df) defined here as the entrance surface of the sample) of the contrast of the SSB, iCoM, ABF, and ADF signals simulated at a dose of 2000 e − /Å 2 for 24 nm thick STO.

Figure 4 :
Figure 4: Defocus contribution to the phase in the double disk overlap region of a single spatial frequency at ±12 nm of defocus.The defocus phase contribution in the two slices is perfectly out of phase, thus when they are summed the resulting phase is zero.

Figure 5 :
Figure 5: Overall phase and amplitude from defocus vs spatial frequency at different distances from the focal plane of the probe (df= 0).As can be seen, the contributions from planes equally above and below the focus of the probe contribute with equal magnitude but opposite phase.Note there is no object function here, and the lack of any phase at the central plane means there will be no defocus contribution to the phase here and only the phase due to an object function would contribute here to the SSB image.

Figure 7 :
Figure 7: SSB images of very thin 5 nm thick STO as a function of physical probe focus within the sample depth (zero defocus (df) is again the entrance surface) as a function of the convergence angle.As the convergence angle increases such that depth of field is on par or shorter than the thickness the contrast reversals are overall diminished or absent and central focusing again provides the best contrast.

Figure 8 :
Figure 8: SSB images of very 12 nm thick STO as a function of physical probe focus within the sample depth (zero defocus (df) is again the entrance surface) as a function of the convergence angle.For this thickness the central focusing again seems to work regardless of the convergence angle.