Skip to content

Commit

Permalink
Merge pull request #164 from usnistgov/bugfix_energy_index
Browse files Browse the repository at this point in the history
Handle non-energy scans that are saturated/underexposed
  • Loading branch information
pbeaucage authored Dec 5, 2024
2 parents 5059025 + 5742d64 commit 3adbdc3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/PyHyperScattering/SST1RSoXSDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,8 +1102,11 @@ def loadMd(self, run):
message += "Wide Angle CCD Detector is reported as underexposed at all energies."
else:
idx = np.where(md["Wide Angle CCD Detector_under_exposed"])
warning_e = md["energy"][idx]
message += f"Affected energies include: \n{warning_e}"
try:
warning_e = md["energy"][idx]
message += f"Affected energies include: \n{warning_e}"
except Exception:
message += f"Affected frames were {idx}."
warnings.warn(message, stacklevel=2)
else:
warnings.warn(
Expand All @@ -1118,8 +1121,11 @@ def loadMd(self, run):
message += "\tWide Angle CCD Detector is reported as saturated at all energies."
else:
idx = np.where(md["Wide Angle CCD Detector_saturated"])
warning_e = md["energy"][idx]
message += f"Affected energies include: \n{warning_e}"
try:
warning_e = md["energy"][idx]
message += f"Affected energies include: \n{warning_e}"
except Exception:
message += f"Affected frames were {idx}."
warnings.warn(message, stacklevel=2)
else:
warnings.warn(
Expand Down

0 comments on commit 3adbdc3

Please sign in to comment.