Skip to content

Commit 5d06d62

Browse files
authored
Merge pull request NSLS2#335 from dmgav/json-issue
Resolved multiple issues with PyXRF
2 parents 938db81 + 66be934 commit 5d06d62

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

pyxrf/core/map_processing.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,7 @@ def compute_selected_rois(
11431143
# is interest. The output of this function is tested to match the
11441144
# output of 'snip_method' to make sure the functions are equivalent.
11451145

1146+
11461147
_default_con_val_no_bin = 3
11471148
_default_con_val_bin = 5
11481149
_default_iter_num_no_bin = 3
@@ -1225,6 +1226,7 @@ def snip_method_numba(
12251226
geoscience applications", Nuclear Instruments and Methods in
12261227
Physics Research Section B, vol. 34, 1998.
12271228
"""
1229+
12281230
# clean input a bit
12291231
if con_val is None:
12301232
if spectral_binning is None:
@@ -1319,7 +1321,12 @@ def _clip(arr, vmin, vmax):
13191321
temp = (background[lo_index.astype(np.int32)] + background[hi_index.astype(np.int32)]) / 2.0
13201322

13211323
bg_index = background > temp
1322-
background[bg_index] = temp[bg_index]
1324+
# The following numpy based line of code stopped working with numba v0.61.0
1325+
# background[bg_index] = temp[bg_index]
1326+
# The following code is the workaround. Seems fast enough.
1327+
for n in range(len(background)):
1328+
if bg_index[n]:
1329+
background[n] = temp[n]
13231330

13241331
current_width = window_p
13251332
max_current_width = np.amax(current_width)
@@ -1331,7 +1338,12 @@ def _clip(arr, vmin, vmax):
13311338
temp = (background[lo_index.astype(np.int32)] + background[hi_index.astype(np.int32)]) / 2.0
13321339

13331340
bg_index = background > temp
1334-
background[bg_index] = temp[bg_index]
1341+
# The following numpy based line of code stopped working with numba v0.61.0
1342+
# background[bg_index] = temp[bg_index]
1343+
# The following code is the workaround. Seems fast enough.
1344+
for n in range(len(background)):
1345+
if bg_index[n]:
1346+
background[n] = temp[n]
13351347

13361348
# decrease the width and repeat
13371349
current_width = current_width / decrease_factor

pyxrf/model/lineplot.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,9 +1499,11 @@ def _show_preview_spectrum_plot(self):
14991499
# Completely redraw the plot each time the function is called
15001500
self.prepare_preview_spectrum_plot()
15011501

1502-
# Remove all lines from the plot
1503-
while len(self._lines_preview):
1504-
self._lines_preview.pop().remove()
1502+
# Remove all lines from the plot. This is not really needed, since the axes are cleared.
1503+
# while len(self._lines_preview):
1504+
# _ = self._lines_preview.pop()
1505+
# if _.axes is not None:
1506+
# _.remove()
15051507

15061508
# The list of color names
15071509
color_names = get_color_name()

0 commit comments

Comments
 (0)