Skip to content

Commit 0502b6a

Browse files
committed
Changing np.int and np.float to int and float respectively
1 parent 349df86 commit 0502b6a

File tree

3 files changed

+40
-40
lines changed

3 files changed

+40
-40
lines changed

powerspectrum/modemixing_matrices.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def _get_wEBlm(window_scal, lmax=None, maps=False):
248248
wlm = H.map2alm(window_scal, lmax=lmax)
249249

250250
n = len(wlm)
251-
wEBlm = np.empty([5, n], dtype=np.complex)
251+
wEBlm = np.empty([5, n], dtype=complex)
252252
wEBlm[0, :] = -wlm
253253

254254
wlm_tmp = H.map2alm_spin(window_vect, 1, lmax=lmax)
@@ -439,9 +439,9 @@ def _calc_Mpol(comm, wEBlm, lmax=None, cl_type='pseudo', verbose=True):
439439
wEBlm_tmp = wEBlm[:, idx]
440440

441441
# Calculate the correct index in the Jp and Jm terms
442-
idx_l3_0 = np.array(l_tmp - l3min, dtype=np.int) # Jp0, Jm0
443-
idx_l3_1 = np.array(l_tmp - l3min1, dtype=np.int) # Jp1, Jm1
444-
idx_l3_2 = np.array(l_tmp - l3min2, dtype=np.int) # Jp2, Jm2
442+
idx_l3_0 = np.array(l_tmp - l3min, dtype=int) # Jp0, Jm0
443+
idx_l3_1 = np.array(l_tmp - l3min1, dtype=int) # Jp1, Jm1
444+
idx_l3_2 = np.array(l_tmp - l3min2, dtype=int) # Jp2, Jm2
445445

446446
# When l3min is 0 or 1 and take the whole range, Jp1(Jm1) and/or
447447
# Jp2(Jm2) get non-zero values when they should be zero (when l3 =
@@ -627,9 +627,9 @@ def _calc_Mcross(comm, wEBlm, lmax=None, cl_type='pseudo', verbose=True):
627627
# sub array of wEBlm that have valid l (for l = l3)
628628
wEBlm_tmp = wEBlm[:, idx]
629629

630-
idx_l3_0 = np.array(l_tmp - l3min, dtype=np.int) # Jp0,Jm0
631-
idx_l3_1 = np.array(l_tmp - l3min1, dtype=np.int) # Jp1,Jm1
632-
idx_l3_2 = np.array(l_tmp - l3min2, dtype=np.int) # Jp2,Jm2
630+
idx_l3_0 = np.array(l_tmp - l3min, dtype=int) # Jp0,Jm0
631+
idx_l3_1 = np.array(l_tmp - l3min1, dtype=int) # Jp1,Jm1
632+
idx_l3_2 = np.array(l_tmp - l3min2, dtype=int) # Jp2,Jm2
633633

634634
# Subsets of the subset. When l3min is 0 or 1 and take the whole
635635
# range, Jp1(Jm1) and/or Jp2(Jm2) get non-zero values when

powerspectrum/pyspice.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ def _correct_xi_from_mask(xi, xi_mask):
246246
ncor = len(xi)
247247

248248
if ncmask == 3:
249-
kindex = np.array([0, 1, 1, 2, 2, 1, 2, 2, 1], dtype=np.int)
249+
kindex = np.array([0, 1, 1, 2, 2, 1, 2, 2, 1], dtype=int)
250250
elif ncmask == 4:
251-
kindex = np.array([0, 1, 1, 2, 2, 1, 3, 3, 1], dtype=np.int)
251+
kindex = np.array([0, 1, 1, 2, 2, 1, 3, 3, 1], dtype=int)
252252
else:
253-
kindex = np.zeros(9, dtype=np.int)
253+
kindex = np.zeros(9, dtype=int)
254254

255255
ncountbinrm = np.zeros(9)
256256
xi_final = np.empty_like(xi)
@@ -756,7 +756,7 @@ def _cumul_simpson(theta, cl, nmax, thetamax, cl_mask=None):
756756

