@@ -121,26 +121,43 @@ def custom_error(self, msg):
121
121
help = """Exclude a manipulation from refinement by name. This can
122
122
appear multiple times.""" ,
123
123
)
124
- group .add_option ("--scale" , type = "float" , metavar = "SCALE" , help = "Apply scale factor SCALE." )
125
124
group .add_option (
126
- "--smear " ,
125
+ "--scale " ,
127
126
type = "float" ,
128
- metavar = "SMEAR " ,
129
- help = "Smear peaks with a Gaussian of width SMEAR ." ,
127
+ metavar = "SCALE " ,
128
+ help = "Apply scale factor SCALE ." ,
130
129
)
131
130
group .add_option (
132
131
"--stretch" ,
133
132
type = "float" ,
134
133
metavar = "STRETCH" ,
135
134
help = "Stretch PDF by a fraction STRETCH." ,
136
135
)
136
+ group .add_option (
137
+ "--smear" ,
138
+ type = "float" ,
139
+ metavar = "SMEAR" ,
140
+ help = "Smear peaks with a Gaussian of width SMEAR." ,
141
+ )
137
142
group .add_option (
138
143
"--slope" ,
139
144
type = "float" ,
140
145
dest = "baselineslope" ,
141
146
help = """Slope of the baseline. This is used when applying the smear
142
147
factor. It will be estimated if not provided.""" ,
143
148
)
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
+ )
144
161
group .add_option (
145
162
"--qdamp" ,
146
163
type = "float" ,
@@ -318,6 +335,8 @@ def single_morph(parser, opts, pargs, stdout_flag=True):
318
335
scale_in = "None"
319
336
stretch_in = "None"
320
337
smear_in = "None"
338
+ hshift_in = "None"
339
+ vshift_in = "None"
321
340
config = {}
322
341
config ["rmin" ] = opts .rmin
323
342
config ["rmax" ] = opts .rmax
@@ -336,22 +355,33 @@ def single_morph(parser, opts, pargs, stdout_flag=True):
336
355
if opts .scale is not None :
337
356
scale_in = opts .scale
338
357
chain .append (morphs .MorphScale ())
339
- config ["scale" ] = opts . scale
358
+ config ["scale" ] = scale_in
340
359
refpars .append ("scale" )
341
360
# Stretch
342
361
if opts .stretch is not None :
343
362
stretch_in = opts .stretch
344
363
chain .append (morphs .MorphStretch ())
345
- config ["stretch" ] = opts . stretch
364
+ config ["stretch" ] = stretch_in
346
365
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" )
347
377
# Smear
348
378
if opts .smear is not None :
349
379
smear_in = opts .smear
350
380
chain .append (helpers .TransformXtalPDFtoRDF ())
351
381
chain .append (morphs .MorphSmear ())
352
382
chain .append (helpers .TransformXtalRDFtoPDF ())
353
383
refpars .append ("smear" )
354
- config ["smear" ] = opts . smear
384
+ config ["smear" ] = smear_in
355
385
# Set baselineslope if not given
356
386
config ["baselineslope" ] = opts .baselineslope
357
387
if opts .baselineslope is None :
@@ -432,6 +462,7 @@ def single_morph(parser, opts, pargs, stdout_flag=True):
432
462
433
463
# Input morph parameters
434
464
morph_inputs = {"scale" : scale_in , "stretch" : stretch_in , "smear" : smear_in }
465
+ morph_inputs .update ({"hshift" : hshift_in , "vshift" : vshift_in })
435
466
436
467
# Output morph parameters
437
468
morph_results = dict (config .items ())
@@ -580,6 +611,7 @@ def multiple_targets(parser, opts, pargs, stdout_flag=True):
580
611
target_file_names .append (key )
581
612
582
613
morph_inputs = {"scale" : opts .scale , "stretch" : opts .stretch , "smear" : opts .smear }
614
+ morph_inputs .update ({"hshift" : opts .hshift , "vshift" : opts .vshift })
583
615
584
616
try :
585
617
# Print summary of morphs to terminal and to file (if requested)
@@ -724,6 +756,7 @@ def multiple_morphs(parser, opts, pargs, stdout_flag=True):
724
756
morph_file_names .append (key )
725
757
726
758
morph_inputs = {"scale" : opts .scale , "stretch" : opts .stretch , "smear" : opts .smear }
759
+ morph_inputs .update ({"hshift" : opts .hshift , "vshift" : opts .vshift })
727
760
728
761
try :
729
762
# Print summary of morphs to terminal and to file (if requested)
0 commit comments