@@ -58,8 +58,7 @@ def ndim(self) -> int:
5858
5959 @property
6060 def shape (self ) -> Tuple [int , ...]:
61- """Returns the source data shape
62- """
61+ """Returns the source data shape"""
6362 shape : List [int ] = list (self .c .shape [2 :])
6463 shape .insert (self .axis , self .c .shape [1 ] + 1 )
6564
@@ -124,7 +123,6 @@ def __init__(
124123 axis : int = - 1 ,
125124 normalizedsmooth : bool = False ,
126125 ):
127-
128126 x , y , w , shape , axis = self ._prepare_data (xdata , ydata , weights , axis )
129127 coeffs , smooth = self ._make_spline (x , y , w , smooth , shape , normalizedsmooth )
130128 spline = SplinePPForm .construct_fast (coeffs , x , axis = axis )
@@ -236,7 +234,7 @@ def _compute_smooth(a, b):
236234 def trace (m : sp .dia_matrix ):
237235 return m .diagonal ().sum ()
238236
239- return 1. / (1. + trace (a ) / (6. * trace (b )))
237+ return 1.0 / (1.0 + trace (a ) / (6.0 * trace (b )))
240238
241239 @staticmethod
242240 def _normalize_smooth (x : np .ndarray , w : np .ndarray , smooth : Optional [float ]):
@@ -246,8 +244,8 @@ def _normalize_smooth(x: np.ndarray, w: np.ndarray, smooth: Optional[float]):
246244
247245 span = np .ptp (x )
248246
249- eff_x = 1 + (span ** 2 ) / np .sum (np .diff (x )** 2 )
250- eff_w = np .sum (w )** 2 / np .sum (w ** 2 )
247+ eff_x = 1 + (span ** 2 ) / np .sum (np .diff (x ) ** 2 )
248+ eff_w = np .sum (w ) ** 2 / np .sum (w ** 2 )
251249 k = 80 * (span ** 3 ) * (x .size ** - 2 ) * (eff_x ** - 0.5 ) * (eff_w ** - 0.5 )
252250
253251 s = 0.5 if smooth is None else smooth
@@ -281,11 +279,11 @@ def _make_spline(x, y, w, smooth, shape, normalizedsmooth):
281279 diags_r = np .vstack ((dx [1 :], 2 * (dx [1 :] + dx [:- 1 ]), dx [:- 1 ]))
282280 r = sp .spdiags (diags_r , [- 1 , 0 , 1 ], pcount - 2 , pcount - 2 )
283281
284- dx_recip = 1. / dx
282+ dx_recip = 1.0 / dx
285283 diags_qtw = np .vstack ((dx_recip [:- 1 ], - (dx_recip [1 :] + dx_recip [:- 1 ]), dx_recip [1 :]))
286- diags_sqrw_recip = 1. / np .sqrt (w )
284+ diags_sqrw_recip = 1.0 / np .sqrt (w )
287285
288- qtw = ( sp .diags (diags_qtw , [0 , 1 , 2 ], (pcount - 2 , pcount )) @ sp .diags (diags_sqrw_recip , 0 , (pcount , pcount ) ))
286+ qtw = sp .diags (diags_qtw , [0 , 1 , 2 ], (pcount - 2 , pcount )) @ sp .diags (diags_sqrw_recip , 0 , (pcount , pcount ))
289287 qtw = qtw @ qtw .T
290288
291289 p = smooth
@@ -295,7 +293,7 @@ def _make_spline(x, y, w, smooth, shape, normalizedsmooth):
295293 elif smooth is None :
296294 p = CubicSmoothingSpline ._compute_smooth (r , qtw )
297295
298- pp = ( 6. * (1. - p ) )
296+ pp = 6.0 * (1.0 - p )
299297
300298 # Solve linear system for the 2nd derivatives
301299 a = pp * qtw + p * r
@@ -314,15 +312,15 @@ def _make_spline(x, y, w, smooth, shape, normalizedsmooth):
314312 d1 = np .diff (vpad (u ), axis = 0 ) / dx
315313 d2 = np .diff (vpad (d1 ), axis = 0 )
316314
317- diags_w_recip = 1. / w
315+ diags_w_recip = 1.0 / w
318316 w = sp .diags (diags_w_recip , 0 , (pcount , pcount ))
319317
320318 yi = y .T - (pp * w ) @ d2
321319 pu = vpad (p * u )
322320
323321 c1 = np .diff (pu , axis = 0 ) / dx
324- c2 = 3. * pu [:- 1 , :]
325- c3 = np .diff (yi , axis = 0 ) / dx - dx * (2. * pu [:- 1 , :] + pu [1 :, :])
322+ c2 = 3.0 * pu [:- 1 , :]
323+ c3 = np .diff (yi , axis = 0 ) / dx - dx * (2.0 * pu [:- 1 , :] + pu [1 :, :])
326324 c4 = yi [:- 1 , :]
327325
328326 c_shape = (4 , pcount - 1 ) + shape [1 :]
0 commit comments