Skip to content

Commit 3473c89

Browse files
author
Release Manager
committed
gh-40329: cylint cleanup in calculus just adding spaces after commas ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. URL: #40329 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents d86a6e6 + 731ab58 commit 3473c89

File tree

3 files changed

+43
-38
lines changed

3 files changed

+43
-38
lines changed

src/sage/calculus/integration.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ def numerical_integral(func, a, b=None,
394394
_b = b
395395
W = <gsl_integration_workspace*> gsl_integration_workspace_alloc(n)
396396
sig_on()
397-
gsl_integration_qag(&F,_a,_b,eps_abs,eps_rel,n,rule,W,&result,&abs_err)
397+
gsl_integration_qag(&F, _a, _b, eps_abs, eps_rel,
398+
n, rule, W, &result, &abs_err)
398399
sig_off()
399400

400401
elif algorithm == "qags":

src/sage/calculus/riemann.pyx

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,10 @@ cdef class Riemann_Map:
240240
if self.exterior and (self.B > 1):
241241
raise ValueError(
242242
"The exterior map is undefined for multiply connected domains")
243-
cdef np.ndarray[COMPLEX_T,ndim=2] cps = np.zeros([self.B, N],
244-
dtype=COMPLEX)
245-
cdef np.ndarray[COMPLEX_T,ndim=2] dps = np.zeros([self.B, N],
246-
dtype=COMPLEX)
243+
cdef np.ndarray[COMPLEX_T, ndim=2] cps = np.zeros([self.B, N],
244+
dtype=COMPLEX)
245+
cdef np.ndarray[COMPLEX_T, ndim=2] dps = np.zeros([self.B, N],
246+
dtype=COMPLEX)
247247
# Find the points on the boundaries and their derivatives.
248248
if self.exterior:
249249
for k in range(self.B):
@@ -324,11 +324,11 @@ cdef class Riemann_Map:
324324
C = I / N * sadp # equivalent to -TWOPI / N * 1 / (TWOPI * I) * sadp
325325
errinvalid = np.geterr()['invalid'] # checks the current error handling for invalid
326326
errdivide = np.geterr()['divide'] # checks the current error handling for divide
327-
np.seterr(divide='ignore',invalid='ignore')
327+
np.seterr(divide='ignore', invalid='ignore')
328328
K = np.array([C * sadp[t] * (normalized_dp/(cp-cp[t]) -
329329
(normalized_dp[t]/(cp-cp[t])).conjugate())
330330
for t in np.arange(NB)], dtype=np.complex128)
331-
np.seterr(divide=errdivide,invalid=errinvalid) # resets the error handling
331+
np.seterr(divide=errdivide, invalid=errinvalid) # resets the error handling
332332
for i in range(NB):
333333
K[i, i] = 1
334334
# Nystrom Method for solving 2nd kind integrals
@@ -562,7 +562,7 @@ cdef class Riemann_Map:
562562
p_vector[k, N] = (I / (3*N) * dps[k, 0] *
563563
exp(I * theta_array[k, 0]))
564564
self.p_vector = p_vector.flatten()
565-
cdef np.ndarray[double complex, ndim=1] pq = self.cps[:,list(range(N))+[0]].flatten()
565+
cdef np.ndarray[double complex, ndim=1] pq = self.cps[:, list(range(N))+[0]].flatten()
566566
self.pre_q_vector = pq
567567

568568
cpdef riemann_map(self, COMPLEX_T pt):
@@ -819,12 +819,12 @@ cdef class Riemann_Map:
819819
for i in range(x_points):
820820
for j in range(y_points):
821821
pt = 1/(xmin + 0.5*xstep + i*xstep + I*(ymin + 0.5*ystep + j*ystep))
822-
z_values[j, i] = 1/(-np.dot(p_vector,1/(pre_q_vector - pt)))
822+
z_values[j, i] = 1/(-np.dot(p_vector, 1/(pre_q_vector - pt)))
823823
else:
824824
for i in range(x_points):
825825
for j in range(y_points):
826826
pt = xmin + 0.5*xstep + i*xstep + I*(ymin + 0.5*ystep + j*ystep)
827-
z_values[j, i] = -np.dot(p_vector,1/(pre_q_vector - pt))
827+
z_values[j, i] = -np.dot(p_vector, 1/(pre_q_vector - pt))
828828
return z_values, xmin, xmax, ymin, ymax
829829

830830
@options(interpolation='catrom')
@@ -1014,7 +1014,7 @@ cdef class Riemann_Map:
10141014
thickness,
10151015
withcolor,
10161016
min_mag),
1017-
(xmin, xmax), (ymin, ymax),options))
1017+
(xmin, xmax), (ymin, ymax), options))
10181018
return g + self.plot_boundaries(thickness = thickness)
10191019

