epdfsuite.calibration
Functions
|
Generate a list of diffraction peaks from a CIF structure file. |
|
Extract calibration parameters from a PONI file generated by pyFAI-calib2. |
|
Perform geometric calibration of electron diffraction data using pyFAI-calib2. |
- epdfsuite.calibration.build_calibration_data_from_cif(cif_file, wavelength, n_peaks=15, two_theta_range=(0, 2))[source]
Generate a list of diffraction peaks from a CIF structure file.
Uses pymatgen’s XRD calculator to compute the simulated diffraction pattern, then exports the d-spacings to a text file (
distances.txt) for use by pyFAI-calib2.- Parameters:
cif_file (str) – Path to the CIF structure file.
wavelength (float) – Electron (or X-ray) wavelength in Å.
n_peaks (int, optional) – Maximum number of peaks to return. Default is 15.
two_theta_range (tuple of float, optional) – Angular range in degrees
(2θ_min, 2θ_max)used to filter peaks. Default is(0, 2).
- Returns:
peaks (list of dict) – Each element contains:
'hkl': Miller indices'd': d-spacing in Å'two_theta': Bragg angle in degrees'intensity': relative intensity
- epdfsuite.calibration.perform_geometric_calibration(cif_file, image_file, mtf_file=None)[source]
Perform geometric calibration of electron diffraction data using pyFAI-calib2.
Exports the image as a temporary EDF file, optionally applies MTF deconvolution, computes calibrant d-spacings from the CIF, prints the instrument settings to enter in pyFAI-calib2, and launches the calibration GUI.
- Parameters:
cif_file (str) – Path to the CIF structure file of the calibrant.
image_file (str) – Path to the DM4 image file of the calibrant diffraction pattern.
mtf_file (str, optional) – Path to the MTF file. If provided, Wiener deconvolution is applied to the image before calibration.
- epdfsuite.calibration.get_calibration_parameters(poni_file)[source]
Extract calibration parameters from a PONI file generated by pyFAI-calib2.
- Parameters:
poni_file (str) – Path to the PONI file produced after calibration.
- Returns:
calibration_params (dict) – Dictionary containing the following keys (when present in the file):
'distance': sample-to-detector distance (m)'poni1','poni2': point of normal incidence coordinates (m)'rot1','rot2','rot3': detector rotation angles (rad)'wavelength': wavelength (m)'pixel1','pixel2': pixel sizes (m)'max_shape': detector shape in pixels