757757
sum1 = np.zeros(nell)
758758
sum2 = np.zeros(nell)
759-
lastn = 2*np.array(np.round(theta/(2.0*step)), dtype=np.int)
759+
lastn = 2*np.array(np.round(theta/(2.0*step)), dtype=int)
760760

761761
for j in range(nell):
762762
if lastn[j] != 0:

util/pixfunc.py

+29-29
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ def _uv2pix(c, res=6):
105105

106106
i = x * num_pix_side
107107
i[i > 2**res1-1] = 2**res1 - 1
108-
i = np.array(i, dtype=np.int)
108+
i = np.array(i, dtype=int)
109109

110110
j = y * num_pix_side
111111
j[j > 2**res1-1] = 2**res1 - 1
112-
j = np.array(j, dtype=np.int)
112+
j = np.array(j, dtype=int)
113113

114114
fij = np.empty([npts, 3])
115115
fij[:, 0] = face
@@ -151,9 +151,9 @@ def _axisxy(c):
151151
c1 = np.array([c.y.value])
152152
c2 = np.array([c.z.value])
153153

154-
abs_yx = np.ones_like(c0, dtype=np.float)*np.inf
155-
abs_zx = np.ones_like(c0, dtype=np.float)*np.inf
156-
abs_zy = np.ones_like(c0, dtype=np.float)*np.inf
154+
abs_yx = np.ones_like(c0, dtype=float)*np.inf
155+
abs_zx = np.ones_like(c0, dtype=float)*np.inf
156+
abs_zy = np.ones_like(c0, dtype=float)*np.inf
157157

158158
g = c0 != 0
159159
abs_yx[g] = np.abs(c1[g]/c0[g])
@@ -248,10 +248,10 @@ def _fij2pix(fij, res):
248248

249249
n = len(fij)
250250

251-
pixel_1 = np.zeros(n, dtype=np.int)
251+
pixel_1 = np.zeros(n, dtype=int)
252252

253-
i = np.array(fij[:, 1], dtype=np.int)
254-
j = np.array(fij[:, 2], dtype=np.int)
253+
i = np.array(fij[:, 1], dtype=int)
254+
j = np.array(fij[:, 2], dtype=int)
255255

256256
num_pix_face = 4**(res-1)
257257

@@ -263,7 +263,7 @@ def _fij2pix(fij, res):
263263

264264
pixel = fij[:, 0]*num_pix_face + pixel_1
265265

266-
return np.array(pixel, dtype=np.int)
266+
return np.array(pixel, dtype=int)
267267

268268
def _incube(alpha, beta):
269269

@@ -393,8 +393,8 @@ def _pix2fij(pixel, res=6):
393393

394394
pow_2 = 2**np.arange(16)
395395

396-
i = np.zeros(n, dtype=np.int)
397-
j = np.zeros(n, dtype=np.int)
396+
i = np.zeros(n, dtype=int)
397+
j = np.zeros(n, dtype=int)
398398

399399
for bit in range(res):
400400
i = i | (pow_2[bit] * (1 & fpix))
@@ -500,12 +500,12 @@ def _xyaxis(nface, xi, eta):
500500

501501
n = np.size(nface)
502502

503-
nface_0 = np.array(nface == 0, dtype=np.int)
504-
nface_1 = np.array(nface == 1, dtype=np.int)
505-
nface_2 = np.array(nface == 2, dtype=np.int)
506-
nface_3 = np.array(nface == 3, dtype=np.int)
507-
nface_4 = np.array(nface == 4, dtype=np.int)
508-
nface_5 = np.array(nface == 5, dtype=np.int)
503+
nface_0 = np.array(nface == 0, dtype=int)
504+
nface_1 = np.array(nface == 1, dtype=int)
505+
nface_2 = np.array(nface == 2, dtype=int)
506+
nface_3 = np.array(nface == 3, dtype=int)
507+
nface_4 = np.array(nface == 4, dtype=int)
508+
nface_5 = np.array(nface == 5, dtype=int)
509509

