@@ -240,10 +240,10 @@ cdef class Riemann_Map:
240
240
if self .exterior and (self .B > 1 ):
241
241
raise ValueError (
242
242
" 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)
247
247
# Find the points on the boundaries and their derivatives.
248
248
if self .exterior:
249
249
for k in range (self .B):
@@ -324,11 +324,11 @@ cdef class Riemann_Map:
324
324
C = I / N * sadp # equivalent to -TWOPI / N * 1 / (TWOPI * I) * sadp
325
325
errinvalid = np.geterr()[' invalid' ] # checks the current error handling for invalid
326
326
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' )
328
328
K = np.array([C * sadp[t] * (normalized_dp/ (cp- cp[t]) -
329
329
(normalized_dp[t]/ (cp- cp[t])).conjugate())
330
330
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
332
332
for i in range (NB):
333
333
K[i, i] = 1
334
334
# Nystrom Method for solving 2nd kind integrals
@@ -562,7 +562,7 @@ cdef class Riemann_Map:
562
562
p_vector[k, N] = (I / (3 * N) * dps[k, 0 ] *
563
563
exp(I * theta_array[k, 0 ]))
564
564
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()
566
566
self .pre_q_vector = pq
567
567
568
568
cpdef riemann_map(self , COMPLEX_T pt):
@@ -819,12 +819,12 @@ cdef class Riemann_Map:
819
819
for i in range (x_points):
820
820
for j in range (y_points):
821
821
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)))
823
823
else :
824
824
for i in range (x_points):
825
825
for j in range (y_points):
826
826
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))
828
828
return z_values, xmin, xmax, ymin, ymax
829
829
830
830
@ options (interpolation = ' catrom' )
@@ -1014,7 +1014,7 @@ cdef class Riemann_Map:
1014
1014
thickness,
1015
1015
withcolor,
1016
1016
min_mag),
1017
- (xmin, xmax), (ymin, ymax),options))
1017
+ (xmin, xmax), (ymin, ymax), options))
1018
1018
return g + self .plot_boundaries(thickness = thickness)
1019
1019
1020
1020
@ options (interpolation = ' catrom' )
@@ -1153,12 +1153,12 @@ cpdef get_derivatives(np.ndarray[COMPLEX_T, ndim=2] z_values,
1153
1153
cdef np.ndarray[COMPLEX_T, ndim= 2 ] xderiv
1154
1154
cdef np.ndarray[FLOAT_T, ndim = 2 ] dr, dtheta, zabs
1155
1155
# (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)
1157
1157
# b/c the function is analytic, we know the magnitude of its
1158
1158
# derivative is equal in all directions
1159
1159
dr = np.abs(xderiv)
1160
1160
# 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 ])
1162
1162
dtheta = np.divide(dr, zabs)
1163
1163
return dr, dtheta
1164
1164
@@ -1259,26 +1259,26 @@ cpdef complex_to_spiderweb(np.ndarray[COMPLEX_T, ndim = 2] z_values,
1259
1259
circ_radii = []
1260
1260
if spokes != 0 :
1261
1261
# 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)
1263
1263
else :
1264
1264
spoke_angles = []
1265
1265
for i in range (imax- 2 ): # the d arrays are 1 smaller on each side
1266
1266
for j in range (jmax- 2 ):
1267
- z = z_values[i+ 1 ,j+ 1 ]
1267
+ z = z_values[i+ 1 , j+ 1 ]
1268
1268
mag = abs (z)
1269
1269
arg = phase(z)
1270
- dmag = dr[i,j]
1271
- darg = dtheta[i,j]
1270
+ dmag = dr[i, j]
1271
+ darg = dtheta[i, j]
1272
1272
# points that change too rapidly are presumed to be borders
1273
1273
# points that are too small are presumed to be outside
1274
1274
if darg < DMAX and mag > min_mag:
1275
1275
for target in circ_radii:
1276
1276
if abs (mag - target)/ dmag < precision:
1277
- rgb[i+ 1 ,j+ 1 ] = rgbcolor
1277
+ rgb[i+ 1 , j+ 1 ] = rgbcolor
1278
1278
break
1279
1279
for target in spoke_angles:
1280
1280
if abs (arg - target)/ darg < precision:
1281
- rgb[i+ 1 ,j+ 1 ] = rgbcolor
1281
+ rgb[i+ 1 , j+ 1 ] = rgbcolor
1282
1282
break
1283
1283
return rgb
1284
1284
@@ -1472,7 +1472,7 @@ cpdef cauchy_kernel(t, args):
1472
1472
cdef COMPLEX_T z = args[1 ]
1473
1473
cdef int n = args[2 ]
1474
1474
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) * \
1476
1476
(I* exp(I* t)- I* epsilon* exp(- I* t))
1477
1477
if part == ' c' :
1478
1478
return result
@@ -1486,9 +1486,11 @@ cpdef cauchy_kernel(t, args):
1486
1486
1487
1487
cpdef analytic_interior(COMPLEX_T z, int n, FLOAT_T epsilon):
1488
1488
"""
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.
1492
1494
1493
1495
INPUT:
1494
1496
@@ -1511,10 +1513,10 @@ cpdef analytic_interior(COMPLEX_T z, int n, FLOAT_T epsilon):
1511
1513
sage: abs(m.riemann_map(.5)-analytic_interior(.5, 20, .3)) < 10^-6
1512
1514
True
1513
1515
"""
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 ]
1520
1522
return rp + ip
0 commit comments