@@ -331,10 +331,11 @@ def single_morph(parser, opts, pargs, stdout_flag=True):
331331 chain .append (helpers .TransformXtalRDFtoPDF ())
332332 refpars .append ("smear" )
333333 config ["smear" ] = opts .smear
334+ # Set baselineslope if not given
334335 config ["baselineslope" ] = opts .baselineslope
335336 if opts .baselineslope is None :
336- refpars .append ("baselineslope" )
337337 config ["baselineslope" ] = - 0.5
338+ refpars .append ("baselineslope" )
338339 # Size
339340 radii = [opts .radius , opts .pradius ]
340341 nrad = 2 - radii .count (None )
@@ -371,8 +372,7 @@ def single_morph(parser, opts, pargs, stdout_flag=True):
371372
372373 # Now remove non-refinable parameters
373374 if opts .exclude is not None :
374- refpars = set (refpars ) - set (opts .exclude )
375- refpars = list (refpars )
375+ refpars = list (set (refpars ) - set (opts .exclude ))
376376
377377 # Refine or execute the morph
378378 refiner = refine .Refiner (chain , x_morph , y_morph , x_target , y_target )
@@ -388,12 +388,15 @@ def single_morph(parser, opts, pargs, stdout_flag=True):
388388 if "scale" in refpars :
389389 rptemp .append ("scale" )
390390 refiner .refine (* rptemp )
391+ # Adjust all parameters
391392 refiner .refine (* refpars )
392393 except ValueError as e :
393394 parser .custom_error (str (e ))
394- elif "smear" in refpars and opts .baselineslope is None :
395+ # Smear is not being refined, but baselineslope needs to refined to apply smear
396+ # Note that baselineslope is only added to the refine list if smear is applied
397+ elif "baselineslope" in refpars :
395398 try :
396- refiner .refine ("baselineslope" , baselineslope = - 0.5 )
399+ refiner .refine ("baselineslope" , baselineslope = config [ "baselineslope" ] )
397400 except ValueError as e :
398401 parser .custom_error (str (e ))
399402 else :
0 commit comments