autoemx.runners.modify_standards_file module
Runner: Modify EDS Standards JSON File In-Place
- This runner updates an EDS standards JSON file in place. It supports:
Deleting standard entries by ID and el_line (or “all”)
Deleting el_lines from all standards
Excluding entries from mean calculation by ID and el_line (or “all”)
Recomputing the reference means of the modified el_lines from the entries used for the mean (Use_for_mean_calc = True)
Setting reference_mean to null if no entry used for the mean remains
Before the file is changed, a timestamped backup copy is saved next to it.
- How to use:
Set the variables in scripts/Experimental standards/Modify_EDS_Standards_File.py.
Run the script to apply the changes.
A summary of all actions taken (deletions, exclusions, means recomputed, etc.) is printed.
Created on Tue May 19 2026 @author: Andrea
- autoemx.runners.modify_standards_file.modify_standards_file(file_path, delete_std_lines=None, exclude_std_lines_from_mean_calc=None, delete_el_lines: List[str] | None = None, mode: str = 'point', backup: bool = True) Dict[str, Any][source]
Modify an EDS standards JSON file in place.
- Parameters:
file_path (str or Path) – Path to the standards file (e.g. EDS_Stds_15keV.json).
delete_std_lines (list of dict, optional) – Entries to delete, as {standard ID: el_line(s) or “all”}, e.g. [{“BaSO4”: “all”}, {“BaSO4”: [“Ba_La1”]}].
exclude_std_lines_from_mean_calc (list of dict, optional) – Entries to exclude from the reference means, in the same format as delete_std_lines.
delete_el_lines (list of str, optional) – El_lines deleted from all standards (entries and reference mean), e.g. [“Mo_La1”].
mode (str, optional) – Measurement mode of the standards to modify (key of standards_by_mode). Default is “point”.
backup (bool, optional) – If True (default), a copy of the file is saved as <name>_backup_<date>_<time>.json before it is changed.
- Returns:
Summary of the changes: deleted_entries, excluded_entries, deleted_el_lines, means_recomputed, means_removed, not_found_deletions, not_found_exclusions, not_found_el_lines, backup_path, changed.
- Return type:
dict