Skip to content

Commit 7bda73b

Browse files
committed
Keep phase fraction constraints in WPPF after load
After loading parameters (either from a state file or importing params from an HDF5 file), if there was an expression on a parameter, restore that parameter after the load. Fixes: #1923 Signed-off-by: Patrick Avery <[email protected]>
1 parent 3bb3f59 commit 7bda73b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

hexrdgui/calibration/wppf_options_dialog.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,13 @@ def params_dict(self, v):
803803
if key not in self.params:
804804
continue
805805

806+
old_param = self.params[key]
806807
self.params[key] = dict_to_param(val)
807808

809+
if old_param.expr:
810+
# If there was an expression, restore that expression
811+
self.params[key].expr = old_param.expr
812+
808813
def load_settings(self):
809814
settings = HexrdConfig().config['calibration'].get('wppf')
810815
if not settings:
@@ -1688,8 +1693,11 @@ def load_params(self, filename):
16881693
self.validate_import_params(import_params, filename)
16891694

16901695
# Keep the ordering the same as the GUI currently has
1691-
for key in self.params.keys():
1696+
for key, old_param in self.params.items():
16921697
self.params[key] = dict_to_param(import_params[key])
1698+
if old_param.expr:
1699+
# If there was an expression, restore that expression
1700+
self.params[key].expr = old_param.expr
16931701

16941702
self.update_tree_view()
16951703
self.save_settings()

0 commit comments

Comments
 (0)