From 3e5dfe47e9677a80844b981804591d6cba69804e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=AB=20Bullard?= <68021211+chloeann95@users.noreply.github.com> Date: Mon, 13 Mar 2023 04:46:15 -0400 Subject: [PATCH 1/3] Added input morph parameters to the output [WIP] --- diffpy/pdfmorph/pdfmorphapp.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/diffpy/pdfmorph/pdfmorphapp.py b/diffpy/pdfmorph/pdfmorphapp.py index ac211ea7..88837ce7 100755 --- a/diffpy/pdfmorph/pdfmorphapp.py +++ b/diffpy/pdfmorph/pdfmorphapp.py @@ -199,6 +199,9 @@ def main(): xref, yref = getPDFFromFile(pargs[1]) # Get configuration values + scale_in = 'None' + stretch_in = 'None' + smear_in = 'None' config = {} config["rmin"] = opts.rmin config["rmax"] = opts.rmax @@ -215,16 +218,19 @@ def main(): ## Scale if opts.scale is not None: + scale_in = opts.scale chain.append(morphs.MorphScale()) config["scale"] = opts.scale refpars.append("scale") ## Stretch if opts.stretch is not None: + stretch_in = opts.stretch chain.append(morphs.MorphStretch()) config["stretch"] = opts.stretch refpars.append("stretch") ## Smear if opts.smear is not None: + smear_in = opts.smear chain.append(morphs.MorphXtalPDFtoRDF()) chain.append(morphs.MorphSmear()) chain.append(morphs.MorphXtalRDFtoPDF()) @@ -305,9 +311,16 @@ def main(): chain[0] = morphs.Morph() chain(xobj, yobj, xref, yref) + morphs_in = "\nInput morphing parameters:" + morphs_in += f"\n scale = {scale_in}" + morphs_in += f"\n stretch = {stretch_in}" + morphs_in += f"\n smear = {smear_in}" + print(morphs_in) + items = list(config.items()) items.sort() - output = "\n".join("# %s = %f" % i for i in items) + output = "\n Optimized morphing parameters:" + output += "\n".join("# %s = %f" % i for i in items) output += "\n# Rw = %f" % rw output += "\n# Pearson = %f" % pcc print(output) @@ -315,6 +328,7 @@ def main(): header = "# PDF created by pdfmorph\n" header += "# from %s\n" % os.path.abspath(pargs[0]) + header += morphs_in header += output if opts.savefile == "-": outfile = sys.stdout From 49ec4b7e7d3de5efd2aa97abf68e09d966a66e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=AB=20Bullard?= <68021211+chloeann95@users.noreply.github.com> Date: Mon, 13 Mar 2023 04:55:14 -0400 Subject: [PATCH 2/3] added some fixed --- diffpy/pdfmorph/pdfmorphapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diffpy/pdfmorph/pdfmorphapp.py b/diffpy/pdfmorph/pdfmorphapp.py index 88837ce7..1944d9cd 100755 --- a/diffpy/pdfmorph/pdfmorphapp.py +++ b/diffpy/pdfmorph/pdfmorphapp.py @@ -319,7 +319,7 @@ def main(): items = list(config.items()) items.sort() - output = "\n Optimized morphing parameters:" + output = "\nOptimized morphing parameters:\n" output += "\n".join("# %s = %f" % i for i in items) output += "\n# Rw = %f" % rw output += "\n# Pearson = %f" % pcc From f4268d97abee00811cd6191e86f2f78ec974b50f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=AB=20Bullard?= <68021211+chloeann95@users.noreply.github.com> Date: Mon, 13 Mar 2023 04:57:42 -0400 Subject: [PATCH 3/3] added # to printed data for formatting --- diffpy/pdfmorph/pdfmorphapp.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/diffpy/pdfmorph/pdfmorphapp.py b/diffpy/pdfmorph/pdfmorphapp.py index 1944d9cd..371a22b4 100755 --- a/diffpy/pdfmorph/pdfmorphapp.py +++ b/diffpy/pdfmorph/pdfmorphapp.py @@ -311,15 +311,15 @@ def main(): chain[0] = morphs.Morph() chain(xobj, yobj, xref, yref) - morphs_in = "\nInput morphing parameters:" - morphs_in += f"\n scale = {scale_in}" - morphs_in += f"\n stretch = {stretch_in}" - morphs_in += f"\n smear = {smear_in}" + morphs_in = "\n# Input morphing parameters:" + morphs_in += f"\n# scale = {scale_in}" + morphs_in += f"\n# stretch = {stretch_in}" + morphs_in += f"\n# smear = {smear_in}" print(morphs_in) items = list(config.items()) items.sort() - output = "\nOptimized morphing parameters:\n" + output = "\n# Optimized morphing parameters:\n" output += "\n".join("# %s = %f" % i for i in items) output += "\n# Rw = %f" % rw output += "\n# Pearson = %f" % pcc