pyextal.dinfo

Classes

BaseDiffractionInfo

Base class for storing diffraction information and refined results.

CBEDDiffractionInfo

Stores and processes Convergent Beam Electron Diffraction (CBED) data.

LARBEDDiffractionInfo

Stores and processes Large Angle Rocking Beam Electron Diffraction (LARBED) data.

Module Contents

class pyextal.dinfo.BaseDiffractionInfo

Base class for storing diffraction information and refined results.

dp

The diffraction pattern as a NumPy array of np.float32.

Type:

np.ndarray

thickness

Thickness of the sample in Angstroms.

Type:

float

tiltX

Tilt angle around the x-axis in degrees.

Type:

float

tiltY

Tilt angle around the y-axis in degrees.

Type:

float

gl

X-axis length in experimental diffraction pattern space.

Type:

float

datpath

Path to the .dat file containing crystal information.

Type:

str

dp: numpy.ndarray[numpy.float32]
thickness: float
tiltX: float
tiltY: float
gl: float
datpath: str
__post_init__()

Initializes additional attributes after the dataclass is created.

property includeBeam

Gets the list of Miller indices for beams included in the simulation.

updateSF(beam: tuple, value: numpy.ndarray[numpy.float32])

Updates the structure factor for a given beam and its symmetric equivalents.

Parameters:
  • beam (tuple) – The Miller index (h, k, l) of the beam to update.

  • value (np.ndarray) – A 4-element NumPy array containing the new structure factor values.

Raises:

ValueError – If the provided value is not a 4-element NumPy array.

getSF(beam: tuple) numpy.ndarray

Retrieves the structure factor for a given beam.

If the beam is part of a symmetry group, the group’s structure factor is returned. Otherwise, it looks up the Independent Atom Model (IAM) value.

Parameters:

beam (tuple) – The Miller index (h, k, l) of the beam.

Returns:

The structure factor of the beam.

Return type:

np.ndarray

getAllSF() tuple[numpy.ndarray, numpy.ndarray]

Retrieves all unique structure factors and their corresponding beams.

Returns:

A tuple containing:
  • An array of all unique structure factors.

  • An array of one representative beam (h, k, l) for each factor.

Return type:

tuple[np.ndarray, np.ndarray]

save(path: str | pathlib.Path)

Saves the diffraction information to a file.

Note: This method is not yet implemented.

Parameters:

path (str | Path) – The path to the file where the data will be saved.

save_hkl(path: str | pathlib.Path, glen: float = 5.0, minOutput: float = 0.001) None

Saves structure factors to a .hkl file for VESTA Fourier synthesis.

Parameters:
  • path (str | Path) – Path to the output .hkl file.

  • glen (float, optional) – Maximum length of the g-vector to include, in inverse Angstroms. Defaults to 5.0.

  • minOutput (float, optional) – The minimum IAM structure factor magnitude to be included in the output file. Defaults to 1e-3.

class pyextal.dinfo.CBEDDiffractionInfo

Bases: BaseDiffractionInfo

Stores and processes Convergent Beam Electron Diffraction (CBED) data.

This class extends BaseDiffractionInfo with attributes and methods specific to CBED experiments, including detector parameters and background correction.

dtpar

Detector DQE parameters [varB, delta, A, g, m].

Type:

list[float]

mtf

The Modulation Transfer Function as a NumPy array.

Type:

np.ndarray

background

Background level of the diffraction pattern.

Type:

float

numIter

Number of iterations for Lucy-Richardson deconvolution. Defaults to 25.

Type:

int, optional

dtpar: list[float]
mtf: numpy.ndarray[numpy.float32]
background: float
numIter: int = 25
class pyextal.dinfo.LARBEDDiffractionInfo

Bases: BaseDiffractionInfo

Stores and processes Large Angle Rocking Beam Electron Diffraction (LARBED) data.

This class extends BaseDiffractionInfo with attributes specific to LARBED experiments, such as g-vector indices and variance maps.

gindex

An array of g-vector indices.

Type:

np.ndarray

varianceMaps

Variance maps associated with the diffraction pattern. If not provided, it defaults to a copy of the diffraction pattern.

Type:

np.ndarray, optional

gindex: numpy.ndarray
varianceMaps: numpy.ndarray[numpy.float32] = None
__post_init__()

Initializes variance maps if they are not provided.