510510
row0 = eta * (nface_5 - nface_0) + xi * (nface_4 - nface_2) + \
511511
(nface_1 - nface_3)
@@ -781,8 +781,8 @@ def get_8_neighbors(pixel, res, four_neighbors=False):
781781
two14 = 2**14
782782
two28 = 2**28
783783

784-
ixtab = np.zeros(128, dtype=np.int)
785-
iytab = np.zeros(128, dtype=np.int)
784+
ixtab = np.zeros(128, dtype=int)
785+
iytab = np.zeros(128, dtype=int)
786786

787787
bit_table_set(ixtab, iytab)
788788
pixels_per_face = (2**(res-1)) ** 2
@@ -812,7 +812,7 @@ def get_8_neighbors(pixel, res, four_neighbors=False):
812812
ix *= distance
813813
iy *= distance
814814

815-
neighbors = np.zeros(4 + 4*eight_neighbors, dtype=np.int)
815+
neighbors = np.zeros(4 + 4*eight_neighbors, dtype=int)
816816

817817
#Calculate coordinates of each neighbor, check for edges, and return pixel number
818818
#in appropriate array element
@@ -1094,11 +1094,11 @@ def _rastr(pixel, res=6, face=False, sixpack=False, data=-1, bad_pixval=0.0):
10941094

10951095
len0 = i0 * cube_side
10961096

1097-
idx = fij[:, 0].astype(np.int)
1097+
idx = fij[:, 0].astype(int)
10981098

10991099
x_out = offx[idx] * cube_side + fij[:, 1]
1100-
x_out = (len0 - (x_out+1)).astype(np.int)
1101-
y_out = (offy[idx] * cube_side + fij[:, 2]).astype(np.int)
1100+
x_out = (len0 - (x_out+1)).astype(int)
1101+
y_out = (offy[idx] * cube_side + fij[:, 2]).astype(int)
11021102

11031103
if len(data) != 1:
11041104
thrd = ndata // npix
@@ -1198,20 +1198,20 @@ def _uv2proj(uvec, proj, sz_proj):
11981198
if proj.upper() == 'A':
11991199
den = np.sqrt(1.0 + np.cos(lat)*np.cos(lon / 2.0))
12001200

1201-
proj_x = half_l - np.fix(half_l * (np.cos(lat)*np.sin(lon/2) / den)).astype(np.int)
1202-
proj_y = half_h + np.fix(half_h * (np.sin(lat) / den)).astype(np.int)
1201+
proj_x = half_l - np.fix(half_l * (np.cos(lat)*np.sin(lon/2) / den)).astype(int)
1202+
proj_y = half_h + np.fix(half_h * (np.sin(lat) / den)).astype(int)
12031203
elif proj.upper() == 'S':
1204-
proj_x = half_l - np.fix(half_l * lon * np.cos(lat) / np.pi).astype(np.int)
1205-
proj_y = half_h + np.fix(half_h * lat / (np.pi/2)).astype(np.int)
1204+
proj_x = half_l - np.fix(half_l * lon * np.cos(lat) / np.pi).astype(int)
1205+
proj_y = half_h + np.fix(half_h * lat / (np.pi/2)).astype(int)
12061206
elif proj.upper() == 'M':
12071207
pass
12081208
elif proj.upper() == 'P':
12091209
fac1 = np.sqrt(1 - np.sin(np.abs(lat)))
12101210
sgn = np.sign(lat)
12111211
fac2 = 1 - (sgn / 2)
12121212

1213-
proj_x = fac2 * half_l - sgn * np.fix(0.5 * half_l * fac1 * np.sin(lon)).astype(np.int)
1214-
proj_y = half_h - np.fix(half_h * fac1 * np.cos(lon)).astype(np.int)
1213+
proj_x = fac2 * half_l - sgn * np.fix(0.5 * half_l * fac1 * np.sin(lon)).astype(int)
1214+
proj_y = half_h - np.fix(half_h * fac1 * np.cos(lon)).astype(int)
12151215
else:
12161216
raise ValueError("Invalid projection string entered")
12171217

0 commit comments

Comments
 (0)