Skip to content

Commit 76d1bd1

Browse files
committed
Isolating shifting morphs
1 parent bd0c834 commit 76d1bd1

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/diffpy/pdfmorph/morphs/morphshift.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,13 @@ class MorphShift(Morph):
4747

4848
def morph(self, x_morph, y_morph, x_target, y_target):
4949
"""Apply the shifts."""
50-
if self.hshift is None:
50+
try:
51+
self.hshift
52+
except AttributeError:
5153
self.hshift = 0
52-
if self.vshift is None:
54+
try:
55+
self.vshift
56+
except AttributeError:
5357
self.vshift = 0
5458

5559
Morph.morph(self, x_morph, y_morph, x_target, y_target)

src/diffpy/pdfmorph/pdfmorphapp.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -369,19 +369,11 @@ def single_morph(parser, opts, pargs, stdout_flag=True):
369369
chain.append(morphs.MorphShift())
370370
config["hshift"] = hshift_in
371371
refpars.append("hshift")
372-
if opts.vshift is None:
373-
vshift_in = 0
374-
config["vshift"] = vshift_in
375-
refpars.append("vshift")
376372
if opts.vshift is not None:
377373
vshift_in = opts.vshift
378374
chain.append(morphs.MorphShift())
379375
config["vshift"] = vshift_in
380376
refpars.append("vshift")
381-
if opts.hshift is None:
382-
hshift_in = 0
383-
config["hshift"] = hshift_in
384-
refpars.append("hshift")
385377
# Smear
386378
if opts.smear is not None:
387379
smear_in = opts.smear

0 commit comments

Comments
 (0)