qem.probe
Functions for emulating electron optics of a TEM.
Functions
|
Calculate the defocus spread for chromatic aberration. |
|
Calculate the defocus integration points for simulating chromatic aberration. |
Create the set of aberrations up to fifth order. |
|
|
Calculate the aberration function, chi. |
|
Convert the energy spread input to a 1/e spread. |
|
Convert tilt to pixel or inverse Angstroms units regardless of input units. |
|
Calculate the probe depth of field (z-resolution) for a probe. |
|
Make a focused electron probe wave function. |
|
Make an electron lens contrast transfer function. |
|
Generate plane wave illumination for input to multislice. |
|
Return the appropriately scaled 2D reciprocal space coordinates. |
Evaluate the relativistic mass correction for electron with energy E in eV. |
|
|
Perform a simulation using function, taking into account chromatic aberration. |
|
Evaluate the relativistically corrected wavenumber of an electron with energy E. |
Classes
|
A class describing electron lens aberrations. |
- class qem.probe.aberration(Krivanek, Haider, Description, amplitude, angle, n, m)[source]
A class describing electron lens aberrations.
- __init__(Krivanek, Haider, Description, amplitude, angle, n, m)[source]
Intialize the lens aberration object.
- Parameters:
Krivanek (
str
) – A string describing the aberration coefficient in Krivanek notation (C_mn)Haider (
str
) – A string describing the aberration coefficient in Haider notation (ie. A1, A2, B2)Description (
str
) – A string describing the colloqiual name of the aberration ie. 2-fold astig.amplitude (
float
) – The amplitude of the aberration in Angstromangle (
float
) – The angle of the aberration in radiansn (
int
) – The principle aberration orderm (
int
) – The rotational order of the aberration.
- qem.probe.depth_of_field(eV, alpha)[source]
Calculate the probe depth of field (z-resolution) for a probe.
- qem.probe.chi(q, qphi, lam, df=0.0, aberrations=None)[source]
Calculate the aberration function, chi.
- Parameters:
q (
float
orarray_like
) – Reciprocal space extent (Inverse angstroms).qphi (
float
orarray_like
) – Azimuth of grid in radianslam (
float
) – Wavelength of electron (Inverse angstroms).df (
float
, optional) – Defocus in Angstromaberrations (
list
, optional) – A list containing a set of the class aberration, pass an empty list for an unaberrated contrast transfer function.
- Returns:
chi (
float
orarray_like
) – The aberration function, will be the same shape as q. This is used to calculate the probe wave function in reciprocal space.
- qem.probe.make_contrast_transfer_function(pix_dim, real_dim, eV, app, optic_axis=None, aperture_shift=None, tilt_units='mrad', df=0, aberrations=None, q=None, app_units='mrad')[source]
Make an electron lens contrast transfer function.
- Parameters:
pix_dim (
(2,) int array_like
) – The pixel size of the gridreal_dim (
(2,) float array_like
) – The size of the grid in AngstromeV (
float
) – The energy of the probe electrons in eVapp (
float
orNone
) – The aperture in units specified by app_units, pass app = None for no apertureoptic_axis (
(2,) array_like
, optional) – allows the user to specify a different optic axis in units specified by tilt_unitsaperture_shift (
(2,) array_like
, optional) – Shift of the objective aperture relative to the center of the arraytilt_units (
string
) – Units of the optic_axis or aperture_shift values, default is mraddf (
float
) – Probe defocus in A, a negative value indicate overfocusaberrations (
array_like
ofaberration objects
) – List containing instances of class aberrationq – Precomputed reciprocal space array, allows the user to reduce computation time somewhat
app_units (
string
) – The units of app (A^-1 or mrad)
- Returns:
ctf (
array_like
) – The lens contrast transfer function in reciprocal space
- qem.probe.focused_probe(gridshape, rsize, eV, app, beam_tilt=None, aperture_shift=None, tilt_units='mrad', df=0, aberrations=None, q=None, app_units='mrad', qspace=False)[source]
Make a focused electron probe wave function.
- Parameters:
gridshape (
(2,) array_like
) – The pixel size of the gridrsize (
(2,) array_like
) – The size of the grid in AngstromeV (
float
) – The energy of the probe electrons in electron voltsapp (
float
) – The probe-forming apperture in units specified by app_units, pass None if no probe forming aperture is to be usedbeam_tilt (
array_like
, optional) – Allows the user to simulate a (small < 50 mrad) beam tilt. To maintain periodicity of the wave function at the boundaries this tilt is rounded to the nearest pixel value.aperture_shift (
array_like
, optional) – Allows the user to simulate a (small < 50 mrad) aperture shift. To maintain periodicity of the wave function at the boundaries this tilt is rounded to the nearest pixel value.tilt_units (
string
, optional) – Units of beam tilt and aperture shift, can be ‘mrad’,’pixels’ or ‘invA’df (
float
, optional) – Probe defocus in A, a negative value indicate overfocusaberrations (
list
, optional) – A list of of probe aberrations of class pyms.Probe.aberration, pass an empty list for an un-aberrated probeapp_units (
string
, optional) – The units of the aperture size (“invA”, “pixels” or “mrad”)qspace (
bool
, optional) – If True return the probe in reciprocal space
- Returns:
probe (
complex (Y,X) np.ndarray
) – The requested electron probe wave function
- qem.probe.plane_wave_illumination(gridshape, gridsize, eV, tilt=None, tilt_units='mrad', qspace=False)[source]
Generate plane wave illumination for input to multislice.
The wave function will be normalized such that sum of intensity is unity in real space.
- Parameters:
gridshape (
(2,) array_like
) – Pixel dimensions of the 2D gridgridsize (
(2,) array_like
) – Size of the grid in real spaceeV (
float
) – Probe energy in electron volts (irrelevant for untilted illumination)tilt (
array_like
, optional) – Allows the user to simulate a (small < 50 mrad) beam tilt, To maintain periodicity of the wave function at the boundaries this tilt is rounded to the nearest pixel value.tilt_units (
string
, optional) – Units of beam tilt, can be ‘mrad’,’pixels’ or ‘invA’qspace (
bool
, optional) – Pass qspace = True to get the probe in momentum (q) space
- Returns:
illum (
np.ndarray (Y,X)
)
- qem.probe.wavev(E)[source]
Evaluate the relativistically corrected wavenumber of an electron with energy E.
Energy E must be in electron-volts, see Eq. (2.5) in Kirkland’s Advanced Computing in electron microscopy
- qem.probe.relativistic_mass_correction(E)[source]
Evaluate the relativistic mass correction for electron with energy E in eV.
See Eq. (2.2) in Kirkland’s Advanced Computing in electron microscopy.
- qem.probe.simulation_result_with_Cc(func, Cc, deltaE, eV, args=None, kwargs=None, npoints=7, deltaEconv='1/e')[source]
Perform a simulation using function, taking into account chromatic aberration.
Pass in the function that simulates the multislice result, it is assumed that defocus is a variable named ‘df’ somewhere in the keyword argument list.
- Parameters:
func (
function
) – Function that simulates the result of interest, ie. pyms.HRTEM. The defocus must be present in the keyword argument list as ‘df’Cc (
float
) – Chromatic aberration coefficient in AngstromsdeltaE (
float
) – Energy spread in electron volts using 1/e measure of spread (to convert from FWHM divide by 1.655, and divide by sqrt(2) to convert from standard deviation )eV (
float
) – (Mean) beam energy in electron voltsargs (
list
, optional) – Arguments for the method function used to propagate probes to the exit surfacekwargs (
Dict
, optional) – Keyword arguments for the method function used to propagate probes to the exit surfacenpoints (
int,optional
) – Number of integration points in the Cc numerical integration
- Returns:
average (
dict
orarray_like
) – The simulation requested but averaged over the different defocus values to account for chromatic aberration.
- qem.probe.Cc_integration_points(Cc, deltaE, eV, npoints=7, deltaEconv='1/e')[source]
Calculate the defocus integration points for simulating chromatic aberration.
The integration points are selected by dividing the assumed gaussian defocus spread into npoints regions of equal probability, then finding the mean defocus in each of those regions.
- Parameters:
Cc (
float
) – Chromatic aberration coefficient in AngstromsdeltaE (
float
) – Energy spread in electron volts using 1/e measure of spread (to convert from FWHM divide by 1.655, and divide by sqrt(2) to convert from standard deviation )eV (
float
) – (Mean) beam energy in electron voltsnpoints (
int,optional
) – Number of integration points in the Cc numerical integrationdeltaEconv (
float,optional
) – The convention for deltaE, the energy spread, acceptable inputs are ‘1/e’ the energy point that the probability density function drops to 1/e times its maximum value, ‘std’ for standard deviation and ‘FWHM’ for the full width at half maximum of the energy spread.
- Returns:
defocii (
(`npoints
,) array_like`) – The defocus integration points
- qem.probe.Cc_defocus_spread(df, Cc, deltaE, eV, deltaEconv)[source]
Calculate the defocus spread for chromatic aberration.
Evaluates the probability density function at defocus df for the defocus spread of a chromatic aberration (Cc) for (1/e) energy spread deltaE and beam energy eV in electron volts.
- Parameters:
df (
float
orarray_like
) – defocus or defocii at which to evaluate the probability density functionCc (
float
) – Chromatic aberration coefficient in AngstromsdeltaE (
float
) – Energy spread in electron volts using the measure given by deltaEconv (1/e measure of spread is default)eV (
float
) – (Mean) beam energy in electron voltsdeltaEconv (
string,optional
) – The convention for deltaE, the energy spread, acceptable inputs are ‘1/e’ the energy point that the probability density function drops to 1/e times its maximum value, ‘std’ for standard deviation and ‘FWHM’ for the full width at half maximum of the energy spread
- Returns:
Cc_pdf (
float
orarray_like
) – the probability density function, will be the same size and shape as df
- qem.probe.convert_deltaE(deltaE, deltaEconv)[source]
Convert the energy spread input to a 1/e spread.
- Parameters:
deltaE (
float
) – Energy spread in electron volts using the measure given by deltaEconvdeltaEconv (
string
) – The convention for deltaE, the energy spread, acceptable inputs are ‘1/e’ the energy point that the probability density function drops to 1/e times its maximum value, ‘std’ for standard deviation and ‘FWHM’ for the full width at half maximum of the energy spread
- qem.probe.convert_tilt_angles(tilt, tilt_units, rsize, eV, invA_out=False)[source]
Convert tilt to pixel or inverse Angstroms units regardless of input units.
Input units can be mrad, pixels or inverse Angstrom
- Parameters:
tilt (
array_like
) – Tilt in units of mrad, pixels or inverse Angstromtilt_units (
string
) – Units of specimen and beam tilt, can be ‘mrad’,’pixels’ or ‘invA’rsize (
(2,) array_like
) – The size of the grid in AngstromeV (
float
) – Probe energy in electron voltsinvA_out (
bool
) – Pass True if inverse Angstrom units are desired.