Skip to content

Commit cb3a404

Browse files
committed
Update exclude morphs option (#246)
* Update exclude * News
1 parent 965b535 commit cb3a404

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

docs/source/morphpy.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ excluded with the apply or exclude parameters.
102102

103103
apply: bool
104104
Apply morphs but do not refine.
105-
exclude: str
106-
Exclude a manipulation from refinement by name.
105+
exclude: list of str
106+
Exclude a manipulations from refinement by name
107+
(e.g. exclude=["scale", "stretch"] excludes the scale and stretch morphs).
107108
scale: float
108109
Apply scale factor.
109110

tests/test_morphpy.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,48 @@ class Chain:
148148
morphapp_params[key], abs=1e-08
149149
)
150150

151+
def test_exclude(self, setup_morph):
152+
morph_file = self.testfiles[0]
153+
target_file = self.testfiles[-1]
154+
morph_info, _ = morph(
155+
morph_file,
156+
target_file,
157+
scale=1,
158+
stretch=0,
159+
exclude=["scale", "stretch"],
160+
sort_by="temperature",
161+
)
162+
163+
# Nothing should be refined
164+
assert pytest.approx(morph_info["scale"]) == 1
165+
assert pytest.approx(morph_info["stretch"]) == 0
166+
167+
morph_info, _ = morph(
168+
morph_file,
169+
target_file,
170+
scale=1,
171+
stretch=0,
172+
exclude=["scale"],
173+
sort_by="temperature",
174+
)
175+
176+
# Stretch only should be refined
177+
assert pytest.approx(morph_info["scale"]) == 1
178+
assert pytest.approx(morph_info["stretch"]) != 0
179+
180+
morph_info, _ = morph(
181+
morph_file,
182+
target_file,
183+
scale=1,
184+
stretch=0,
185+
exclude=["stretch"],
186+
sort_by="temperature",
187+
)
188+
189+
# Scale only should be refined
190+
assert pytest.approx(morph_info["scale"]) != 1
191+
assert pytest.approx(morph_info["stretch"]) == 0
192+
151193
def test_morphpy(self, setup_morph):
152194
morph_results = {}
153195
morph_file = self.testfiles[0]

0 commit comments

Comments
 (0)