|
21 | 21 |
|
22 | 22 | To define a ProfileGenerator, one must implement the required Parameters and |
23 | 23 | ParameterSets as well as overload the __call__ method with the calculation. A |
24 | | -very simple example is > class Gaussian(ProfileGenerator): > > def |
25 | | -__init__(self): > # Initialize and give this a name > |
26 | | -ProfileGenerator.__init__(self, "g") > # Add amplitude, center and width |
27 | | -parameters > self.newParameter("amp", 0) > |
28 | | -self.newParameter("center", 0) > self.newParameter("width", 0) > > |
29 | | -def __call__(self, x): > a = self.amp.getValue() > x0 = |
30 | | -self.center.getValue() > w = self.width.getValue() > return a * |
31 | | -exp(-0.5*((x-x0)/w)**2) |
| 24 | +very simple example is |
| 25 | +> class Gaussian(ProfileGenerator): |
| 26 | +> |
| 27 | +> def __init__(self): |
| 28 | +> # Initialize and give this a name |
| 29 | +> ProfileGenerator.__init__(self, "g") |
| 30 | +> # Add amplitude, center and width parameters |
| 31 | +> self.newParameter("amp", 0) |
| 32 | +> self.newParameter("center", 0) |
| 33 | +> self.newParameter("width", 0) |
| 34 | +> |
| 35 | +> def __call__(self, x): |
| 36 | +> a = self.amp.getValue() |
| 37 | +> x0 = self.center.getValue() |
| 38 | +> w = self.width.getValue() |
| 39 | +> return a * exp(-0.5*((x-x0)/w)**2) |
32 | 40 |
|
33 | 41 | More examples can be found in the example directory of the documentation. |
34 | 42 | """ |
|
0 commit comments