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

Class ParamQuantEstimation

pyxrf/core/quant_analysis.py:684–1123  ·  view source on GitHub ↗

r""" The class is used for measurement of parameters in the process of estimation of quantitative calibration data. The methods of the class are designed to be used in the followingsequence: # Create object pqe = ParamQuantEstimation() # Load standards pqe.load_standard

Source from the content-addressed store, hash-verified

682
683
684class ParamQuantEstimation:
685 r"""
686 The class is used for measurement of parameters in the process of estimation of
687 quantitative calibration data.
688
689 The methods of the class are designed to be used in the followingsequence:
690
691 # Create object
692 pqe = ParamQuantEstimation()
693 # Load standards
694 pqe.load_standards()
695 # Find standard if needed (different options are available)
696 st = pqe.find_standard(serial_number, key="serial")
697 # Select standard
698 pqe.set_selected_standard(st)
699
700 # Generate data dictionary
701 pqe.gen_fluorescence_data_dict(incident_energy=12.0)
702 # Fill the dictionary using XRF map dictionary (e.g. ``img_dict``) and scaler name (e.g. ``i0``)
703 pqe.fill_fluorescence_data_dict(xrf_map_dict=img_dict, scaler_name="i0")
704 # Set different (optional but desired) parameters
705 pqe.set_detector_channel_in_data_dict(detector_channel="sum")
706 pqe.set_optional_parameters(scan_id=12345, scan_uid="some-uid-string")
707
708 # Get preview (if needed) for displaying to users
709 preview_str = pqe.get_fluorescence_data_dict_text_preview()
710
711 # Get suggested file name for the parameter file
712 fln = pqe.get_suggested_json_fln()
713 # Generate full path based on fln
714 file_path = .....
715 # Save data to file
716 pqe.save_fluorescence_data_dict(file_path=file_path)
717
718 At any time, the generated/filled fluorescence data dictionary may be
719 accessed as ``self.fluorescence_data_dict``.
720 """
721
722 def __init__(self, *, home_dir="~", config_dir=".pyxrf", standards_fln="quantitative_standards.yaml"):
723 r"""
724 Constructor of the ``ParamQuantEstiomation`` class. In addition to initalization
725 of the fields, the constructor checks if the default file with user-defined
726 reference standards exists in the PyXRF config directory and creates an empty file
727 if it does not exist.
728
729 Parameters
730 ----------
731
732 home_dir: str
733 HOME directory for PyXRF configuration files. Typically it is ``~``,
734 but may be changed to temporary directory to run unit tests
735
736 config_dir: str
737 subdirectory in the HOME directory, used to keep PyXRF config files.
738 Typical value is ``.pyxrf``.
739
740 standards_fln: str
741 name of the file for storing the data on user-defined reference standards.

Callers 6

Fit1DClass · 0.85
gen_hdf5_qa_datasetFunction · 0.85

Calls

no outgoing calls

Tested by 4