Skip to content

Commit 22ba3f1

Browse files
committed
Skip multiplication for layer type
The layer type is a string and should not be multiplied. Originally, the multiplication worked fine, because the multiplier was an integer of 1, and doing things like `'sample' * 1` results in `'sample'` - just the string. However, we changed the multiplier to a float in the type annotations PR, and we can't multiply a float with a string, so we would get an error. This fixes the code so the layer type string does not get multiplied at all. Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
1 parent 37eec4e commit 22ba3f1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hexrdgui/pinhole_correction_editor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,10 @@ def correction_kwargs(self, v: dict[str, Any] | None) -> None:
192192
vp = v.copy()
193193
# These units are in mm, but we display in micrometers
194194
for key, value in v.items():
195-
if key in ('num_phi_elements', 'absorption_length', 'layer_type'):
195+
if key == 'layer_type':
196+
# This is a string, not numeric. Skip conversion.
197+
continue
198+
elif key in ('num_phi_elements', 'absorption_length'):
196199
multiplier = 1.0
197200
else:
198201
multiplier = 1e3

0 commit comments

Comments
 (0)