10201020
@options(interpolation='catrom')
@@ -1153,12 +1153,12 @@ cpdef get_derivatives(np.ndarray[COMPLEX_T, ndim=2] z_values,
11531153
cdef np.ndarray[COMPLEX_T, ndim=2] xderiv
11541154
cdef np.ndarray[FLOAT_T, ndim = 2] dr, dtheta, zabs
11551155
# (f(x+delta)-f(x-delta))/2delta
1156-
xderiv = (z_values[1:-1,2:]-z_values[1:-1,:-2])/(2*xstep)
1156+
xderiv = (z_values[1:-1, 2:]-z_values[1:-1, :-2]) / (2 * xstep)
11571157
# b/c the function is analytic, we know the magnitude of its
11581158
# derivative is equal in all directions
11591159
dr = np.abs(xderiv)
11601160
# the abs(derivative) scaled by distance from origin
1161-
zabs = np.abs(z_values[1:-1,1:-1])
1161+
zabs = np.abs(z_values[1:-1, 1:-1])
11621162
dtheta = np.divide(dr, zabs)
11631163
return dr, dtheta
11641164

@@ -1259,26 +1259,26 @@ cpdef complex_to_spiderweb(np.ndarray[COMPLEX_T, ndim = 2] z_values,
12591259
circ_radii = []
12601260
if spokes != 0:
12611261
# both -pi and pi are included
1262-
spoke_angles = srange(-PI,PI+TWOPI/spokes,TWOPI/spokes)
1262+
spoke_angles = srange(-PI, PI+TWOPI/spokes, TWOPI/spokes)
12631263
else:
12641264
spoke_angles = []
12651265
for i in range(imax-2): # the d arrays are 1 smaller on each side
12661266
for j in range(jmax-2):
1267-
z = z_values[i+1,j+1]
1267+
z = z_values[i+1, j+1]
12681268
mag = abs(z)
12691269
arg = phase(z)
1270-
dmag = dr[i,j]
1271-
darg = dtheta[i,j]
1270+
dmag = dr[i, j]
1271+
darg = dtheta[i, j]
12721272
# points that change too rapidly are presumed to be borders
12731273
# points that are too small are presumed to be outside
12741274
if darg < DMAX and mag > min_mag:
12751275
for target in circ_radii:
12761276
if abs(mag - target)/dmag < precision:
1277-
rgb[i+1,j+1] = rgbcolor
1277+
rgb[i+1, j+1] = rgbcolor
12781278
break
12791279
for target in spoke_angles:
12801280
if abs(arg - target)/darg < precision:
1281-
rgb[i+1,j+1] = rgbcolor
1281+
rgb[i+1, j+1] = rgbcolor
12821282
break
12831283
return rgb
12841284

@@ -1472,7 +1472,7 @@ cpdef cauchy_kernel(t, args):
14721472
cdef COMPLEX_T z = args[1]
14731473
cdef int n = args[2]
14741474
part = args[3]
1475-
result = exp(I*analytic_boundary(t,n, epsilon))/(exp(I*t)+epsilon*exp(-I*t)-z) * \
1475+
result = exp(I*analytic_boundary(t, n, epsilon))/(exp(I*t)+epsilon*exp(-I*t)-z) * \
14761476
(I*exp(I*t)-I*epsilon*exp(-I*t))
14771477
if part == 'c':
14781478
return result
@@ -1486,9 +1486,11 @@ cpdef cauchy_kernel(t, args):
14861486

14871487
cpdef analytic_interior(COMPLEX_T z, int n, FLOAT_T epsilon):
14881488
"""
1489-
Provides a nearly exact computation of the Riemann Map of an interior
1490-
point of the ellipse with axes 1 + epsilon and 1 - epsilon. It is
1491-
primarily useful for testing the accuracy of the numerical Riemann Map.
1489+
Provide a nearly exact computation of the Riemann Map of an interior
1490+
point of the ellipse with axes 1 + epsilon and 1 - epsilon.
1491+
1492+
It is primarily useful for testing the accuracy of the numerical
1493+
Riemann Map.
14921494
14931495
INPUT:
14941496
@@ -1511,10 +1513,10 @@ cpdef analytic_interior(COMPLEX_T z, int n, FLOAT_T epsilon):
15111513
sage: abs(m.riemann_map(.5)-analytic_interior(.5, 20, .3)) < 10^-6
15121514
True
15131515
"""
1514-
# evaluates the Cauchy integral of the boundary, split into the real
1515-
# and imaginary results because numerical_integral can't handle complex data.
1516-
rp = 1/(TWOPI)*numerical_integral(cauchy_kernel,0,2*pi,
1517-
params = [epsilon,z,n,'i'])[0]
1518-
ip = 1/(TWOPI*I)*numerical_integral(cauchy_kernel,0,2*pi,
1519-
params = [epsilon,z,n,'r'])[0]
1516+
# evaluates the Cauchy integral of the boundary, split into the real and
1517+
# imaginary results because numerical_integral cannot handle complex data.
1518+
rp = 1 / (TWOPI) * numerical_integral(cauchy_kernel, 0, 2 * pi,
1519+
params=[epsilon, z, n, 'i'])[0]
1520+
ip = 1 / (TWOPI*I) * numerical_integral(cauchy_kernel, 0, 2 * pi,
1521+
params=[epsilon, z, n, 'r'])[0]
15201522
return rp + ip

src/sage/calculus/transforms/dwt.pyx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def WaveletTransform(n, wavelet_type, wavelet_k):
9393
_k = int(wavelet_k)
9494
if not is2pow(_n):
9595
raise NotImplementedError("discrete wavelet transform only implemented when n is a 2-power")
96-
return DiscreteWaveletTransform(_n,1,wavelet_type,_k)
96+
return DiscreteWaveletTransform(_n, 1, wavelet_type, _k)
9797

9898

9999
DWT = WaveletTransform
@@ -110,19 +110,19 @@ cdef class DiscreteWaveletTransform(GSLDoubleArray):
110110
def __init__(self, size_t n, size_t stride, wavelet_type, size_t wavelet_k):
111111
if not is2pow(n):
112112
raise NotImplementedError("discrete wavelet transform only implemented when n is a 2-power")
113-
GSLDoubleArray.__init__(self,n,stride)
113+
GSLDoubleArray.__init__(self, n, stride)
114114
if wavelet_type=="daubechies":
115115
self.wavelet = <gsl_wavelet*> gsl_wavelet_alloc(gsl_wavelet_daubechies, wavelet_k)
116116
elif wavelet_type == "daubechies_centered":
117-
self.wavelet = <gsl_wavelet*> gsl_wavelet_alloc(gsl_wavelet_daubechies_centered,wavelet_k)
117+
self.wavelet = <gsl_wavelet*> gsl_wavelet_alloc(gsl_wavelet_daubechies_centered, wavelet_k)
118118
elif wavelet_type == "haar":
119-
self.wavelet = <gsl_wavelet *> gsl_wavelet_alloc(gsl_wavelet_haar,wavelet_k)
119+
self.wavelet = <gsl_wavelet *> gsl_wavelet_alloc(gsl_wavelet_haar, wavelet_k)
120120
elif wavelet_type == "haar_centered":
121-
self.wavelet = <gsl_wavelet*> gsl_wavelet_alloc(gsl_wavelet_haar_centered,wavelet_k)
121+
self.wavelet = <gsl_wavelet*> gsl_wavelet_alloc(gsl_wavelet_haar_centered, wavelet_k)
122122
elif wavelet_type == "bspline":
123-
self.wavelet = <gsl_wavelet*> gsl_wavelet_alloc(gsl_wavelet_bspline,wavelet_k)
123+
self.wavelet = <gsl_wavelet*> gsl_wavelet_alloc(gsl_wavelet_bspline, wavelet_k)
124124
elif wavelet_type == "bspline_centered":
125-
self.wavelet = <gsl_wavelet*> gsl_wavelet_alloc(gsl_wavelet_bspline_centered,wavelet_k)
125+
self.wavelet = <gsl_wavelet*> gsl_wavelet_alloc(gsl_wavelet_bspline_centered, wavelet_k)
126126
self.workspace = <gsl_wavelet_workspace*> gsl_wavelet_workspace_alloc(n)
127127

128128
def __dealloc__(self):
@@ -131,10 +131,12 @@ cdef class DiscreteWaveletTransform(GSLDoubleArray):
131131
gsl_wavelet_workspace_free(self.workspace)
132132

133133
def forward_transform(self):
134-
gsl_wavelet_transform_forward(self.wavelet,self.data,self.stride,self.n,self.workspace)
134+
gsl_wavelet_transform_forward(self.wavelet, self.data,
135+
self.stride, self.n, self.workspace)
135136

136137
def backward_transform(self):
137-
gsl_wavelet_transform_inverse(self.wavelet,self.data,self.stride,self.n,self.workspace)
138+
gsl_wavelet_transform_inverse(self.wavelet, self.data,
139+
self.stride, self.n, self.workspace)
138140

139141
def plot(self, xmin=None, xmax=None, **args):
140142
from sage.plot.point import point

0 commit comments

Comments
 (0)