Skip to content

Commit f8ee98a

Browse files
authored
Put the MorphRGrid at the end of the morphing chain (#232)
* Update numerical file comparisons in tests * News * Dictionary numeric comparison * Renaming for clarity * Change order in which r-grid is compared * News * Remove undeveloped option
1 parent 5d9fd64 commit f8ee98a

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

news/config_order.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* <news item>
4+
5+
**Changed:**
6+
7+
* 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.
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

src/diffpy/morph/morphapp.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,6 @@ def single_morph(
506506

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

513511
# Python-Specific Morphs
@@ -632,6 +630,10 @@ def single_morph(
632630
refpars.append("qdamp")
633631
config["qdamp"] = opts.qdamp
634632

633+
# Add the r-range morph, we will remove it when saving and plotting
634+
mrg = morphs.MorphRGrid()
635+
chain.append(mrg)
636+
635637
# Now remove non-refinable parameters
636638
if opts.exclude is not None:
637639
refpars = list(set(refpars) - set(opts.exclude))
@@ -674,7 +676,8 @@ def single_morph(
674676
rw = tools.getRw(chain)
675677
pcc = tools.get_pearson(chain)
676678
# Replace the MorphRGrid with Morph identity
677-
chain[0] = morphs.Morph()
679+
# This removes the r-range morph as mentioned above
680+
mrg = morphs.Morph()
678681
chain(x_morph, y_morph, x_target, y_target)
679682

680683
# FOR FUTURE MAINTAINERS

0 commit comments

Comments
 (0)