Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/aspire/basis/fb_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def _compute_indices(self):
# We'll also generate a mapping for complex construction
self.complex_count = sum(self.k_max)
# These map indices in complex array to pair of indices in real array
self._pos = np.zeros(self.complex_count, dtype=np.int)
self._neg = np.zeros(self.complex_count, dtype=np.int)
self._pos = np.zeros(self.complex_count, dtype=int)
self._neg = np.zeros(self.complex_count, dtype=int)

i = 0
ci = 0
Expand Down Expand Up @@ -217,7 +217,7 @@ def evaluate(self, v):
x = np.zeros(shape=tuple([np.prod(self.sz)] + list(v.shape[1:])), dtype=v.dtype)
for ell in range(0, self.ell_max + 1):
k_max = self.k_max[ell]
idx_radial = ind_radial + np.arange(0, k_max, dtype=np.int)
idx_radial = ind_radial + np.arange(0, k_max, dtype=int)

# include the normalization factor of angular part
ang_nrms = self.angular_norms[idx_radial]
Expand All @@ -228,7 +228,7 @@ def evaluate(self, v):
for _ in sgns:
ang = self._precomp["ang"][:, ind_ang]
ang_radial = np.expand_dims(ang[ang_idx], axis=1) * radial[r_idx]
idx = ind + np.arange(0, k_max, dtype=np.int)
idx = ind + np.arange(0, k_max, dtype=int)
x[mask] += ang_radial @ v[idx]
ind += len(idx)
ind_ang += 1
Expand Down
6 changes: 3 additions & 3 deletions src/aspire/basis/fb_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def indices(self):
"""
Create the indices for each basis function
"""
indices_ells = np.zeros(self.count, dtype=np.int)
indices_ms = np.zeros(self.count, dtype=np.int)
indices_ks = np.zeros(self.count, dtype=np.int)
indices_ells = np.zeros(self.count, dtype=int)
indices_ms = np.zeros(self.count, dtype=int)
indices_ks = np.zeros(self.count, dtype=int)

ind = 0
for ell in range(self.ell_max + 1):
Expand Down
6 changes: 3 additions & 3 deletions src/aspire/basis/ffb_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def evaluate(self, v):

ind = 0

idx = ind + np.arange(self.k_max[0], dtype=np.int)
idx = ind + np.arange(self.k_max[0], dtype=int)

# include the normalization factor of angular part into radial part
radial_norm = self._precomp["radial"] / np.expand_dims(self.angular_norms, 1)
Expand All @@ -145,8 +145,8 @@ def evaluate(self, v):
ind_pos = ind

for ell in range(1, self.ell_max + 1):
idx = ind + np.arange(self.k_max[ell], dtype=np.int)
idx_pos = ind_pos + np.arange(self.k_max[ell], dtype=np.int)
idx = ind + np.arange(self.k_max[ell], dtype=int)
idx_pos = ind_pos + np.arange(self.k_max[ell], dtype=int)
idx_neg = idx_pos + self.k_max[ell]

v_ell = (v[:, idx_pos] - 1j * v[:, idx_neg]) / 2.0
Expand Down
2 changes: 1 addition & 1 deletion src/aspire/classification/legacy_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def bispec_2drot_large(coeff, freqs, eigval, alpha, sample_n):
freqs_not_zero = freqs != 0

coeff_norm = np.log(np.power(np.absolute(coeff[freqs_not_zero]), alpha))
if np.any(coeff_norm == np.float("-inf")):
if np.any(coeff_norm == float("-inf")):
raise ValueError("coeff_norm should not be -inf")

