Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion diffpy/pdfmorph/pdfmorphapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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())
Expand Down Expand Up @@ -305,16 +311,24 @@ def main():
chain[0] = morphs.Morph()
chain(xobj, yobj, xref, yref)

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 = "\n".join("# %s = %f" % i for i in items)
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
print(output)
if opts.savefile is not None:
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
Expand Down