@@ -245,9 +245,11 @@ def morph_error(self, msg, error):
245245 type = "float" ,
246246 metavar = "SMEAR" ,
247247 help = (
248- "Smear the peaks with a Gaussian of width SMEAR. "
248+ "Smear the peaks with a function of width SMEAR. "
249+ "The smearing function is chosen by the --smear-function option "
250+ "(default is Gaussian if that option is not enabled). "
249251 "This is done by convolving the function with a "
250- "Gaussian with standard deviation SMEAR. "
252+ "function with width SMEAR. "
251253 "If both --smear and --smear-pdf are enabled, "
252254 "only --smear-pdf will be applied."
253255 ),
@@ -258,12 +260,29 @@ def morph_error(self, msg, error):
258260 metavar = "SMEAR" ,
259261 help = (
260262 "Convert PDF to RDF. "
261- "Then, smear peaks with a Gaussian of width SMEAR. "
263+ "Then, smear peaks with a function of width SMEAR. "
264+ "The smearing function is chosen by the --smear-function option "
265+ "(default is Gaussian if that option is not enabled). "
262266 "Convert back to PDF. "
263267 "If both --smear and --smear-pdf are enabled, "
264268 "only --smear-pdf will be applied."
265269 ),
266270 )
271+ group .add_option (
272+ "--smear-function" ,
273+ "--smear-func" ,
274+ dest = "smear_func" ,
275+ metavar = "SMEARFUNCTION" ,
276+ help = (
277+ "Choose the function for the smear morph. "
278+ "Only used if --smear or --smear-pdf is enabled. "
279+ "Available options: Gaussian (default) and Lorentzian. "
280+ "If Gaussian, the SMEAR parameter is the standard "
281+ "deviation. "
282+ "If Lorentzian, the SMEAR parameter is the half width "
283+ "half maximum."
284+ ),
285+ )
267286 group .add_option (
268287 "--slope" ,
269288 type = "float" ,
@@ -665,13 +684,17 @@ def single_morph(
665684 config ["stretch" ] = stretch_in
666685 refpars .append ("stretch" )
667686 # Smear
687+ smear_func = "gaussian"
688+ if opts .smear_func is not None :
689+ smear_func = opts .smear_func .lower ()
668690 if opts .smear_pdf is not None :
669691 smear_in = opts .smear_pdf
670692 chain .append (helpers .TransformXtalPDFtoRDF ())
671693 chain .append (morphs .MorphSmear ())
672694 chain .append (helpers .TransformXtalRDFtoPDF ())
673695 refpars .append ("smear" )
674696 config ["smear" ] = smear_in
697+ config ["smear_func" ] = smear_func
675698 # Set baselineslope if not given
676699 config ["baselineslope" ] = opts .baselineslope
677700 if opts .baselineslope is None :
@@ -682,6 +705,7 @@ def single_morph(
682705 chain .append (morphs .MorphSmear ())
683706 refpars .append ("smear" )
684707 config ["smear" ] = smear_in
708+ config ["smear_func" ] = smear_func
685709 # Shift
686710 # Only enable hshift is squeeze is not enabled
687711 shift_morph = None
@@ -825,6 +849,7 @@ def single_morph(
825849 opts .stretch ,
826850 opts .smear_pdf ,
827851 opts .smear ,
852+ opts .smear_func ,
828853 opts .hshift ,
829854 opts .vshift ,
830855 opts .squeeze ,
@@ -1060,6 +1085,7 @@ def multiple_targets(parser, opts, pargs, stdout_flag=True, python_wrap=False):
10601085 opts .stretch ,
10611086 opts .smear_pdf ,
10621087 opts .smear ,
1088+ opts .smear_func ,
10631089 opts .hshift ,
10641090 opts .vshift ,
10651091 opts .squeeze ,
@@ -1254,6 +1280,7 @@ def multiple_morphs(parser, opts, pargs, stdout_flag=True, python_wrap=False):
12541280 opts .stretch ,
12551281 opts .smear_pdf ,
12561282 opts .smear ,
1283+ opts .smear_func ,
12571284 opts .hshift ,
12581285 opts .vshift ,
12591286 opts .squeeze ,
0 commit comments