Skip to content

Commit

Permalink
Needed to move ROI setting before column renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
cjtitus committed Nov 14, 2024
1 parent 5857ca5 commit b7054ae
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions export_to_xdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b7054ae

Please sign in to comment.