CFML_BckPeaks

This module provides procedures to determine the background and peaks in diffraction patterns.

Dictionaries

peak_search_cond_type

Parameters controlling the automatic determination of peaks and backgrounds (see automatic_peak_background_search)

Keys and types:

  • peak_threshold (float): peak threshold.

  • shoulder_threshold (float): shoulder threshold.

  • bkg_threshold (float): background threshold.

  • kindofpeaks (int): 1: single peak | 2: doublet (Cu-ka) | 3: doublet (Mo-ka) | 4: doublet (Co-ka), (default = 1).

  • iterations (int): number of iterations.

pkb_type

Keys and types:

  • bkg (ndarray, dim=(:), float32): background.

  • x (ndarray, dim=(:), float32): x values.

  • y (ndarray, dim=(:), float32): y values.

Functions

get_pkb_conditions()

List the parameters that controls the algorithm of function automatic_peak_background_search.

Returns:

parameters controlling the automatic detection of peaks and background.

Return type:

dict (peak_search_cond_type)

>>> from pycrysfml import cfml_bckpeaks
>>> pkb = cfml_bckpeaks.get_pkb_conditions()
>>> for k in pkb:
...   print(f'{k:>14}: {pkb[k]}')
...
        fortran_type: peak_search_cond_type
      peak_threshold: 0.019999999552965164
  shoulder_threshold: 2.0
       bkg_threshold: 0.05000000074505806
         kindofpeaks: 1
          iterations: 3
set_pkb_conditions(**kwargs)

Set the parameters that controls the algorithm of function automatic_peak_background_search.

Parameters:
  • kwargs – optional arguments.

  • kwargs['pk_th'] (float) – peak threshold (default = 0.02).

  • kwargs['sh_th'] (float) – shoulder threshold (default = 2.0).

  • kwargs['bg_th'] (float) – background threshold (default = 0.05).

  • kwargs['peak_kind'] (int) – 1: single peak | 2: doublet (Cu-ka) | 3: doublet (Mo-ka) | 4: doublet (Co-ka), (default = 1).

  • kwargs['iter'] (int) – Number of iterations (default = 3).

Returns:

None.

>>> from pycrysfml import cfml_bckpeaks
>>> cfml_bckpeaks.set_pkb_conditions(pk_th=1.0,iter=5)
>>> pkb = cfml_bckpeaks.get_pkb_conditions()
>>> for k in pkb:
...   print(f'{k:>14}: {pkb[k]}')
...
        fortran_type: peak_search_cond_type
      peak_threshold: 1.0
  shoulder_threshold: 2.0
       bkg_threshold: 0.05000000074505806
         kindofpeaks: 1
          iterations: 5