Skip to content

Put the MorphRGrid at the end of the morphing chain #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 9, 2025
Merged
Show file tree
Hide file tree
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
23 changes: 23 additions & 0 deletions news/config_order.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* The interpolation of the morphed/objective function onto the target function grid is now done at the end of the morphing chain. Prior, it was done before. This change is desirable as the target function grid may be much smaller/larger than that of the objective, but a morph (e.g. stretch) accounts for that difference. Then, we ensure the morph is done before we regrid for comparison.

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
9 changes: 6 additions & 3 deletions src/diffpy/morph/morphapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,6 @@ def single_morph(

# Set up the morphs
chain = morphs.MorphChain(config)
# Add the r-range morph, we will remove it when saving and plotting
chain.append(morphs.MorphRGrid())
refpars = []

# Python-Specific Morphs
Expand Down Expand Up @@ -632,6 +630,10 @@ def single_morph(
refpars.append("qdamp")
config["qdamp"] = opts.qdamp

# Add the r-range morph, we will remove it when saving and plotting
mrg = morphs.MorphRGrid()
chain.append(mrg)

# Now remove non-refinable parameters
if opts.exclude is not None:
refpars = list(set(refpars) - set(opts.exclude))
Expand Down Expand Up @@ -674,7 +676,8 @@ def single_morph(
rw = tools.getRw(chain)
pcc = tools.get_pearson(chain)
# Replace the MorphRGrid with Morph identity
chain[0] = morphs.Morph()
# This removes the r-range morph as mentioned above
mrg = morphs.Morph()
chain(x_morph, y_morph, x_target, y_target)

# FOR FUTURE MAINTAINERS
Expand Down
Loading