@@ -11,16 +11,13 @@ class MorphFuncx(Morph):
11
11
General morph function that applies a user-supplied function to the
12
12
x-coordinates of morph data to make it align with a target.
13
13
14
- Notice: the function provided must preserve the monotonic
15
- increase of the grid.
16
- I.e. the function f applied on the grid x must ensure for all
17
- indices i<j, f(x[i]) < f(x[j]).
14
+ Notice: the morph should maintain the monotonicity of the grid.
18
15
19
16
Configuration Variables
20
17
-----------------------
21
18
function: callable
22
19
The user-supplied function that applies a transformation to the
23
- x -coordinates of the data.
20
+ y -coordinates of the data.
24
21
25
22
parameters: dict
26
23
A dictionary of parameters to pass to the function.
@@ -32,31 +29,27 @@ class MorphFuncx(Morph):
32
29
transformed according to the user-specified function and parameters
33
30
The morphed data is returned on the same grid as the unmorphed data
34
31
35
- Example
36
- -------
37
- Import the funcx morph function:
32
+ Example (FIX)
33
+ -------------
34
+ Import the funcy morph function:
38
35
39
- >>> from diffpy.morph.morphs.morphfuncx import MorphFuncx
36
+ >>> from diffpy.morph.morphs.morphfuncy import MorphFuncy
40
37
41
38
Define or import the user-supplied transformation function:
42
39
43
- >>> import numpy as np
44
- >>> def exp_function(x, y, scale, rate):
45
- >>> return abs(scale) * np.exp(rate * x)
46
-
47
- Note that this transformation is monotonic increasing, so will preserve
48
- the monotonic increasing nature of the provided grid.
40
+ >>> def sine_function(x, y, amplitude, frequency):
41
+ >>> return amplitude * np.sin(frequency * x) * y
49
42
50
43
Provide initial guess for parameters:
51
44
52
- >>> parameters = {'scale ': 1 , 'rate ': 1 }
45
+ >>> parameters = {'amplitude ': 2 , 'frequency ': 2 }
53
46
54
47
Run the funcy morph given input morph array (x_morph, y_morph)and target
55
48
array (x_target, y_target):
56
49
57
- >>> morph = MorphFuncx ()
58
- >>> morph.funcx_function = exp_function
59
- >>> morph.funcx = parameters
50
+ >>> morph = MorphFuncy ()
51
+ >>> morph.function = sine_function
52
+ >>> morph.funcy = parameters
60
53
>>> x_morph_out, y_morph_out, x_target_out, y_target_out =
61
54
... morph.morph(x_morph, y_morph, x_target, y_target)
62
55
@@ -70,7 +63,7 @@ class MorphFuncx(Morph):
70
63
"""
71
64
72
65
# Define input output types
73
- summary = "Apply a Python function to the x -axis data"
66
+ summary = "Apply a Python function to the y -axis data"
74
67
xinlabel = LABEL_RA
75
68
yinlabel = LABEL_GR
76
69
xoutlabel = LABEL_RA
0 commit comments