99 create_instr_params ,
1010 create_tth_parameters ,
1111 DEFAULT_EULER_CONVENTION ,
12+ RelativeConstraints ,
1213 tth_parameter_prefixes ,
1314 update_instrument_from_params ,
1415)
@@ -38,20 +39,26 @@ def __init__(self,
3839 data ,
3940 tth_distortion = None ,
4041 engineering_constraints = None ,
42+ relative_constraints = RelativeConstraints .none ,
4143 euler_convention = DEFAULT_EULER_CONVENTION ):
4244
4345 self ._instr = instr
4446 self ._data = data
4547 self ._tth_distortion = tth_distortion
4648 self ._engineering_constraints = engineering_constraints
49+ self ._relative_constraints = relative_constraints
4750 self .euler_convention = euler_convention
4851 self ._update_tth_distortion_panels ()
4952 self .make_lmfit_params ()
5053 self .set_minimizer ()
5154
5255 def make_lmfit_params (self ):
5356 params = []
54- params += create_instr_params (self .instr , self .euler_convention )
57+ params += create_instr_params (
58+ self .instr ,
59+ self .euler_convention ,
60+ self .relative_constraints ,
61+ )
5562 params += create_tth_parameters (self .instr , self .meas_angles )
5663
5764 params_dict = lmfit .Parameters ()
@@ -66,6 +73,7 @@ def calc_residual(self, params):
6673 self .instr ,
6774 params ,
6875 self .euler_convention ,
76+ self .relative_constraints ,
6977 )
7078
7179 # Store these in variables so they are only computed once.
@@ -154,6 +162,18 @@ def _update_tth_distortion_panels(self):
154162 for det_key , obj in self .tth_distortion .items ():
155163 obj .panel = self .instr .detectors [det_key ]
156164
165+ @property
166+ def relative_constraints (self ):
167+ return self ._relative_constraints
168+
169+ @relative_constraints .setter
170+ def relative_constraints (self , v ):
171+ if v == self ._relative_constraints :
172+ return
173+
174+ self ._relative_constraints = v
175+ self .make_lmfit_params ()
176+
157177 @property
158178 def engineering_constraints (self ):
159179 return self ._engineering_constraints
0 commit comments