phase = coeff[freqs_not_zero] / np.absolute(coeff[freqs_not_zero])
Expand Down
4 changes: 2 additions & 2 deletions src/aspire/ctf/ctf_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,8 @@ def gd(
rad_sq_min = N * pixel_size / g_min
rad_sq_max = N * pixel_size / g_max

max_val = r[center, np.int(center - 1 + np.floor(rad_sq_max))]
min_val = r[center, np.int(center - 1 + np.ceil(rad_sq_min))]
max_val = r[center, int(center - 1 + np.floor(rad_sq_max))]
min_val = r[center, int(center - 1 + np.ceil(rad_sq_min))]

mask = (r <= max_val) & (r > min_val)
a = a[mask]
Expand Down
2 changes: 1 addition & 1 deletion src/aspire/operators/blk_diag_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ def partition(self):
"""

if self._cached_blk_sizes is None:
blk_sizes = np.empty((self.nblocks, 2), dtype=np.int)
blk_sizes = np.empty((self.nblocks, 2), dtype=int)
for i, blk in enumerate(self.data):
blk_sizes[i] = np.shape(blk)
self._cached_blk_sizes = blk_sizes
Expand Down
2 changes: 1 addition & 1 deletion src/aspire/reconstruction/mean.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def compute_kernel(self):
sq_filters_f = self.src.eval_filter_grid(self.L, power=2)

for i in range(0, self.n, self.batch_size):
_range = np.arange(i, min(self.n, i + self.batch_size), dtype=np.int)
_range = np.arange(i, min(self.n, i + self.batch_size), dtype=int)
pts_rot = rotated_grids(self.L, self.src.rots[_range, :, :])
weights = sq_filters_f[:, :, _range]
weights *= self.src.amplitudes[_range] ** 2
Expand Down
2 changes: 1 addition & 1 deletion src/aspire/source/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def images(self, start, num, *args, **kwargs):
:param kwargs: Any additional keyword arguments to pass on to the `ImageSource`'s underlying `_images` method.
:return: an `Image` object.
"""
indices = np.arange(start, min(start + num, self.n), dtype=np.int)
indices = np.arange(start, min(start + num, self.n), dtype=int)

if self._cached_im is not None:
logger.info("Loading images from cache")
Expand Down
2 changes: 1 addition & 1 deletion src/aspire/source/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def clean_images(self, start=0, num=np.inf, indices=None):

def _images(self, start=0, num=np.inf, indices=None, enable_noise=True):
if indices is None:
indices = np.arange(start, min(start + num, self.n), dtype=np.int)
indices = np.arange(start, min(start + num, self.n), dtype=int)

im = self.projections(start=start, num=num, indices=indices)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ def testGetTestTol(self):
self.assertEqual(1e-8, utest_tolerance(np.float64))
self.assertEqual(1e-5, utest_tolerance(np.float32))
with raises(TypeError):
utest_tolerance(np.int)
utest_tolerance(int)
2 changes: 1 addition & 1 deletion tutorials/examples/basic_image_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def noise_function(x, y):
def radial_profile(data):
y, x = np.indices((data.shape))
# Distance from origin to lower left corner
r = np.sqrt(x ** 2 + y ** 2).astype(np.int)
r = np.sqrt(x ** 2 + y ** 2).astype(int)
binsum = np.bincount(r.ravel(), np.log(1 + data.ravel()))
bincount = np.bincount(r.ravel())
# Return the mean per bin
Expand Down
4 changes: 2 additions & 2 deletions tutorials/notebooks/Class_Averaging_RIR_FSPCA.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@
"include_refl = True # I'll have to get some help regarding the reflected set. I don't like the results.\n",
"\n",
"# angles had a bug in Simulation\n",
"angles = src._rotations.as_euler('ZYZ', degrees=True).astype(np.int)\n",
"angles = src._rotations.as_euler('ZYZ', degrees=True).astype(int)\n",
"print(angles.shape)\n",
"\n",
"logger.info(\"Classed Sample:\")\n",
Expand Down Expand Up @@ -1552,7 +1552,7 @@
"source": [
"\n",
"# angles had a bug in Simulation\n",
"angles = src._rotations.as_euler('ZYZ', degrees=True).astype(np.int)\n",
"angles = src._rotations.as_euler('ZYZ', degrees=True).astype(int)\n",
"#ex_a = angles[neighbors][class_refl[c]][:,[1,0,2]].shape\n",
"#ex_r = src.rots[neighbors]\n",
"\n",
Expand Down