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

Class ParamQuantitativeAnalysis

pyxrf/core/quant_analysis.py:1126–1858  ·  view source on GitHub ↗

r""" The class is used to load and manipulate quantitative calibration data and apply quantitative normalization to XRF maps. Calibration data is loaded as entries, one calibration entry is produced by processing one calibration scan based on a reference standards. Typically calibration

Source from the content-addressed store, hash-verified

1124
1125
1126class ParamQuantitativeAnalysis:
1127 r"""
1128 The class is used to load and manipulate quantitative calibration data and apply quantitative
1129 normalization to XRF maps. Calibration data is loaded as entries, one calibration entry is
1130 produced by processing one calibration scan based on a reference standards. Typically calibration
1131 entry is stored in JSON file, but it can be added to the class directly. Multiple entries
1132 based on different reference standards may be loaded simultaneously. The same emission line
1133 may be used in different reference standards and therefore be present in multiple calibration
1134 entries. The class allows to select the source of calibration data (entry) for each emission
1135 line.
1136
1137 The functions should be applied in the following sequence:
1138
1139 pqa = ParamQuantitativeAnalysis()
1140 # Load calibration entries
1141 pqa.load_entry(<file_path1>)
1142 pqa.load_entry(<file_path2>)
1143 ...
1144 # or add calibration entries (the 1st parameter doesn't need to be a file path)
1145 pqa.add_entry("calibration1", calibration_data=<calib1>)
1146 pqa.add_entry("calibration2", calibration_data=<calib2>)
1147 ...
1148 # Entry may be removed as
1149 pqa.remove_entry(<file_path1>)
1150 # Get the list of file paths (or IDs)
1151 file_paths = pqa.get_file_path_list()
1152 # Get the number of entries
1153 n_entries = pqa.get_n_entries()
1154 # Entry index (index of loaded entry in the internal dictionaries)
1155 entry_index = pqa.find_entry_index(<file_path>)
1156 # Get text preview of loaded calibration entry
1157 text_preview = pqa.get_entry_text_preview(<file_path>)
1158 # Update the internal state of the object (including the list of available emission lines)
1159 # Should be run each time the fields of the object are manually modified.
1160 pqa.update_emission_line_list()
1161 # Get the complete set of loaded calibration entries for the given emission line
1162 # Note, then the index of the entry in 'eline_info' may be different from the
1163 # index of the entry, since 'eline_info' contains only the entries which contain calibration
1164 # for the emission line. The list 'eline_info' may be useful for GUI presentation of data.
1165 eline_info = pqa.get_eline_info_complete(<emission line, e.g. "Cu_K">)
1166 # Select emission line from the standard (useful when emission line is present in mutliple standards)
1167 pqa.select_eline(<emission_line>, <file_path>)
1168 # Check if emission line for particular standard is selected
1169 pqa.is_eline_selected(<emission_line>, <file_path>)
1170 # Get calibration data for the emission line (only from the selected entry)
1171 # The information is useful at the stage of applying quantitative normalization
1172 eline_calib = pqa.get_calibrations_selected(<emission_line>)
1173 # Get calibration data on all emission lines as a list of dictionaries (the function
1174 # calls 'get_calibrations_selected' for each emission line in the set)
1175 all_elines_calib = pqa.get_calibrations_selected
1176 # Set parameters of the experiment (before processing XRF map)
1177 pqa.set_experiment_incident_energy(<incident_energy>)
1178 pqa.set_experiment_detector_channel(<detector_channel>)
1179 pqa.set_experiment_distance_to_sample(<distance_to_sample>)
1180 # Process XRF map using selected calibrations and set experiment parameters
1181 data_normalized = apply_quantitative_normalization(<data_in>, scaler_dict=<scaler_dict>,
1182 scaler_name_default = <scaler_name_default>,
1183 data_name = <emission_line>,

Callers 5

fit_pixel_data_and_saveFunction · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by 1