MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / prune_quant_fluor_data_dict

Function prune_quant_fluor_data_dict

pyxrf/core/quant_analysis.py:580–607  ·  view source on GitHub ↗

r""" Prunes the fluorescence data dictionary by removing the element lines that are not present (fluorescence is None) or have fluorescence <= 0. 'Pruning' is performed before saving calibration data, so that only meaningful information is saved. The function does not modify the orig

(quant_fluor_data_dict)

Source from the content-addressed store, hash-verified

578
579
580def prune_quant_fluor_data_dict(quant_fluor_data_dict):
581 r"""
582 Prunes the fluorescence data dictionary by removing the element lines that are not
583 present (fluorescence is None) or have fluorescence <= 0. 'Pruning' is performed before
584 saving calibration data, so that only meaningful information is saved.
585 The function does not modify the original data structure. Instead it returns the
586 copy of the original dictionary with some emission line removed.
587
588 Parameters
589 ----------
590
591 quant_fluor_data_dict: dict
592
593 Dictionary with XRF reference sample data. This dictionary is modified by the function.
594 The dictionary must satisfy the '_xrf_quant_fluor_schema' schema.
595
596 Returns
597 -------
598
599 Copy of ``quant_fluor_data_dict`` with some emission lines removed. Only the emission
600 lines that have fluorescence set to valid value are left.
601 """
602 quant_fluor_data_dict = copy.deepcopy(quant_fluor_data_dict)
603 for key, val in quant_fluor_data_dict["element_lines"].copy().items():
604 if (val["fluorescence"] is None) or (val["fluorescence"] <= 0):
605 del quant_fluor_data_dict["element_lines"][key]
606
607 return quant_fluor_data_dict
608
609
610def set_quant_fluor_data_dict_optional(quant_fluor_data_dict, *, scan_id=None, scan_uid=None):

Calls 1

itemsMethod · 0.80

Tested by 2