CFML_Diffraction_Patterns¶
This module provides types and procedures to work with diffraction patterns.
Dictionaries¶
- diffpat_e_type¶
A diffraction pattern.
Keys and types:
bgr (ndarray, dim=(:), float32): background.
filename (str): file name.
filepath (str): file path.
instr (str): instrument name.
kindrad (str): type of radiation.
monitor (float): monitor counts.
norm_mon (float): monitor normalization.
npts (int): number of points.
scal (float): scale factor.
scatvar (str): scattering variable -2theta, TOF, Q, s, d-spacing-.
sigma (ndarray, dim=(:), float32): sigma values.
sigvar (bool): if True, sigma represents standard deviation, otherwise, it represents the variance.
step (float): step value.
title (str): title of the diffraction pattern.
tsample (float): sample temperature.
tset (float): wished temperature.
wave (float): wavelength.
x (ndarray, dim=(:), float32): x values.
xmax (float): maximum value of the scattering variable.
xmin (float): minimum value of the scattering variable.
y (ndarray, dim=(:), float32): y values.
ycalc (ndarray, dim=(:), float32): calculated intensity.
ymax (float): maximum value of the intensity.
ymin (float): minimum value of the intensity.
Functions¶
- load_pattern(filename, pat, **kwargs)¶
Load a diffraction pattern from a file.
- Parameters:
filename (str) – full path of the file.
kwargs – optional arguments.
kwargs['mode'] (str) – format specifier: ‘CIF’ | ‘DMC’ |’D1A’ | ‘D1AOLD’ | ‘D1B’ | ‘D2B’ | ‘D2BOLD’ | ‘D20’ | ‘GSAS’ | ‘GSASTOF’ | ‘G41’ | ‘G42’ | ‘HRPT’ | ‘PANALYTICAL’ | ‘NLS’ | ‘SOCABIM’ | ‘TIMEVARIABLE’ | ‘XYSIGMA’ | ‘3T2’.
kwargs['sig'] (bool) – if False, sigma of pattern will be the standard deviation. Otherwise, sigma of pattern will be the variance.
kwargs['header'] (str) – a header for the diffraction pattern
- Returns:
diffraction pattern.
- Return type:
dict (diffpat_type)
>>> from pycrysfml import cfml_diffpatt >>> pat = cfml_diffpatt.load_pattern("pbso4.dat",mode="d1a") >>> for k in pat: ... print(f'{k :>16}: {pat[k]}') ... title: PbSO4 D1A(ILL)(Rietveld Refinement Round Robin, R.J. Hill, JApC 25, 589 (1992) kindrad: scatvar: xmin: 10.0 xmax: 155.4499969482422 ymin: 176.0 ymax: 2459.0 step: 0.0 npts: 2910 sigvar: True wave: [0. 0. 0. 0. 0.] x: [10. 10.05 10.1 ... 0. 0. 0. ] y: [220. 214. 219. ... 0. 0. 0.] sigma: [220. 214. 219. ... 0. 0. 0.] instr: D1A filename: filepath: scal: 1.0 monitor: 10000.0 norm_mon: 0.0 col_time: 0.0 tsample: 298.0 tset: 0.0 ycalc: [0. 0. 0. ... 0. 0. 0.] bgr: [0. 0. 0. ... 0. 0. 0.]