From b7054aed66928f8f4b8020f8ff3ea5b22ea5170d Mon Sep 17 00:00:00 2001 From: Charles Titus Date: Thu, 14 Nov 2024 11:38:42 -0500 Subject: [PATCH] Needed to move ROI setting before column renaming --- export_to_xdi.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/export_to_xdi.py b/export_to_xdi.py index 3cea765..b2eb6d6 100644 --- a/export_to_xdi.py +++ b/export_to_xdi.py @@ -158,6 +158,15 @@ def exportToXDI( zero_array = np.zeros_like(run_data[index - 1]) run_data.insert(index, zero_array) + # Add TES ROI info + for c in columns: + if c in tes_rois: + metadata[f"rois.{c}"] = "{:.2f} {:.2f}".format(*tes_rois[c]) + + # Rename TFY and PFY channels + metadata["rois.tfy"] = metadata.pop("rois.tes_mca_counts", "") + metadata["rois.pfy"] = metadata.pop("rois.tes_mca_pfy", "") + # Rename energy columns if present normalize_detector( "nexafs_i0up", @@ -197,15 +206,6 @@ def exportToXDI( normalize_detector("en_energy", "energy", columns) exclude_column("ucal_sc", columns, run_data) - # Add TES ROI info - for c in columns: - if c in tes_rois: - metadata[f"rois.{c}"] = "{:.2f} {:.2f}".format(*tes_rois[c]) - - # Rename TFY and PFY channels - metadata["rois.tfy"] = metadata.pop("rois.tes_mca_counts", "") - metadata["rois.pfy"] = metadata.pop("rois.tes_mca_pfy", "") - fmtStr = generate_format_string(run_data) data = np.vstack(run_data).T colStr = " ".join(columns)