Skip to content

Commit

Permalink
Ensure each invalid peak has a unique value
Browse files Browse the repository at this point in the history
Previously, all invalid peaks would have a value of `-999`. This would
make them difficult to distinguish, however, in our spots viewer in
HEXRDGUI.

Instead, now all invalid peaks still have a negative number (starting
at `-100`), but they all have unique negative numbers. This allows us to
ensure that the correct images are being displayed for whichever invalid
peak the user wishes to see.

Signed-off-by: Patrick Avery <[email protected]>
  • Loading branch information
psavery committed Oct 2, 2023
1 parent 7170521 commit 412fad1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hexrd/instrument/hedm_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -1782,6 +1782,7 @@ def pull_spots(self, plane_data, grain_params,
# LOOP OVER PANELS
# =====================================================================
iRefl = 0
next_invalid_peak_id = -100
compl = []
output = dict.fromkeys(self.detectors)
for detector_id, panel in self.detectors.items():
Expand Down Expand Up @@ -1935,7 +1936,7 @@ def pull_spots(self, plane_data, grain_params,
else:
# initialize spot data parameters
# !!! maybe change these to nan to not fuck up writer
peak_id = -999
peak_id = next_invalid_peak_id
sum_int = np.nan
max_int = np.nan
meas_angs = np.nan*np.ones(3)
Expand Down Expand Up @@ -2051,6 +2052,12 @@ def pull_spots(self, plane_data, grain_params,
else:
patch_data = patch_data_raw
pass # end contains_signal

if peak_id < 0:
# The peak is invalid.
# Decrement the next invalid peak ID.
next_invalid_peak_id -= 1

# write output
if filename is not None:
if output_format.lower() == 'text':
Expand Down

0 comments on commit 412fad1

Please sign in to comment.