Skip to content

Commit 655676e

Browse files
committed
test/func: replacing parameters name with funcy
1 parent ca832a6 commit 655676e

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/diffpy/morph/morph_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
],
4141
qdamp=morphs.MorphResolutionDamping,
4242
squeeze=morphs.MorphSqueeze,
43-
parameters=morphs.MorphFuncy,
43+
funcy=morphs.MorphFuncy,
4444
)
4545
_default_config = dict(
4646
scale=None,
@@ -49,7 +49,7 @@
4949
baselineslope=None,
5050
qdamp=None,
5151
squeeze=None,
52-
parameters=None,
52+
funcy=None,
5353
)
5454

5555

@@ -144,7 +144,7 @@ def morph(
144144
- 'baselineslope'
145145
- 'qdamp'
146146
- 'squeeze'
147-
- 'parameters'
147+
- 'funcy'
148148
149149
Returns
150150
-------
@@ -207,7 +207,7 @@ def morph(
207207
if k == "smear":
208208
[chain.append(el()) for el in morph_cls]
209209
refpars.append("baselineslope")
210-
elif k == "parameters":
210+
elif k == "funcy":
211211
morph_inst = morph_cls()
212212
morph_inst.function = rv_cfg.get("function", None)
213213
if morph_inst.function is None:

src/diffpy/morph/morphs/morphfuncy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class MorphFuncy(Morph):
1111
yinlabel = LABEL_GR
1212
xoutlabel = LABEL_RA
1313
youtlabel = LABEL_GR
14-
parnames = ["parameters"]
14+
parnames = ["funcy"]
1515

1616
def morph(self, x_morph, y_morph, x_target, y_target):
1717
"""General morph function that applies a user-supplied function to the
@@ -50,7 +50,7 @@ def morph(self, x_morph, y_morph, x_target, y_target):
5050
and target array (x_target, y_target):
5151
>>> morph = MorphFuncy()
5252
>>> morph.function = sine_function
53-
>>> morph.parameters = parameters
53+
>>> morph.funcy = parameters
5454
>>> x_morph_out, y_morph_out, x_target_out, y_target_out = morph.morph(
5555
... x_morph, y_morph, x_target, y_target)
5656
@@ -59,11 +59,11 @@ def morph(self, x_morph, y_morph, x_target, y_target):
5959
>>> y_morph_in = morph.y_morph_in
6060
>>> x_target_in = morph.x_target_in
6161
>>> y_target_in = morph.y_target_in
62-
>>> parameters_out = morph.parameters
62+
>>> parameters_out = morph.funcy
6363
"""
6464
Morph.morph(self, x_morph, y_morph, x_target, y_target)
6565

6666
self.y_morph_out = self.function(
67-
self.x_morph_in, self.y_morph_in, **self.parameters
67+
self.x_morph_in, self.y_morph_in, **self.funcy
6868
)
6969
return self.xyallout

tests/test_morph_func.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def linear_function(x, y, scale, offset):
133133
y_morph = np.sin(x_morph)
134134
x_target = x_morph.copy()
135135
y_target = np.sin(x_target) * 2 * x_target + 0.4
136-
cfg = morph_default_config(parameters={"scale": 1.2, "offset": 0.1})
136+
cfg = morph_default_config(funcy={"scale": 1.2, "offset": 0.1})
137137
cfg["function"] = linear_function
138138
morph_rv = morph(x_morph, y_morph, x_target, y_target, **cfg)
139139
morphed_cfg = morph_rv["morphed_config"]
@@ -142,6 +142,6 @@ def linear_function(x, y, scale, offset):
142142
].xyallout
143143
assert np.allclose(x_morph_out, x_target_out)
144144
assert np.allclose(y_morph_out, y_target_out, atol=1e-6)
145-
fitted_parameters = morphed_cfg["parameters"]
145+
fitted_parameters = morphed_cfg["funcy"]
146146
assert np.allclose(fitted_parameters["scale"], 2, atol=1e-6)
147147
assert np.allclose(fitted_parameters["offset"], 0.4, atol=1e-6)

tests/test_morphfuncy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_funcy(function, parameters, expected_function):
6363
y_morph_expected = expected_function(x_morph, y_morph)
6464
morph = MorphFuncy()
6565
morph.function = function
66-
morph.parameters = parameters
66+
morph.funcy = parameters
6767
x_morph_actual, y_morph_actual, x_target_actual, y_target_actual = (
6868
morph.morph(x_morph, y_morph, x_target, y_target)
6969
)

0 commit comments

Comments
 (0)