@@ -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,33 @@ 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 or opts .vshift is not None :
368+ chain .append (morphs .MorphShift ())
369+ if opts .hshift is not None :
370+ hshift_in = opts .hshift
371+ config ["hshift" ] = hshift_in
372+ refpars .append ("hshift" )
373+ if opts .vshift is not None :
374+ vshift_in = opts .vshift
375+ config ["vshift" ] = vshift_in
376+ refpars .append ("vshift" )
347377 # Smear
348378 if opts .smear is not None :
349379 smear_in = opts .smear
350380 chain .append (helpers .TransformXtalPDFtoRDF ())
351381 chain .append (morphs .MorphSmear ())
352382 chain .append (helpers .TransformXtalRDFtoPDF ())
353383 refpars .append ("smear" )
354- config ["smear" ] = opts . smear
384+ config ["smear" ] = smear_in
355385 # Set baselineslope if not given
356386 config ["baselineslope" ] = opts .baselineslope
357387 if opts .baselineslope is None :
@@ -432,6 +462,7 @@ def single_morph(parser, opts, pargs, stdout_flag=True):
432462
433463 # Input morph parameters
434464 morph_inputs = {"scale" : scale_in , "stretch" : stretch_in , "smear" : smear_in }
465+ morph_inputs .update ({"hshift" : hshift_in , "vshift" : vshift_in })
435466
436467 # Output morph parameters
437468 morph_results = dict (config .items ())
@@ -580,6 +611,7 @@ def multiple_targets(parser, opts, pargs, stdout_flag=True):
580611 target_file_names .append (key )
581612
582613 morph_inputs = {"scale" : opts .scale , "stretch" : opts .stretch , "smear" : opts .smear }
614+ morph_inputs .update ({"hshift" : opts .hshift , "vshift" : opts .vshift })
583615
584616 try :
585617 # Print summary of morphs to terminal and to file (if requested)
@@ -724,6 +756,7 @@ def multiple_morphs(parser, opts, pargs, stdout_flag=True):
724756 morph_file_names .append (key )
725757
726758 morph_inputs = {"scale" : opts .scale , "stretch" : opts .stretch , "smear" : opts .smear }
759+ morph_inputs .update ({"hshift" : opts .hshift , "vshift" : opts .vshift })
727760
728761 try :
729762 # Print summary of morphs to terminal and to file (if requested)
0 commit comments