Skip to content

Commit

Permalink
Fixed Error Handling for integrateImage energy
Browse files Browse the repository at this point in the history
When attempting to integrate data from cycle 2022-2, was getting an
IndexError when integrateImageStack called integrateSingleImage.  The
indexes for finding the energy were switched from what they needed to
be. Perhaps this block of code isn't running for other cycles, or the
index structure is different.

Changes are at lines 62 and 63.
  • Loading branch information
Camille Bishop committed Sep 14, 2023
1 parent 12c71b0 commit 21b0b5d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/PyHyperScattering/PFEnergySeriesIntegrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ def integrateSingleImage(self,img):
for i,n in enumerate(img.indexes[multiindex_name].names):
if n == 'energy':
idx_of_energy = i
en = float(getattr(img,multiindex_name).values[idx_of_energy][0])
try:
en = float(getattr(img,multiindex_name).values[idx_of_energy][0]) # this does not work for 2022-2 data; does it work for other cycles?
except IndexError:
en = float(getattr(img,multiindex_name).values[0][idx_of_energy])
except KeyError:
pass
if en is not None:
Expand Down

0 comments on commit 21b0b5d

Please sign in to comment.