@@ -8,7 +8,7 @@ class ComponentSignal:
88 ----------
99 grid: 1d array of floats
1010 The vector containing the grid points of the component.
11-
11+ iq: 1d array of floats
1212 The intensity/g(r) values of the component.
1313 weights: 1d array of floats
1414 The vector containing the weight of the component signal for each signal.
@@ -36,22 +36,17 @@ def apply_stretch(self, m):
3636 Returns
3737 -------
3838 tuple of 1d arrays
39- The tuple of vectors where one vector is the stretched component, one vector is the 1st derivative
40- of the stretching operation, and one vector is the second derivative of the stretching operation.
39+ The tuple of vectors where one vector is the stretched component, one vector is the 1st derivative of the
40+ stretching operation, and one vector is the second derivative of the stretching operation.
4141 """
4242 normalized_grid = np .arange (len (self .grid ))
43- # func = lambda stretching_factor: np.interp(
44- # normalized_grid / stretching_factor, normalized_grid, self.iq, left=0, right=0
45- # )
46-
47- # E731 do not assign a lambda expression, use a def
48- def func (stretching_factor ):
49- return np .interp (normalized_grid / stretching_factor , normalized_grid , self .iq , left = 0 , right = 0 )
50-
51- derivative_func = numdifftools .Derivative (func )
43+ interpolate_intensity = lambda stretching_factor : np .interp ( # noqa: E731
44+ normalized_grid / stretching_factor , normalized_grid , self .iq , left = 0 , right = 0
45+ )
46+ derivative_func = numdifftools .Derivative (interpolate_intensity )
5247 second_derivative_func = numdifftools .Derivative (derivative_func )
5348
54- stretched_component = func (self .stretching_factors [m ])
49+ stretched_component = interpolate_intensity (self .stretching_factors [m ])
5550 stretched_component_gra = derivative_func (self .stretching_factors [m ])
5651 stretched_component_hess = second_derivative_func (self .stretching_factors [m ])
5752
0 commit comments