Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle non-energy scans that are saturated/underexposed #164

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading