@@ -37,18 +37,22 @@ def morph(self, x_morph, y_morph, x_target, y_target):
37
37
-------
38
38
Import the funcy morph function:
39
39
>>> from diffpy.morph.morphs.morphfuncy import MorphFuncy
40
+
40
41
Define or import the user-supplied transformation function:
41
42
>>> def sine_function(x, y, amplitude, frequency):
42
43
>>> return amplitude * np.sin(frequency * x) * y
44
+
43
45
Provide initial guess for parameters:
44
46
>>> parameters = {'amplitude': 2, 'frequency': 2}
47
+
45
48
Run the funcy morph given input morph array (x_morph, y_morph)
46
49
and target array (x_target, y_target):
47
50
>>> morph = MorphFuncy()
48
51
>>> morph.function = sine_function
49
52
>>> morph.parameters = parameters
50
- >>> x_morph_out, y_morph_out, x_target_out, y_target_out = morph(
53
+ >>> x_morph_out, y_morph_out, x_target_out, y_target_out = morph.morph (
51
54
... x_morph, y_morph, x_target, y_target)
55
+
52
56
To access parameters from the morph instance:
53
57
>>> x_morph_in = morph.x_morph_in
54
58
>>> y_morph_in = morph.y_morph_in
@@ -61,5 +65,4 @@ def morph(self, x_morph, y_morph, x_target, y_target):
61
65
self .y_morph_out = self .function (
62
66
self .x_morph_in , self .y_morph_in , ** self .parameters
63
67
)
64
-
65
68
return self .xyallout
0 commit comments