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

Method save_fluorescence_data_dict

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

r""" Save the results of processing of a scan data for XRF standard sample to a JSON file. The saved data will be used later for quantitative analysis of experimental samples. Before saving, the copy of the original dictionary is createda and inactive emission lines (

(self, file_path, *, overwrite_existing=False)

Source from the content-addressed store, hash-verified

1082 return s, msg_warnings
1083
1084 def save_fluorescence_data_dict(self, file_path, *, overwrite_existing=False):
1085 r"""
1086 Save the results of processing of a scan data for XRF standard sample to a JSON file.
1087 The saved data will be used later for quantitative analysis of experimental samples.
1088 Before saving, the copy of the original dictionary is createda and inactive emission
1089 lines (with ZERO fluorescence) are removed from the copy. Original dictionary is not
1090 modified and the copy is saved to the file.
1091
1092 Before this function is called, the standards must be loaded (``load_standards``),
1093 a standard selected (``set_selected_standard``), fluorescence data dictionary generated
1094 (``gen_fluorescence_data_dict``) and filled (``fill_fluorescence_data_dict``).
1095
1096 Parameters
1097 ----------
1098
1099 file_path: str
1100 absolute or relative path to the saved JSON file. If the path does not exist, then
1101 it is created.
1102
1103 overwrite_existing: bool
1104 indicates if existing file should be overwritten. Default is False, since
1105 overwriting of an existing parameter file will lead to loss of data.
1106
1107 Returns
1108 -------
1109
1110 no value is returned
1111
1112 Raises
1113 ------
1114
1115 IOError if the JSON file already exists and ``overwrite_existing`` is not enabled.
1116
1117 jsonschema.ValidationError if schema validation fails
1118 """
1119 # Set time (in the original dictionary)
1120 set_quant_fluor_data_dict_time(self.fluorescence_data_dict)
1121 # The next step creates a copy of the dictionary with removed inactive emission lines
1122 pruned_dict = prune_quant_fluor_data_dict(self.fluorescence_data_dict)
1123 save_xrf_quant_fluor_json_file(file_path, pruned_dict, overwrite_existing=overwrite_existing)
1124
1125
1126class ParamQuantitativeAnalysis:

Callers 3

Tested by 2