Skip to content

Commit 7af78df

Browse files
committed
Do not allow memoized median output to be modified
Make a copy of the memoized median filter output so that we can be sure the array will not be modified. This was causing a bug where, if you had one state file loaded in with the median filter applied, and you load in another state file that has the median filter applied, the memoized output was somehow modified and made the image data invalid. Making a copy of the memoized output ensures that it won't be modified. Signed-off-by: Patrick Avery <[email protected]>
1 parent a10a15f commit 7af78df

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hexrdgui/hexrd_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,10 +971,12 @@ def intensity_corrected_images_dict(self):
971971
# (such as polar or stereo)
972972
if HexrdConfig().apply_median_filter_correction:
973973
for name, img in images_dict.items():
974+
# Since this is memoized, make a copy so we won't modify
975+
# the original.
974976
images_dict[name] = medfilt2d_memoized(
975977
img,
976978
kernel_size=HexrdConfig().median_filter_kernel_size
977-
)
979+
).copy()
978980

979981
# Create this corrections dict, even if we don't use it, because
980982
# it updates the `intensity_corrections_dict` that may be used

0 commit comments

Comments
 (0)