Skip to content

Commit a7f0c35

Browse files
committed
Set pinhole thickness to zero when disabled
This ensures that the thickness of any layer is properly set to zero when they are disabled - including the pinhole. Layers having a thickness of zero is what indicates that they don't exist. This is properly handled in the absorption correction math. Fixes: #1922 Signed-off-by: Patrick Avery <[email protected]>
1 parent 3908ff0 commit a7f0c35

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

hexrdgui/physics_package_manager_dialog.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ def layer_thickness(self, name: str) -> float:
310310
w = getattr(self.ui, f'{name}_thickness')
311311
return w.value()
312312

313+
def layer_density(self, name: str) -> float:
314+
return getattr(self.ui, f'{name}_density').value()
315+
313316
def material_changed(self, index, category):
314317
material = self.material_selectors[category].currentText()
315318

@@ -348,7 +351,10 @@ def accept_changes(self):
348351
kwargs[f'{name}_material'] = materials[name]
349352
for key in ('density', 'thickness'):
350353
attr = f'{name}_{key}'
351-
kwargs[attr] = getattr(self.ui, attr).value()
354+
# We MUST use the getter function, so the thickness will
355+
# be automatically set to zero for disabled layers.
356+
getter = getattr(self, f'layer_{key}')
357+
kwargs[attr] = getter(name)
352358
kwargs[f'{name}_formula'] = self.chemical_formula(name)
353359

354360
HexrdConfig().update_physics_package(**kwargs)

0 commit comments

Comments
 (0)