@@ -121,26 +121,43 @@ def custom_error(self, msg):
121121 help = """Exclude a manipulation from refinement by name. This can
122122 appear multiple times.""" ,
123123 )
124- group .add_option ("--scale" , type = "float" , metavar = "SCALE" , help = "Apply scale factor SCALE." )
125124 group .add_option (
126- "--smear " ,
125+ "--scale " ,
127126 type = "float" ,
128- metavar = "SMEAR " ,
129- help = "Smear peaks with a Gaussian of width SMEAR ." ,
127+ metavar = "SCALE " ,
128+ help = "Apply scale factor SCALE ." ,
130129 )
131130 group .add_option (
132131 "--stretch" ,
133132 type = "float" ,
134133 metavar = "STRETCH" ,
135134 help = "Stretch PDF by a fraction STRETCH." ,
136135 )
136+ group .add_option (
137+ "--smear" ,
138+ type = "float" ,
139+ metavar = "SMEAR" ,
140+ help = "Smear peaks with a Gaussian of width SMEAR." ,
141+ )
137142 group .add_option (
138143 "--slope" ,
139144 type = "float" ,
140145 dest = "baselineslope" ,
141146 help = """Slope of the baseline. This is used when applying the smear
142147 factor. It will be estimated if not provided.""" ,
143148 )
149+ group .add_option (
150+ "--hshift" ,
151+ type = "float" ,
152+ metavar = "HSHIFT" ,
153+ help = "Shift the PDF horizontally by HSHIFT to the right." ,
154+ )
155+ group .add_option (
156+ "--vshift" ,
157+ type = "float" ,
158+ metavar = "VSHIFT" ,
159+ help = "Shift the PDF vertically by VSHIFT upward." ,
160+ )
144161 group .add_option (
145162 "--qdamp" ,
146163 type = "float" ,
@@ -318,6 +335,8 @@ def single_morph(parser, opts, pargs, stdout_flag=True):
318335 scale_in = "None"
319336 stretch_in = "None"
320337 smear_in = "None"
338+ hshift_in = "None"
339+ vshift_in = "None"
321340 config = {}
322341 config ["rmin" ] = opts .rmin
323342 config ["rmax" ] = opts .rmax
@@ -336,22 +355,41 @@ def single_morph(parser, opts, pargs, stdout_flag=True):
336355 if opts .scale is not None :
337356 scale_in = opts .scale
338357 chain .append (morphs .MorphScale ())
339- config ["scale" ] = opts . scale
358+ config ["scale" ] = scale_in
340359 refpars .append ("scale" )
341360 # Stretch
342361 if opts .stretch is not None :
343362 stretch_in = opts .stretch
344363 chain .append (morphs .MorphStretch ())
345- config ["stretch" ] = opts . stretch
364+ config ["stretch" ] = stretch_in
346365 refpars .append ("stretch" )
366+ # Shift
367+ if opts .hshift is not None :
368+ hshift_in = opts .hshift
369+ chain .append (morphs .MorphShift ())
370+ config ["hshift" ] = hshift_in
371+ refpars .append ("hshift" )
372+ if opts .vshift is None :
373+ vshift_in = 0
374+ config ["vshift" ] = vshift_in
375+ refpars .append ("vshift" )
376+ if opts .vshift is not None :
377+ vshift_in = opts .vshift
378+ chain .append (morphs .MorphShift ())
379+ config ["vshift" ] = vshift_in
380+ refpars .append ("vshift" )
381+ if opts .hshift is None :
382+ hshift_in = 0
383+ config ["hshift" ] = hshift_in
384+ refpars .append ("hshift" )
347385 # Smear
348386 if opts .smear is not None :
349387 smear_in = opts .smear
350388 chain .append (helpers .TransformXtalPDFtoRDF ())
351389 chain .append (morphs .MorphSmear ())
352390 chain .append (helpers .TransformXtalRDFtoPDF ())
353391 refpars .append ("smear" )
354- config ["smear" ] = opts . smear
392+ config ["smear" ] = smear_in
355393 # Set baselineslope if not given
356394 config ["baselineslope" ] = opts .baselineslope
357395 if opts .baselineslope is None :
@@ -432,6 +470,7 @@ def single_morph(parser, opts, pargs, stdout_flag=True):
432470
433471 # Input morph parameters
434472 morph_inputs = {"scale" : scale_in , "stretch" : stretch_in , "smear" : smear_in }
473+ morph_inputs .update ({"hshift" : hshift_in , "vshift" : vshift_in })
435474
436475 # Output morph parameters
437476 morph_results = dict (config .items ())
@@ -580,6 +619,7 @@ def multiple_targets(parser, opts, pargs, stdout_flag=True):
580619 target_file_names .append (key )
581620
582621 morph_inputs = {"scale" : opts .scale , "stretch" : opts .stretch , "smear" : opts .smear }
622+ morph_inputs .update ({"hshift" : opts .hshift , "vshift" : opts .vshift })
583623
584624 try :
585625 # Print summary of morphs to terminal and to file (if requested)
@@ -724,6 +764,7 @@ def multiple_morphs(parser, opts, pargs, stdout_flag=True):
724764 morph_file_names .append (key )
725765
726766 morph_inputs = {"scale" : opts .scale , "stretch" : opts .stretch , "smear" : opts .smear }
767+ morph_inputs .update ({"hshift" : opts .hshift , "vshift" : opts .vshift })
727768
728769 try :
729770 # Print summary of morphs to terminal and to file (if requested)
0 commit comments