From 778d777c8d683ee5ce63f7d423b4a311b2c0ab47 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 2 Jul 2024 09:21:21 -0400 Subject: [PATCH 001/433] 10081 pipeline doc and sym updates --- .../experimental_abinitio_pipeline_10081.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/gallery/experiments/experimental_abinitio_pipeline_10081.py b/gallery/experiments/experimental_abinitio_pipeline_10081.py index be27bc6e43..0711f8cb4b 100644 --- a/gallery/experiments/experimental_abinitio_pipeline_10081.py +++ b/gallery/experiments/experimental_abinitio_pipeline_10081.py @@ -59,7 +59,11 @@ # Create a source object for the experimental images src = RelionSource( - starfile_in, pixel_size=pixel_size, max_rows=n_imgs, data_folder=data_folder + starfile_in, + pixel_size=pixel_size, + max_rows=n_imgs, + data_folder=data_folder, + symmetry_group="C4", ) # Downsample the images @@ -115,12 +119,13 @@ # Volume Reconstruction # ---------------------- # -# Using the oriented source, attempt to reconstruct a volume. -# Since this is a Cn symmetric molecule, as indicated by -# ``symmetry="C4"`` above, the ``avgs`` images set will be repeated -# for each of the 3 additional rotations during the back-projection -# step. This boosts the effective number of images used in the -# reconstruction from ``n_classes`` to ``4*n_classes``. +# Using the oriented source, attempt to reconstruct a volume. Since +# this is a Cn symmetric molecule, as specified by ``RelionSource(..., +# symmetry_group="C4, ...)"``, the ``symmetry_group`` source attribute +# will flow through the pipeline to ``avgs``. Then each image will be +# repeated for each of the 3 additional rotations during +# back-projection. This boosts the effective number of images used in +# the reconstruction from ``n_classes`` to ``4*n_classes``. logger.info("Begin Volume reconstruction") From eaa9437e97277cd3ae34c9922f75c8edef8d8f19 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 2 Jul 2024 09:22:00 -0400 Subject: [PATCH 002/433] CL sync c3c4 eps change, and numerical issue --- src/aspire/abinitio/commonline_c3_c4.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/aspire/abinitio/commonline_c3_c4.py b/src/aspire/abinitio/commonline_c3_c4.py index 8e9652258a..68469618dd 100644 --- a/src/aspire/abinitio/commonline_c3_c4.py +++ b/src/aspire/abinitio/commonline_c3_c4.py @@ -47,7 +47,7 @@ def __init__( n_theta=None, max_shift=0.15, shift_step=1, - epsilon=1e-3, + epsilon=1e-2, max_iters=1000, degree_res=1, seed=None, @@ -691,7 +691,8 @@ def _J_sync_power_method(self, vijs): ) while itr < max_iters and residual > epsilon: itr += 1 - vec_new = self._signs_times_v(vijs, vec) + # Note, this appears to need double precision for accuracy in the following division. + vec_new = self._signs_times_v(vijs, vec).astype(np.float64, copy=False) vec_new = vec_new / norm(vec_new) residual = norm(vec_new - vec) vec = vec_new From 92b2e93ab4b5187ad3b7c0500bca003cd8ff375c Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 10 Jul 2024 08:34:25 -0400 Subject: [PATCH 003/433] fix doc " typo --- gallery/experiments/experimental_abinitio_pipeline_10081.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gallery/experiments/experimental_abinitio_pipeline_10081.py b/gallery/experiments/experimental_abinitio_pipeline_10081.py index 0711f8cb4b..838b2c2d5a 100644 --- a/gallery/experiments/experimental_abinitio_pipeline_10081.py +++ b/gallery/experiments/experimental_abinitio_pipeline_10081.py @@ -121,7 +121,7 @@ # # Using the oriented source, attempt to reconstruct a volume. Since # this is a Cn symmetric molecule, as specified by ``RelionSource(..., -# symmetry_group="C4, ...)"``, the ``symmetry_group`` source attribute +# symmetry_group="C4", ...)``, the ``symmetry_group`` source attribute # will flow through the pipeline to ``avgs``. Then each image will be # repeated for each of the 3 additional rotations during # back-projection. This boosts the effective number of images used in From 01058cc25eca8c2b47272484f245e8f3d716d59d Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 10 Jul 2024 08:46:05 -0400 Subject: [PATCH 004/433] Log a diagnostic whether we are actually boosting anything --- src/aspire/image/image.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index ff2353d333..1cb5ece1ab 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -517,6 +517,8 @@ def backproject(self, rot_matrices, symmetry_group=None): # Get symmetry rotations from SymmetryGroup. symmetry_rots = SymmetryGroup.parse(symmetry_group, dtype=self.dtype).matrices + if len(symmetry_rots) > 1: + logger.info("Boosting with {len(symmetry_rots)} rotational symmetries.") # Compute Fourier transform of images. im_f = xp.asnumpy(fft.centered_fft2(xp.asarray(self._data))) / (L**2) From db844878f7955c842dea4452886d390ae8cab69c Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 8 Jul 2024 13:22:38 -0400 Subject: [PATCH 005/433] symmetry_group pass-through for ClassAvgSource. --- src/aspire/denoising/class_avg.py | 1 + tests/test_class_src.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/aspire/denoising/class_avg.py b/src/aspire/denoising/class_avg.py index 586e0a08a9..20c3694dbf 100644 --- a/src/aspire/denoising/class_avg.py +++ b/src/aspire/denoising/class_avg.py @@ -76,6 +76,7 @@ def __init__( L=self.averager.src.L, n=self.averager.src.n, dtype=self.averager.src.dtype, + symmetry_group=self.src.symmetry_group, ) # Any further operations should not mutate this instance. diff --git a/tests/test_class_src.py b/tests/test_class_src.py index 0c169621cd..e395aecc8e 100644 --- a/tests/test_class_src.py +++ b/tests/test_class_src.py @@ -128,7 +128,14 @@ def class_sim_fixture(dtype, img_size): # Note using a single volume via C=1 is critical to matching # alignment without the complexity of remapping via states etc. src = Simulation( - L=img_size, n=n, vols=v, offsets=0, amplitudes=1, C=1, angles=true_rots.angles + L=img_size, + n=n, + vols=v, + offsets=0, + amplitudes=1, + C=1, + angles=true_rots.angles, + symmetry_group="C4", # For testing symmetry_group pass-through. ) # Prefetch all the images src = src.cache() @@ -193,6 +200,9 @@ class averages. k = len(src2.class_indices) np.testing.assert_equal(src2.class_indices, test_src.class_indices[::3][:k]) + # Check symmetry_group pass-through. + assert test_src.symmetry_group == class_sim_fixture.symmetry_group + # Test the _HeapItem helper class def test_heap_helper(): From 2511f43d87c5c7c1de7e636af8872a60c003d80f Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 10 Jul 2024 13:38:22 -0400 Subject: [PATCH 006/433] Add symmetry_group to test_indexed_source. --- tests/test_indexed_source.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_indexed_source.py b/tests/test_indexed_source.py index 30a23ee16b..9ce35c7052 100644 --- a/tests/test_indexed_source.py +++ b/tests/test_indexed_source.py @@ -13,7 +13,7 @@ def sim_fixture(): """ Generate a very small simulation and slice it. """ - sim = Simulation(L=8, n=10, C=1) + sim = Simulation(L=8, n=10, C=1, symmetry_group="D3") sim2 = sim[0::2] # Slice the evens return sim, sim2 @@ -31,6 +31,9 @@ def test_remapping(sim_fixture): # Check meta is served correctly. assert np.all(sim.get_metadata(indices=sim2.index_map) == sim2.get_metadata()) + # Check symmetry_group pass-through. + assert sim.symmetry_group == sim2.symmetry_group + def test_repr(sim_fixture): sim, sim2 = sim_fixture From 2b63e39e4c8325d502d113c46a039cbc7a47c0a7 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 12 Jul 2024 09:53:15 -0400 Subject: [PATCH 007/433] missing f in log message --- src/aspire/image/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 1cb5ece1ab..fd160d1644 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -518,7 +518,7 @@ def backproject(self, rot_matrices, symmetry_group=None): # Get symmetry rotations from SymmetryGroup. symmetry_rots = SymmetryGroup.parse(symmetry_group, dtype=self.dtype).matrices if len(symmetry_rots) > 1: - logger.info("Boosting with {len(symmetry_rots)} rotational symmetries.") + logger.info(f"Boosting with {len(symmetry_rots)} rotational symmetries.") # Compute Fourier transform of images. im_f = xp.asnumpy(fft.centered_fft2(xp.asarray(self._data))) / (L**2) From e92971e6e4a60d4dbcd5b1abef587dc3db19fcad Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 15 Jul 2024 09:41:35 -0400 Subject: [PATCH 008/433] use utest_tolerance for single precision run to run variability --- tests/test_covar2d_denoiser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_covar2d_denoiser.py b/tests/test_covar2d_denoiser.py index a403a72109..7b4da5511e 100644 --- a/tests/test_covar2d_denoiser.py +++ b/tests/test_covar2d_denoiser.py @@ -6,6 +6,7 @@ from aspire.noise import WhiteNoiseAdder from aspire.operators import IdentityFilter, RadialCTFFilter from aspire.source import Simulation +from aspire.utils import utest_tolerance # TODO, parameterize these further. dtype = np.float32 @@ -89,7 +90,9 @@ def test_batched_rotcov2d_MSE(sim, basis): # Additionally test the `DenoisedSource` and lazy-eval-cache # of the cov2d estimator. src = DenoisedSource(sim, denoiser) - np.testing.assert_allclose(imgs_denoised, src.images[:], rtol=1e-05, atol=1e-08) + np.testing.assert_allclose( + imgs_denoised, src.images[:], rtol=1e-05, atol=utest_tolerance(src.dtype) + ) def test_source_mismatch(sim, basis): From 6e45cfc52fe45631a64fa0905eb0337bf4ed52a7 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Thu, 13 Jun 2024 13:41:07 -0400 Subject: [PATCH 009/433] added 2D projection stub --- src/aspire/image/image.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index fd160d1644..392b5fd15d 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -186,6 +186,9 @@ def __init__(self, data, dtype=None): self.__array_interface__ = self._data.__array_interface__ self.__array__ = self._data + def project(self, angles): + """docstring""" + @property def res(self): warn( From 5ac3cbc4c31854ea5d67372f8192c9c59acbf736 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Mon, 17 Jun 2024 11:57:06 -0400 Subject: [PATCH 010/433] initial test file add --- tests/test_sinogram.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/test_sinogram.py diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py new file mode 100644 index 0000000000..5871ed8eef --- /dev/null +++ b/tests/test_sinogram.py @@ -0,0 +1 @@ +import pytest From fa5f37bf2544f046297ea580b4ead1c9677af62d Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Tue, 18 Jun 2024 12:33:31 -0400 Subject: [PATCH 011/433] Stashing initial project with test placeholder --- src/aspire/image/image.py | 37 ++++++++++++++++++++++++++++++++++++- tests/test_sinogram.py | 22 ++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 392b5fd15d..dfa526082b 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -9,6 +9,7 @@ from scipy.linalg import lstsq import aspire.volume +import finufft from aspire.nufft import anufft from aspire.numeric import fft, xp from aspire.utils import FourierRingCorrelation, anorm, crop_pad_2d, grid_2d @@ -187,7 +188,41 @@ def __init__(self, data, dtype=None): self.__array__ = self._data def project(self, angles): - """docstring""" + """docstring + angles: radians + """ + n_points = self.resolution # number of points to sample on radial line in polar grid + + nufft_type=2 + eps=1e-8 + + n_trans = self.n_images + assert n_trans == 1 + + # 2-D grid + + y_idx = np.arange(-n_points / 2, n_points / 2) / n_points * 2 + + x_theta = y_idx[:, np.newaxis] * np.sin(angles)[np.newaxis, :] + x_theta = np.pi * x_theta.flatten() + + y_theta = y_idx[:, np.newaxis] * np.cos(angles)[np.newaxis, :] + y_theta = np.pi * y_theta.flatten() + + # NUFFT + plan = finufft.Plan(nufft_type, (self.resolution, self.resolution), n_trans, eps) + plan.setpts(x_theta, y_theta) + + freqs = np.abs(np.pi * y_idx) + n_lines = len(angles) + + # compute the polar nufft + image_ft = plan.execute(self._data.astype(np.complex128)).reshape(n_points, n_lines) + + # compute the Radon transform (sinogram) + + image_rt = np.fft.fftshift(np.fft.ifft(np.fft.ifftshift(image_ft, axes=0), axis=0), axes=0).real + return image_rt @property def res(self): diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 5871ed8eef..8179e83788 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -1 +1,23 @@ import pytest +from skimage import data +from skimage.transform import radon +from aspire.image import Image +import numpy as np + +#Image.project and compare results to skimage.radon + +def test_image_project(): + image = Image(data.camera().astype(np.float64)) + ny = image.resolution + angles = np.linspace(0, 360, ny, endpoint=False) + rads = angles / 180 * np.pi + s = image.project(rads) + + # add reference skimage radon here + + + #compare s with reference + + + + From f6834b23b35d147a99af81b36135e56e4239d547 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Tue, 18 Jun 2024 12:35:17 -0400 Subject: [PATCH 012/433] Style Updates --- src/aspire/image/image.py | 26 +++++++++++++++++--------- tests/test_sinogram.py | 13 +++++-------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index dfa526082b..02185ff0a2 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -2,6 +2,7 @@ import os from warnings import catch_warnings, filterwarnings, simplefilter, warn +import finufft import matplotlib.pyplot as plt import mrcfile import numpy as np @@ -9,7 +10,6 @@ from scipy.linalg import lstsq import aspire.volume -import finufft from aspire.nufft import anufft from aspire.numeric import fft, xp from aspire.utils import FourierRingCorrelation, anorm, crop_pad_2d, grid_2d @@ -191,16 +191,18 @@ def project(self, angles): """docstring angles: radians """ - n_points = self.resolution # number of points to sample on radial line in polar grid + n_points = ( + self.resolution + ) # number of points to sample on radial line in polar grid + + nufft_type = 2 + eps = 1e-8 - nufft_type=2 - eps=1e-8 - n_trans = self.n_images assert n_trans == 1 # 2-D grid - + y_idx = np.arange(-n_points / 2, n_points / 2) / n_points * 2 x_theta = y_idx[:, np.newaxis] * np.sin(angles)[np.newaxis, :] @@ -210,18 +212,24 @@ def project(self, angles): y_theta = np.pi * y_theta.flatten() # NUFFT - plan = finufft.Plan(nufft_type, (self.resolution, self.resolution), n_trans, eps) + plan = finufft.Plan( + nufft_type, (self.resolution, self.resolution), n_trans, eps + ) plan.setpts(x_theta, y_theta) freqs = np.abs(np.pi * y_idx) n_lines = len(angles) # compute the polar nufft - image_ft = plan.execute(self._data.astype(np.complex128)).reshape(n_points, n_lines) + image_ft = plan.execute(self._data.astype(np.complex128)).reshape( + n_points, n_lines + ) # compute the Radon transform (sinogram) - image_rt = np.fft.fftshift(np.fft.ifft(np.fft.ifftshift(image_ft, axes=0), axis=0), axes=0).real + image_rt = np.fft.fftshift( + np.fft.ifft(np.fft.ifftshift(image_ft, axes=0), axis=0), axes=0 + ).real return image_rt @property diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 8179e83788..d3b7d6fb3d 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -1,10 +1,12 @@ +import numpy as np import pytest from skimage import data from skimage.transform import radon + from aspire.image import Image -import numpy as np -#Image.project and compare results to skimage.radon +# Image.project and compare results to skimage.radon + def test_image_project(): image = Image(data.camera().astype(np.float64)) @@ -15,9 +17,4 @@ def test_image_project(): # add reference skimage radon here - - #compare s with reference - - - - + # compare s with reference From aef46194ba558ca01025fc9a14a5a932a68d18fc Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Fri, 21 Jun 2024 12:00:34 -0400 Subject: [PATCH 013/433] Pytest fixtures --- tests/test_sinogram.py | 62 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 6 deletions(-) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index d3b7d6fb3d..cf095f649a 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -1,20 +1,70 @@ +import itertools + import numpy as np import pytest from skimage import data -from skimage.transform import radon +from skimage.transform import radon, resize from aspire.image import Image +from aspire.utils import grid_2d + +# parameter img_sizes: 511, 512 +IMG_SIZES = [ + 511, + 512, +] + +# parameter dtype: float32, float64 +DTYPES = [ + np.float32, + np.float64, +] + + +@pytest.fixture(params=DTYPES, ids=lambda x: f"dtype={x}", scope="module") +def dtype(request): + """ + Dtypes for image. + """ + return request.param -# Image.project and compare results to skimage.radon +@pytest.fixture(params=IMG_SIZES, ids=lambda x: f"px={x}", scope="module") +def img_size(request): + """ + Image size. + """ + return request.param -def test_image_project(): - image = Image(data.camera().astype(np.float64)) - ny = image.resolution + +@pytest.fixture +def masked_image(dtype, img_size): + """ + Construct a masked image fixture that takes paramters + """ + g = grid_2d(img_size, normalized=True, shifted=True) + mask = g["r"] < 1 + + # add more logic to check the sizes and readjust accordingly + image = data.camera().astype(dtype) + image = image[:img_size, :img_size] + return Image(image * mask) + + +# Image.project and compare results to skimage.radon +def test_image_project(masked_image): + ny = masked_image.resolution angles = np.linspace(0, 360, ny, endpoint=False) rads = angles / 180 * np.pi - s = image.project(rads) + s = masked_image.project(rads) # add reference skimage radon here + n = masked_image._data[0] + print(s.shape) + print(n.shape) + reference_sinogram = radon(n, theta=angles) # compare s with reference + np.testing.assert_allclose(s, reference_sinogram, rtol=11, atol=1e-8) + + # create fixture called masked_image(img_size) -> return: masked image of size (grid generation goes in fixture) From df8953d9179b3a06940885449e511726cea189eb Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Fri, 21 Jun 2024 12:21:14 -0400 Subject: [PATCH 014/433] Cleanup --- src/aspire/image/image.py | 6 ++---- tests/test_sinogram.py | 8 ++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 02185ff0a2..40546aff1a 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -191,9 +191,8 @@ def project(self, angles): """docstring angles: radians """ - n_points = ( - self.resolution - ) # number of points to sample on radial line in polar grid + # number of points to sample on radial line in polar grid + n_points = self.resolution nufft_type = 2 eps = 1e-8 @@ -217,7 +216,6 @@ def project(self, angles): ) plan.setpts(x_theta, y_theta) - freqs = np.abs(np.pi * y_idx) n_lines = len(angles) # compute the polar nufft diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index cf095f649a..de65ce252c 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -1,9 +1,7 @@ -import itertools - import numpy as np import pytest from skimage import data -from skimage.transform import radon, resize +from skimage.transform import radon from aspire.image import Image from aspire.utils import grid_2d @@ -60,9 +58,7 @@ def test_image_project(masked_image): # add reference skimage radon here n = masked_image._data[0] - print(s.shape) - print(n.shape) - reference_sinogram = radon(n, theta=angles) + reference_sinogram = radon(n, theta=angles[::-1]) # compare s with reference np.testing.assert_allclose(s, reference_sinogram, rtol=11, atol=1e-8) From 9970e815fbf8fdbd8a1fd4990a13dc09e5b2bf72 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Fri, 21 Jun 2024 13:01:21 -0400 Subject: [PATCH 015/433] changed nufft call --- src/aspire/image/image.py | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 40546aff1a..2d771766b0 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -2,7 +2,6 @@ import os from warnings import catch_warnings, filterwarnings, simplefilter, warn -import finufft import matplotlib.pyplot as plt import mrcfile import numpy as np @@ -10,7 +9,7 @@ from scipy.linalg import lstsq import aspire.volume -from aspire.nufft import anufft +from aspire.nufft import anufft, nufft from aspire.numeric import fft, xp from aspire.utils import FourierRingCorrelation, anorm, crop_pad_2d, grid_2d from aspire.volume import SymmetryGroup @@ -194,37 +193,24 @@ def project(self, angles): # number of points to sample on radial line in polar grid n_points = self.resolution - nufft_type = 2 - eps = 1e-8 - n_trans = self.n_images assert n_trans == 1 # 2-D grid - y_idx = np.arange(-n_points / 2, n_points / 2) / n_points * 2 + pts = np.empty((2, n_points * len(angles)), dtype=self.dtype) x_theta = y_idx[:, np.newaxis] * np.sin(angles)[np.newaxis, :] - x_theta = np.pi * x_theta.flatten() + pts[0] = np.pi * x_theta.flatten() y_theta = y_idx[:, np.newaxis] * np.cos(angles)[np.newaxis, :] - y_theta = np.pi * y_theta.flatten() + pts[1] = np.pi * y_theta.flatten() # NUFFT - plan = finufft.Plan( - nufft_type, (self.resolution, self.resolution), n_trans, eps - ) - plan.setpts(x_theta, y_theta) - - n_lines = len(angles) - # compute the polar nufft - image_ft = plan.execute(self._data.astype(np.complex128)).reshape( - n_points, n_lines - ) + image_ft = nufft(self._data, pts).reshape(n_points, n_points) # compute the Radon transform (sinogram) - image_rt = np.fft.fftshift( np.fft.ifft(np.fft.ifftshift(image_ft, axes=0), axis=0), axes=0 ).real From eafe89e7283c87edbf9a60e66386b6e5fca02960 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 21 Jun 2024 13:18:49 -0400 Subject: [PATCH 016/433] added stub for image stack line project marc to continue --- tests/test_sinogram.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index de65ce252c..020e8b58bf 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -4,6 +4,7 @@ from skimage.transform import radon from aspire.image import Image +from aspire.source import Simulation from aspire.utils import grid_2d # parameter img_sizes: 511, 512 @@ -64,3 +65,32 @@ def test_image_project(masked_image): np.testing.assert_allclose(s, reference_sinogram, rtol=11, atol=1e-8) # create fixture called masked_image(img_size) -> return: masked image of size (grid generation goes in fixture) + + +def test_multidim(): + """ + Test Image.project on stacks of images. + """ + + L = 32 # pixels + n = 3 + + # Generate a mask + g = grid_2d(L, normalized=True, shifted=True) + mask = g["r"] < 1 + + # Generate a simulation + src = Simulation(n=n, L=L, C=1, dtype=np.float64) + imgs = src.images[:] + + # Generate line project angles + ang_degrees = np.linspace(0, 180, L) + ang_rads = ang_degrees * np.pi / 180.0 + + # Call the line projection method + s = imgs.project(ang_rads) + + # # Compare with sk + # res = np.empty((n,L,L)) + # for i,img in enumerate(imgs.asnumpy()): + # #res[i] = radon(img ...) From c078f84f976a06b00f4d06ad99fc3a522c0630a4 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Mon, 24 Jun 2024 12:03:41 -0400 Subject: [PATCH 017/433] Dimensional Test Fix --- src/aspire/image/image.py | 14 ++++++++------ tests/test_sinogram.py | 16 +++++++++------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 2d771766b0..ee0b46e3f0 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -194,7 +194,6 @@ def project(self, angles): n_points = self.resolution n_trans = self.n_images - assert n_trans == 1 # 2-D grid y_idx = np.arange(-n_points / 2, n_points / 2) / n_points * 2 @@ -207,13 +206,16 @@ def project(self, angles): pts[1] = np.pi * y_theta.flatten() # NUFFT - # compute the polar nufft - image_ft = nufft(self._data, pts).reshape(n_points, n_points) + # compute the polar nufft, create a + image_ft = nufft(self._data, pts).reshape(self.n_images, n_points, n_points) # compute the Radon transform (sinogram) - image_rt = np.fft.fftshift( - np.fft.ifft(np.fft.ifftshift(image_ft, axes=0), axis=0), axes=0 - ).real + image_rt = np.empty((self.n_images, n_points, n_points)) + for i in range(n_trans): + image_rt[i] = np.fft.fftshift( + np.fft.ifft(np.fft.ifftshift(image_ft[i], axes=0), axis=0), axes=0 + ).real + # previous code: image_rt = np.fft.fftshift(np.fft.ifft(np.fft.ifftshift(image_ft, axes=0), axis=0), axes=0).real return image_rt @property diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 020e8b58bf..b9b2f3912f 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -62,7 +62,7 @@ def test_image_project(masked_image): reference_sinogram = radon(n, theta=angles[::-1]) # compare s with reference - np.testing.assert_allclose(s, reference_sinogram, rtol=11, atol=1e-8) + np.testing.assert_allclose(s[0], reference_sinogram, rtol=11, atol=1e-8) # create fixture called masked_image(img_size) -> return: masked image of size (grid generation goes in fixture) @@ -72,7 +72,7 @@ def test_multidim(): Test Image.project on stacks of images. """ - L = 32 # pixels + L = 64 # pixels n = 3 # Generate a mask @@ -81,16 +81,18 @@ def test_multidim(): # Generate a simulation src = Simulation(n=n, L=L, C=1, dtype=np.float64) - imgs = src.images[:] + imgs = src.images[:] * mask # Generate line project angles - ang_degrees = np.linspace(0, 180, L) + ang_degrees = np.linspace(0, 180, L, endpoint=False) ang_rads = ang_degrees * np.pi / 180.0 # Call the line projection method s = imgs.project(ang_rads) # # Compare with sk - # res = np.empty((n,L,L)) - # for i,img in enumerate(imgs.asnumpy()): - # #res[i] = radon(img ...) + res = np.empty((n, L, L)) + for i, img in enumerate(imgs._data): + res[i] = radon(img, theta=ang_rads[::-1]) + + np.testing.assert_allclose(s, res, rtol=12, atol=1e-8) From 49ecd4b7489538785b12444529435813273b1c38 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Mon, 24 Jun 2024 12:26:06 -0400 Subject: [PATCH 018/433] Multidim FFT --- src/aspire/image/image.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index ee0b46e3f0..c88a17e6a3 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -196,7 +196,7 @@ def project(self, angles): n_trans = self.n_images # 2-D grid - y_idx = np.arange(-n_points / 2, n_points / 2) / n_points * 2 + y_idx = np.arange(-n_points / 2, n_points / 2, dtype=self.dtype) / n_points * 2 pts = np.empty((2, n_points * len(angles)), dtype=self.dtype) x_theta = y_idx[:, np.newaxis] * np.sin(angles)[np.newaxis, :] @@ -210,12 +210,10 @@ def project(self, angles): image_ft = nufft(self._data, pts).reshape(self.n_images, n_points, n_points) # compute the Radon transform (sinogram) - image_rt = np.empty((self.n_images, n_points, n_points)) - for i in range(n_trans): - image_rt[i] = np.fft.fftshift( - np.fft.ifft(np.fft.ifftshift(image_ft[i], axes=0), axis=0), axes=0 - ).real - # previous code: image_rt = np.fft.fftshift(np.fft.ifft(np.fft.ifftshift(image_ft, axes=0), axis=0), axes=0).real + image_rt = np.fft.fftshift( + np.fft.ifftn(np.fft.ifftshift(image_ft, axes=(0, 1)), axes=(0, 1)), + axes=(0, 1), + ).real return image_rt @property From 399be2f17505dd728edf457cfdc50829f184cd3d Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Tue, 25 Jun 2024 11:43:25 -0400 Subject: [PATCH 019/433] Integrated stack reshape to project --- src/aspire/image/image.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index c88a17e6a3..f30c82ca3b 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -192,8 +192,7 @@ def project(self, angles): """ # number of points to sample on radial line in polar grid n_points = self.resolution - - n_trans = self.n_images + original_stack = self.stack_shape # 2-D grid y_idx = np.arange(-n_points / 2, n_points / 2, dtype=self.dtype) / n_points * 2 @@ -206,14 +205,17 @@ def project(self, angles): pts[1] = np.pi * y_theta.flatten() # NUFFT - # compute the polar nufft, create a - image_ft = nufft(self._data, pts).reshape(self.n_images, n_points, n_points) + # compute the polar nufft + image_ft = nufft(self.stack_reshape(-1)._data, pts).reshape( + self.n_images, n_points, n_points + ) # compute the Radon transform (sinogram) image_rt = np.fft.fftshift( np.fft.ifftn(np.fft.ifftshift(image_ft, axes=(0, 1)), axes=(0, 1)), axes=(0, 1), ).real + image_rt = image_rt.reshape(*original_stack, n_points, n_points) return image_rt @property From 7994ecd8580fc4e6170a0b561d19a07a9263b3d0 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Wed, 26 Jun 2024 15:46:26 -0400 Subject: [PATCH 020/433] Fleshed out Image Project Single and Multidim Tests --- tests/test_sinogram.py | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index b9b2f3912f..eb42b0a871 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -44,7 +44,6 @@ def masked_image(dtype, img_size): g = grid_2d(img_size, normalized=True, shifted=True) mask = g["r"] < 1 - # add more logic to check the sizes and readjust accordingly image = data.camera().astype(dtype) image = image[:img_size, :img_size] return Image(image * mask) @@ -52,6 +51,9 @@ def masked_image(dtype, img_size): # Image.project and compare results to skimage.radon def test_image_project(masked_image): + """ + TestImage.project on a single stack of images. Compares project method with skimage. + """ ny = masked_image.resolution angles = np.linspace(0, 360, ny, endpoint=False) rads = angles / 180 * np.pi @@ -62,9 +64,15 @@ def test_image_project(masked_image): reference_sinogram = radon(n, theta=angles[::-1]) # compare s with reference - np.testing.assert_allclose(s[0], reference_sinogram, rtol=11, atol=1e-8) + nrms = np.sqrt(np.mean((s[0] - reference_sinogram) ** 2, axis=0)) / np.linalg.norm( + reference_sinogram, axis=0 + ) + tol = 0.002 - # create fixture called masked_image(img_size) -> return: masked image of size (grid generation goes in fixture) + # odd image tolerance (stink) + if masked_image.resolution % 2 == 1: + tol = 0.02 + np.testing.assert_array_less(nrms, tol, "Error in test image") def test_multidim(): @@ -72,7 +80,7 @@ def test_multidim(): Test Image.project on stacks of images. """ - L = 64 # pixels + L = 512 # pixels n = 3 # Generate a mask @@ -84,15 +92,18 @@ def test_multidim(): imgs = src.images[:] * mask # Generate line project angles - ang_degrees = np.linspace(0, 180, L, endpoint=False) - ang_rads = ang_degrees * np.pi / 180.0 - - # Call the line projection method - s = imgs.project(ang_rads) + angles = np.linspace(0, 180, L, endpoint=False) + rads = angles / 180.0 * np.pi + s = imgs.project(rads) # # Compare with sk - res = np.empty((n, L, L)) + reference_sinograms = np.empty((n, L, L)) for i, img in enumerate(imgs._data): - res[i] = radon(img, theta=ang_rads[::-1]) - - np.testing.assert_allclose(s, res, rtol=12, atol=1e-8) + reference_sinograms[i] = radon(img, theta=angles[::-1]) + + # decrease tolerance as L goes up + for i in range(n): + nrms = np.sqrt( + np.mean((s[i] - reference_sinograms[i]) ** 2, axis=0) + ) / np.linalg.norm(reference_sinograms[i], axis=0) + np.testing.assert_array_less(nrms, 0.05, err_msg=f"Error in image {i}") From 59e4b2446425b50e89bae505d88602e7019c1236 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Thu, 27 Jun 2024 12:35:05 -0400 Subject: [PATCH 021/433] Fixed the grid issues yay --- src/aspire/image/image.py | 16 +++++++--------- tests/test_sinogram.py | 6 +----- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index f30c82ca3b..c38e57dcde 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -195,19 +195,17 @@ def project(self, angles): original_stack = self.stack_shape # 2-D grid - y_idx = np.arange(-n_points / 2, n_points / 2, dtype=self.dtype) / n_points * 2 - pts = np.empty((2, n_points * len(angles)), dtype=self.dtype) + y_idx = np.fft.fftshift(np.fft.fftfreq(n_points)) + pts = np.empty((2, n_points, len(angles)), dtype=self.dtype) - x_theta = y_idx[:, np.newaxis] * np.sin(angles)[np.newaxis, :] - pts[0] = np.pi * x_theta.flatten() - - y_theta = y_idx[:, np.newaxis] * np.cos(angles)[np.newaxis, :] - pts[1] = np.pi * y_theta.flatten() + pts[0] = y_idx[:, np.newaxis] * np.sin(angles)[np.newaxis, :] + pts[1] = y_idx[:, np.newaxis] * np.cos(angles)[np.newaxis, :] + pts = pts.reshape(2, n_points * len(angles)) * 2 * np.pi # NUFFT # compute the polar nufft image_ft = nufft(self.stack_reshape(-1)._data, pts).reshape( - self.n_images, n_points, n_points + self.n_images, n_points, len(angles) ) # compute the Radon transform (sinogram) @@ -215,7 +213,7 @@ def project(self, angles): np.fft.ifftn(np.fft.ifftshift(image_ft, axes=(0, 1)), axes=(0, 1)), axes=(0, 1), ).real - image_rt = image_rt.reshape(*original_stack, n_points, n_points) + image_rt = image_rt.reshape(*original_stack, n_points, len(angles)) return image_rt @property diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index eb42b0a871..efa2c4aa3d 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -55,7 +55,7 @@ def test_image_project(masked_image): TestImage.project on a single stack of images. Compares project method with skimage. """ ny = masked_image.resolution - angles = np.linspace(0, 360, ny, endpoint=False) + angles = np.linspace(0, 360, ny + 1, endpoint=False) rads = angles / 180 * np.pi s = masked_image.project(rads) @@ -68,10 +68,6 @@ def test_image_project(masked_image): reference_sinogram, axis=0 ) tol = 0.002 - - # odd image tolerance (stink) - if masked_image.resolution % 2 == 1: - tol = 0.02 np.testing.assert_array_less(nrms, tol, "Error in test image") From 5532c3b79326b95665db4a974287ff5ede803198 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Fri, 28 Jun 2024 11:52:09 -0400 Subject: [PATCH 022/433] Angle slow moving axis --- src/aspire/image/image.py | 14 +++++++------- tests/test_sinogram.py | 10 ++++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index c38e57dcde..92aa780823 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -196,24 +196,24 @@ def project(self, angles): # 2-D grid y_idx = np.fft.fftshift(np.fft.fftfreq(n_points)) - pts = np.empty((2, n_points, len(angles)), dtype=self.dtype) + pts = np.empty((2, len(angles), n_points), dtype=self.dtype) - pts[0] = y_idx[:, np.newaxis] * np.sin(angles)[np.newaxis, :] - pts[1] = y_idx[:, np.newaxis] * np.cos(angles)[np.newaxis, :] + pts[0] = y_idx[np.newaxis, :] * np.sin(angles)[:, np.newaxis] + pts[1] = y_idx[np.newaxis, :] * np.cos(angles)[:, np.newaxis] pts = pts.reshape(2, n_points * len(angles)) * 2 * np.pi # NUFFT # compute the polar nufft image_ft = nufft(self.stack_reshape(-1)._data, pts).reshape( - self.n_images, n_points, len(angles) + self.n_images, len(angles), n_points ) # compute the Radon transform (sinogram) image_rt = np.fft.fftshift( - np.fft.ifftn(np.fft.ifftshift(image_ft, axes=(0, 1)), axes=(0, 1)), - axes=(0, 1), + np.fft.ifftn(np.fft.ifftshift(image_ft, axes=(0, 2)), axes=(0, 2)), + axes=(0, 2), ).real - image_rt = image_rt.reshape(*original_stack, n_points, len(angles)) + image_rt = image_rt.reshape(*original_stack, len(angles), n_points) return image_rt @property diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index efa2c4aa3d..2abe42f12e 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -58,14 +58,16 @@ def test_image_project(masked_image): angles = np.linspace(0, 360, ny + 1, endpoint=False) rads = angles / 180 * np.pi s = masked_image.project(rads) + assert s.shape == (1, len(angles), ny) # add reference skimage radon here n = masked_image._data[0] - reference_sinogram = radon(n, theta=angles[::-1]) - + reference_sinogram = radon(n, theta=angles[::-1]).T # transpose angles, points + assert reference_sinogram.shape == (len(angles), ny) # compare s with reference - nrms = np.sqrt(np.mean((s[0] - reference_sinogram) ** 2, axis=0)) / np.linalg.norm( - reference_sinogram, axis=0 + + nrms = np.sqrt(np.mean((s[0] - reference_sinogram) ** 2, axis=1)) / np.linalg.norm( + reference_sinogram, axis=1 ) tol = 0.002 np.testing.assert_array_less(nrms, tol, "Error in test image") From 6620a2e7108e31f4eaa5acec5547df5ed0cd4bcd Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Fri, 28 Jun 2024 15:50:29 -0400 Subject: [PATCH 023/433] Replaced FFT with rfft --- src/aspire/image/image.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 92aa780823..e12cf29598 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -5,6 +5,7 @@ import matplotlib.pyplot as plt import mrcfile import numpy as np +from numpy.fft import irfft from PIL import Image as PILImage from scipy.linalg import lstsq @@ -195,24 +196,27 @@ def project(self, angles): original_stack = self.stack_shape # 2-D grid - y_idx = np.fft.fftshift(np.fft.fftfreq(n_points)) - pts = np.empty((2, len(angles), n_points), dtype=self.dtype) + y_idx = np.fft.rfftfreq(n_points) * np.pi * 2 + n_real_points = len(y_idx) + + # y_idx = np.fft.fftshift(np.fft.fftfreq(n_points)) + pts = np.empty((2, len(angles), n_real_points), dtype=self.dtype) pts[0] = y_idx[np.newaxis, :] * np.sin(angles)[:, np.newaxis] pts[1] = y_idx[np.newaxis, :] * np.cos(angles)[:, np.newaxis] - pts = pts.reshape(2, n_points * len(angles)) * 2 * np.pi + pts = pts.reshape(2, n_real_points * len(angles)) # NUFFT # compute the polar nufft image_ft = nufft(self.stack_reshape(-1)._data, pts).reshape( - self.n_images, len(angles), n_points + self.n_images, len(angles), n_real_points ) # compute the Radon transform (sinogram) image_rt = np.fft.fftshift( - np.fft.ifftn(np.fft.ifftshift(image_ft, axes=(0, 2)), axes=(0, 2)), + np.fft.irfftn(image_ft, s=(self.n_images, n_points), axes=(0, 2)), axes=(0, 2), - ).real + ) image_rt = image_rt.reshape(*original_stack, len(angles), n_points) return image_rt From 223065f58c0ed957b9f439297b7f51595574c5be Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Fri, 28 Jun 2024 16:00:17 -0400 Subject: [PATCH 024/433] Cleaned up other unit tests --- src/aspire/image/image.py | 1 - tests/test_sinogram.py | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index e12cf29598..f0ef24dcc7 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -5,7 +5,6 @@ import matplotlib.pyplot as plt import mrcfile import numpy as np -from numpy.fft import irfft from PIL import Image as PILImage from scipy.linalg import lstsq diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 2abe42f12e..fc8e712408 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -4,7 +4,6 @@ from skimage.transform import radon from aspire.image import Image -from aspire.source import Simulation from aspire.utils import grid_2d # parameter img_sizes: 511, 512 @@ -85,9 +84,8 @@ def test_multidim(): g = grid_2d(L, normalized=True, shifted=True) mask = g["r"] < 1 - # Generate a simulation - src = Simulation(n=n, L=L, C=1, dtype=np.float64) - imgs = src.images[:] * mask + # Generate images + imgs = Image(np.random.random((n, L, L))) * mask # Generate line project angles angles = np.linspace(0, 180, L, endpoint=False) @@ -97,11 +95,11 @@ def test_multidim(): # # Compare with sk reference_sinograms = np.empty((n, L, L)) for i, img in enumerate(imgs._data): - reference_sinograms[i] = radon(img, theta=angles[::-1]) + reference_sinograms[i] = radon(img, theta=angles[::-1]).T # decrease tolerance as L goes up for i in range(n): nrms = np.sqrt( - np.mean((s[i] - reference_sinograms[i]) ** 2, axis=0) - ) / np.linalg.norm(reference_sinograms[i], axis=0) + np.mean((s[i] - reference_sinograms[i]) ** 2, axis=1) + ) / np.linalg.norm(reference_sinograms[i], axis=1) np.testing.assert_array_less(nrms, 0.05, err_msg=f"Error in image {i}") From cff9378770f095c1b77eaf11055cf4c433a002aa Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Fri, 5 Jul 2024 20:48:03 -0400 Subject: [PATCH 025/433] Added Doc Test and Cleaned up Code --- src/aspire/image/image.py | 15 ++++++++------- tests/test_sinogram.py | 17 ++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index f0ef24dcc7..d5d1b9885e 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -187,8 +187,12 @@ def __init__(self, data, dtype=None): self.__array__ = self._data def project(self, angles): - """docstring - angles: radians + """ + Computes the Radon Transform on an Image Stack using Non-Uniform Fast Fourier Transforms. This method projects the Image stack along different angles and returns the Radon Transform. + + :param angles: A 1-D Numpy Array of angles in Radians. This is used to compute the Radon Transform at different angles. + :return: Radon transform of the Image Stack. + :rtype: Ndarray (stack size, number of angles, image resolution) """ # number of points to sample on radial line in polar grid n_points = self.resolution @@ -198,20 +202,17 @@ def project(self, angles): y_idx = np.fft.rfftfreq(n_points) * np.pi * 2 n_real_points = len(y_idx) - # y_idx = np.fft.fftshift(np.fft.fftfreq(n_points)) pts = np.empty((2, len(angles), n_real_points), dtype=self.dtype) - pts[0] = y_idx[np.newaxis, :] * np.sin(angles)[:, np.newaxis] pts[1] = y_idx[np.newaxis, :] * np.cos(angles)[:, np.newaxis] pts = pts.reshape(2, n_real_points * len(angles)) - # NUFFT - # compute the polar nufft + # compute the polar nufft (NUFFT) image_ft = nufft(self.stack_reshape(-1)._data, pts).reshape( self.n_images, len(angles), n_real_points ) - # compute the Radon transform (sinogram) + # Radon transform image_rt = np.fft.fftshift( np.fft.irfftn(image_ft, s=(self.n_images, n_points), axes=(0, 2)), axes=(0, 2), diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index fc8e712408..a935f68ccc 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -38,7 +38,7 @@ def img_size(request): @pytest.fixture def masked_image(dtype, img_size): """ - Construct a masked image fixture that takes paramters + Creates a masked image fixture using camera data from Skikit-Image. """ g = grid_2d(img_size, normalized=True, shifted=True) mask = g["r"] < 1 @@ -51,7 +51,7 @@ def masked_image(dtype, img_size): # Image.project and compare results to skimage.radon def test_image_project(masked_image): """ - TestImage.project on a single stack of images. Compares project method with skimage. + Test Image.project on a single stack of images. Compares project method with skimage. """ ny = masked_image.resolution angles = np.linspace(0, 360, ny + 1, endpoint=False) @@ -59,22 +59,22 @@ def test_image_project(masked_image): s = masked_image.project(rads) assert s.shape == (1, len(angles), ny) - # add reference skimage radon here + # ski-kit image radon reference n = masked_image._data[0] reference_sinogram = radon(n, theta=angles[::-1]).T # transpose angles, points assert reference_sinogram.shape == (len(angles), ny) - # compare s with reference + # compare project method on ski-image reference nrms = np.sqrt(np.mean((s[0] - reference_sinogram) ** 2, axis=1)) / np.linalg.norm( reference_sinogram, axis=1 ) tol = 0.002 - np.testing.assert_array_less(nrms, tol, "Error in test image") + np.testing.assert_array_less(nrms, tol, "Error in image projections.") def test_multidim(): """ - Test Image.project on stacks of images. + Test Image.project on stacks of images. Extension of test_image_project but for multi-dimensional stacks. """ L = 512 # pixels @@ -92,14 +92,13 @@ def test_multidim(): rads = angles / 180.0 * np.pi s = imgs.project(rads) - # # Compare with sk + # Compare with ski-image reference_sinograms = np.empty((n, L, L)) for i, img in enumerate(imgs._data): reference_sinograms[i] = radon(img, theta=angles[::-1]).T - # decrease tolerance as L goes up for i in range(n): nrms = np.sqrt( np.mean((s[i] - reference_sinograms[i]) ** 2, axis=1) ) / np.linalg.norm(reference_sinograms[i], axis=1) - np.testing.assert_array_less(nrms, 0.05, err_msg=f"Error in image {i}") + np.testing.assert_array_less(nrms, 0.05, err_msg=f"Error in image {i}.") From 5192d54ca19b90d6662edc27e72cc0b5a4b8b5a6 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 10 Jul 2024 19:59:12 -0400 Subject: [PATCH 026/433] fixup sinogram tests and simpler multi test Co-authored-by: Marc Karimi --- tests/test_sinogram.py | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index a935f68ccc..323c1f2eb0 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -6,6 +6,10 @@ from aspire.image import Image from aspire.utils import grid_2d +# Relative tolerance comparing line projections to scikit +# The same tolerance will be used in all scikit comparisons +SK_TOL = 0.002 + # parameter img_sizes: 511, 512 IMG_SIZES = [ 511, @@ -59,17 +63,23 @@ def test_image_project(masked_image): s = masked_image.project(rads) assert s.shape == (1, len(angles), ny) - # ski-kit image radon reference - n = masked_image._data[0] - reference_sinogram = radon(n, theta=angles[::-1]).T # transpose angles, points - assert reference_sinogram.shape == (len(angles), ny) + # sci-kit image `radon` reference + # + # Note, Image.project's angles are wrt projection line (ie + # grid), while sk's radon are wrt the image. To correspond the + # rotations are inverted. This was the convention prefered by + # the original author of this method. + # + # Note, transpose sk output to match (angles, points) + reference_sinogram = radon(masked_image._data[0], theta=angles[::-1]).T + assert reference_sinogram.shape == (len(angles), ny), "Incorrect Shape" # compare project method on ski-image reference nrms = np.sqrt(np.mean((s[0] - reference_sinogram) ** 2, axis=1)) / np.linalg.norm( reference_sinogram, axis=1 ) - tol = 0.002 - np.testing.assert_array_less(nrms, tol, "Error in image projections.") + + np.testing.assert_array_less(nrms, SK_TOL, "Error in image projections.") def test_multidim(): @@ -92,13 +102,20 @@ def test_multidim(): rads = angles / 180.0 * np.pi s = imgs.project(rads) - # Compare with ski-image + # Compare reference_sinograms = np.empty((n, L, L)) - for i, img in enumerate(imgs._data): - reference_sinograms[i] = radon(img, theta=angles[::-1]).T + for i, img in enumerate(imgs): + # Compute the singleton case, and compare with the stack + single_sinogram = img.project(rads) + # These should be allclose up to determinism in the FFT and NUFFT. + np.testing.assert_allclose(s[i : i + 1], single_sinogram) + + # Next individually compute sk's radon transform for each image. + reference_sinograms[i] = radon(img._data[0], theta=angles[::-1]).T + # Compare all lines in each sinogram with sk-image for i in range(n): nrms = np.sqrt( np.mean((s[i] - reference_sinograms[i]) ** 2, axis=1) ) / np.linalg.norm(reference_sinograms[i], axis=1) - np.testing.assert_array_less(nrms, 0.05, err_msg=f"Error in image {i}.") + np.testing.assert_array_less(nrms, SK_TOL, err_msg=f"Error in image {i}.") From b321364755fa48d43d776cdb20c1acd3e1b96edd Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 10 Jul 2024 20:07:57 -0400 Subject: [PATCH 027/433] fix irfft and shift Co-authored-by: Marc Karimi --- src/aspire/image/image.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index d5d1b9885e..dd0adefd13 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -213,10 +213,7 @@ def project(self, angles): ) # Radon transform - image_rt = np.fft.fftshift( - np.fft.irfftn(image_ft, s=(self.n_images, n_points), axes=(0, 2)), - axes=(0, 2), - ) + image_rt = np.fft.fftshift(np.fft.irfft(image_ft, n=n_points, axis=-1), axes=-1) image_rt = image_rt.reshape(*original_stack, len(angles), n_points) return image_rt From 3d9d123d291474403de7dc5fc54bb6d4daf3069f Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Thu, 11 Jul 2024 12:49:52 -0400 Subject: [PATCH 028/433] added angles but need to change multidim --- src/aspire/image/image.py | 17 +++++++++-------- tests/test_sinogram.py | 14 ++++++++++---- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index dd0adefd13..f6e07dcdc6 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -199,22 +199,23 @@ def project(self, angles): original_stack = self.stack_shape # 2-D grid - y_idx = np.fft.rfftfreq(n_points) * np.pi * 2 - n_real_points = len(y_idx) + radial_idx = np.fft.rfftfreq(n_points) * np.pi * 2 + n_real_points = len(radial_idx) + n_angles = len(angles) - pts = np.empty((2, len(angles), n_real_points), dtype=self.dtype) - pts[0] = y_idx[np.newaxis, :] * np.sin(angles)[:, np.newaxis] - pts[1] = y_idx[np.newaxis, :] * np.cos(angles)[:, np.newaxis] - pts = pts.reshape(2, n_real_points * len(angles)) + pts = np.empty((2, n_angles, n_real_points), dtype=self.dtype) + pts[0] = radial_idx[np.newaxis, :] * np.sin(angles)[:, np.newaxis] + pts[1] = radial_idx[np.newaxis, :] * np.cos(angles)[:, np.newaxis] + pts = pts.reshape(2, n_real_points * n_angles) # compute the polar nufft (NUFFT) image_ft = nufft(self.stack_reshape(-1)._data, pts).reshape( - self.n_images, len(angles), n_real_points + self.n_images, n_angles, n_real_points ) # Radon transform image_rt = np.fft.fftshift(np.fft.irfft(image_ft, n=n_points, axis=-1), axes=-1) - image_rt = image_rt.reshape(*original_stack, len(angles), n_points) + image_rt = image_rt.reshape(*original_stack, n_angles, n_points) return image_rt @property diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 323c1f2eb0..94cc172189 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -10,18 +10,17 @@ # The same tolerance will be used in all scikit comparisons SK_TOL = 0.002 -# parameter img_sizes: 511, 512 IMG_SIZES = [ 511, 512, ] -# parameter dtype: float32, float64 DTYPES = [ np.float32, np.float64, ] +ANGLES = [1, 50, 90, 117, 180, 360] @pytest.fixture(params=DTYPES, ids=lambda x: f"dtype={x}", scope="module") def dtype(request): @@ -38,6 +37,13 @@ def img_size(request): """ return request.param +@pytest.fixture(params=ANGLES, ids=lambda x: f"angles={x}", scope="module") +def num_ang(request): + """ + Angles. + """ + return request.param + @pytest.fixture def masked_image(dtype, img_size): @@ -53,12 +59,12 @@ def masked_image(dtype, img_size): # Image.project and compare results to skimage.radon -def test_image_project(masked_image): +def test_image_project(masked_image, num_ang): """ Test Image.project on a single stack of images. Compares project method with skimage. """ ny = masked_image.resolution - angles = np.linspace(0, 360, ny + 1, endpoint=False) + angles = np.linspace(0, 360, num_ang, endpoint=False) rads = angles / 180 * np.pi s = masked_image.project(rads) assert s.shape == (1, len(angles), ny) From d486dd2d269366fb48655138f6b4f091a9bc8948 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Thu, 11 Jul 2024 15:37:37 -0400 Subject: [PATCH 029/433] Added Changes from PR: parameterized angles, adjusted tests accordingly, renamed variables --- tests/test_sinogram.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 94cc172189..69fdd1da37 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -8,7 +8,7 @@ # Relative tolerance comparing line projections to scikit # The same tolerance will be used in all scikit comparisons -SK_TOL = 0.002 +SK_TOL = 0.005 IMG_SIZES = [ 511, @@ -22,6 +22,7 @@ ANGLES = [1, 50, 90, 117, 180, 360] + @pytest.fixture(params=DTYPES, ids=lambda x: f"dtype={x}", scope="module") def dtype(request): """ @@ -37,6 +38,7 @@ def img_size(request): """ return request.param + @pytest.fixture(params=ANGLES, ids=lambda x: f"angles={x}", scope="module") def num_ang(request): """ @@ -88,7 +90,7 @@ def test_image_project(masked_image, num_ang): np.testing.assert_array_less(nrms, SK_TOL, "Error in image projections.") -def test_multidim(): +def test_multidim(num_ang): """ Test Image.project on stacks of images. Extension of test_image_project but for multi-dimensional stacks. """ @@ -104,12 +106,12 @@ def test_multidim(): imgs = Image(np.random.random((n, L, L))) * mask # Generate line project angles - angles = np.linspace(0, 180, L, endpoint=False) + angles = np.linspace(0, 180, num_ang, endpoint=False) rads = angles / 180.0 * np.pi s = imgs.project(rads) # Compare - reference_sinograms = np.empty((n, L, L)) + reference_sinograms = np.empty((n, num_ang, L)) for i, img in enumerate(imgs): # Compute the singleton case, and compare with the stack single_sinogram = img.project(rads) From 614f08ddae28494637bf8648555966b973f57977 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Thu, 18 Jul 2024 00:46:02 -0400 Subject: [PATCH 030/433] Added extra comments + Integrated Changes from lineproject_dbg2 branch --- src/aspire/image/image.py | 2 +- tests/test_sinogram.py | 57 ++++++++++++++++++++++----------------- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index f6e07dcdc6..613f393993 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -213,7 +213,7 @@ def project(self, angles): self.n_images, n_angles, n_real_points ) - # Radon transform + # Radon transform, output: (stack size, angles, points) image_rt = np.fft.fftshift(np.fft.irfft(image_ft, n=n_points, axis=-1), axes=-1) image_rt = image_rt.reshape(*original_stack, n_angles, n_points) return image_rt diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 69fdd1da37..4dee693351 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -20,7 +20,14 @@ np.float64, ] -ANGLES = [1, 50, 90, 117, 180, 360] +ANGLES = [ + 1, + 50, + pytest.param(90, marks=pytest.mark.expensive), + pytest.param(117, marks=pytest.mark.expensive), + pytest.param(180, marks=pytest.mark.expensive), + pytest.param(360, marks=pytest.mark.expensive), +] @pytest.fixture(params=DTYPES, ids=lambda x: f"dtype={x}", scope="module") @@ -42,7 +49,7 @@ def img_size(request): @pytest.fixture(params=ANGLES, ids=lambda x: f"angles={x}", scope="module") def num_ang(request): """ - Angles. + Angles (Degrees). """ return request.param @@ -50,7 +57,7 @@ def num_ang(request): @pytest.fixture def masked_image(dtype, img_size): """ - Creates a masked image fixture using camera data from Skikit-Image. + Creates a masked image fixture using camera data from Scikit-Image. """ g = grid_2d(img_size, normalized=True, shifted=True) mask = g["r"] < 1 @@ -63,7 +70,7 @@ def masked_image(dtype, img_size): # Image.project and compare results to skimage.radon def test_image_project(masked_image, num_ang): """ - Test Image.project on a single stack of images. Compares project method with skimage. + Test Image.project on a single stack of images. Compares project method output with skimage project. """ ny = masked_image.resolution angles = np.linspace(0, 360, num_ang, endpoint=False) @@ -83,8 +90,8 @@ def test_image_project(masked_image, num_ang): assert reference_sinogram.shape == (len(angles), ny), "Incorrect Shape" # compare project method on ski-image reference - nrms = np.sqrt(np.mean((s[0] - reference_sinogram) ** 2, axis=1)) / np.linalg.norm( - reference_sinogram, axis=1 + nrms = np.sqrt(np.mean((s[0] - reference_sinogram) ** 2, axis=-1)) / np.linalg.norm( + reference_sinogram, axis=-1 ) np.testing.assert_array_less(nrms, SK_TOL, "Error in image projections.") @@ -97,33 +104,35 @@ def test_multidim(num_ang): L = 512 # pixels n = 3 + m = 2 # Generate a mask g = grid_2d(L, normalized=True, shifted=True) mask = g["r"] < 1 # Generate images - imgs = Image(np.random.random((n, L, L))) * mask + imgs = Image(np.random.random((m, n, L, L))) * mask # Generate line project angles - angles = np.linspace(0, 180, num_ang, endpoint=False) + angles = np.linspace(0, 360, num_ang, endpoint=False) rads = angles / 180.0 * np.pi s = imgs.project(rads) # Compare - reference_sinograms = np.empty((n, num_ang, L)) - for i, img in enumerate(imgs): - # Compute the singleton case, and compare with the stack - single_sinogram = img.project(rads) - # These should be allclose up to determinism in the FFT and NUFFT. - np.testing.assert_allclose(s[i : i + 1], single_sinogram) - - # Next individually compute sk's radon transform for each image. - reference_sinograms[i] = radon(img._data[0], theta=angles[::-1]).T - - # Compare all lines in each sinogram with sk-image - for i in range(n): - nrms = np.sqrt( - np.mean((s[i] - reference_sinograms[i]) ** 2, axis=1) - ) / np.linalg.norm(reference_sinograms[i], axis=1) - np.testing.assert_array_less(nrms, SK_TOL, err_msg=f"Error in image {i}.") + reference_sinograms = np.empty((m, n, num_ang, L)) + for i in range(m): + for j in range(n): + img = imgs[i, j] + # Compute the singleton case, and compare with stack. + single_sinogram = img.project(rads) + + # These should be allclose up to determinism in the FFT and NUFFT. + np.testing.assert_allclose(s[i, j : j + 1], single_sinogram) + + # Next individually compute sk's radon transform for each image. + reference_sinograms[i, j] = radon(img._data[0], theta=angles[::-1]).T + + _nrms = np.sqrt(np.mean((s - reference_sinograms) ** 2, axis=-1)) / np.linalg.norm( + reference_sinograms, axis=-1 + ) + np.testing.assert_array_less(_nrms, SK_TOL, "Error in image projections.") From 2b2e01901c444ef1231848dc5fc07ebb57294d11 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Fri, 19 Jul 2024 04:10:13 -0400 Subject: [PATCH 031/433] Changed angle fixture description + Id Name --- tests/test_sinogram.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 4dee693351..56aa6776e0 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -46,10 +46,10 @@ def img_size(request): return request.param -@pytest.fixture(params=ANGLES, ids=lambda x: f"angles={x}", scope="module") +@pytest.fixture(params=ANGLES, ids=lambda x: f"n_angles={x}", scope="module") def num_ang(request): """ - Angles (Degrees). + Number of angles in radon transform. """ return request.param From fa8bd54785040fa0d243344be02b6bbd2357b275 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 19 Jul 2024 08:01:36 -0400 Subject: [PATCH 032/433] Docstring len cleanup --- src/aspire/image/image.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 613f393993..20d998afe6 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -188,9 +188,13 @@ def __init__(self, data, dtype=None): def project(self, angles): """ - Computes the Radon Transform on an Image Stack using Non-Uniform Fast Fourier Transforms. This method projects the Image stack along different angles and returns the Radon Transform. + Computes the Radon Transform on an Image Stack using + Non-Uniform Fast Fourier Transforms. This method projects the + Image stack along different angles and returns the Radon + Transform. - :param angles: A 1-D Numpy Array of angles in Radians. This is used to compute the Radon Transform at different angles. + :param angles: A 1-D Numpy Array of angles in Radians. + This is used to compute the Radon Transform at different angles. :return: Radon transform of the Image Stack. :rtype: Ndarray (stack size, number of angles, image resolution) """ From 2d5a459b1c1d59fc140aa521e44e94457acfae77 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 9 May 2024 10:21:18 -0400 Subject: [PATCH 033/433] add simple basis benchmark and plotting script [skip ci] --- bbenchmark/bbenchmark.py | 57 ++++++++++++++++++++++++++++++ bbenchmark/benchmark_gpu0.pkl | Bin 0 -> 307 bytes bbenchmark/benchmark_host.pkl | Bin 0 -> 307 bytes bbenchmark/plot_bb.py | 64 ++++++++++++++++++++++++++++++++++ 4 files changed, 121 insertions(+) create mode 100644 bbenchmark/bbenchmark.py create mode 100644 bbenchmark/benchmark_gpu0.pkl create mode 100644 bbenchmark/benchmark_host.pkl create mode 100644 bbenchmark/plot_bb.py diff --git a/bbenchmark/bbenchmark.py b/bbenchmark/bbenchmark.py new file mode 100644 index 0000000000..6c6320c101 --- /dev/null +++ b/bbenchmark/bbenchmark.py @@ -0,0 +1,57 @@ +import os +import pickle +from pprint import pprint +from time import perf_counter, time + +import matplotlib.pyplot as plt +import numpy as np +from aspire.basis import FFBBasis2D, FLEBasis2D +from aspire.downloader import emdb_2660 +from aspire.noise import WhiteNoiseAdder +from aspire.source import ArrayImageSource, Simulation + +# Download and cache volume map +vol = emdb_2660().astype(np.float64) # doubles +cached_image_fn = "simulated_images.npy" + +if os.path.exists(cached_image_fn): + print(f"Loading cached image source from {cached_image_fn}.") + sim = ArrayImageSource(np.load(cached_image_fn)) +else: + print("Generating Simulated Datatset") + sim = Simulation( + n=512, C=1, vols=vol, noise_adder=WhiteNoiseAdder.from_snr(0.1) + ).cache() + print(f"Saving to {cached_image_fn}") + np.save(cached_image_fn, sim.images[:].asnumpy()) + + +TIMES = {} +for L in [32, 64, 128, 256]: + print(f"Begin L={L}") + src = sim.downsample(L) + imgs = src.images[:] + TIMES[L] = {} + for basis_type in [FFBBasis2D, FLEBasis2D]: + # Construct basis + TIMES[L][basis_type.__name__] = {} + basis = basis_type(L, dtype=src.dtype) + + # Time expanding into basis + tic = perf_counter() + coef = basis.evaluate_t(imgs) + toc = perf_counter() + TIMES[L][basis_type.__name__]["evaluate_t"] = toc - tic + + # Time expanding back into images + tic = perf_counter() + _ = coef.evaluate() + toc = perf_counter() + TIMES[L][basis_type.__name__]["evaluate"] = toc - tic + + +pprint(TIMES) + + +with open(f"benchmark_{int(time())}.pkl", "wb") as fh: + pickle.dump(TIMES, fh) diff --git a/bbenchmark/benchmark_gpu0.pkl b/bbenchmark/benchmark_gpu0.pkl new file mode 100644 index 0000000000000000000000000000000000000000..e702dd442dced27acb26fcc3b3e395ce9f465585 GIT binary patch literal 307 zcmZo*nX19a00y;FG`tmnL=Tsno0C&wab~fR%M>s_wJb5GG_fQ#zGRBK{fB=m-#lPo z=;45g0>v(0*=`CnqZFvs#}!Fy28+7`_dcgM4hDt{R(A)1g!$SUKxL)g4nT7=m_P)J zyZseA`*#jt74}bVm#$9$s>oo2$TFJo@? J0igC$Jpf$(W#0e* literal 0 HcmV?d00001 diff --git a/bbenchmark/benchmark_host.pkl b/bbenchmark/benchmark_host.pkl new file mode 100644 index 0000000000000000000000000000000000000000..dc0dd2a1769fc52c9470986e74eb64864f59e7fe GIT binary patch literal 307 zcmZo*nX19a00y;FG`tmnL=Tsno0C&wab~fR%M>s_wJb5GG_fQ#zGRBK{l>F_wm|hg z957L!*k;SlN}yONP^*tClGY3scLzS3waO9<3>mEM4m>kTmTLf&m3lh>&COr}5iIWZ zmm4fH4}ewJUv3m%3ovVBHPKy1(9iTm;ktG~fPnyM$W- zvToDPIg_qJbek#on}>jO`!X;hX?O6pRZ8-OC=s5uZo?jA?UmgRJ_s6sonHA^-k?wb IsJ&DV0PQbeIsgCw literal 0 HcmV?d00001 diff --git a/bbenchmark/plot_bb.py b/bbenchmark/plot_bb.py new file mode 100644 index 0000000000..05f5350f4b --- /dev/null +++ b/bbenchmark/plot_bb.py @@ -0,0 +1,64 @@ +import os +import pickle +from pprint import pprint + +import matplotlib.pyplot as plt +import numpy as np + +host_fn = "benchmark_host.pkl" +gpu_fn = "benchmark_gpu0.pkl" + + +with open(host_fn, "rb") as fh: + host_times = pickle.load(fh) + +with open(gpu_fn, "rb") as fh: + gpu_times = pickle.load(fh) + +markers = {"FFBBasis2D": "8", "FLEBasis2D": "s"} + +# Evaluate_t +Ls = list(host_times.keys()) +for basis_type in markers.keys(): + plt.plot( + Ls, + [host_times[L][basis_type]["evaluate_t"] for L in Ls], + marker=markers[basis_type], + color="blue", + label=basis_type + "-host", + ) + plt.plot( + Ls, + [gpu_times[L][basis_type]["evaluate_t"] for L in Ls], + marker=markers[basis_type], + color="green", + label=basis_type + "-gpu", + ) +plt.title("Basis `evaluate_t` Permformance - Batch of 512 Images") +plt.xlabel("Image Pixel L (LxL)") +plt.ylabel("Time (seconds)") +plt.legend() +plt.savefig("evaluate_t.png") +plt.show() + +for basis_type in markers.keys(): + plt.plot( + Ls, + [host_times[L][basis_type]["evaluate"] for L in Ls], + marker=markers[basis_type], + color="blue", + label=basis_type + "-host", + ) + plt.plot( + Ls, + [gpu_times[L][basis_type]["evaluate"] for L in Ls], + marker=markers[basis_type], + color="green", + label=basis_type + "-gpu", + ) +plt.title("Basis `evaluate` Permformance - Batch of 512 Images") +plt.xlabel("Image Pixel L (LxL)") +plt.ylabel("Time (seconds)") +plt.legend() +plt.savefig("evaluate.png") +plt.show() From f4f41df23c8839ca3b3658f260e0325a4f35d437 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 4 Jun 2024 10:26:19 -0400 Subject: [PATCH 034/433] convert cufinufft towards cupy, keeping result on dvice --- pyproject.toml | 10 ++++----- src/aspire/nufft/cufinufft.py | 40 +++++++++++++++++------------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3cd57981ef..fcc0f7cf4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,11 +61,11 @@ dependencies = [ "Source" = "https://github.com/ComputationalCryoEM/ASPIRE-Python" [project.optional-dependencies] -gpu-102 = ["pycuda", "cupy-cuda102", "cufinufft==1.3"] -gpu-110 = ["pycuda", "cupy-cuda110", "cufinufft==1.3"] -gpu-111 = ["pycuda", "cupy-cuda111", "cufinufft==1.3"] -gpu-11x = ["pycuda", "cupy-cuda11x", "cufinufft==1.3"] -gpu-12x = ["pycuda", "cupy-cuda12x", "cufinufft==2.2.0"] +gpu-102 = ["cupy-cuda102", "cufinufft==1.3"] +gpu-110 = ["cupy-cuda110", "cufinufft==1.3"] +gpu-111 = ["cupy-cuda111", "cufinufft==1.3"] +gpu-11x = ["cupy-cuda11x", "cufinufft==1.3"] +gpu-12x = ["cupy-cuda12x", "cufinufft==2.2.0"] dev = [ "black", "bumpversion", diff --git a/src/aspire/nufft/cufinufft.py b/src/aspire/nufft/cufinufft.py index 465c0b23f9..2dceb08b80 100644 --- a/src/aspire/nufft/cufinufft.py +++ b/src/aspire/nufft/cufinufft.py @@ -1,9 +1,7 @@ import logging +import cupy as cp import numpy as np -import pycuda.autoinit # noqa: F401 -import pycuda.driver as cuda # noqa: F401 -import pycuda.gpuarray as gpuarray # noqa: F401 from cufinufft import Plan as cufPlan from aspire.nufft import Plan @@ -85,7 +83,7 @@ def __init__(self, sz, fourier_pts, epsilon=1e-8, ntransforms=1, **kwargs): # Note, I store self.fourier_pts_gpu so the GPUArrray life # is tied to instance, instead of this method. - self.fourier_pts_gpu = gpuarray.to_gpu(self.fourier_pts) + self.fourier_pts_gpu = cp.array(self.fourier_pts) self._transform_plan.setpts(*self.fourier_pts_gpu) self._adjoint_plan.setpts(*self.fourier_pts_gpu) @@ -99,7 +97,7 @@ def transform(self, signal): For a batch, signal should have shape `(*sz, ntransforms)`. :returns: Transformed signal of shape `num_pts` or - `(ntransforms, num_pts)`. + `(ntransforms, num_pts)` as CuPy array. """ # Check we're not forcing a dtype workaround for ASPIRE-Python/703, @@ -113,6 +111,8 @@ def transform(self, signal): " In the future this will be an error." ) + signal = cp.asarray(signal, dtype=self.complex_dtype) + sig_shape = signal.shape res_shape = self.num_pts # Note, there is a corner case for ntransforms == 1. @@ -134,17 +134,16 @@ def transform(self, signal): sig_shape == self.sz ), f"Signal frame to be transformed must have shape {self.sz}" - signal_gpu = gpuarray.to_gpu( - np.ascontiguousarray(signal, dtype=self.complex_dtype) - ) + result = cp.empty(res_shape, dtype=self.complex_dtype) - result_gpu = gpuarray.GPUArray(res_shape, dtype=self.complex_dtype) + if signal.dtype != self.complex_dtype: + signal = signal.astype(self.complex_dtype) - self._transform_plan.execute(signal_gpu, out=result_gpu) + self._transform_plan.execute(signal, out=result) - result = result_gpu.get() # ASPIRE-Python/703 - result = result.astype(complex_type(self._original_dtype), copy=False) + if result.dtype != complex_type(self._original_dtype): + result = result.astype(complex_type(self._original_dtype)) return result @@ -156,7 +155,7 @@ def adjoint(self, signal): this should be a a 1D array of len `num_pts`. For a batch, signal should have shape `(ntransforms, num_pts)`. - :returns: Transformed signal `(sz)` or `(sz, ntransforms)`. + :returns: Transformed signal `(sz)` or `(sz, ntransforms)` as CuPy array. """ # Check we're not forcing a dtype workaround for ASPIRE-Python/703, @@ -170,6 +169,8 @@ def adjoint(self, signal): " In the future this will be an error." ) + signal = cp.asarray(signal, dtype=self.complex_dtype) + res_shape = self.sz # Note, there is a corner case for ntransforms == 1. if self.ntransforms > 1 or (self.ntransforms == 1 and len(signal.shape) == 2): @@ -181,16 +182,15 @@ def adjoint(self, signal): ), "For multiple transforms, signal stack length should match ntransforms {self.ntransforms}." res_shape = (self.ntransforms, *self.sz) - signal_gpu = gpuarray.to_gpu( - np.ascontiguousarray(signal, dtype=self.complex_dtype) - ) + result = cp.empty(res_shape, dtype=self.complex_dtype) - result_gpu = gpuarray.GPUArray(res_shape, dtype=self.complex_dtype) + if signal.dtype != self.complex_dtype: + signal = signal.astype(self.complex_dtype) - self._adjoint_plan.execute(signal_gpu, out=result_gpu) + self._adjoint_plan.execute(signal, out=result) - result = result_gpu.get() # ASPIRE-Python/703 - result = result.astype(complex_type(self._original_dtype), copy=False) + if result.dtype != complex_type(self._original_dtype): + result = result.astype(complex_type(self._original_dtype)) return result From a60a3e0976f73e78a5427515705eff17d6096ba5 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 4 Jun 2024 10:49:11 -0400 Subject: [PATCH 035/433] convert anufft and nufft towards detecting whether to keep array on gpu [skip ci] --- src/aspire/nufft/__init__.py | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/aspire/nufft/__init__.py b/src/aspire/nufft/__init__.py index aa7c3a4adf..f748a10d84 100644 --- a/src/aspire/nufft/__init__.py +++ b/src/aspire/nufft/__init__.py @@ -2,6 +2,11 @@ import numpy as np +try: + import cupy as cp +except ModuleNotFoundError: + cp = None + from aspire import config from aspire.utils import LogFilterByCount, complex_type, real_type @@ -152,6 +157,9 @@ def anufft(sig_f, fourier_pts, sz, real=False, epsilon=1e-8): Selects best available package from `nfft` `backends` configuration list. + When sig_f is provided as a CuPy gpu array with a cufinufft + backend, result is maintained on GPU. + :param sig_f: Array representing the signal(s) in Fourier space to be transformed. \ sig_f either matches length of fourier_pts or sig_f.shape is stack of (`ntransforms`, ...). :param fourier_pts: The points in Fourier space where the Fourier transform is to be calculated, @@ -162,6 +170,10 @@ def anufft(sig_f, fourier_pts, sz, real=False, epsilon=1e-8): """ + on_gpu = False + if cp and isinstance(sig_f, cp.ndarray): + on_gpu = True + if fourier_pts.dtype != real_type(sig_f.dtype): raise RuntimeError( "anufft passed inconsistent dtypes." @@ -181,7 +193,13 @@ def anufft(sig_f, fourier_pts, sz, real=False, epsilon=1e-8): sz=sz, fourier_pts=fourier_pts, ntransforms=ntransforms, epsilon=epsilon ) adjoint = plan.adjoint(sig_f) - return np.real(adjoint) if real else adjoint + + adjoint = adjoint.real if real else adjoint + + if not on_gpu: + adjoint = adjoint.get() + + return adjoint def nufft(sig_f, fourier_pts, real=False, epsilon=1e-8): @@ -191,6 +209,9 @@ def nufft(sig_f, fourier_pts, real=False, epsilon=1e-8): Selects best available package from `nfft` `backends` configuration list. + When sig_f is provided as a CuPy gpu array with a cufinufft + backend, result is maintained on GPU. + :param sig_f: Array representing the signal(s) in real space to be transformed. \ sig_f either matches `sz` or sig_f.shape is stack of (..., `ntransforms`). :param fourier_pts: The points in Fourier space where the Fourier transform is to be calculated, @@ -200,6 +221,10 @@ def nufft(sig_f, fourier_pts, real=False, epsilon=1e-8): """ + on_gpu = False + if cp and isinstance(sig_f, cp.ndarray): + on_gpu = True + if fourier_pts.dtype != real_type(sig_f.dtype): raise RuntimeError( "nufft passed inconsistent dtypes." @@ -229,4 +254,10 @@ def nufft(sig_f, fourier_pts, real=False, epsilon=1e-8): sz=sz, fourier_pts=fourier_pts, ntransforms=ntransforms, epsilon=epsilon ) transform = plan.transform(sig_f) - return np.real(transform) if real else transform + + transform = transform.real if real else transform + + if not on_gpu: + transform = transform.get() + + return transform From 1a14068cbc6c9c1d8ef2cfaa355960508ccaf15b Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 5 Jun 2024 10:17:06 -0400 Subject: [PATCH 036/433] whitespace --- bbenchmark/bbenchmark.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bbenchmark/bbenchmark.py b/bbenchmark/bbenchmark.py index 6c6320c101..01aac6e7eb 100644 --- a/bbenchmark/bbenchmark.py +++ b/bbenchmark/bbenchmark.py @@ -5,6 +5,7 @@ import matplotlib.pyplot as plt import numpy as np + from aspire.basis import FFBBasis2D, FLEBasis2D from aspire.downloader import emdb_2660 from aspire.noise import WhiteNoiseAdder From 092cda07dedaec106f4fec98c33bbc09b87709b7 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 5 Jun 2024 10:16:54 -0400 Subject: [PATCH 037/433] add sparse cupy gpu wrapper and tests for methods in use --- src/aspire/numeric/__init__.py | 19 ++++++++++++ tests/test_numeric_sparse.py | 54 ++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 tests/test_numeric_sparse.py diff --git a/src/aspire/numeric/__init__.py b/src/aspire/numeric/__init__.py index d298f131e4..95283e5d87 100644 --- a/src/aspire/numeric/__init__.py +++ b/src/aspire/numeric/__init__.py @@ -35,3 +35,22 @@ def fft_object(which): fft = fft_object(config["common"]["fft"].as_str()) + + +# Configure `sparse` in tandem with `numeric` as the arrays generally will need to interoperate. +def sparse_object(which): + if which == "cupy": + from cupyx.scipy import sparse as SparseClass + + # CuPy imports don't work the same as scipy + from cupyx.scipy.sparse.linalg import eigsh + + SparseClass.linalg.eigsh = eigsh + elif which == "numpy": + from scipy import sparse as SparseClass + else: + raise RuntimeError(f"Invalid selection for sparse module: {which}") + return SparseClass + + +sparse = sparse_object(config["common"]["numeric"].as_str()) diff --git a/tests/test_numeric_sparse.py b/tests/test_numeric_sparse.py new file mode 100644 index 0000000000..3964419e21 --- /dev/null +++ b/tests/test_numeric_sparse.py @@ -0,0 +1,54 @@ +import numpy as np +import pytest + +from aspire.numeric import numeric_object, sparse_object + +# If cupy is not available, skip this entire test module +pytest.importorskip("cupy") + +NUMERICS = ["numpy", "cupy"] + + +@pytest.fixture(params=NUMERICS, ids=lambda x: f"{x}", scope="module") +def backends(request): + xp = numeric_object(request.param) + sparse = sparse_object(request.param) + return xp, sparse + + +def test_csr_matrix(backends): + """ + Create csr_matrix and multiply with an `xp` array. + """ + xp, sparse = backends + + m, n = 10, 10 + jdx = xp.arange(10) + idx = xp.arange(10) + vals = xp.random.random(10) + + # Compute dense matmul + _A = np.diag(xp.asnumpy(vals)) + _B = np.random.random((10, 20)) + _C = _A @ _B + + # Compute matmul using sparse csr + A = sparse.csr_matrix((vals, (jdx, idx)), shape=(m, n), dtype=np.float64) + B = xp.array(_B) + C = A @ B + + # Compare + np.testing.assert_allclose(_C, xp.asnumpy(C)) + + +def test_eigsh(backends): + """ + Invoke sparse eigsh call with `xp` arrays. + """ + xp, sparse = backends + + A = xp.eye(123) + + lamb, _ = sparse.linalg.eigsh(A) + np.testing.assert_allclose(xp.asnumpy(lamb), 1.0) + print(lamb) From 415c9410ab6574a22888fb016c09a5853b04314b Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 5 Jun 2024 15:11:20 -0400 Subject: [PATCH 038/433] fixup mn --- tests/test_numeric_sparse.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_numeric_sparse.py b/tests/test_numeric_sparse.py index 3964419e21..45c28bef31 100644 --- a/tests/test_numeric_sparse.py +++ b/tests/test_numeric_sparse.py @@ -23,13 +23,13 @@ def test_csr_matrix(backends): xp, sparse = backends m, n = 10, 10 - jdx = xp.arange(10) - idx = xp.arange(10) + jdx = xp.arange(m) + idx = xp.arange(n) vals = xp.random.random(10) # Compute dense matmul _A = np.diag(xp.asnumpy(vals)) - _B = np.random.random((10, 20)) + _B = np.random.random((n, 20)) _C = _A @ _B # Compute matmul using sparse csr From 62d46204896dce87955638a8998fd3149925516f Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 5 Jun 2024 10:46:35 -0400 Subject: [PATCH 039/433] first pass migrating FLE to cupy via xp --- src/aspire/basis/fle_2d.py | 37 ++++++++++++++++++-------------- src/aspire/basis/fle_2d_utils.py | 16 ++++++++------ src/aspire/config_default.yaml | 2 +- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/src/aspire/basis/fle_2d.py b/src/aspire/basis/fle_2d.py index 423d37c093..ce6f04d3a2 100644 --- a/src/aspire/basis/fle_2d.py +++ b/src/aspire/basis/fle_2d.py @@ -1,7 +1,6 @@ import logging import numpy as np -import scipy.sparse as sparse from scipy.fft import dct, idct from scipy.special import jv @@ -13,7 +12,7 @@ transform_complex_to_real, ) from aspire.nufft import anufft, nufft -from aspire.numeric import fft +from aspire.numeric import fft, sparse, xp from aspire.operators import DiagMatrix from aspire.utils import complex_type, grid_2d @@ -440,7 +439,7 @@ def _create_basis_functions(self): """ Generate the actual basis functions as Python lambda operators """ - norm_constants = np.zeros(self.count) + norm_constants = xp.zeros(self.count) basis_functions = [None] * self.count for i in range(self.count): # parameters defining the basis function: bessel order and which bessel root @@ -537,13 +536,14 @@ def _step2_t(self, z): num_img = z.shape[0] # Compute FFT along angular nodes betas = fft.fft(z, axis=2) / self.num_angular_nodes + betas = xp.asarray(betas) # RM betas = betas[:, :, self.nus] - betas = np.conj(betas) - betas = np.swapaxes(betas, 0, 2) + betas = betas.conj() + betas = betas.swapaxes(0, 2) betas = betas.reshape(-1, self.num_radial_nodes * num_img) betas = self.c2r_nus @ betas betas = betas.reshape(-1, self.num_radial_nodes, num_img) - betas = np.real(np.swapaxes(betas, 0, 2)) + betas = betas.swapaxes(0, 2).real return betas def _step3_t(self, betas): @@ -554,18 +554,20 @@ def _step3_t(self, betas): """ num_img = betas.shape[0] if self.num_interp > self.num_radial_nodes: + betas = xp.asnumpy(betas) betas = dct(betas, axis=1, type=2) / (2 * self.num_radial_nodes) zeros = np.zeros(betas.shape) betas = np.concatenate((betas, zeros), axis=1) betas = idct(betas, axis=1, type=2) * 2 * betas.shape[1] - betas = np.moveaxis(betas, 0, -1) + betas = xp.asarray(betas) + betas = xp.moveaxis(betas, 0, -1) - coefs = np.zeros((self.count, num_img), dtype=np.float64) + coefs = xp.zeros((self.count, num_img), dtype=np.float64) for i in range(self.ell_p_max + 1): coefs[self.idx_list[i]] = self.A3[i] @ betas[:, i, :] coefs = coefs.T - return coefs * self.norm_constants / self.h + return xp.asnumpy(coefs * self.norm_constants / self.h) def _step3(self, coefs): """ @@ -574,19 +576,20 @@ def _step3(self, coefs): Uses barycenteric interpolation in reverse to compute values of Betas at Chebyshev nodes, given an array of FLE coefficients. """ - coefs = coefs.copy().reshape(-1, self.count) + coefs = xp.asarray(coefs.reshape(-1, self.count)) num_img = coefs.shape[0] coefs *= self.h * self.norm_constants coefs = coefs.T - out = np.zeros( + out = xp.zeros( (self.num_interp, 2 * self.max_ell + 1, num_img), dtype=np.float64, ) for i in range(self.ell_p_max + 1): out[:, i, :] = self.A3_T[i] @ coefs[self.idx_list[i]] - out = np.moveaxis(out, -1, 0) + out = xp.moveaxis(out, -1, 0) if self.num_interp > self.num_radial_nodes: + out = xp.asnumpy(out) # RM out = dct(out, axis=1, type=2) out = out[:, : self.num_radial_nodes, :] out = idct(out, axis=1, type=2) @@ -599,19 +602,21 @@ def _step2(self, betas): to images). Uses the IFFT to convert Beta values into Fourier-space images. """ + betas = xp.asarray(betas) num_img = betas.shape[0] - tmp = np.zeros( + tmp = xp.zeros( (num_img, self.num_radial_nodes, self.num_angular_nodes), dtype=np.complex128, ) - betas = np.swapaxes(betas, 0, 2) + betas = betas.swapaxes(0, 2) betas = betas.reshape(-1, self.num_radial_nodes * num_img) betas = self.r2c_nus @ betas betas = betas.reshape(-1, self.num_radial_nodes, num_img) - betas = np.swapaxes(betas, 0, 2) + betas = betas.swapaxes(0, 2) - tmp[:, :, self.nus] = np.conj(betas) + tmp[:, :, self.nus] = betas.conj() + tmp = xp.asnumpy(tmp) # rm z = fft.ifft(tmp, axis=2) return z diff --git a/src/aspire/basis/fle_2d_utils.py b/src/aspire/basis/fle_2d_utils.py index cde0cd11bf..23d1441a68 100644 --- a/src/aspire/basis/fle_2d_utils.py +++ b/src/aspire/basis/fle_2d_utils.py @@ -1,5 +1,6 @@ import numpy as np -import scipy.sparse as sparse + +from aspire.numeric import sparse, xp def transform_complex_to_real(B, ells): @@ -43,9 +44,9 @@ def precomp_transform_complex_to_real(ells): """ count = len(ells) num_nonzero = np.sum(ells == 0) + 2 * np.sum(ells != 0) - idx = np.zeros(num_nonzero, dtype=int) - jdx = np.zeros(num_nonzero, dtype=int) - vals = np.zeros(num_nonzero, dtype=np.complex128) + idx = xp.zeros(num_nonzero, dtype=int) + jdx = xp.zeros(num_nonzero, dtype=int) + vals = xp.zeros(num_nonzero, dtype=np.complex128) k = 0 for i in range(count): @@ -190,9 +191,10 @@ def barycentric_interp_sparse(target_points, known_points, numsparse): # note that const cancels in numerator and denominator vals = vals / denom.reshape(-1, 1) - vals = vals.flatten() - idx = idx.flatten() - jdx = jdx.flatten() + # TODO, migrate more of this method towards `xp` + vals = xp.array(vals.flatten()) + idx = xp.array(idx.flatten()) + jdx = xp.array(jdx.flatten()) # A is the linear operator mapping the function values from the fixed source # points to the fixed target points. # A(i,j) = \ell(x[i] ) w_j/(x[i] - xs[j]), with the notation in Eq. 3.3 diff --git a/src/aspire/config_default.yaml b/src/aspire/config_default.yaml index def78983c0..26176a97ac 100644 --- a/src/aspire/config_default.yaml +++ b/src/aspire/config_default.yaml @@ -1,7 +1,7 @@ version: 0.12.3 common: # numeric module to use - one of numpy/cupy - numeric: numpy + numeric: cupy # fft backend to use - one of pyfftw/scipy/cupy/mkl fft: scipy From 51f60dbc201b58d36b7bfdf46ca21b24ced3c205 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 5 Jun 2024 11:02:32 -0400 Subject: [PATCH 040/433] add dct/idct to pyfftw, scipy, cupy wrappers --- src/aspire/basis/fle_2d.py | 13 ++++++------- src/aspire/numeric/cupy_fft.py | 6 ++++++ src/aspire/numeric/pyfftw_fft.py | 6 ++++++ src/aspire/numeric/scipy_fft.py | 6 ++++++ 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/aspire/basis/fle_2d.py b/src/aspire/basis/fle_2d.py index ce6f04d3a2..5675becf86 100644 --- a/src/aspire/basis/fle_2d.py +++ b/src/aspire/basis/fle_2d.py @@ -1,7 +1,6 @@ import logging import numpy as np -from scipy.fft import dct, idct from scipy.special import jv from aspire.basis import Coef, FBBasisMixin, SteerableBasis2D @@ -555,10 +554,10 @@ def _step3_t(self, betas): num_img = betas.shape[0] if self.num_interp > self.num_radial_nodes: betas = xp.asnumpy(betas) - betas = dct(betas, axis=1, type=2) / (2 * self.num_radial_nodes) + betas = fft.dct(betas, axis=1, type=2) / (2 * self.num_radial_nodes) zeros = np.zeros(betas.shape) betas = np.concatenate((betas, zeros), axis=1) - betas = idct(betas, axis=1, type=2) * 2 * betas.shape[1] + betas = fft.idct(betas, axis=1, type=2) * 2 * betas.shape[1] betas = xp.asarray(betas) betas = xp.moveaxis(betas, 0, -1) @@ -590,9 +589,9 @@ def _step3(self, coefs): out = xp.moveaxis(out, -1, 0) if self.num_interp > self.num_radial_nodes: out = xp.asnumpy(out) # RM - out = dct(out, axis=1, type=2) + out = fft.dct(out, axis=1, type=2) out = out[:, : self.num_radial_nodes, :] - out = idct(out, axis=1, type=2) + out = fft.idct(out, axis=1, type=2) return out @@ -736,10 +735,10 @@ def _radial_convolve_weights(self, b): b = np.squeeze(b) b = np.array(b) if self.num_interp > self.num_radial_nodes: - b = dct(b, axis=0, type=2) / (2 * self.num_radial_nodes) + b = fft.dct(b, axis=0, type=2) / (2 * self.num_radial_nodes) bz = np.zeros(b.shape) b = np.concatenate((b, bz), axis=0) - b = idct(b, axis=0, type=2) * 2 * b.shape[0] + b = fft.idct(b, axis=0, type=2) * 2 * b.shape[0] a = np.zeros(self.count, dtype=np.float64) y = [None] * (self.ell_p_max + 1) for i in range(self.ell_p_max + 1): diff --git a/src/aspire/numeric/cupy_fft.py b/src/aspire/numeric/cupy_fft.py index 4f45f92117..3327c78f7d 100644 --- a/src/aspire/numeric/cupy_fft.py +++ b/src/aspire/numeric/cupy_fft.py @@ -33,3 +33,9 @@ def fftshift(self, x, axes=None): def ifftshift(self, x, axes=None): return cp.fft.ifftshift(x, axes=axes) + + def dct(self, *args, **kwargs): + return cp.fft.dct(*args, **kwargs) + + def idct(self, *args, **kwargs): + return cp.fft.idct(*args, **kwargs) diff --git a/src/aspire/numeric/pyfftw_fft.py b/src/aspire/numeric/pyfftw_fft.py index 9cfdd45210..afcad98d28 100644 --- a/src/aspire/numeric/pyfftw_fft.py +++ b/src/aspire/numeric/pyfftw_fft.py @@ -159,3 +159,9 @@ def fftshift(self, a, axes=None): def ifftshift(self, a, axes=None): return scipy_fft.ifftshift(a, axes=axes) + + def dct(self, *args, **kwargs): + return scipy_fft.dct(*args, **kwargs) + + def idct(self, *args, **kwargs): + return scipy_fft.idct(*args, **kwargs) diff --git a/src/aspire/numeric/scipy_fft.py b/src/aspire/numeric/scipy_fft.py index c5a392f96b..d78e463803 100644 --- a/src/aspire/numeric/scipy_fft.py +++ b/src/aspire/numeric/scipy_fft.py @@ -33,3 +33,9 @@ def fftshift(self, x, axes=None): def ifftshift(self, x, axes=None): return sp.fft.ifftshift(x, axes=axes) + + def dct(self, *args, **kwargs): + return sp.fft.dct(*args, **kwargs) + + def idct(self, *args, **kwargs): + return sp.fft.idct(*args, **kwargs) From 61e7db1a0a3b9218fa69e094ecf34a5dad57c488 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 5 Jun 2024 11:52:13 -0400 Subject: [PATCH 041/433] phase 2, fle internals --- src/aspire/basis/fle_2d.py | 15 ++++----------- src/aspire/config_default.yaml | 2 +- src/aspire/image/image.py | 7 +++++-- src/aspire/numeric/__init__.py | 15 +++++++++++++++ src/aspire/numeric/cupy_fft.py | 5 +++-- src/aspire/numeric/numpy.py | 7 ++++++- 6 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/aspire/basis/fle_2d.py b/src/aspire/basis/fle_2d.py index 5675becf86..6215baaca8 100644 --- a/src/aspire/basis/fle_2d.py +++ b/src/aspire/basis/fle_2d.py @@ -496,7 +496,7 @@ def _evaluate_t(self, imgs): coefficients. """ # See Section 3.5 - imgs = imgs.copy() + imgs = xp.array(imgs) # Copy here, mutating. imgs[:, self.radial_mask] = 0 z = self._step1_t(imgs) b = self._step2_t(z) @@ -513,7 +513,7 @@ def _step1_t(self, im): """ im = im.reshape(-1, self.nres, self.nres).astype(complex_type(self.dtype)) num_img = im.shape[0] - z = np.zeros( + z = xp.zeros( (num_img, self.num_radial_nodes, self.num_angular_nodes), dtype=complex_type(self.dtype), ) @@ -535,7 +535,6 @@ def _step2_t(self, z): num_img = z.shape[0] # Compute FFT along angular nodes betas = fft.fft(z, axis=2) / self.num_angular_nodes - betas = xp.asarray(betas) # RM betas = betas[:, :, self.nus] betas = betas.conj() betas = betas.swapaxes(0, 2) @@ -553,12 +552,9 @@ def _step3_t(self, betas): """ num_img = betas.shape[0] if self.num_interp > self.num_radial_nodes: - betas = xp.asnumpy(betas) betas = fft.dct(betas, axis=1, type=2) / (2 * self.num_radial_nodes) - zeros = np.zeros(betas.shape) - betas = np.concatenate((betas, zeros), axis=1) + betas = xp.concatenate((betas, xp.zeros(betas.shape)), axis=1) betas = fft.idct(betas, axis=1, type=2) * 2 * betas.shape[1] - betas = xp.asarray(betas) betas = xp.moveaxis(betas, 0, -1) coefs = xp.zeros((self.count, num_img), dtype=np.float64) @@ -588,7 +584,6 @@ def _step3(self, coefs): out[:, i, :] = self.A3_T[i] @ coefs[self.idx_list[i]] out = xp.moveaxis(out, -1, 0) if self.num_interp > self.num_radial_nodes: - out = xp.asnumpy(out) # RM out = fft.dct(out, axis=1, type=2) out = out[:, : self.num_radial_nodes, :] out = fft.idct(out, axis=1, type=2) @@ -601,7 +596,6 @@ def _step2(self, betas): to images). Uses the IFFT to convert Beta values into Fourier-space images. """ - betas = xp.asarray(betas) num_img = betas.shape[0] tmp = xp.zeros( (num_img, self.num_radial_nodes, self.num_angular_nodes), @@ -615,7 +609,6 @@ def _step2(self, betas): betas = betas.swapaxes(0, 2) tmp[:, :, self.nus] = betas.conj() - tmp = xp.asnumpy(tmp) # rm z = fft.ifft(tmp, axis=2) return z @@ -639,7 +632,7 @@ def _step1(self, z): im = im.reshape(num_img, self.nres, self.nres) im[:, self.radial_mask] = 0 - return im + return xp.asnumpy(im) def _create_dense_matrix(self): """ diff --git a/src/aspire/config_default.yaml b/src/aspire/config_default.yaml index 26176a97ac..fed4cea50a 100644 --- a/src/aspire/config_default.yaml +++ b/src/aspire/config_default.yaml @@ -3,7 +3,7 @@ common: # numeric module to use - one of numpy/cupy numeric: cupy # fft backend to use - one of pyfftw/scipy/cupy/mkl - fft: scipy + fft: cupy # Set cache directory for ASPIRE example data. # By default the cache location will be set by pooch.os_cache(), diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 20d998afe6..40d6087f13 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -393,11 +393,14 @@ def downsample(self, ds_res): im = self.stack_reshape(-1) # compute FT with centered 0-frequency - fx = fft.centered_fft2(im._data) + fx = xp.asnumpy(fft.centered_fft2(xp.asarray(im._data))) # crop 2D Fourier transform for each image crop_fx = np.array([crop_pad_2d(fx[i], ds_res) for i in range(self.n_images)]) # take back to real space, discard complex part, and scale - out = np.real(fft.centered_ifft2(crop_fx)) * (ds_res**2 / self.resolution**2) + out = fft.centered_ifft2(xp.asarray(crop_fx)).real * ( + ds_res**2 / self.resolution**2 + ) + out = xp.asnumpy(out) return self.__class__(out).stack_reshape(original_stack_shape) diff --git a/src/aspire/numeric/__init__.py b/src/aspire/numeric/__init__.py index 95283e5d87..be88775498 100644 --- a/src/aspire/numeric/__init__.py +++ b/src/aspire/numeric/__init__.py @@ -36,6 +36,21 @@ def fft_object(which): fft = fft_object(config["common"]["fft"].as_str()) +# Sanity check. +if (config["common"]["numeric"].as_str() == "cupy") and ( + config["common"]["fft"].as_str() != "cupy" +): + raise RuntimeError( + "Using `cupy` numeric backend without `cupy` fft is unsupported." + ) + +if (config["common"]["fft"].as_str() == "cupy") and ( + config["common"]["numeric"].as_str() != "cupy" +): + raise RuntimeError( + "Using `cupy` fft without `cupy` numeric backend is unsupported." + ) + # Configure `sparse` in tandem with `numeric` as the arrays generally will need to interoperate. def sparse_object(which): diff --git a/src/aspire/numeric/cupy_fft.py b/src/aspire/numeric/cupy_fft.py index 3327c78f7d..29939e504c 100644 --- a/src/aspire/numeric/cupy_fft.py +++ b/src/aspire/numeric/cupy_fft.py @@ -1,4 +1,5 @@ import cupy as cp +import cupyx.scipy.fft as cufft from aspire.numeric.base_fft import FFT @@ -35,7 +36,7 @@ def ifftshift(self, x, axes=None): return cp.fft.ifftshift(x, axes=axes) def dct(self, *args, **kwargs): - return cp.fft.dct(*args, **kwargs) + return cufft.dct(*args, **kwargs) def idct(self, *args, **kwargs): - return cp.fft.idct(*args, **kwargs) + return cufft.idct(*args, **kwargs) diff --git a/src/aspire/numeric/numpy.py b/src/aspire/numeric/numpy.py index 3237c2c3ad..9367409c78 100644 --- a/src/aspire/numeric/numpy.py +++ b/src/aspire/numeric/numpy.py @@ -1,8 +1,13 @@ +import cupy as cp import numpy as np class Numpy: - asnumpy = staticmethod(lambda x: x) + @staticmethod + def asnumpy(x): + if isinstance(x, cp.ndarray): + x = x.get() + return x def __getattr__(self, item): """ From a84fb5a75d90a292c1d71d6728926a45447d84ae Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 5 Jun 2024 12:20:05 -0400 Subject: [PATCH 042/433] mem cleanup workaround --- src/aspire/basis/fle_2d.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/aspire/basis/fle_2d.py b/src/aspire/basis/fle_2d.py index 6215baaca8..4278331e1a 100644 --- a/src/aspire/basis/fle_2d.py +++ b/src/aspire/basis/fle_2d.py @@ -1,3 +1,4 @@ +import gc import logging import numpy as np @@ -18,6 +19,19 @@ logger = logging.getLogger(__name__) +def _cleanup(): + """ + Utility for informing python+cupy to cleanup memory held by old vars. + """ + gc.collect() + try: + import cupy + + cupy.get_default_memory_pool().free_all_blocks() + except ModuleNotFoundError: + pass + + class FLEBasis2D(SteerableBasis2D, FBBasisMixin): """ Define a derived class for Fast Fourier Bessel 2D expansion using interpolation @@ -499,12 +513,20 @@ def _evaluate_t(self, imgs): imgs = xp.array(imgs) # Copy here, mutating. imgs[:, self.radial_mask] = 0 z = self._step1_t(imgs) + del imgs + _cleanup() + b = self._step2_t(z) + del z + _cleanup() + coefs = self._step3_t(b) + del b + _cleanup() # return in FB order coefs = coefs[..., self._fle_to_fb_indices] - return coefs.astype(self.coefficient_dtype, copy=False) + return xp.asnumpy(coefs.astype(self.coefficient_dtype)) def _step1_t(self, im): """ @@ -562,7 +584,7 @@ def _step3_t(self, betas): coefs[self.idx_list[i]] = self.A3[i] @ betas[:, i, :] coefs = coefs.T - return xp.asnumpy(coefs * self.norm_constants / self.h) + return coefs * self.norm_constants / self.h def _step3(self, coefs): """ From 584330935be33f75c451972d78bcf5722e226232 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 5 Jun 2024 14:54:57 -0400 Subject: [PATCH 043/433] cupy eigvals needs large problem or nans... --- tests/test_numeric_sparse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_numeric_sparse.py b/tests/test_numeric_sparse.py index 45c28bef31..120a7de49f 100644 --- a/tests/test_numeric_sparse.py +++ b/tests/test_numeric_sparse.py @@ -47,7 +47,7 @@ def test_eigsh(backends): """ xp, sparse = backends - A = xp.eye(123) + A = xp.eye(1234) lamb, _ = sparse.linalg.eigsh(A) np.testing.assert_allclose(xp.asnumpy(lamb), 1.0) From a780c51a4c40dd1c36d39005afbe4e3deb7be615 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 5 Jun 2024 14:55:34 -0400 Subject: [PATCH 044/433] crop pad updates --- src/aspire/image/image.py | 6 +++--- src/aspire/utils/coor_trans.py | 14 +++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 40d6087f13..5ea20e2343 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -393,11 +393,11 @@ def downsample(self, ds_res): im = self.stack_reshape(-1) # compute FT with centered 0-frequency - fx = xp.asnumpy(fft.centered_fft2(xp.asarray(im._data))) + fx = fft.centered_fft2(xp.asarray(im._data)) # crop 2D Fourier transform for each image - crop_fx = np.array([crop_pad_2d(fx[i], ds_res) for i in range(self.n_images)]) + crop_fx = crop_pad_2d(fx, ds_res) # take back to real space, discard complex part, and scale - out = fft.centered_ifft2(xp.asarray(crop_fx)).real * ( + out = fft.centered_ifft2(crop_fx).real * ( ds_res**2 / self.resolution**2 ) out = xp.asnumpy(out) diff --git a/src/aspire/utils/coor_trans.py b/src/aspire/utils/coor_trans.py index e909e2f394..844f218551 100644 --- a/src/aspire/utils/coor_trans.py +++ b/src/aspire/utils/coor_trans.py @@ -8,6 +8,7 @@ from numpy.linalg import norm from scipy.linalg import svd +from aspire.numeric import xp from aspire.utils.random import Random from aspire.utils.rotation import Rotation @@ -368,23 +369,26 @@ def rots_to_clmatrix(rots, n_theta): def crop_pad_2d(im, size, fill_value=0): """ - :param im: A 2-dimensional numpy array + :param im: A >=2-dimensional numpy array :param size: Integer size of cropped/padded output - :return: A numpy array of shape (size, size) + :return: A numpy array of shape (..., size, size) """ - im_y, im_x = im.shape + im_y, im_x = im.shape[-2:] # shift terms start_x = math.floor(im_x / 2) - math.floor(size / 2) start_y = math.floor(im_y / 2) - math.floor(size / 2) # cropping if size <= min(im_y, im_x): - return im[start_y : start_y + size, start_x : start_x + size] + return im[..., start_y : start_y + size, start_x : start_x + size] # padding elif size >= max(im_y, im_x): + # Determine shape + shape = list(im.shape[:-2]) + shape.extend([size,size]) # ensure that we return in the same dtype as the input - to_return = fill_value * np.ones((size, size), dtype=im.dtype) + to_return = xp.full(shape, fill_value, dtype=im.dtype) # when padding, start_x and start_y are negative since size is larger # than im_x and im_y; the below line calculates where the original image # is placed in relation to the (now-larger) box size From f4c8bf78db12bf844f3b9109bd22f2832c8bb199 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 5 Jun 2024 14:56:56 -0400 Subject: [PATCH 045/433] tox cleanup [skip ci] --- src/aspire/image/image.py | 4 +--- src/aspire/utils/coor_trans.py | 2 +- tests/test_numeric_sparse.py | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 5ea20e2343..cbe0bbf07d 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -397,9 +397,7 @@ def downsample(self, ds_res): # crop 2D Fourier transform for each image crop_fx = crop_pad_2d(fx, ds_res) # take back to real space, discard complex part, and scale - out = fft.centered_ifft2(crop_fx).real * ( - ds_res**2 / self.resolution**2 - ) + out = fft.centered_ifft2(crop_fx).real * (ds_res**2 / self.resolution**2) out = xp.asnumpy(out) return self.__class__(out).stack_reshape(original_stack_shape) diff --git a/src/aspire/utils/coor_trans.py b/src/aspire/utils/coor_trans.py index 844f218551..dfb1c630f1 100644 --- a/src/aspire/utils/coor_trans.py +++ b/src/aspire/utils/coor_trans.py @@ -386,7 +386,7 @@ def crop_pad_2d(im, size, fill_value=0): elif size >= max(im_y, im_x): # Determine shape shape = list(im.shape[:-2]) - shape.extend([size,size]) + shape.extend([size, size]) # ensure that we return in the same dtype as the input to_return = xp.full(shape, fill_value, dtype=im.dtype) # when padding, start_x and start_y are negative since size is larger diff --git a/tests/test_numeric_sparse.py b/tests/test_numeric_sparse.py index 120a7de49f..288e41a176 100644 --- a/tests/test_numeric_sparse.py +++ b/tests/test_numeric_sparse.py @@ -51,4 +51,3 @@ def test_eigsh(backends): lamb, _ = sparse.linalg.eigsh(A) np.testing.assert_allclose(xp.asnumpy(lamb), 1.0) - print(lamb) From 440175c9eb67d273826a9b38ec3e68b16b8cdb1b Mon Sep 17 00:00:00 2001 From: "Joshua C. Carmichael" Date: Tue, 4 Jun 2024 16:06:28 -0400 Subject: [PATCH 046/433] evaluate_t on gpu. --- src/aspire/basis/ffb_2d.py | 37 +++++++++++++++++-------------------- src/aspire/image/image.py | 2 +- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/aspire/basis/ffb_2d.py b/src/aspire/basis/ffb_2d.py index 5a5c7c3f27..e9e6ab90a8 100644 --- a/src/aspire/basis/ffb_2d.py +++ b/src/aspire/basis/ffb_2d.py @@ -193,56 +193,53 @@ def _evaluate_t(self, x): n_images = x.shape[0] # resamping x in a polar Fourier gird using nonuniform discrete Fourier transform - pf = nufft(x, 2 * pi * freqs) - pf = np.reshape(pf, (n_images, n_r, n_theta)) + pf = nufft(xp.array(x), 2 * pi * freqs) + pf = pf.reshape(n_images, n_r, n_theta) # Recover "negative" frequencies from "positive" half plane. - pf = np.concatenate((pf, pf.conjugate()), axis=2) + pf = xp.concatenate((pf, pf.conjugate()), axis=2) # evaluate radial integral using the Gauss-Legendre quadrature rule - for i_r in range(0, n_r): - pf[:, i_r, :] = pf[:, i_r, :] * ( - self._precomp["gl_weights"][i_r] * self._precomp["gl_nodes"][i_r] - ) + pf = pf * (xp.array(self._precomp["gl_weights"]) * xp.array(self._precomp["gl_nodes"]))[None, :, None] # 1D FFT on the angular dimension for each concentric circle - pf = 2 * pi / (2 * n_theta) * xp.asnumpy(fft.fft(xp.asarray(pf))) + pf = 2 * xp.pi / (2 * n_theta) * fft.fft(pf) # This only makes it easier to slice the array later. - v = np.zeros((n_images, self.count), dtype=x.dtype) + v = xp.zeros((n_images, self.count), dtype=x.dtype) # go through each basis function and find the corresponding coefficient ind = 0 - idx = ind + np.arange(self.k_max[0]) + idx = ind + xp.arange(self.k_max[0]) # include the normalization factor of angular part into radial part - radial_norm = self._precomp["radial"] / np.expand_dims(self.angular_norms, 1) + radial_norm = xp.array(self._precomp["radial"] / np.expand_dims(self.angular_norms, 1)) v[:, self._zero_angular_inds] = pf[:, :, 0].real @ radial_norm[idx].T - ind = ind + np.size(idx) + ind = ind + idx.size ind_pos = ind for ell in range(1, self.ell_max + 1): - idx = ind + np.arange(self.k_max[ell]) - idx_pos = ind_pos + np.arange(self.k_max[ell]) + idx = ind + xp.arange(self.k_max[ell]) + idx_pos = ind_pos + xp.arange(self.k_max[ell]) idx_neg = idx_pos + self.k_max[ell] v_ell = pf[:, :, ell] @ radial_norm[idx].T if np.mod(ell, 2) == 0: - v_pos = np.real(v_ell) - v_neg = -np.imag(v_ell) + v_pos = v_ell.real + v_neg = -v_ell.imag else: - v_pos = np.imag(v_ell) - v_neg = np.real(v_ell) + v_pos = v_ell.imag + v_neg = v_ell.real v[:, idx_pos] = v_pos v[:, idx_neg] = v_neg - ind = ind + np.size(idx) + ind = ind + idx.size ind_pos = ind_pos + 2 * self.k_max[ell] - return v + return xp.asnumpy(v) def filter_to_basis_mat(self, f, **kwargs): """ diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index cbe0bbf07d..d1f9dc8c04 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -400,7 +400,7 @@ def downsample(self, ds_res): out = fft.centered_ifft2(crop_fx).real * (ds_res**2 / self.resolution**2) out = xp.asnumpy(out) - return self.__class__(out).stack_reshape(original_stack_shape) + return self.__class__(np.array(out.get())).stack_reshape(original_stack_shape) def filter(self, filter): """ From a64b8728f159463ff3a0620513a5b3a2651ef435 Mon Sep 17 00:00:00 2001 From: "Joshua C. Carmichael" Date: Wed, 5 Jun 2024 16:06:21 -0400 Subject: [PATCH 047/433] Optimize ffb2d for gpu. --- src/aspire/basis/ffb_2d.py | 56 ++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/src/aspire/basis/ffb_2d.py b/src/aspire/basis/ffb_2d.py index e9e6ab90a8..996e44f95a 100644 --- a/src/aspire/basis/ffb_2d.py +++ b/src/aspire/basis/ffb_2d.py @@ -105,6 +105,7 @@ def _evaluate(self, v): coordinate basis. This is Image instance with resolution of `self.sz` and the first dimension correspond to remaining dimension of `v`. """ + v = xp.array(v) sz_roll = v.shape[:-1] v = v.reshape(-1, self.count) @@ -112,27 +113,29 @@ def _evaluate(self, v): n_data = v.shape[0] # get information on polar grids from precomputed data - n_theta = np.size(self._precomp["freqs"], 2) - n_r = np.size(self._precomp["freqs"], 1) + n_theta = self._precomp["freqs"].shape[2] + n_r = self._precomp["freqs"].shape[1] # go through each basis function and find corresponding coefficient - pf = np.zeros((n_data, 2 * n_theta, n_r), dtype=complex_type(self.dtype)) + pf = xp.zeros((n_data, 2 * n_theta, n_r), dtype=complex_type(self.dtype)) ind = 0 - idx = ind + np.arange(self.k_max[0], dtype=int) + idx = ind + xp.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) - pf[:, 0, :] = v[:, self._zero_angular_inds] @ radial_norm[idx] - ind = ind + np.size(idx) + radial_norm = xp.array(self._precomp["radial"]) / xp.array( + np.expand_dims(self.angular_norms, 1) + ) + pf[:, 0, :] = v[:, xp.array(self._zero_angular_inds)] @ radial_norm[idx] + ind = ind + idx.size ind_pos = ind for ell in range(1, self.ell_max + 1): - 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] + idx = ind + xp.arange(self.k_max[ell], dtype=int) + idx_pos = ind_pos + xp.arange(self.k_max[ell], dtype=int) + idx_neg = idx_pos + xp.array(self.k_max[ell]) v_ell = (v[:, idx_pos] - 1j * v[:, idx_neg]) / 2.0 @@ -147,22 +150,19 @@ def _evaluate(self, v): else: pf[:, 2 * n_theta - ell, :] = -pf_ell.conjugate() - ind = ind + np.size(idx) - ind_pos = ind_pos + 2 * self.k_max[ell] + ind = ind + idx.size + ind_pos = ind_pos + 2 * xp.array(self.k_max[ell]) # 1D inverse FFT in the degree of polar angle - pf = 2 * pi * xp.asnumpy(fft.ifft(xp.asarray(pf), axis=1)) + pf = 2 * xp.pi * fft.ifft(xp.asarray(pf), axis=1) # Only need "positive" frequencies. - hsize = int(np.size(pf, 1) / 2) + hsize = int(pf.shape[1] / 2) pf = pf[:, 0:hsize, :] - - for i_r in range(0, n_r): - pf[..., i_r] = pf[..., i_r] * ( - self._precomp["gl_weights"][i_r] * self._precomp["gl_nodes"][i_r] - ) - - pf = np.reshape(pf, (n_data, n_r * n_theta)) + pf *= ( + xp.array(self._precomp["gl_weights"]) * xp.array(self._precomp["gl_nodes"]) + )[None, None, :] + pf = pf.reshape(n_data, n_r * n_theta) # perform inverse non-uniformly FFT transform back to 2D coordinate basis freqs = m_reshape(self._precomp["freqs"], (2, n_r * n_theta)) @@ -172,7 +172,7 @@ def _evaluate(self, v): # Return X as Image instance with the last two dimensions as *self.sz x = x.reshape((*sz_roll, *self.sz)) - return x + return xp.asnumpy(x) def _evaluate_t(self, x): """ @@ -200,7 +200,13 @@ def _evaluate_t(self, x): pf = xp.concatenate((pf, pf.conjugate()), axis=2) # evaluate radial integral using the Gauss-Legendre quadrature rule - pf = pf * (xp.array(self._precomp["gl_weights"]) * xp.array(self._precomp["gl_nodes"]))[None, :, None] + pf = ( + pf + * ( + xp.array(self._precomp["gl_weights"]) + * xp.array(self._precomp["gl_nodes"]) + )[None, :, None] + ) # 1D FFT on the angular dimension for each concentric circle pf = 2 * xp.pi / (2 * n_theta) * fft.fft(pf) @@ -213,7 +219,9 @@ def _evaluate_t(self, x): idx = ind + xp.arange(self.k_max[0]) # include the normalization factor of angular part into radial part - radial_norm = xp.array(self._precomp["radial"] / np.expand_dims(self.angular_norms, 1)) + radial_norm = xp.array( + self._precomp["radial"] / np.expand_dims(self.angular_norms, 1) + ) v[:, self._zero_angular_inds] = pf[:, :, 0].real @ radial_norm[idx].T ind = ind + idx.size From 8a6b4c4ee280c4f8470ea851ef3670a3707cb394 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 11 Jun 2024 11:01:51 -0400 Subject: [PATCH 048/433] downsample return --- src/aspire/image/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index d1f9dc8c04..cbe0bbf07d 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -400,7 +400,7 @@ def downsample(self, ds_res): out = fft.centered_ifft2(crop_fx).real * (ds_res**2 / self.resolution**2) out = xp.asnumpy(out) - return self.__class__(np.array(out.get())).stack_reshape(original_stack_shape) + return self.__class__(out).stack_reshape(original_stack_shape) def filter(self, filter): """ From 81ba7afa7553eefd90fa3c6c2448d517f188f3fa Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 11 Jun 2024 11:43:52 -0400 Subject: [PATCH 049/433] remove unnecessary xp.array --- src/aspire/basis/ffb_2d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/basis/ffb_2d.py b/src/aspire/basis/ffb_2d.py index 996e44f95a..4971b44f77 100644 --- a/src/aspire/basis/ffb_2d.py +++ b/src/aspire/basis/ffb_2d.py @@ -154,7 +154,7 @@ def _evaluate(self, v): ind_pos = ind_pos + 2 * xp.array(self.k_max[ell]) # 1D inverse FFT in the degree of polar angle - pf = 2 * xp.pi * fft.ifft(xp.asarray(pf), axis=1) + pf = 2 * xp.pi * fft.ifft(pf, axis=1) # Only need "positive" frequencies. hsize = int(pf.shape[1] / 2) From 325129fae9b89f152c2f0a134ae10a11b010bd7e Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 11 Jun 2024 15:24:56 -0400 Subject: [PATCH 050/433] convert pf to complex --- src/aspire/basis/ffb_2d.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aspire/basis/ffb_2d.py b/src/aspire/basis/ffb_2d.py index 4971b44f77..821800ee54 100644 --- a/src/aspire/basis/ffb_2d.py +++ b/src/aspire/basis/ffb_2d.py @@ -167,7 +167,9 @@ def _evaluate(self, v): # perform inverse non-uniformly FFT transform back to 2D coordinate basis freqs = m_reshape(self._precomp["freqs"], (2, n_r * n_theta)) - x = 2 * anufft(pf, 2 * pi * freqs, self.sz, real=True) + x = 2 * anufft( + pf.astype(complex_type(self.dtype)), 2 * pi * freqs, self.sz, real=True + ) # Return X as Image instance with the last two dimensions as *self.sz x = x.reshape((*sz_roll, *self.sz)) From af6d519655003dba8ee927c01f48f24c6718ae1e Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 13 Jun 2024 08:59:56 -0400 Subject: [PATCH 051/433] precompute radial_norm and gl_weighted_nodes in build. --- src/aspire/basis/ffb_2d.py | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/aspire/basis/ffb_2d.py b/src/aspire/basis/ffb_2d.py index 821800ee54..891ab2600d 100644 --- a/src/aspire/basis/ffb_2d.py +++ b/src/aspire/basis/ffb_2d.py @@ -58,6 +58,16 @@ def _build(self): # precompute the basis functions in 2D grids self._precomp = self._precomp() + # include the normalization factor of angular part into radial part + self.radial_norm = xp.array(self._precomp["radial"]) / xp.array( + np.expand_dims(self.angular_norms, 1) + ) + + # precompute weighted nodes + self.gl_weighted_nodes = xp.array(self._precomp["gl_weights"]) * xp.array( + self._precomp["gl_nodes"] + ) + def _precomp(self): """ Precomute the basis functions on a polar Fourier grid @@ -123,11 +133,7 @@ def _evaluate(self, v): idx = ind + xp.arange(self.k_max[0], dtype=int) - # include the normalization factor of angular part into radial part - radial_norm = xp.array(self._precomp["radial"]) / xp.array( - np.expand_dims(self.angular_norms, 1) - ) - pf[:, 0, :] = v[:, xp.array(self._zero_angular_inds)] @ radial_norm[idx] + pf[:, 0, :] = v[:, xp.array(self._zero_angular_inds)] @ self.radial_norm[idx] ind = ind + idx.size ind_pos = ind @@ -142,7 +148,7 @@ def _evaluate(self, v): if np.mod(ell, 2) == 1: v_ell = 1j * v_ell - pf_ell = v_ell @ radial_norm[idx] + pf_ell = v_ell @ self.radial_norm[idx] pf[:, ell, :] = pf_ell if np.mod(ell, 2) == 0: @@ -159,9 +165,7 @@ def _evaluate(self, v): # Only need "positive" frequencies. hsize = int(pf.shape[1] / 2) pf = pf[:, 0:hsize, :] - pf *= ( - xp.array(self._precomp["gl_weights"]) * xp.array(self._precomp["gl_nodes"]) - )[None, None, :] + pf *= self.gl_weighted_nodes[None, None, :] pf = pf.reshape(n_data, n_r * n_theta) # perform inverse non-uniformly FFT transform back to 2D coordinate basis @@ -202,13 +206,7 @@ def _evaluate_t(self, x): pf = xp.concatenate((pf, pf.conjugate()), axis=2) # evaluate radial integral using the Gauss-Legendre quadrature rule - pf = ( - pf - * ( - xp.array(self._precomp["gl_weights"]) - * xp.array(self._precomp["gl_nodes"]) - )[None, :, None] - ) + pf *= self.gl_weighted_nodes[None, :, None] # 1D FFT on the angular dimension for each concentric circle pf = 2 * xp.pi / (2 * n_theta) * fft.fft(pf) @@ -221,10 +219,8 @@ def _evaluate_t(self, x): idx = ind + xp.arange(self.k_max[0]) # include the normalization factor of angular part into radial part - radial_norm = xp.array( - self._precomp["radial"] / np.expand_dims(self.angular_norms, 1) - ) - v[:, self._zero_angular_inds] = pf[:, :, 0].real @ radial_norm[idx].T + + v[:, self._zero_angular_inds] = pf[:, :, 0].real @ self.radial_norm[idx].T ind = ind + idx.size ind_pos = ind @@ -233,7 +229,7 @@ def _evaluate_t(self, x): idx_pos = ind_pos + xp.arange(self.k_max[ell]) idx_neg = idx_pos + self.k_max[ell] - v_ell = pf[:, :, ell] @ radial_norm[idx].T + v_ell = pf[:, :, ell] @ self.radial_norm[idx].T if np.mod(ell, 2) == 0: v_pos = v_ell.real From a98e00b8e9a321ef61beb93550b79444217cc9c3 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 13 Jun 2024 09:07:46 -0400 Subject: [PATCH 052/433] remove comment --- src/aspire/basis/ffb_2d.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/aspire/basis/ffb_2d.py b/src/aspire/basis/ffb_2d.py index 891ab2600d..1c7ed8cad1 100644 --- a/src/aspire/basis/ffb_2d.py +++ b/src/aspire/basis/ffb_2d.py @@ -218,8 +218,6 @@ def _evaluate_t(self, x): ind = 0 idx = ind + xp.arange(self.k_max[0]) - # include the normalization factor of angular part into radial part - v[:, self._zero_angular_inds] = pf[:, :, 0].real @ self.radial_norm[idx].T ind = ind + idx.size From 92c61f29cc009ee365be2af818f9ff00f35c8212 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 13 Jun 2024 10:42:35 -0400 Subject: [PATCH 053/433] use asarray --- src/aspire/basis/ffb_2d.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/aspire/basis/ffb_2d.py b/src/aspire/basis/ffb_2d.py index 1c7ed8cad1..f44e959149 100644 --- a/src/aspire/basis/ffb_2d.py +++ b/src/aspire/basis/ffb_2d.py @@ -59,12 +59,12 @@ def _build(self): self._precomp = self._precomp() # include the normalization factor of angular part into radial part - self.radial_norm = xp.array(self._precomp["radial"]) / xp.array( + self.radial_norm = xp.asarray(self._precomp["radial"]) / xp.asarray( np.expand_dims(self.angular_norms, 1) ) # precompute weighted nodes - self.gl_weighted_nodes = xp.array(self._precomp["gl_weights"]) * xp.array( + self.gl_weighted_nodes = xp.asarray(self._precomp["gl_weights"]) * xp.asarray( self._precomp["gl_nodes"] ) @@ -115,7 +115,7 @@ def _evaluate(self, v): coordinate basis. This is Image instance with resolution of `self.sz` and the first dimension correspond to remaining dimension of `v`. """ - v = xp.array(v) + v = xp.asarray(v) sz_roll = v.shape[:-1] v = v.reshape(-1, self.count) @@ -133,7 +133,7 @@ def _evaluate(self, v): idx = ind + xp.arange(self.k_max[0], dtype=int) - pf[:, 0, :] = v[:, xp.array(self._zero_angular_inds)] @ self.radial_norm[idx] + pf[:, 0, :] = v[:, xp.asarray(self._zero_angular_inds)] @ self.radial_norm[idx] ind = ind + idx.size ind_pos = ind @@ -141,7 +141,7 @@ def _evaluate(self, v): for ell in range(1, self.ell_max + 1): idx = ind + xp.arange(self.k_max[ell], dtype=int) idx_pos = ind_pos + xp.arange(self.k_max[ell], dtype=int) - idx_neg = idx_pos + xp.array(self.k_max[ell]) + idx_neg = idx_pos + xp.asarray(self.k_max[ell]) v_ell = (v[:, idx_pos] - 1j * v[:, idx_neg]) / 2.0 @@ -157,7 +157,7 @@ def _evaluate(self, v): pf[:, 2 * n_theta - ell, :] = -pf_ell.conjugate() ind = ind + idx.size - ind_pos = ind_pos + 2 * xp.array(self.k_max[ell]) + ind_pos = ind_pos + 2 * xp.asarray(self.k_max[ell]) # 1D inverse FFT in the degree of polar angle pf = 2 * xp.pi * fft.ifft(pf, axis=1) @@ -199,7 +199,7 @@ def _evaluate_t(self, x): n_images = x.shape[0] # resamping x in a polar Fourier gird using nonuniform discrete Fourier transform - pf = nufft(xp.array(x), 2 * pi * freqs) + pf = nufft(xp.asarray(x), 2 * pi * freqs) pf = pf.reshape(n_images, n_r, n_theta) # Recover "negative" frequencies from "positive" half plane. From 030062c1bad6af15be6161992f0b1d027717fdd8 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 13 Jun 2024 13:36:16 -0400 Subject: [PATCH 054/433] Remove cupy.fill culprit. un-cupy indices. --- src/aspire/basis/ffb_2d.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/basis/ffb_2d.py b/src/aspire/basis/ffb_2d.py index f44e959149..116e009757 100644 --- a/src/aspire/basis/ffb_2d.py +++ b/src/aspire/basis/ffb_2d.py @@ -141,7 +141,7 @@ def _evaluate(self, v): for ell in range(1, self.ell_max + 1): idx = ind + xp.arange(self.k_max[ell], dtype=int) idx_pos = ind_pos + xp.arange(self.k_max[ell], dtype=int) - idx_neg = idx_pos + xp.asarray(self.k_max[ell]) + idx_neg = idx_pos + self.k_max[ell] v_ell = (v[:, idx_pos] - 1j * v[:, idx_neg]) / 2.0 @@ -157,7 +157,7 @@ def _evaluate(self, v): pf[:, 2 * n_theta - ell, :] = -pf_ell.conjugate() ind = ind + idx.size - ind_pos = ind_pos + 2 * xp.asarray(self.k_max[ell]) + ind_pos = ind_pos + 2 * self.k_max[ell] # 1D inverse FFT in the degree of polar angle pf = 2 * xp.pi * fft.ifft(pf, axis=1) From 58838e3b3f461c716f39f0c4f62f4a01e480d5ef Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 13 Jun 2024 14:10:48 -0400 Subject: [PATCH 055/433] cupy.fill culprit in fle_2d. sparse indices. --- src/aspire/basis/fle_2d_utils.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/aspire/basis/fle_2d_utils.py b/src/aspire/basis/fle_2d_utils.py index 23d1441a68..33f237165e 100644 --- a/src/aspire/basis/fle_2d_utils.py +++ b/src/aspire/basis/fle_2d_utils.py @@ -44,9 +44,9 @@ def precomp_transform_complex_to_real(ells): """ count = len(ells) num_nonzero = np.sum(ells == 0) + 2 * np.sum(ells != 0) - idx = xp.zeros(num_nonzero, dtype=int) - jdx = xp.zeros(num_nonzero, dtype=int) - vals = xp.zeros(num_nonzero, dtype=np.complex128) + idx = np.zeros(num_nonzero, dtype=int) + jdx = np.zeros(num_nonzero, dtype=int) + vals = np.zeros(num_nonzero, dtype=np.complex128) k = 0 for i in range(count): @@ -86,7 +86,11 @@ def precomp_transform_complex_to_real(ells): jdx[k] = i + 1 k = k + 1 - A = sparse.csr_matrix((vals, (idx, jdx)), shape=(count, count), dtype=np.complex128) + A = sparse.csr_matrix( + (xp.asarray(vals), (xp.asarray(idx), xp.asarray(jdx))), + shape=(count, count), + dtype=np.complex128, + ) return A.conjugate() From 03697ff0a596c4a82d149e45015d9d24342ad265 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 13 Jun 2024 10:58:04 -0400 Subject: [PATCH 056/433] bare min vol hack --- src/aspire/volume/volume.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index b6c100db36..7883f59190 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -475,15 +475,16 @@ def downsample(self, ds_res, mask=None): v = self.stack_reshape(-1) # take 3D Fourier transform of each volume in the stack - fx = fft.fftshift(fft.fftn(v._data, axes=(1, 2, 3))) + fx = xp.asnumpy(fft.fftshift(fft.fftn(xp.asarray(v._data), axes=(1, 2, 3)))) # crop each volume to the desired resolution in frequency space crop_fx = ( np.array([crop_pad_3d(fx[i, :, :, :], ds_res) for i in range(self.n_vols)]) * mask ) # inverse Fourier transform of each volume - out = fft.ifftn(fft.ifftshift(crop_fx), axes=(1, 2, 3)) * ( - ds_res**3 / self.resolution**3 + out = xp.asnumpy( + fft.ifftn(fft.ifftshift(xp.asarray(crop_fx)), axes=(1, 2, 3)) + * (ds_res**3 / self.resolution**3) ) # returns a new Volume object return self.__class__( From eceaf2547ae72b41698df02cf7ebeba4a9a713c7 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 13 Jun 2024 11:33:04 -0400 Subject: [PATCH 057/433] bare min ffb3d hacks [skip ci] --- src/aspire/basis/ffb_3d.py | 52 ++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/src/aspire/basis/ffb_3d.py b/src/aspire/basis/ffb_3d.py index 6362a9a703..1ac5fd62ff 100644 --- a/src/aspire/basis/ffb_3d.py +++ b/src/aspire/basis/ffb_3d.py @@ -6,6 +6,7 @@ from aspire.basis import FBBasis3D from aspire.basis.basis_utils import lgwt, norm_assoc_legendre, sph_bessel from aspire.nufft import anufft, nufft +from aspire.numeric import xp from aspire.utils.matlab_compat import m_flatten, m_reshape logger = logging.getLogger(__name__) @@ -146,10 +147,10 @@ def _precomp(self): ) return { - "radial_wtd": radial_wtd, - "ang_phi_wtd_even": ang_phi_wtd_even, - "ang_phi_wtd_odd": ang_phi_wtd_odd, - "ang_theta_wtd": ang_theta_wtd, + "radial_wtd": xp.asarray(radial_wtd), + "ang_phi_wtd_even": [xp.asarray(x) for x in ang_phi_wtd_even], + "ang_phi_wtd_odd": [xp.asarray(x) for x in ang_phi_wtd_odd], + "ang_theta_wtd": xp.asarray(ang_theta_wtd), "fourier_pts": fourier_pts, } @@ -163,6 +164,7 @@ def _evaluate(self, v): coordinate basis. This is an array whose last three dimensions equal `self.sz` and the remaining dimensions correspond to `v`. """ + v = xp.asarray(v) # roll dimensions of v sz_roll = v.shape[:-1] v = v.reshape((-1, self.count)) @@ -175,7 +177,7 @@ def _evaluate(self, v): # number of 3D image samples n_data = v.shape[0] - u_even = np.zeros( + u_even = xp.zeros( ( n_r, int(2 * self.ell_max + 1), @@ -184,7 +186,7 @@ def _evaluate(self, v): ), dtype=v.dtype, ) - u_odd = np.zeros( + u_odd = xp.zeros( (n_r, int(2 * self.ell_max + 1), n_data, int(np.ceil(self.ell_max / 2))), dtype=v.dtype, ) @@ -216,10 +218,10 @@ def _evaluate(self, v): int((ell - 1) / 2), ] = v_ell - u_even = np.transpose(u_even, (3, 0, 1, 2)) - u_odd = np.transpose(u_odd, (3, 0, 1, 2)) - w_even = np.zeros((n_phi, n_r, n_data, 2 * self.ell_max + 1), dtype=v.dtype) - w_odd = np.zeros((n_phi, n_r, n_data, 2 * self.ell_max + 1), dtype=v.dtype) + u_even = xp.transpose(u_even, (3, 0, 1, 2)) + u_odd = xp.transpose(u_odd, (3, 0, 1, 2)) + w_even = xp.zeros((n_phi, n_r, n_data, 2 * self.ell_max + 1), dtype=v.dtype) + w_odd = xp.zeros((n_phi, n_r, n_data, 2 * self.ell_max + 1), dtype=v.dtype) # evaluate the phi parts for m in range(0, self.ell_max + 1): @@ -252,8 +254,8 @@ def _evaluate(self, v): w_even[:, :, :, self.ell_max + sgn * m] = w_m_even w_odd[:, :, :, self.ell_max + sgn * m] = w_m_odd - w_even = np.transpose(w_even, (3, 0, 1, 2)) - w_odd = np.transpose(w_odd, (3, 0, 1, 2)) + w_even = xp.transpose(w_even, (3, 0, 1, 2)) + w_odd = xp.transpose(w_odd, (3, 0, 1, 2)) u_even = w_even u_odd = w_odd @@ -266,7 +268,7 @@ def _evaluate(self, v): pf = w_even + 1j * w_odd pf = m_reshape(pf, (n_theta * n_phi * n_r, n_data)) - pf = np.moveaxis(pf, 0, -1) + pf = xp.moveaxis(pf, 0, -1) # perform inverse non-uniformly FFT transformation back to 3D rectangular coordinates freqs = m_reshape(self._precomp["fourier_pts"], (3, n_r * n_theta * n_phi)) @@ -275,7 +277,7 @@ def _evaluate(self, v): # Roll, return the x with the last three dimensions as self.sz # Higher dimensions should be like v. x = x.reshape((*sz_roll, *self.sz)) - return x + return xp.asnumpy(x) def _evaluate_t(self, x): """ @@ -288,6 +290,7 @@ def _evaluate_t(self, x): `self.count` and whose remaining dimensions correspond to higher dimensions of `x`. """ + x = xp.asarray(x) # roll dimensions sz_roll = x.shape[:-3] x = x.reshape((-1, *self.sz)) @@ -303,20 +306,21 @@ def _evaluate_t(self, x): pf = m_reshape(pf.T, (n_theta, n_phi * n_r * n_data)) # evaluate the theta parts - u_even = self._precomp["ang_theta_wtd"].T @ np.real(pf) - u_odd = self._precomp["ang_theta_wtd"].T @ np.imag(pf) + tmp = self._precomp["ang_theta_wtd"].T + u_even = tmp @ xp.real(pf) + u_odd = tmp @ xp.imag(pf) u_even = m_reshape(u_even, (2 * self.ell_max + 1, n_phi, n_r, n_data)) u_odd = m_reshape(u_odd, (2 * self.ell_max + 1, n_phi, n_r, n_data)) - u_even = np.transpose(u_even, (1, 2, 3, 0)) - u_odd = np.transpose(u_odd, (1, 2, 3, 0)) + u_even = xp.transpose(u_even, (1, 2, 3, 0)) + u_odd = xp.transpose(u_odd, (1, 2, 3, 0)) - w_even = np.zeros( + w_even = xp.zeros( (int(np.floor(self.ell_max / 2) + 1), n_r, 2 * self.ell_max + 1, n_data), dtype=x.dtype, ) - w_odd = np.zeros( + w_odd = xp.zeros( (int(np.ceil(self.ell_max / 2)), n_r, 2 * self.ell_max + 1, n_data), dtype=x.dtype, ) @@ -351,11 +355,11 @@ def _evaluate_t(self, x): end = np.size(w_odd, 0) w_odd[end - n_odd_ell : end, :, self.ell_max + sgn * m, :] = w_m_odd - w_even = np.transpose(w_even, (1, 2, 3, 0)) - w_odd = np.transpose(w_odd, (1, 2, 3, 0)) + w_even = xp.transpose(w_even, (1, 2, 3, 0)) + w_odd = xp.transpose(w_odd, (1, 2, 3, 0)) # evaluate the radial parts - v = np.zeros((n_data, self.count), dtype=x.dtype) + v = xp.zeros((n_data, self.count), dtype=x.dtype) for ell in range(0, self.ell_max + 1): k_max_ell = self.k_max[ell] radial_wtd = self._precomp["radial_wtd"][:, 0:k_max_ell, ell] @@ -388,4 +392,4 @@ def _evaluate_t(self, x): # Roll dimensions, last dimension should be self.count, # Higher dimensions like x. v = v.reshape((*sz_roll, self.count)) - return v + return xp.asnumpy(v) From 1aae0727909ff9ff569cdc1078bedc8bc50f21e1 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 13 Jun 2024 14:58:00 -0400 Subject: [PATCH 058/433] better style --- src/aspire/basis/ffb_3d.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/aspire/basis/ffb_3d.py b/src/aspire/basis/ffb_3d.py index 1ac5fd62ff..5740900a34 100644 --- a/src/aspire/basis/ffb_3d.py +++ b/src/aspire/basis/ffb_3d.py @@ -218,8 +218,8 @@ def _evaluate(self, v): int((ell - 1) / 2), ] = v_ell - u_even = xp.transpose(u_even, (3, 0, 1, 2)) - u_odd = xp.transpose(u_odd, (3, 0, 1, 2)) + u_even = u_even.transpose((3, 0, 1, 2)) + u_odd = u_odd.transpose((3, 0, 1, 2)) w_even = xp.zeros((n_phi, n_r, n_data, 2 * self.ell_max + 1), dtype=v.dtype) w_odd = xp.zeros((n_phi, n_r, n_data, 2 * self.ell_max + 1), dtype=v.dtype) @@ -254,8 +254,8 @@ def _evaluate(self, v): w_even[:, :, :, self.ell_max + sgn * m] = w_m_even w_odd[:, :, :, self.ell_max + sgn * m] = w_m_odd - w_even = xp.transpose(w_even, (3, 0, 1, 2)) - w_odd = xp.transpose(w_odd, (3, 0, 1, 2)) + w_even = w_even.transpose((3, 0, 1, 2)) + w_odd = w_odd.transpose((3, 0, 1, 2)) u_even = w_even u_odd = w_odd @@ -307,14 +307,14 @@ def _evaluate_t(self, x): # evaluate the theta parts tmp = self._precomp["ang_theta_wtd"].T - u_even = tmp @ xp.real(pf) - u_odd = tmp @ xp.imag(pf) + u_even = tmp @ pf.real + u_odd = tmp @ pf.imag u_even = m_reshape(u_even, (2 * self.ell_max + 1, n_phi, n_r, n_data)) u_odd = m_reshape(u_odd, (2 * self.ell_max + 1, n_phi, n_r, n_data)) - u_even = xp.transpose(u_even, (1, 2, 3, 0)) - u_odd = xp.transpose(u_odd, (1, 2, 3, 0)) + u_even = u_even.transpose((1, 2, 3, 0)) + u_odd = u_odd.transpose((1, 2, 3, 0)) w_even = xp.zeros( (int(np.floor(self.ell_max / 2) + 1), n_r, 2 * self.ell_max + 1, n_data), @@ -355,8 +355,8 @@ def _evaluate_t(self, x): end = np.size(w_odd, 0) w_odd[end - n_odd_ell : end, :, self.ell_max + sgn * m, :] = w_m_odd - w_even = xp.transpose(w_even, (1, 2, 3, 0)) - w_odd = xp.transpose(w_odd, (1, 2, 3, 0)) + w_even = w_even.transpose((1, 2, 3, 0)) + w_odd = w_odd.transpose((1, 2, 3, 0)) # evaluate the radial parts v = xp.zeros((n_data, self.count), dtype=x.dtype) From d63b1dc909673a55378bbca2dbb789b8ff1b7262 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 13 Jun 2024 15:11:04 -0400 Subject: [PATCH 059/433] last cupy fill --- src/aspire/basis/fle_2d.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/basis/fle_2d.py b/src/aspire/basis/fle_2d.py index 4278331e1a..df1d66c608 100644 --- a/src/aspire/basis/fle_2d.py +++ b/src/aspire/basis/fle_2d.py @@ -452,7 +452,7 @@ def _create_basis_functions(self): """ Generate the actual basis functions as Python lambda operators """ - norm_constants = xp.zeros(self.count) + norm_constants = np.zeros(self.count) basis_functions = [None] * self.count for i in range(self.count): # parameters defining the basis function: bessel order and which bessel root @@ -481,7 +481,7 @@ def _create_basis_functions(self): norm_constants[i] = c - self.norm_constants = norm_constants + self.norm_constants = xp.asarray(norm_constants) self.basis_functions = basis_functions def _evaluate(self, coefs): From b16fa015dd0691adfee557442c0c3188173f3a11 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 18 Jun 2024 09:39:42 -0400 Subject: [PATCH 060/433] revert config to numpy/scipy --- src/aspire/config_default.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/config_default.yaml b/src/aspire/config_default.yaml index fed4cea50a..def78983c0 100644 --- a/src/aspire/config_default.yaml +++ b/src/aspire/config_default.yaml @@ -1,9 +1,9 @@ version: 0.12.3 common: # numeric module to use - one of numpy/cupy - numeric: cupy + numeric: numpy # fft backend to use - one of pyfftw/scipy/cupy/mkl - fft: cupy + fft: scipy # Set cache directory for ASPIRE example data. # By default the cache location will be set by pooch.os_cache(), From 41e3208572749ffc655ed1584e86a5e20a8f65a7 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 18 Jun 2024 16:13:28 -0400 Subject: [PATCH 061/433] fft host array preservation --- src/aspire/numeric/cupy_fft.py | 45 +++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/src/aspire/numeric/cupy_fft.py b/src/aspire/numeric/cupy_fft.py index 29939e504c..7d73367bc7 100644 --- a/src/aspire/numeric/cupy_fft.py +++ b/src/aspire/numeric/cupy_fft.py @@ -1,9 +1,36 @@ +import functools + import cupy as cp import cupyx.scipy.fft as cufft from aspire.numeric.base_fft import FFT +def _preserve_host(func): + """ + Method decorator that returns a numpy/cupy array result when passed a numpy/cupy array input. + + This improves the flexibility of our FFT wrappers by allowing for incremental code changes. + """ + + @functools.wraps(func) # Pass metadata (eg name and doctrings) from `func` + def wrapper(self, x, *args, **kwargs): + + _host = False + if not isinstance(x, cp.ndarray): + _host = True + x = cp.asarray(x) + + res = func(self, x, *args, **kwargs) + + if _host: + res = res.get() + + return res + + return wrapper + + class CupyFFT(FFT): """ Define a unified wrapper class for Cupy FFT functions @@ -11,32 +38,42 @@ class CupyFFT(FFT): To be consistent with Scipy and Pyfftw, not all arguments are included. """ + @_preserve_host def fft(self, x, axis=-1, workers=-1): return cp.fft.fft(x, axis=axis) + @_preserve_host def ifft(self, x, axis=-1, workers=-1): return cp.fft.ifft(x, axis=axis) + @_preserve_host def fft2(self, x, axes=(-2, -1), workers=-1): return cp.fft.fft2(x, axes=axes) + @_preserve_host def ifft2(self, x, axes=(-2, -1), workers=-1): return cp.fft.ifft2(x, axes=axes) + @_preserve_host def fftn(self, x, axes=None, workers=-1): return cp.fft.fftn(x, axes=axes) + @_preserve_host def ifftn(self, x, axes=None, workers=-1): return cp.fft.ifftn(x, axes=axes) + @_preserve_host def fftshift(self, x, axes=None): return cp.fft.fftshift(x, axes=axes) + @_preserve_host def ifftshift(self, x, axes=None): return cp.fft.ifftshift(x, axes=axes) - def dct(self, *args, **kwargs): - return cufft.dct(*args, **kwargs) + @_preserve_host + def dct(self, x, **kwargs): + return cufft.dct(x, **kwargs) - def idct(self, *args, **kwargs): - return cufft.idct(*args, **kwargs) + @_preserve_host + def idct(self, x, **kwargs): + return cufft.idct(x, **kwargs) From ca657a7bab1e98cc392a814bebbea85a342125ef Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 20 Jun 2024 09:29:34 -0400 Subject: [PATCH 062/433] interop crop_pad_2d --- src/aspire/utils/coor_trans.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/aspire/utils/coor_trans.py b/src/aspire/utils/coor_trans.py index dfb1c630f1..771c5bd5af 100644 --- a/src/aspire/utils/coor_trans.py +++ b/src/aspire/utils/coor_trans.py @@ -369,6 +369,11 @@ def rots_to_clmatrix(rots, n_theta): def crop_pad_2d(im, size, fill_value=0): """ + Crop/pads `im` according to `size`. + + Padding will use `fill_value`. + Return's host/gpu array based on `im`. + :param im: A >=2-dimensional numpy array :param size: Integer size of cropped/padded output :return: A numpy array of shape (..., size, size) @@ -387,8 +392,16 @@ def crop_pad_2d(im, size, fill_value=0): # Determine shape shape = list(im.shape[:-2]) shape.extend([size, size]) - # ensure that we return in the same dtype as the input - to_return = xp.full(shape, fill_value, dtype=im.dtype) + + # Ensure that we return in the same dtype as the input + _full = np.full # Default to numpy array + if isinstance(im, xp.ndarray): + # Use cupy when `im` _and_ xp are cupy ndarray + # Avoids having to handle when cupy is not installed + _full = xp.full + + to_return = _full(shape, fill_value, dtype=im.dtype) + # when padding, start_x and start_y are negative since size is larger # than im_x and im_y; the below line calculates where the original image # is placed in relation to the (now-larger) box size From dbe66e5e7f9a6fa97ba81829155e31608d7792f1 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 20 Jun 2024 10:11:49 -0400 Subject: [PATCH 063/433] interop fle radial convolve --- src/aspire/basis/fle_2d.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/aspire/basis/fle_2d.py b/src/aspire/basis/fle_2d.py index df1d66c608..332b84f64d 100644 --- a/src/aspire/basis/fle_2d.py +++ b/src/aspire/basis/fle_2d.py @@ -721,10 +721,12 @@ def radial_convolve(self, coefs, radial_img): "`radial_convolve` currently only implemented for 1D stacks." ) - coefs = coefs.asnumpy() + # Potentially migrate to GPU + coefs = xp.asarray(coefs.asnumpy()) + radial_img = xp.asarray(radial_img) num_img = coefs.shape[0] - coefs_conv = np.zeros(coefs.shape) + coefs_conv = xp.zeros(coefs.shape) # Convert to internal FLE indices ordering coefs = coefs[..., self._fb_to_fle_indices] @@ -736,25 +738,26 @@ def radial_convolve(self, coefs, radial_img): weights = self._radial_convolve_weights(b) b = weights / (self.h**2) b = b.reshape(self.count) - coefs_conv[k, :] = np.real(self.c2r @ (b * (self.r2c @ _coefs).flatten())) + coefs_conv[k, :] = (self.c2r @ (b * (self.r2c @ _coefs).flatten())).real # Convert from internal FLE ordering to FB convention coefs_conv = coefs_conv[..., self._fle_to_fb_indices] - return Coef(self, coefs_conv) + # Return as Coef on host + return Coef(self, xp.asnumpy(coefs_conv)) def _radial_convolve_weights(self, b): """ Helper function for step 3 of convolving with a radial function. """ - b = np.squeeze(b) - b = np.array(b) + b = xp.squeeze(b) + b = xp.array(b) # implies copy if self.num_interp > self.num_radial_nodes: b = fft.dct(b, axis=0, type=2) / (2 * self.num_radial_nodes) - bz = np.zeros(b.shape) - b = np.concatenate((b, bz), axis=0) + bz = xp.zeros(b.shape) + b = xp.concatenate((b, bz), axis=0) b = fft.idct(b, axis=0, type=2) * 2 * b.shape[0] - a = np.zeros(self.count, dtype=np.float64) + a = xp.zeros(self.count, dtype=np.float64) y = [None] * (self.ell_p_max + 1) for i in range(self.ell_p_max + 1): y[i] = (self.A3[i] @ b[:, 0]).flatten() From 8e2f20033068167de4dc396fbc1ef824d06d7d02 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 20 Jun 2024 14:05:33 -0400 Subject: [PATCH 064/433] cleanup --- src/aspire/utils/coor_trans.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/utils/coor_trans.py b/src/aspire/utils/coor_trans.py index 771c5bd5af..ef7857c994 100644 --- a/src/aspire/utils/coor_trans.py +++ b/src/aspire/utils/coor_trans.py @@ -401,7 +401,7 @@ def crop_pad_2d(im, size, fill_value=0): _full = xp.full to_return = _full(shape, fill_value, dtype=im.dtype) - + # when padding, start_x and start_y are negative since size is larger # than im_x and im_y; the below line calculates where the original image # is placed in relation to the (now-larger) box size From 57a3679f0a0aaf6fba5a8e8638d8a00dfe8459e2 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 20 Jun 2024 14:06:43 -0400 Subject: [PATCH 065/433] remove bbenchmark code, hackathon over --- bbenchmark/bbenchmark.py | 58 ------------------------------ bbenchmark/benchmark_gpu0.pkl | Bin 307 -> 0 bytes bbenchmark/benchmark_host.pkl | Bin 307 -> 0 bytes bbenchmark/plot_bb.py | 64 ---------------------------------- 4 files changed, 122 deletions(-) delete mode 100644 bbenchmark/bbenchmark.py delete mode 100644 bbenchmark/benchmark_gpu0.pkl delete mode 100644 bbenchmark/benchmark_host.pkl delete mode 100644 bbenchmark/plot_bb.py diff --git a/bbenchmark/bbenchmark.py b/bbenchmark/bbenchmark.py deleted file mode 100644 index 01aac6e7eb..0000000000 --- a/bbenchmark/bbenchmark.py +++ /dev/null @@ -1,58 +0,0 @@ -import os -import pickle -from pprint import pprint -from time import perf_counter, time - -import matplotlib.pyplot as plt -import numpy as np - -from aspire.basis import FFBBasis2D, FLEBasis2D -from aspire.downloader import emdb_2660 -from aspire.noise import WhiteNoiseAdder -from aspire.source import ArrayImageSource, Simulation - -# Download and cache volume map -vol = emdb_2660().astype(np.float64) # doubles -cached_image_fn = "simulated_images.npy" - -if os.path.exists(cached_image_fn): - print(f"Loading cached image source from {cached_image_fn}.") - sim = ArrayImageSource(np.load(cached_image_fn)) -else: - print("Generating Simulated Datatset") - sim = Simulation( - n=512, C=1, vols=vol, noise_adder=WhiteNoiseAdder.from_snr(0.1) - ).cache() - print(f"Saving to {cached_image_fn}") - np.save(cached_image_fn, sim.images[:].asnumpy()) - - -TIMES = {} -for L in [32, 64, 128, 256]: - print(f"Begin L={L}") - src = sim.downsample(L) - imgs = src.images[:] - TIMES[L] = {} - for basis_type in [FFBBasis2D, FLEBasis2D]: - # Construct basis - TIMES[L][basis_type.__name__] = {} - basis = basis_type(L, dtype=src.dtype) - - # Time expanding into basis - tic = perf_counter() - coef = basis.evaluate_t(imgs) - toc = perf_counter() - TIMES[L][basis_type.__name__]["evaluate_t"] = toc - tic - - # Time expanding back into images - tic = perf_counter() - _ = coef.evaluate() - toc = perf_counter() - TIMES[L][basis_type.__name__]["evaluate"] = toc - tic - - -pprint(TIMES) - - -with open(f"benchmark_{int(time())}.pkl", "wb") as fh: - pickle.dump(TIMES, fh) diff --git a/bbenchmark/benchmark_gpu0.pkl b/bbenchmark/benchmark_gpu0.pkl deleted file mode 100644 index e702dd442dced27acb26fcc3b3e395ce9f465585..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 307 zcmZo*nX19a00y;FG`tmnL=Tsno0C&wab~fR%M>s_wJb5GG_fQ#zGRBK{fB=m-#lPo z=;45g0>v(0*=`CnqZFvs#}!Fy28+7`_dcgM4hDt{R(A)1g!$SUKxL)g4nT7=m_P)J zyZseA`*#jt74}bVm#$9$s>oo2$TFJo@? J0igC$Jpf$(W#0e* diff --git a/bbenchmark/benchmark_host.pkl b/bbenchmark/benchmark_host.pkl deleted file mode 100644 index dc0dd2a1769fc52c9470986e74eb64864f59e7fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 307 zcmZo*nX19a00y;FG`tmnL=Tsno0C&wab~fR%M>s_wJb5GG_fQ#zGRBK{l>F_wm|hg z957L!*k;SlN}yONP^*tClGY3scLzS3waO9<3>mEM4m>kTmTLf&m3lh>&COr}5iIWZ zmm4fH4}ewJUv3m%3ovVBHPKy1(9iTm;ktG~fPnyM$W- zvToDPIg_qJbek#on}>jO`!X;hX?O6pRZ8-OC=s5uZo?jA?UmgRJ_s6sonHA^-k?wb IsJ&DV0PQbeIsgCw diff --git a/bbenchmark/plot_bb.py b/bbenchmark/plot_bb.py deleted file mode 100644 index 05f5350f4b..0000000000 --- a/bbenchmark/plot_bb.py +++ /dev/null @@ -1,64 +0,0 @@ -import os -import pickle -from pprint import pprint - -import matplotlib.pyplot as plt -import numpy as np - -host_fn = "benchmark_host.pkl" -gpu_fn = "benchmark_gpu0.pkl" - - -with open(host_fn, "rb") as fh: - host_times = pickle.load(fh) - -with open(gpu_fn, "rb") as fh: - gpu_times = pickle.load(fh) - -markers = {"FFBBasis2D": "8", "FLEBasis2D": "s"} - -# Evaluate_t -Ls = list(host_times.keys()) -for basis_type in markers.keys(): - plt.plot( - Ls, - [host_times[L][basis_type]["evaluate_t"] for L in Ls], - marker=markers[basis_type], - color="blue", - label=basis_type + "-host", - ) - plt.plot( - Ls, - [gpu_times[L][basis_type]["evaluate_t"] for L in Ls], - marker=markers[basis_type], - color="green", - label=basis_type + "-gpu", - ) -plt.title("Basis `evaluate_t` Permformance - Batch of 512 Images") -plt.xlabel("Image Pixel L (LxL)") -plt.ylabel("Time (seconds)") -plt.legend() -plt.savefig("evaluate_t.png") -plt.show() - -for basis_type in markers.keys(): - plt.plot( - Ls, - [host_times[L][basis_type]["evaluate"] for L in Ls], - marker=markers[basis_type], - color="blue", - label=basis_type + "-host", - ) - plt.plot( - Ls, - [gpu_times[L][basis_type]["evaluate"] for L in Ls], - marker=markers[basis_type], - color="green", - label=basis_type + "-gpu", - ) -plt.title("Basis `evaluate` Permformance - Batch of 512 Images") -plt.xlabel("Image Pixel L (LxL)") -plt.ylabel("Time (seconds)") -plt.legend() -plt.savefig("evaluate.png") -plt.show() From 07daa17e4e9e93dd9af7d0e1ac2cca13fbdde8a2 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 20 Jun 2024 14:25:30 -0400 Subject: [PATCH 066/433] fix interop cp check --- src/aspire/nufft/__init__.py | 12 +++++++----- src/aspire/numeric/numpy.py | 9 +++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/aspire/nufft/__init__.py b/src/aspire/nufft/__init__.py index f748a10d84..c2db4f2e8e 100644 --- a/src/aspire/nufft/__init__.py +++ b/src/aspire/nufft/__init__.py @@ -2,13 +2,15 @@ import numpy as np +from aspire import config +from aspire.utils import LogFilterByCount, complex_type, real_type + +cp = None try: import cupy as cp except ModuleNotFoundError: - cp = None + pass -from aspire import config -from aspire.utils import LogFilterByCount, complex_type, real_type logger = logging.getLogger(__name__) @@ -196,7 +198,7 @@ def anufft(sig_f, fourier_pts, sz, real=False, epsilon=1e-8): adjoint = adjoint.real if real else adjoint - if not on_gpu: + if cp and not on_gpu: adjoint = adjoint.get() return adjoint @@ -257,7 +259,7 @@ def nufft(sig_f, fourier_pts, real=False, epsilon=1e-8): transform = transform.real if real else transform - if not on_gpu: + if cp and not on_gpu: transform = transform.get() return transform diff --git a/src/aspire/numeric/numpy.py b/src/aspire/numeric/numpy.py index 9367409c78..07627399f9 100644 --- a/src/aspire/numeric/numpy.py +++ b/src/aspire/numeric/numpy.py @@ -1,11 +1,16 @@ -import cupy as cp import numpy as np +cp = None +try: + import cupy as cp +except ModuleNotFoundError: + pass + class Numpy: @staticmethod def asnumpy(x): - if isinstance(x, cp.ndarray): + if cp and isinstance(x, cp.ndarray): x = x.get() return x From 1947c7d2c9ac86210093e56f8795592b91c21724 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 20 Jun 2024 15:22:03 -0400 Subject: [PATCH 067/433] use cupy modes on ampere_gpu jobs --- .github/workflows/workflow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index f2d5472e52..24528a6b72 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -148,6 +148,8 @@ jobs: echo "WORK_DIR=${WORK_DIR}" >> $GITHUB_ENV echo -e "ray:\n temp_dir: ${WORK_DIR}\n" > ${WORK_DIR}/config.yaml echo -e "common:\n cache_dir: ${CI_CACHE_DIR}\n" >> ${WORK_DIR}/config.yaml + echo -e " numeric: cupy\n" >> ${WORK_DIR}/config.yaml + echo -e " fft: cupy\n" >> ${WORK_DIR}/config.yaml echo "Log the config: ${WORK_DIR}/config.yaml" cat ${WORK_DIR}/config.yaml - name: Run From 8e60d46f347d03fca0773c00fb66f9eaf01d0499 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 20 Jun 2024 15:24:25 -0400 Subject: [PATCH 068/433] ws cleanup in gha config gen --- .github/workflows/workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 24528a6b72..fce5a7f6d4 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -147,8 +147,8 @@ jobs: echo "Stash the WORK_DIR to GitHub env so we can clean it up later." echo "WORK_DIR=${WORK_DIR}" >> $GITHUB_ENV echo -e "ray:\n temp_dir: ${WORK_DIR}\n" > ${WORK_DIR}/config.yaml - echo -e "common:\n cache_dir: ${CI_CACHE_DIR}\n" >> ${WORK_DIR}/config.yaml - echo -e " numeric: cupy\n" >> ${WORK_DIR}/config.yaml + echo -e "common:\n cache_dir: ${CI_CACHE_DIR}" >> ${WORK_DIR}/config.yaml + echo -e " numeric: cupy" >> ${WORK_DIR}/config.yaml echo -e " fft: cupy\n" >> ${WORK_DIR}/config.yaml echo "Log the config: ${WORK_DIR}/config.yaml" cat ${WORK_DIR}/config.yaml From c7eb9dd4867f568bc1eb765a9796dd41895c914d Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 20 Jun 2024 17:14:46 -0400 Subject: [PATCH 069/433] remove older GPU environments. --- pyproject.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fcc0f7cf4f..c9c25a9976 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,10 +61,6 @@ dependencies = [ "Source" = "https://github.com/ComputationalCryoEM/ASPIRE-Python" [project.optional-dependencies] -gpu-102 = ["cupy-cuda102", "cufinufft==1.3"] -gpu-110 = ["cupy-cuda110", "cufinufft==1.3"] -gpu-111 = ["cupy-cuda111", "cufinufft==1.3"] -gpu-11x = ["cupy-cuda11x", "cufinufft==1.3"] gpu-12x = ["cupy-cuda12x", "cufinufft==2.2.0"] dev = [ "black", From 8accd1f42b7597650d1c5f0d174ab80c47036260 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 21 Jun 2024 09:47:04 -0400 Subject: [PATCH 070/433] fle basis to mat xp conversion --- src/aspire/basis/fle_2d.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/aspire/basis/fle_2d.py b/src/aspire/basis/fle_2d.py index 332b84f64d..e82dbb5d2f 100644 --- a/src/aspire/basis/fle_2d.py +++ b/src/aspire/basis/fle_2d.py @@ -786,20 +786,26 @@ def filter_to_basis_mat(self, f, **kwargs): # get 2D grid in polar coordinate k_vals, wts = lgwt(n_k, 0, 0.5, dtype=self.dtype) - k, theta = np.meshgrid( - k_vals, np.arange(n_theta) * 2 * np.pi / (2 * n_theta), indexing="ij" + k, theta = xp.meshgrid( + xp.asarray(k_vals), + xp.arange(n_theta) * 2 * np.pi / (2 * n_theta), + indexing="ij", ) # Get function values in polar 2D grid and average out angle contribution # NOTE: should probably just let the ctf objects handle this... - omegax = k * np.cos(theta) - omegay = k * np.sin(theta) - omega = 2 * np.pi * np.vstack((omegax.flatten("C"), omegay.flatten("C"))) - - h_vals2d = h_fun(omega).reshape(n_k, n_theta).astype(self.dtype) - h_vals = np.sum(h_vals2d, axis=1) / n_theta + omegax = k * xp.cos(theta) + omegay = k * xp.sin(theta) + omega = 2 * xp.pi * xp.vstack((omegax.flatten("C"), omegay.flatten("C"))) + + h_vals2d = ( + xp.asarray(h_fun(omega)) + .reshape(n_k, n_theta) + .astype(self.dtype, copy=False) + ) + h_vals = xp.sum(h_vals2d, axis=1) / n_theta - h_basis = np.zeros(self.count, dtype=self.dtype) + h_basis = xp.zeros(self.count, dtype=self.dtype) # For now we just need to handle 1D (stack of one ctf) for j in range(self.ell_p_max + 1): h_basis[self.idx_list[j]] = self.A3[j] @ h_vals @@ -807,4 +813,4 @@ def filter_to_basis_mat(self, f, **kwargs): # Convert from internal FLE ordering to FB convention h_basis = h_basis[self._fle_to_fb_indices] - return DiagMatrix(h_basis) + return DiagMatrix(xp.asnumpy(h_basis)) From 7b3b080cc1f9fb38e9b9948c4fc2ce11ca30306d Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 21 Jun 2024 10:14:39 -0400 Subject: [PATCH 071/433] better eigsh sanity check --- tests/test_numeric_sparse.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_numeric_sparse.py b/tests/test_numeric_sparse.py index 288e41a176..5a8227fe47 100644 --- a/tests/test_numeric_sparse.py +++ b/tests/test_numeric_sparse.py @@ -47,7 +47,8 @@ def test_eigsh(backends): """ xp, sparse = backends - A = xp.eye(1234) + n = 123 + A = xp.diag(xp.arange(1, n + 1, dtype=np.float64)) - lamb, _ = sparse.linalg.eigsh(A) - np.testing.assert_allclose(xp.asnumpy(lamb), 1.0) + lamb, _ = sparse.linalg.eigsh(A, k=1) + np.testing.assert_allclose(xp.asnumpy(lamb), n) From ac63b7cdc46e7df4bc11aa7346effd92783a96e7 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 24 Jun 2024 10:50:24 -0400 Subject: [PATCH 072/433] cupy fft accuracy casting work around --- src/aspire/numeric/cupy_fft.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/aspire/numeric/cupy_fft.py b/src/aspire/numeric/cupy_fft.py index 7d73367bc7..043780c7a7 100644 --- a/src/aspire/numeric/cupy_fft.py +++ b/src/aspire/numeric/cupy_fft.py @@ -2,6 +2,7 @@ import cupy as cp import cupyx.scipy.fft as cufft +import numpy as np from aspire.numeric.base_fft import FFT @@ -16,6 +17,17 @@ def _preserve_host(func): @functools.wraps(func) # Pass metadata (eg name and doctrings) from `func` def wrapper(self, x, *args, **kwargs): + # CuPy's single precision FFT appears to be too inaccurate for + # many of our unit tests, so the signal is upcast and recast + # on return. + _singles = False + if x.dtype == np.float32: + _singles = True + x = x.astype(np.float64) + elif x.dtype == np.complex64: + _singles = True + x = x.astype(np.complex128) + _host = False if not isinstance(x, cp.ndarray): _host = True @@ -26,6 +38,12 @@ def wrapper(self, x, *args, **kwargs): if _host: res = res.get() + # Recast if needed. + if _singles and res.dtype == np.float64: + res = res.astype(np.float32) + elif _singles and res.dtype == np.complex128: + res = res.astype(np.complex64) + return res return wrapper From 47ee759e5880c882f1746f6699ca6de469f8f385 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 24 Jun 2024 10:51:01 -0400 Subject: [PATCH 073/433] some numpy/cupy interop tweaks --- src/aspire/image/image.py | 15 ++++++++------- src/aspire/volume/volume.py | 8 ++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index cbe0bbf07d..f4d89eb3a5 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -413,17 +413,18 @@ def filter(self, filter): im = self.stack_reshape(-1) - filter_values = filter.evaluate_grid(self.resolution) + filter_values = xp.asarray(filter.evaluate_grid(self.resolution)) - im_f = xp.asnumpy(fft.centered_fft2(xp.asarray(im._data))) + im_f = fft.centered_fft2(xp.asarray(im._data)) # TODO: why are these different? Doesn't the broadcast work? if im_f.ndim > filter_values.ndim: im_f *= filter_values else: im_f = filter_values * im_f - im = xp.asnumpy(fft.centered_ifft2(xp.asarray(im_f))) - im = np.real(im) + + im = fft.centered_ifft2(im_f) + im = xp.asnumpy(im.real) return self.__class__(im).stack_reshape(original_stack_shape) @@ -497,7 +498,7 @@ def _im_translate(self, shifts): shifts = shifts.astype(self.dtype) L = self.resolution - im_f = xp.asnumpy(fft.fft2(xp.asarray(im))) + im_f = xp.asnumpy(fft.fft2(xp.asarray(im))) # todo grid_shifted = fft.ifftshift( xp.asarray(np.ceil(np.arange(-L / 2, L / 2, dtype=self.dtype))) ) @@ -513,8 +514,8 @@ def _im_translate(self, shifts): ) mult_f = np.exp(-1j * phase_shifts) im_translated_f = im_f * mult_f - im_translated = xp.asnumpy(fft.ifft2(xp.asarray(im_translated_f))) - im_translated = np.real(im_translated) + im_translated = fft.ifft2(xp.asarray(im_translated_f)) + im_translated = xp.asnumpy(im_translated.real) # Reshape to stack shape return self.__class__(im_translated).stack_reshape(stack_shape) diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index 7883f59190..b7e4245ede 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -342,13 +342,13 @@ def project(self, rot_matrices): if rot_matrices.ndim == 2: rot_matrices = np.expand_dims(rot_matrices, axis=0) - data = self._data + data = xp.asarray(self._data) n_rots = rot_matrices.shape[0] pts_rot = rotated_grids(self.resolution, rot_matrices) if n_rots == self.n_vols: # Apply rotations to Volumes element-wise. - im_f = np.empty( + im_f = xp.empty( (self.n_vols, self.resolution**2), dtype=complex_type(self.dtype) ) pts_rot = pts_rot.reshape((3, n_rots, self.resolution**2)) @@ -370,9 +370,9 @@ def project(self, rot_matrices): im_f[:, 0, :] = 0 im_f[:, :, 0] = 0 - im_f = xp.asnumpy(fft.centered_ifft2(xp.asarray(im_f))) + im_f = fft.centered_ifft2(im_f) - return aspire.image.Image(np.real(im_f)) + return aspire.image.Image(xp.asnumpy(im_f.real)) def to_vec(self): """Returns an N x resolution ** 3 array.""" From e58e47afbcff763400fbbc41a2f64832c963da96 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 24 Jun 2024 10:57:14 -0400 Subject: [PATCH 074/433] more image interop tweaks --- src/aspire/image/image.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index f4d89eb3a5..8ad8dc8711 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -495,15 +495,15 @@ def _im_translate(self, shifts): n_shifts == 1 or n_shifts == self.n_images ), "number of shifts must be 1 or match the number of images" # Cast shifts to this instance's internal dtype - shifts = shifts.astype(self.dtype) + shifts = xp.asarray(shifts, dtype=self.dtype) L = self.resolution - im_f = xp.asnumpy(fft.fft2(xp.asarray(im))) # todo + im_f = fft.fft2(xp.asarray(im)) grid_shifted = fft.ifftshift( - xp.asarray(np.ceil(np.arange(-L / 2, L / 2, dtype=self.dtype))) + xp.ceil(xp.arange(-L / 2, L / 2, dtype=self.dtype)) ) - grid_1d = xp.asnumpy(grid_shifted) * 2 * np.pi / L - om_x, om_y = np.meshgrid(grid_1d, grid_1d, indexing="ij") + grid_1d = grid_shifted * 2 * xp.pi / L + om_x, om_y = xp.meshgrid(grid_1d, grid_1d, indexing="ij") phase_shifts_x = -shifts[:, 0].reshape((n_shifts, 1, 1)) phase_shifts_y = -shifts[:, 1].reshape((n_shifts, 1, 1)) @@ -512,9 +512,9 @@ def _im_translate(self, shifts): om_x[np.newaxis, :, :] * phase_shifts_x + om_y[np.newaxis, :, :] * phase_shifts_y ) - mult_f = np.exp(-1j * phase_shifts) + mult_f = xp.exp(-1j * phase_shifts) im_translated_f = im_f * mult_f - im_translated = fft.ifft2(xp.asarray(im_translated_f)) + im_translated = fft.ifft2(im_translated_f) im_translated = xp.asnumpy(im_translated.real) # Reshape to stack shape From 0b877b5c43fe3108d31fb5fcfc8d71e97bf736be Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 24 Jun 2024 14:40:29 -0400 Subject: [PATCH 075/433] misc xp/numeric wrapper cleanup --- src/aspire/nufft/__init__.py | 12 ++++++------ src/aspire/numeric/cupy_fft.py | 12 ++++++++++-- src/aspire/numeric/numpy.py | 4 ++++ src/aspire/numeric/pyfftw_fft.py | 8 ++++---- src/aspire/numeric/scipy_fft.py | 8 ++++---- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/aspire/nufft/__init__.py b/src/aspire/nufft/__init__.py index c2db4f2e8e..953f55ce3e 100644 --- a/src/aspire/nufft/__init__.py +++ b/src/aspire/nufft/__init__.py @@ -172,9 +172,9 @@ def anufft(sig_f, fourier_pts, sz, real=False, epsilon=1e-8): """ - on_gpu = False + _on_gpu = False if cp and isinstance(sig_f, cp.ndarray): - on_gpu = True + _on_gpu = True if fourier_pts.dtype != real_type(sig_f.dtype): raise RuntimeError( @@ -198,7 +198,7 @@ def anufft(sig_f, fourier_pts, sz, real=False, epsilon=1e-8): adjoint = adjoint.real if real else adjoint - if cp and not on_gpu: + if cp and not _on_gpu: adjoint = adjoint.get() return adjoint @@ -223,9 +223,9 @@ def nufft(sig_f, fourier_pts, real=False, epsilon=1e-8): """ - on_gpu = False + _on_gpu = False if cp and isinstance(sig_f, cp.ndarray): - on_gpu = True + _on_gpu = True if fourier_pts.dtype != real_type(sig_f.dtype): raise RuntimeError( @@ -259,7 +259,7 @@ def nufft(sig_f, fourier_pts, real=False, epsilon=1e-8): transform = transform.real if real else transform - if cp and not on_gpu: + if cp and not _on_gpu: transform = transform.get() return transform diff --git a/src/aspire/numeric/cupy_fft.py b/src/aspire/numeric/cupy_fft.py index 043780c7a7..f67937813f 100644 --- a/src/aspire/numeric/cupy_fft.py +++ b/src/aspire/numeric/cupy_fft.py @@ -7,11 +7,16 @@ from aspire.numeric.base_fft import FFT +# This improves the flexibility of our FFT wrappers by allowing for +# incremental code changes and testing. def _preserve_host(func): """ - Method decorator that returns a numpy/cupy array result when passed a numpy/cupy array input. + Method decorator that returns a numpy/cupy array result when + passed a numpy/cupy array input respectively. - This improves the flexibility of our FFT wrappers by allowing for incremental code changes. + At the time of writing this wrapper will also upcast cupy FFT + operations to doubles as the precision in singles can cause + accuracy issues. """ @functools.wraps(func) # Pass metadata (eg name and doctrings) from `func` @@ -20,6 +25,9 @@ def wrapper(self, x, *args, **kwargs): # CuPy's single precision FFT appears to be too inaccurate for # many of our unit tests, so the signal is upcast and recast # on return. + # Todo, discuss with Joakim whether we want this upcasting + # business configurable or keep singles, both in conjunction + # with xfailing the tests. _singles = False if x.dtype == np.float32: _singles = True diff --git a/src/aspire/numeric/numpy.py b/src/aspire/numeric/numpy.py index 07627399f9..ddc8355816 100644 --- a/src/aspire/numeric/numpy.py +++ b/src/aspire/numeric/numpy.py @@ -8,8 +8,12 @@ class Numpy: + # This can be required when mixing nufft/fft/numpy backend combinations. @staticmethod def asnumpy(x): + """ + Ensure `asnumpy` is always available and returns a numpy array. + """ if cp and isinstance(x, cp.ndarray): x = x.get() return x diff --git a/src/aspire/numeric/pyfftw_fft.py b/src/aspire/numeric/pyfftw_fft.py index afcad98d28..95a8ea80f7 100644 --- a/src/aspire/numeric/pyfftw_fft.py +++ b/src/aspire/numeric/pyfftw_fft.py @@ -160,8 +160,8 @@ def fftshift(self, a, axes=None): def ifftshift(self, a, axes=None): return scipy_fft.ifftshift(a, axes=axes) - def dct(self, *args, **kwargs): - return scipy_fft.dct(*args, **kwargs) + def dct(self, x, **kwargs): + return scipy_fft.dct(x, **kwargs) - def idct(self, *args, **kwargs): - return scipy_fft.idct(*args, **kwargs) + def idct(self, x, **kwargs): + return scipy_fft.idct(x, **kwargs) diff --git a/src/aspire/numeric/scipy_fft.py b/src/aspire/numeric/scipy_fft.py index d78e463803..3891d45671 100644 --- a/src/aspire/numeric/scipy_fft.py +++ b/src/aspire/numeric/scipy_fft.py @@ -34,8 +34,8 @@ def fftshift(self, x, axes=None): def ifftshift(self, x, axes=None): return sp.fft.ifftshift(x, axes=axes) - def dct(self, *args, **kwargs): - return sp.fft.dct(*args, **kwargs) + def dct(self, x, **kwargs): + return sp.fft.dct(x, **kwargs) - def idct(self, *args, **kwargs): - return sp.fft.idct(*args, **kwargs) + def idct(self, x, **kwargs): + return sp.fft.idct(x, **kwargs) From 5324e7f69547b27ff6dda6cb4ad317d4f7a9a06f Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 26 Jun 2024 14:20:20 -0400 Subject: [PATCH 076/433] precache fle x y grids on gpu --- src/aspire/basis/fle_2d.py | 22 ++++++++++------------ src/aspire/nufft/cufinufft.py | 14 +++++--------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/aspire/basis/fle_2d.py b/src/aspire/basis/fle_2d.py index e82dbb5d2f..2ca41a2994 100644 --- a/src/aspire/basis/fle_2d.py +++ b/src/aspire/basis/fle_2d.py @@ -308,12 +308,13 @@ def _compute_nufft_points(self): * np.arange(self.num_angular_nodes // 2, dtype=self.dtype) / self.num_angular_nodes ) - x = np.cos(phi).reshape(1, self.num_angular_nodes // 2) - y = np.sin(phi).reshape(1, self.num_angular_nodes // 2) - x = x * nodes * h - y = y * nodes * h - self.grid_x = x.flatten() - self.grid_y = y.flatten() + grid_xy = np.empty( + (2, self.num_radial_nodes, self.num_angular_nodes // 2), dtype=self.dtype + ) + grid_xy[0] = np.cos(phi) # x + grid_xy[1] = np.sin(phi) # y + grid_xy *= nodes * h + self.grid_xy = xp.asarray(grid_xy.reshape(2, -1)) def _build_interpolation_matrix(self): """ @@ -531,7 +532,7 @@ def _evaluate_t(self, imgs): def _step1_t(self, im): """ Step 1 of the adjoint transformation (images to coefficients). - Calculates the NUFFT of the image on gridpoints `self.grid_x` and `self.grid_y`. + Calculates the NUFFT of the image on gridpoints `grid_x` and `grid_y`. """ im = im.reshape(-1, self.nres, self.nres).astype(complex_type(self.dtype)) num_img = im.shape[0] @@ -539,10 +540,7 @@ def _step1_t(self, im): (num_img, self.num_radial_nodes, self.num_angular_nodes), dtype=complex_type(self.dtype), ) - _z = ( - nufft(im, np.stack((self.grid_x, self.grid_y)), epsilon=self.epsilon) - * self.h**2 - ) + _z = nufft(im, self.grid_xy, epsilon=self.epsilon) * self.h**2 _z = _z.reshape(num_img, self.num_radial_nodes, self.num_angular_nodes // 2) z[:, :, : self.num_angular_nodes // 2] = _z z[:, :, self.num_angular_nodes // 2 :] = np.conj(_z) @@ -645,7 +643,7 @@ def _step1(self, z): z = z[:, :, : self.num_angular_nodes // 2].reshape(num_img, -1) im = anufft( z.astype(complex_type(self.dtype)), - np.stack((self.grid_x, self.grid_y)), + self.grid_xy, (self.nres, self.nres), epsilon=self.epsilon, ) diff --git a/src/aspire/nufft/cufinufft.py b/src/aspire/nufft/cufinufft.py index 2dceb08b80..c1d15ff686 100644 --- a/src/aspire/nufft/cufinufft.py +++ b/src/aspire/nufft/cufinufft.py @@ -51,11 +51,11 @@ def __init__(self, sz, fourier_pts, epsilon=1e-8, ntransforms=1, **kwargs): "cufinufft has caught a non C_CONTIGUOUS array," " `fourier_pts` will be copied to C_CONTIGUOUS." ) - self.fourier_pts = np.ascontiguousarray( - np.mod(fourier_pts + np.pi, 2 * np.pi) - np.pi, dtype=self.dtype + self.fourier_pts = cp.ascontiguousarray( + cp.mod(cp.asarray(fourier_pts, dtype=self.dtype) + cp.pi, 2 * cp.pi) - cp.pi ) - self.num_pts = fourier_pts.shape[1] + self.num_pts = self.fourier_pts.shape[1] self.epsilon = max(epsilon, np.finfo(self.dtype).eps) self._transform_plan = cufPlan( @@ -81,12 +81,8 @@ def __init__(self, sz, fourier_pts, epsilon=1e-8, ntransforms=1, **kwargs): **self.adjoint_opts, ) - # Note, I store self.fourier_pts_gpu so the GPUArrray life - # is tied to instance, instead of this method. - self.fourier_pts_gpu = cp.array(self.fourier_pts) - - self._transform_plan.setpts(*self.fourier_pts_gpu) - self._adjoint_plan.setpts(*self.fourier_pts_gpu) + self._transform_plan.setpts(*self.fourier_pts) + self._adjoint_plan.setpts(*self.fourier_pts) def transform(self, signal): """ From afbc468c559f372a2fae3188a63ff5b26c8f0ed1 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 27 Jun 2024 15:32:28 -0400 Subject: [PATCH 077/433] Rm unneeded gc call --- src/aspire/basis/fle_2d.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/aspire/basis/fle_2d.py b/src/aspire/basis/fle_2d.py index 2ca41a2994..ba7d4636e9 100644 --- a/src/aspire/basis/fle_2d.py +++ b/src/aspire/basis/fle_2d.py @@ -1,4 +1,3 @@ -import gc import logging import numpy as np @@ -21,9 +20,8 @@ def _cleanup(): """ - Utility for informing python+cupy to cleanup memory held by old vars. + Utility for informing cupy to cleanup memory held by old vars. """ - gc.collect() try: import cupy @@ -511,18 +509,18 @@ def _evaluate_t(self, imgs): coefficients. """ # See Section 3.5 - imgs = xp.array(imgs) # Copy here, mutating. + imgs = xp.array(imgs) # Intentionally copying here, mutating. imgs[:, self.radial_mask] = 0 z = self._step1_t(imgs) - del imgs + del imgs # inform python we're done with imgs _cleanup() b = self._step2_t(z) - del z + del z # inform python we're done with z _cleanup() coefs = self._step3_t(b) - del b + del b # inform python we're done with b _cleanup() # return in FB order From 8526aa7abc3acf3fd4dd829e18b5efb4e5620d0b Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 28 Jun 2024 08:50:25 -0400 Subject: [PATCH 078/433] Add cupy GPU options to config tutorial --- gallery/tutorials/configuration.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/gallery/tutorials/configuration.py b/gallery/tutorials/configuration.py index 819ff9b675..75354bc422 100644 --- a/gallery/tutorials/configuration.py +++ b/gallery/tutorials/configuration.py @@ -102,6 +102,36 @@ time.sleep(1) print("Done Loop 2\n") +# %% +# Enabling GPU Acceleration +# ------------------------- +# Enabling GPU acceleration requires installing supporting software +# packages and small config changes. Installing the supporting +# software is most easily accomplished by installing ASPIRE with one +# of the published GPU extensions, for example ``pip install +# "aspire[dev,gpu_12x]"``. Once the packages are installed users +# should automatically find that the NUFFT calls are running on the +# GPU. Additional acceleration is achieved by enabling `cupy` for +# `numeric` and `fft` components. +# +# .. code-block:: yaml +# +# common: +# # numeric module to use - one of numpy/cupy +# numeric: cupy +# # fft backend to use - one of pyfftw/scipy/cupy/mkl +# fft: cupy +# +# Alternatively, like other config options, this can be changed +# dynamically with code. +# +# .. code-block:: python +# +# from aspire import config +# +# config["common"]["numeric"] = "cupy" +# config["common"]["fft"] = "cupy" +# # %% # Resolution From 2ef3cd3a8f5cf2b85c9a2516343adab1bd674339 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 28 Jun 2024 09:12:55 -0400 Subject: [PATCH 079/433] update GPU install docs --- docs/source/installation.rst | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 4a48e3a505..5fa608ecdf 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -129,10 +129,10 @@ an M1 laptop: Installing GPU Extensions ************************* -ASPIRE does support GPUs, depending on several external packages. The -collection of GPU extensions can be installed using ``pip``. -Extensions are grouped based on CUDA versions. To find the CUDA -driver version, run ``nvidia-smi`` on the intended system. +ASPIRE does support using a GPU, depending on several external +packages. The collection of GPU extensions can be installed using +``pip``. Extensions are grouped based on CUDA versions. To find the +CUDA driver version, run ``nvidia-smi`` on the intended system. .. list-table:: CUDA GPU Extension Versions :widths: 25 25 @@ -140,14 +140,6 @@ driver version, run ``nvidia-smi`` on the intended system. * - CUDA Version - ASPIRE Extension - * - 10.2 - - gpu-102 - * - 11.0 - - gpu-110 - * - 11.1 - - gpu-111 - * - >=11.2 - - gpu-11x * - >=12 - gpu-12x @@ -164,12 +156,15 @@ the command below would install GPU packages required for ASPIRE. By default if the required GPU extensions are correctly installed, -ASPIRE should automatically begin using the GPU for select components -(such as those using ``nufft``). - -Because GPU extensions depend on several third party packages and -libraries, we can only offer limited support if one of the packages -has a problem on your system. +ASPIRE should automatically begin using the GPU calls to our ``nufft`` module. + +Using GPU in other areas of the code is still an experimental feature +and requires a minor configuration setting to enable ``cupy``. See the +:ref:`sphx_glr_auto_tutorials_configuration.py` for details. Because +GPU extensions depend on several third party softwares and machines +vary wildly, we can only offer limited support if one of the packages +has a problem on your system. We are currently expanding GPU code +coverage. Generating Documentation ************************ From 35797878fb24e25f2a0396e3d4b094b5c880c417 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 28 Jun 2024 10:14:57 -0400 Subject: [PATCH 080/433] improve crop 3d xp interop --- src/aspire/utils/coor_trans.py | 63 ++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/src/aspire/utils/coor_trans.py b/src/aspire/utils/coor_trans.py index ef7857c994..457e29f9f8 100644 --- a/src/aspire/utils/coor_trans.py +++ b/src/aspire/utils/coor_trans.py @@ -376,7 +376,7 @@ def crop_pad_2d(im, size, fill_value=0): :param im: A >=2-dimensional numpy array :param size: Integer size of cropped/padded output - :return: A numpy array of shape (..., size, size) + :return: Array of shape (..., size, size) """ im_y, im_x = im.shape[-2:] @@ -393,7 +393,7 @@ def crop_pad_2d(im, size, fill_value=0): shape = list(im.shape[:-2]) shape.extend([size, size]) - # Ensure that we return in the same dtype as the input + # Ensure that we return the same dtype as the input _full = np.full # Default to numpy array if isinstance(im, xp.ndarray): # Use cupy when `im` _and_ xp are cupy ndarray @@ -405,34 +405,61 @@ def crop_pad_2d(im, size, fill_value=0): # when padding, start_x and start_y are negative since size is larger # than im_x and im_y; the below line calculates where the original image # is placed in relation to the (now-larger) box size - to_return[-start_y : im_y - start_y, -start_x : im_x - start_x] = im + to_return[..., -start_y : im_y - start_y, -start_x : im_x - start_x] = im return to_return else: # target size is between mat_x and mat_y raise ValueError("Cannot crop and pad an image at the same time.") -def crop_pad_3d(im, size, fill_value=0): - im_y, im_x, im_z = im.shape +def crop_pad_3d(vol, size, fill_value=0): + """ + Crop/pads `vol` according to `size`. + + Padding will use `fill_value`. + Return's host/gpu array based on `vol`. + + :param vol: A >=3-dimensional numpy array + :param size: Integer size of cropped/padded output + :return: Array of shape (..., size, size, size) + """ + + vol_z, vol_y, vol_x = vol.shape[-3:] # shift terms - start_x = math.floor(im_x / 2) - math.floor(size / 2) - start_y = math.floor(im_y / 2) - math.floor(size / 2) - start_z = math.floor(im_z / 2) - math.floor(size / 2) + start_z = math.floor(vol_z / 2) - math.floor(size / 2) + start_y = math.floor(vol_y / 2) - math.floor(size / 2) + start_x = math.floor(vol_x / 2) - math.floor(size / 2) # cropping - if size <= min(im_y, im_x, im_z): - return im[ - start_y : start_y + size, start_x : start_x + size, start_z : start_z + size + if size <= min(vol_z, vol_y, vol_x): + return vol[ + ..., + start_z : start_z + size, + start_y : start_y + size, + start_x : start_x + size, ] # padding - elif size >= max(im_y, im_x, im_z): - to_return = fill_value * np.ones((size, size, size), dtype=im.dtype) + elif size >= max(vol_z, vol_y, vol_x): + # Determine shape + shape = list(vol.shape[:-3]) + shape.extend([size, size, size]) + + # Ensure that we return the same dtype as the input + _full = np.full # Default to numpy array + if isinstance(vol, xp.ndarray): + # Use cupy when `vol` _and_ xp are cupy ndarray + # Avoids having to handle when cupy is not installed + _full = xp.full + + to_return = _full(shape, fill_value, dtype=vol.dtype) + to_return[ - -start_y : im_y - start_y, - -start_x : im_x - start_x, - -start_z : im_z - start_z, - ] = im + ..., + -start_z : vol_z - start_z, + -start_y : vol_y - start_y, + -start_x : vol_x - start_x, + ] = vol return to_return else: - # target size is between min and max of (im_y, im_x, im_z) + # target size is between min and max of (vol_y, vol_x, vol_z) raise ValueError("Cannot crop and pad a volume at the same time.") From f35ad5267932abab323dd7dd285f4896b6eb9d9f Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 1 Jul 2024 11:13:04 -0400 Subject: [PATCH 081/433] ffb2d self review cleanup --- src/aspire/basis/ffb_2d.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/aspire/basis/ffb_2d.py b/src/aspire/basis/ffb_2d.py index 116e009757..8d46e8419c 100644 --- a/src/aspire/basis/ffb_2d.py +++ b/src/aspire/basis/ffb_2d.py @@ -131,16 +131,16 @@ def _evaluate(self, v): ind = 0 - idx = ind + xp.arange(self.k_max[0], dtype=int) + idx = ind + np.arange(self.k_max[0], dtype=int) - pf[:, 0, :] = v[:, xp.asarray(self._zero_angular_inds)] @ self.radial_norm[idx] + pf[:, 0, :] = v[:, self._zero_angular_inds] @ self.radial_norm[idx] ind = ind + idx.size ind_pos = ind for ell in range(1, self.ell_max + 1): idx = ind + xp.arange(self.k_max[ell], dtype=int) - idx_pos = ind_pos + xp.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 @@ -171,9 +171,7 @@ def _evaluate(self, v): # perform inverse non-uniformly FFT transform back to 2D coordinate basis freqs = m_reshape(self._precomp["freqs"], (2, n_r * n_theta)) - x = 2 * anufft( - pf.astype(complex_type(self.dtype)), 2 * pi * freqs, self.sz, real=True - ) + x = 2 * anufft(pf, 2 * pi * freqs, self.sz, real=True) # Return X as Image instance with the last two dimensions as *self.sz x = x.reshape((*sz_roll, *self.sz)) @@ -206,7 +204,7 @@ def _evaluate_t(self, x): pf = xp.concatenate((pf, pf.conjugate()), axis=2) # evaluate radial integral using the Gauss-Legendre quadrature rule - pf *= self.gl_weighted_nodes[None, :, None] + pf = pf * self.gl_weighted_nodes[None, :, None] # 1D FFT on the angular dimension for each concentric circle pf = 2 * xp.pi / (2 * n_theta) * fft.fft(pf) From e44840240ce7ce665c7d22adc7b8357ac1dd557c Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 1 Jul 2024 14:43:57 -0400 Subject: [PATCH 082/433] ffb3d move more grid precomp to gpu --- src/aspire/basis/ffb_3d.py | 76 +++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/src/aspire/basis/ffb_3d.py b/src/aspire/basis/ffb_3d.py index 5740900a34..7a2509382f 100644 --- a/src/aspire/basis/ffb_3d.py +++ b/src/aspire/basis/ffb_3d.py @@ -1,7 +1,6 @@ import logging import numpy as np -from numpy import pi from aspire.basis import FBBasis3D from aspire.basis.basis_utils import lgwt, norm_assoc_legendre, sph_bessel @@ -61,26 +60,29 @@ def _precomp(self): r, wt_r = lgwt(n_r, 0.0, self.kcut, dtype=self.dtype) z, wt_z = lgwt(n_phi, -1, 1, dtype=self.dtype) - r = m_reshape(r, (n_r, 1)) - wt_r = m_reshape(wt_r, (n_r, 1)) - z = m_reshape(z, (n_phi, 1)) - wt_z = m_reshape(wt_z, (n_phi, 1)) - phi = np.arccos(z) + r = m_reshape(xp.asarray(r), (n_r, 1)) + rh = xp.asnumpy(r) + wt_r = m_reshape(xp.asarray(wt_r), (n_r, 1)) + z = m_reshape(xp.asarray(z), (n_phi, 1)) + wt_z = m_reshape(xp.asarray(wt_z), (n_phi, 1)) + phi = xp.arccos(z) wt_phi = wt_z - theta = 2 * pi * np.arange(n_theta, dtype=self.dtype).T / (2 * n_theta) + theta = 2 * xp.pi * xp.arange(n_theta, dtype=self.dtype).T / (2 * n_theta) theta = m_reshape(theta, (n_theta, 1)) # evaluate basis function in the radial dimension - radial_wtd = np.zeros( + radial_wtd = xp.zeros( shape=(n_r, np.max(self.k_max), self.ell_max + 1), dtype=self.dtype ) for ell in range(0, self.ell_max + 1): k_max_ell = self.k_max[ell] - rmat = r * self.r0[ell][0:k_max_ell].T / self.kcut - radial_ell = np.zeros_like(rmat) + rmat = rh * self.r0[ell][0:k_max_ell].T / self.kcut # host + radial_ell = xp.zeros_like(rmat) for ik in range(0, k_max_ell): - radial_ell[:, ik] = sph_bessel(ell, rmat[:, ik]) - nrm = np.abs(sph_bessel(ell + 1, self.r0[ell][0:k_max_ell].T) / 4) + radial_ell[:, ik] = xp.asarray(sph_bessel(ell, rmat[:, ik])) + nrm = xp.abs( + xp.asarray(sph_bessel(ell + 1, self.r0[ell][0:k_max_ell].T)) / 4 + ) radial_ell = radial_ell / nrm radial_ell_wtd = r**2 * wt_r * radial_ell radial_wtd[:, 0:k_max_ell, ell] = radial_ell_wtd @@ -95,14 +97,14 @@ def _precomp(self): - np.mod(self.ell_max, 2) * np.mod(m, 2) ) n_odd_ell = int(self.ell_max - m + 1 - n_even_ell) - phi_wtd_m_even = np.zeros((n_phi, n_even_ell), dtype=phi.dtype) - phi_wtd_m_odd = np.zeros((n_phi, n_odd_ell), dtype=phi.dtype) + phi_wtd_m_even = xp.zeros((n_phi, n_even_ell), dtype=phi.dtype) + phi_wtd_m_odd = xp.zeros((n_phi, n_odd_ell), dtype=phi.dtype) ind_even = 0 ind_odd = 0 for ell in range(m, self.ell_max + 1): - phi_m_ell = norm_assoc_legendre(ell, m, z) - nrm_inv = np.sqrt(0.5 / pi) + phi_m_ell = xp.asarray(norm_assoc_legendre(ell, m, z)) + nrm_inv = np.sqrt(0.5 / np.pi) phi_m_ell = nrm_inv * phi_m_ell phi_wtd_m_ell = wt_phi * phi_m_ell if np.mod(ell, 2) == 0: @@ -116,41 +118,41 @@ def _precomp(self): ang_phi_wtd_odd.append(phi_wtd_m_odd) # evaluate basis function in the theta dimension - ang_theta = np.zeros((n_theta, 2 * self.ell_max + 1), dtype=theta.dtype) + ang_theta = xp.zeros((n_theta, 2 * self.ell_max + 1), dtype=theta.dtype) - ang_theta[:, 0 : self.ell_max] = np.sqrt(2) * np.sin( - theta @ m_reshape(np.arange(self.ell_max, 0, -1), (1, self.ell_max)) + ang_theta[:, 0 : self.ell_max] = np.sqrt(2) * xp.sin( + theta @ m_reshape(xp.arange(self.ell_max, 0, -1), (1, self.ell_max)) ) - ang_theta[:, self.ell_max] = np.ones(n_theta, dtype=theta.dtype) - ang_theta[:, self.ell_max + 1 : 2 * self.ell_max + 1] = np.sqrt(2) * np.cos( - theta @ m_reshape(np.arange(1, self.ell_max + 1), (1, self.ell_max)) + ang_theta[:, self.ell_max] = xp.ones(n_theta, dtype=theta.dtype) + ang_theta[:, self.ell_max + 1 : 2 * self.ell_max + 1] = np.sqrt(2) * xp.cos( + theta @ m_reshape(xp.arange(1, self.ell_max + 1), (1, self.ell_max)) ) - ang_theta_wtd = (2 * pi / n_theta) * ang_theta + ang_theta_wtd = (2 * np.pi / n_theta) * ang_theta - theta_grid, phi_grid, r_grid = np.meshgrid( - theta, phi, r, sparse=False, indexing="ij" + theta_grid, phi_grid, r_grid = xp.meshgrid( + theta.flatten(), phi.flatten(), r.flatten(), sparse=False, indexing="ij" ) - fourier_x = m_flatten(r_grid * np.cos(theta_grid) * np.sin(phi_grid)) - fourier_y = m_flatten(r_grid * np.sin(theta_grid) * np.sin(phi_grid)) - fourier_z = m_flatten(r_grid * np.cos(phi_grid)) + fourier_x = m_flatten(r_grid * xp.cos(theta_grid) * xp.sin(phi_grid)) + fourier_y = m_flatten(r_grid * xp.sin(theta_grid) * xp.sin(phi_grid)) + fourier_z = m_flatten(r_grid * xp.cos(phi_grid)) fourier_pts = ( 2 - * pi - * np.vstack( + * xp.pi + * xp.vstack( ( - fourier_z[np.newaxis, ...], - fourier_y[np.newaxis, ...], - fourier_x[np.newaxis, ...], + fourier_z[xp.newaxis, ...], + fourier_y[xp.newaxis, ...], + fourier_x[xp.newaxis, ...], ) ) ) return { - "radial_wtd": xp.asarray(radial_wtd), - "ang_phi_wtd_even": [xp.asarray(x) for x in ang_phi_wtd_even], - "ang_phi_wtd_odd": [xp.asarray(x) for x in ang_phi_wtd_odd], - "ang_theta_wtd": xp.asarray(ang_theta_wtd), + "radial_wtd": radial_wtd, + "ang_phi_wtd_even": ang_phi_wtd_even, + "ang_phi_wtd_odd": ang_phi_wtd_odd, + "ang_theta_wtd": ang_theta_wtd, "fourier_pts": fourier_pts, } From 286301e4d1672668cea68e8bf9fc62d9efd29c0c Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 1 Jul 2024 14:58:08 -0400 Subject: [PATCH 083/433] Move more FLE2D grid precomp to GPU --- src/aspire/basis/fle_2d.py | 23 +++++++++++++---------- src/aspire/basis/fle_2d_utils.py | 1 - 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/aspire/basis/fle_2d.py b/src/aspire/basis/fle_2d.py index ba7d4636e9..631161d0fe 100644 --- a/src/aspire/basis/fle_2d.py +++ b/src/aspire/basis/fle_2d.py @@ -21,6 +21,9 @@ def _cleanup(): """ Utility for informing cupy to cleanup memory held by old vars. + + This method is designed to be safely called even when `CuPy` is + not installed, in which case it is a no-op. """ try: import cupy @@ -288,10 +291,10 @@ def _compute_nufft_points(self): self.num_angular_nodes = num_angular_nodes # create gridpoints - nodes = 1 - (2 * np.arange(self.num_radial_nodes, dtype=self.dtype) + 1) / ( + nodes = 1 - (2 * xp.arange(self.num_radial_nodes, dtype=self.dtype) + 1) / ( 2 * self.num_radial_nodes ) - nodes = (np.cos(np.pi * nodes) + 1) / 2 + nodes = (xp.cos(np.pi * nodes) + 1) / 2 nodes = ( self.greatest_lambda - self.smallest_lambda ) * nodes + self.smallest_lambda @@ -302,17 +305,17 @@ def _compute_nufft_points(self): phi = ( 2 - * np.pi - * np.arange(self.num_angular_nodes // 2, dtype=self.dtype) + * xp.pi + * xp.arange(self.num_angular_nodes // 2, dtype=self.dtype) / self.num_angular_nodes ) - grid_xy = np.empty( + grid_xy = xp.empty( (2, self.num_radial_nodes, self.num_angular_nodes // 2), dtype=self.dtype ) - grid_xy[0] = np.cos(phi) # x - grid_xy[1] = np.sin(phi) # y - grid_xy *= nodes * h - self.grid_xy = xp.asarray(grid_xy.reshape(2, -1)) + grid_xy[0] = xp.cos(phi) # x + grid_xy[1] = xp.sin(phi) # y + grid_xy = grid_xy * nodes * h + self.grid_xy = grid_xy.reshape(2, -1) def _build_interpolation_matrix(self): """ @@ -530,7 +533,7 @@ def _evaluate_t(self, imgs): def _step1_t(self, im): """ Step 1 of the adjoint transformation (images to coefficients). - Calculates the NUFFT of the image on gridpoints `grid_x` and `grid_y`. + Calculates the NUFFT of the image on gridpoints `grid_xy`. """ im = im.reshape(-1, self.nres, self.nres).astype(complex_type(self.dtype)) num_img = im.shape[0] diff --git a/src/aspire/basis/fle_2d_utils.py b/src/aspire/basis/fle_2d_utils.py index 33f237165e..ea459988b0 100644 --- a/src/aspire/basis/fle_2d_utils.py +++ b/src/aspire/basis/fle_2d_utils.py @@ -195,7 +195,6 @@ def barycentric_interp_sparse(target_points, known_points, numsparse): # note that const cancels in numerator and denominator vals = vals / denom.reshape(-1, 1) - # TODO, migrate more of this method towards `xp` vals = xp.array(vals.flatten()) idx = xp.array(idx.flatten()) jdx = xp.array(jdx.flatten()) From db0e7d651503e37fbc4165ac9118ddfa90c851f2 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 1 Jul 2024 15:05:58 -0400 Subject: [PATCH 084/433] image self review cleanup --- src/aspire/image/image.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 8ad8dc8711..5a7bde2374 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -392,6 +392,10 @@ def downsample(self, ds_res): original_stack_shape = self.stack_shape im = self.stack_reshape(-1) + # Note image data is intentionally migrated via `xp.asarray` + # because all of the subsequent calls until `asnumpy` are GPU + # when xp and fft in `cupy` mode. + # compute FT with centered 0-frequency fx = fft.centered_fft2(xp.asarray(im._data)) # crop 2D Fourier transform for each image @@ -413,17 +417,16 @@ def filter(self, filter): im = self.stack_reshape(-1) + # Note image and filter data is intentionally migrated via + # `xp.asarray` because all of the subsequent calls until + # `asnumpy` are GPU when xp and fft in `cupy` mode. filter_values = xp.asarray(filter.evaluate_grid(self.resolution)) + # Convolve im_f = fft.centered_fft2(xp.asarray(im._data)) - - # TODO: why are these different? Doesn't the broadcast work? - if im_f.ndim > filter_values.ndim: - im_f *= filter_values - else: - im_f = filter_values * im_f - + im_f = filter_values * im_f im = fft.centered_ifft2(im_f) + im = xp.asnumpy(im.real) return self.__class__(im).stack_reshape(original_stack_shape) From 235979c0c04cb2423ced2498e698bf3bc6ccb486 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 1 Jul 2024 15:10:56 -0400 Subject: [PATCH 085/433] var name improvement --- src/aspire/nufft/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/aspire/nufft/__init__.py b/src/aspire/nufft/__init__.py index 953f55ce3e..fcfe182918 100644 --- a/src/aspire/nufft/__init__.py +++ b/src/aspire/nufft/__init__.py @@ -172,9 +172,9 @@ def anufft(sig_f, fourier_pts, sz, real=False, epsilon=1e-8): """ - _on_gpu = False + _keep_on_gpu = False if cp and isinstance(sig_f, cp.ndarray): - _on_gpu = True + _keep_on_gpu = True if fourier_pts.dtype != real_type(sig_f.dtype): raise RuntimeError( @@ -198,7 +198,7 @@ def anufft(sig_f, fourier_pts, sz, real=False, epsilon=1e-8): adjoint = adjoint.real if real else adjoint - if cp and not _on_gpu: + if cp and not _keep_on_gpu: adjoint = adjoint.get() return adjoint @@ -223,9 +223,9 @@ def nufft(sig_f, fourier_pts, real=False, epsilon=1e-8): """ - _on_gpu = False + _keep_on_gpu = False if cp and isinstance(sig_f, cp.ndarray): - _on_gpu = True + _keep_on_gpu = True if fourier_pts.dtype != real_type(sig_f.dtype): raise RuntimeError( @@ -259,7 +259,7 @@ def nufft(sig_f, fourier_pts, real=False, epsilon=1e-8): transform = transform.real if real else transform - if cp and not _on_gpu: + if cp and not _keep_on_gpu: transform = transform.get() return transform From 4f6ca0aee96ba970031c5f85b83ca80823edf7d9 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 1 Jul 2024 15:16:42 -0400 Subject: [PATCH 086/433] minor crop pad string improvements --- src/aspire/utils/coor_trans.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/aspire/utils/coor_trans.py b/src/aspire/utils/coor_trans.py index 457e29f9f8..53f86714c8 100644 --- a/src/aspire/utils/coor_trans.py +++ b/src/aspire/utils/coor_trans.py @@ -409,7 +409,11 @@ def crop_pad_2d(im, size, fill_value=0): return to_return else: # target size is between mat_x and mat_y - raise ValueError("Cannot crop and pad an image at the same time.") + raise ValueError( + "Cannot crop and pad Image at the same time." + "If this is really what you intended," + " make two seperate calls for cropping and padding." + ) def crop_pad_3d(vol, size, fill_value=0): @@ -461,5 +465,9 @@ def crop_pad_3d(vol, size, fill_value=0): ] = vol return to_return else: - # target size is between min and max of (vol_y, vol_x, vol_z) - raise ValueError("Cannot crop and pad a volume at the same time.") + # target size is between min and max of (vol_x, vol_y, vol_z) + raise ValueError( + "Cannot crop and pad Volume at the same time." + "If this is really what you intended," + " make two seperate calls for cropping and padding." + ) From 6fa1ec609ffb3d81aeaecfa826fe71b8a1d5d024 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 1 Jul 2024 15:23:54 -0400 Subject: [PATCH 087/433] Update volume downsample with crop_pad_3d improvements --- src/aspire/volume/volume.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index b7e4245ede..0f01ef5e61 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -468,27 +468,27 @@ def downsample(self, ds_res, mask=None): :param ds_res: Desired resolution. :param mask: Optional NumPy array mask to multiply in Fourier space. """ - if mask is None: - mask = 1.0 original_stack_shape = self.stack_shape v = self.stack_reshape(-1) # take 3D Fourier transform of each volume in the stack - fx = xp.asnumpy(fft.fftshift(fft.fftn(xp.asarray(v._data), axes=(1, 2, 3)))) + fx = fft.fftshift(fft.fftn(xp.asarray(v._data), axes=(1, 2, 3))) + # crop each volume to the desired resolution in frequency space - crop_fx = ( - np.array([crop_pad_3d(fx[i, :, :, :], ds_res) for i in range(self.n_vols)]) - * mask - ) + fx = crop_pad_3d(fx, ds_res) + + # Optionally apply mask + if mask is not None: + fx = fx * xp.asarray(mask) + # inverse Fourier transform of each volume - out = xp.asnumpy( - fft.ifftn(fft.ifftshift(xp.asarray(crop_fx)), axes=(1, 2, 3)) - * (ds_res**3 / self.resolution**3) - ) + out = fft.ifftn(fft.ifftshift(fx), axes=(1, 2, 3)).real + out = out.real * (ds_res**3 / self.resolution**3) + # returns a new Volume object return self.__class__( - np.real(out), symmetry_group=self.symmetry_group + xp.asnumpy(out), symmetry_group=self.symmetry_group ).stack_reshape(original_stack_shape) def shift(self): From 2431495564142840b71672a0116624e57fc05dfe Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 1 Jul 2024 15:25:59 -0400 Subject: [PATCH 088/433] add docstring --- tests/test_numeric_sparse.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_numeric_sparse.py b/tests/test_numeric_sparse.py index 5a8227fe47..e58aa02e6a 100644 --- a/tests/test_numeric_sparse.py +++ b/tests/test_numeric_sparse.py @@ -1,3 +1,7 @@ +""" +Tests basic numpy/cupy functionality of sparse numeric wrappers. +""" + import numpy as np import pytest From 8db122147e8b9f4c8fab59c09469f57f62654737 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 1 Jul 2024 16:02:58 -0400 Subject: [PATCH 089/433] enforce filter dtype --- src/aspire/image/image.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 5a7bde2374..d25ee4baa0 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -420,7 +420,9 @@ def filter(self, filter): # Note image and filter data is intentionally migrated via # `xp.asarray` because all of the subsequent calls until # `asnumpy` are GPU when xp and fft in `cupy` mode. - filter_values = xp.asarray(filter.evaluate_grid(self.resolution)) + filter_values = xp.asarray( + filter.evaluate_grid(self.resolution), dtype=self.dtype + ) # Convolve im_f = fft.centered_fft2(xp.asarray(im._data)) From 329de8f0cf36567fd7156b0d733a2b28b32f5cc1 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 1 Jul 2024 16:18:53 -0400 Subject: [PATCH 090/433] explicitly force C order before cufinufft call --- src/aspire/nufft/cufinufft.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/aspire/nufft/cufinufft.py b/src/aspire/nufft/cufinufft.py index c1d15ff686..218fbd5fb7 100644 --- a/src/aspire/nufft/cufinufft.py +++ b/src/aspire/nufft/cufinufft.py @@ -165,7 +165,8 @@ def adjoint(self, signal): " In the future this will be an error." ) - signal = cp.asarray(signal, dtype=self.complex_dtype) + # Note, if not C order, cuFINUFFT will copy-cast anyway. + signal = cp.asarray(signal, order="C", dtype=self.complex_dtype) res_shape = self.sz # Note, there is a corner case for ntransforms == 1. From da18c563f5da14a2cdb3692fa7c354e450a24f22 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 2 Jul 2024 10:56:38 -0400 Subject: [PATCH 091/433] Add dtype note and utest tolerance for singles --- src/aspire/image/image.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index d25ee4baa0..f03372b087 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -420,6 +420,8 @@ def filter(self, filter): # Note image and filter data is intentionally migrated via # `xp.asarray` because all of the subsequent calls until # `asnumpy` are GPU when xp and fft in `cupy` mode. + # + # Second note, filter dtype may not match image dtype. filter_values = xp.asarray( filter.evaluate_grid(self.resolution), dtype=self.dtype ) From 7e2bdb327425201f44b42448bf50c94844f4452e Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 15 Jul 2024 10:35:56 -0400 Subject: [PATCH 092/433] configuration doc wording (strings) --- gallery/tutorials/configuration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gallery/tutorials/configuration.py b/gallery/tutorials/configuration.py index 75354bc422..372d97df06 100644 --- a/gallery/tutorials/configuration.py +++ b/gallery/tutorials/configuration.py @@ -110,7 +110,7 @@ # software is most easily accomplished by installing ASPIRE with one # of the published GPU extensions, for example ``pip install # "aspire[dev,gpu_12x]"``. Once the packages are installed users -# should automatically find that the NUFFT calls are running on the +# should find that the NUFFT calls are automatically running on the # GPU. Additional acceleration is achieved by enabling `cupy` for # `numeric` and `fft` components. # From a7fa3f3cafeff0956f59d1c29747717c16d81d92 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 15 Jul 2024 11:04:40 -0400 Subject: [PATCH 093/433] keep a few more vars as cupy --- src/aspire/basis/fle_2d.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/aspire/basis/fle_2d.py b/src/aspire/basis/fle_2d.py index 631161d0fe..76330e6fba 100644 --- a/src/aspire/basis/fle_2d.py +++ b/src/aspire/basis/fle_2d.py @@ -544,7 +544,7 @@ def _step1_t(self, im): _z = nufft(im, self.grid_xy, epsilon=self.epsilon) * self.h**2 _z = _z.reshape(num_img, self.num_radial_nodes, self.num_angular_nodes // 2) z[:, :, : self.num_angular_nodes // 2] = _z - z[:, :, self.num_angular_nodes // 2 :] = np.conj(_z) + z[:, :, self.num_angular_nodes // 2 :] = _z.conj() return z def _step2_t(self, z): @@ -643,13 +643,13 @@ def _step1(self, z): num_img = z.shape[0] z = z[:, :, : self.num_angular_nodes // 2].reshape(num_img, -1) im = anufft( - z.astype(complex_type(self.dtype)), + z.astype(complex_type(self.dtype), copy=False), self.grid_xy, (self.nres, self.nres), epsilon=self.epsilon, ) - im = im + np.conj(im) - im = np.real(im) + im = im + im.conj() + im = im.real im = im.reshape(num_img, self.nres, self.nres) im[:, self.radial_mask] = 0 From 9ac4be9709a944c43286d86689b9a72b47b4d796 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 15 Jul 2024 15:09:41 -0400 Subject: [PATCH 094/433] replace xp.newaxis with None --- src/aspire/basis/ffb_3d.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aspire/basis/ffb_3d.py b/src/aspire/basis/ffb_3d.py index 7a2509382f..4137e572a9 100644 --- a/src/aspire/basis/ffb_3d.py +++ b/src/aspire/basis/ffb_3d.py @@ -141,9 +141,9 @@ def _precomp(self): * xp.pi * xp.vstack( ( - fourier_z[xp.newaxis, ...], - fourier_y[xp.newaxis, ...], - fourier_x[xp.newaxis, ...], + fourier_z[None, ...], + fourier_y[None, ...], + fourier_x[None, ...], ) ) ) From 5ab1c7bc8ea9fbcf6240d0e5bb02de96069449ac Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 23 Jul 2024 08:40:19 -0400 Subject: [PATCH 095/433] put cache dir on new line --- .github/workflows/workflow.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index fce5a7f6d4..c41b221ec4 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -147,7 +147,8 @@ jobs: echo "Stash the WORK_DIR to GitHub env so we can clean it up later." echo "WORK_DIR=${WORK_DIR}" >> $GITHUB_ENV echo -e "ray:\n temp_dir: ${WORK_DIR}\n" > ${WORK_DIR}/config.yaml - echo -e "common:\n cache_dir: ${CI_CACHE_DIR}" >> ${WORK_DIR}/config.yaml + echo -e "common:" >> ${WORK_DIR}/config.yaml + echo -e " cache_dir: ${CI_CACHE_DIR}" >> ${WORK_DIR}/config.yaml echo -e " numeric: cupy" >> ${WORK_DIR}/config.yaml echo -e " fft: cupy\n" >> ${WORK_DIR}/config.yaml echo "Log the config: ${WORK_DIR}/config.yaml" From b86c2d561e493aca8f2214ca60d4bea83300650c Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 23 Jul 2024 08:52:57 -0400 Subject: [PATCH 096/433] rename tmp to ang_theta_wtd_trans --- src/aspire/basis/ffb_3d.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aspire/basis/ffb_3d.py b/src/aspire/basis/ffb_3d.py index 4137e572a9..7f0821b99a 100644 --- a/src/aspire/basis/ffb_3d.py +++ b/src/aspire/basis/ffb_3d.py @@ -308,9 +308,9 @@ def _evaluate_t(self, x): pf = m_reshape(pf.T, (n_theta, n_phi * n_r * n_data)) # evaluate the theta parts - tmp = self._precomp["ang_theta_wtd"].T - u_even = tmp @ pf.real - u_odd = tmp @ pf.imag + ang_theta_wtd_trans = self._precomp["ang_theta_wtd"].T + u_even = ang_theta_wtd_trans @ pf.real + u_odd = ang_theta_wtd_trans @ pf.imag u_even = m_reshape(u_even, (2 * self.ell_max + 1, n_phi, n_r, n_data)) u_odd = m_reshape(u_odd, (2 * self.ell_max + 1, n_phi, n_r, n_data)) From b9f263b0c6dd4aa537fe6f185fe967cc3b03947d Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 23 Jul 2024 08:57:42 -0400 Subject: [PATCH 097/433] gpu to GPU and rm dev comment --- src/aspire/nufft/__init__.py | 4 ++-- src/aspire/numeric/cupy_fft.py | 3 --- src/aspire/utils/coor_trans.py | 4 ++-- tests/test_orient_sdp.py | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/aspire/nufft/__init__.py b/src/aspire/nufft/__init__.py index fcfe182918..07d92c736c 100644 --- a/src/aspire/nufft/__init__.py +++ b/src/aspire/nufft/__init__.py @@ -159,7 +159,7 @@ def anufft(sig_f, fourier_pts, sz, real=False, epsilon=1e-8): Selects best available package from `nfft` `backends` configuration list. - When sig_f is provided as a CuPy gpu array with a cufinufft + When sig_f is provided as a CuPy GPU array with a cufinufft backend, result is maintained on GPU. :param sig_f: Array representing the signal(s) in Fourier space to be transformed. \ @@ -211,7 +211,7 @@ def nufft(sig_f, fourier_pts, real=False, epsilon=1e-8): Selects best available package from `nfft` `backends` configuration list. - When sig_f is provided as a CuPy gpu array with a cufinufft + When sig_f is provided as a CuPy GPU array with a cufinufft backend, result is maintained on GPU. :param sig_f: Array representing the signal(s) in real space to be transformed. \ diff --git a/src/aspire/numeric/cupy_fft.py b/src/aspire/numeric/cupy_fft.py index f67937813f..6ad6a4e9da 100644 --- a/src/aspire/numeric/cupy_fft.py +++ b/src/aspire/numeric/cupy_fft.py @@ -25,9 +25,6 @@ def wrapper(self, x, *args, **kwargs): # CuPy's single precision FFT appears to be too inaccurate for # many of our unit tests, so the signal is upcast and recast # on return. - # Todo, discuss with Joakim whether we want this upcasting - # business configurable or keep singles, both in conjunction - # with xfailing the tests. _singles = False if x.dtype == np.float32: _singles = True diff --git a/src/aspire/utils/coor_trans.py b/src/aspire/utils/coor_trans.py index 53f86714c8..cad8fb0295 100644 --- a/src/aspire/utils/coor_trans.py +++ b/src/aspire/utils/coor_trans.py @@ -372,7 +372,7 @@ def crop_pad_2d(im, size, fill_value=0): Crop/pads `im` according to `size`. Padding will use `fill_value`. - Return's host/gpu array based on `im`. + Return's host/GPU array based on `im`. :param im: A >=2-dimensional numpy array :param size: Integer size of cropped/padded output @@ -421,7 +421,7 @@ def crop_pad_3d(vol, size, fill_value=0): Crop/pads `vol` according to `size`. Padding will use `fill_value`. - Return's host/gpu array based on `vol`. + Return's host/GPU array based on `vol`. :param vol: A >=3-dimensional numpy array :param size: Integer size of cropped/padded output diff --git a/tests/test_orient_sdp.py b/tests/test_orient_sdp.py index a161d2fdd7..22658ee06a 100644 --- a/tests/test_orient_sdp.py +++ b/tests/test_orient_sdp.py @@ -77,7 +77,7 @@ def test_estimate_rotations(src_orient_est_fixture): src, orient_est = src_orient_est_fixture if backend_available("cufinufft") and src.dtype == np.float32: - pytest.skip("CI on gpu fails for singles.") + pytest.skip("CI on GPU fails for singles.") orient_est.estimate_rotations() From 0c20e2ebfe014802855d597b2687ee580379d6e0 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 6 Jun 2024 15:42:33 -0400 Subject: [PATCH 098/433] Add epsilon arg to PowerFilter. --- src/aspire/operators/filters.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/aspire/operators/filters.py b/src/aspire/operators/filters.py index 9b910a8fe0..bb7491c780 100644 --- a/src/aspire/operators/filters.py +++ b/src/aspire/operators/filters.py @@ -184,9 +184,19 @@ class PowerFilter(Filter): A Filter object that is composed of a regular `Filter` object, but evaluates it to a specified power. """ - def __init__(self, filter, power=1): + def __init__(self, filter, power=1, epsilon=None): + """ + Initialize PowerFilter instance. + + :param filter: A Filter instance. + :param power: Exponent to raise filter values. + :param epsilon: Threshold on filter values that get raised to a negative power. + `filter` values below this threshold will be set to zero during evaluation. + Default uses machine epsilon for filter.dtype. + """ self._filter = filter self._power = power + self._epsilon = epsilon super().__init__(dim=filter.dim, radial=filter.radial) def _evaluate(self, omega): @@ -204,7 +214,9 @@ def evaluate_grid(self, L, *args, dtype=np.float32, **kwargs): # Place safeguard on values below machine epsilon for negative powers. if self._power < 0: - eps = np.finfo(filter_vals.dtype).eps + eps = self._epsilon + if eps is None: + eps = np.finfo(filter_vals.dtype).eps condition = abs(filter_vals) < eps num_less_eps = np.count_nonzero(condition) if num_less_eps > 0: From 0ee7a52531405c496ee62f98db54dacdc0baeab9 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 6 Jun 2024 16:02:42 -0400 Subject: [PATCH 099/433] Add threshold to whiten function with matlab default. --- src/aspire/source/image.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/aspire/source/image.py b/src/aspire/source/image.py index 473585acb9..f93a40440b 100644 --- a/src/aspire/source/image.py +++ b/src/aspire/source/image.py @@ -798,7 +798,7 @@ def downsample(self, L): self.L = L @_as_copy - def whiten(self, noise_estimate=None): + def whiten(self, noise_estimate=None, epsilon=None): """ Modify the `ImageSource` in-place by appending a whitening filter to the generation pipeline. @@ -810,6 +810,9 @@ def whiten(self, noise_estimate=None): passed a `NoiseEstimator` the `filter` attribute will be queried. Alternatively, the noise PSD may be passed directly as a `Filter` object. + :param epsilon: Threshold used to determine which frequencies to whiten + and which to set to zero. By default all filter values less than + 100*eps(self.dtype) are zeroed out. :return: On return, the `ImageSource` object has been modified in place. """ @@ -827,8 +830,15 @@ def whiten(self, noise_estimate=None): " instead of `NoiseEstimator` or `Filter`." ) + # Set threshold for whiten_filter. All values such that sqrt(noise_filter) < eps + # will be set to zero in the whiten_filter. + if epsilon is None: + epsilon = 100 * np.finfo(self.dtype).eps + logger.info("Whitening source object") - whiten_filter = PowerFilter(noise_filter, power=-0.5) + # epsilon is squared to account for the PowerFilter applying the threshold + # to noise_filter, not sqrt(noise_filter). + whiten_filter = PowerFilter(noise_filter, power=-0.5, epsilon=epsilon**2) logger.info("Transforming all CTF Filters into Multiplicative Filters") self.unique_filters = [ From d177574b776106b4f94617267dec5a8d914f3dc8 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 10 Jun 2024 15:27:08 -0400 Subject: [PATCH 100/433] Recast ArrayFilter result after scipy workaround upcast occurs. --- src/aspire/operators/filters.py | 3 ++- tests/test_filters.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/aspire/operators/filters.py b/src/aspire/operators/filters.py index bb7491c780..df2d33b036 100644 --- a/src/aspire/operators/filters.py +++ b/src/aspire/operators/filters.py @@ -349,7 +349,8 @@ def _evaluate(self, omega): # Result is 1 x np.prod(self.sz) in shape; convert to a 1-d vector result = np.squeeze(result, 0) - return result + # Recast result with correct dtype + return result.astype(self.xfer_fn_array.dtype) def evaluate_grid(self, L, *args, dtype=np.float32, **kwargs): """ diff --git a/tests/test_filters.py b/tests/test_filters.py index 35d7955a9e..33f8dc7349 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -361,3 +361,19 @@ def test_power_filter_safeguard(dtype, caplog): # Check caplog for warning. msg = f"setting {num_eps} extremal filter value(s) to zero." assert msg in caplog.text + + +@pytest.mark.parametrize("dtype", [np.float32, np.float64]) +def test_array_filter_dtype_passthrough(dtype): + """ + Do to a bug in scipy versions < 1.10.1, scipy's interpolator crashes + in singles. We have a workaround that upcasts to doubles. This test + ensures that we recast to the correct dtype during calculations. + """ + L = 8 + arr = np.ones((L, L), dtype=dtype) + + filt = ArrayFilter(arr) + filt_vals = filt.evaluate_grid(L, dtype=dtype) + + assert filt_vals.dtype == dtype From 86486987edd488ffec733a495c9ce18ff66004fa Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 10 Jun 2024 16:03:53 -0400 Subject: [PATCH 101/433] Revert to original threshold of eps(dtype) on PSD. --- src/aspire/source/image.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/aspire/source/image.py b/src/aspire/source/image.py index f93a40440b..b23b5c98e4 100644 --- a/src/aspire/source/image.py +++ b/src/aspire/source/image.py @@ -811,8 +811,8 @@ def whiten(self, noise_estimate=None, epsilon=None): queried. Alternatively, the noise PSD may be passed directly as a `Filter` object. :param epsilon: Threshold used to determine which frequencies to whiten - and which to set to zero. By default all filter values less than - 100*eps(self.dtype) are zeroed out. + and which to set to zero. By default all PSD values in the `noise_estimate` + less than eps(self.dtype) are zeroed out in the whitening filter. :return: On return, the `ImageSource` object has been modified in place. """ @@ -830,15 +830,10 @@ def whiten(self, noise_estimate=None, epsilon=None): " instead of `NoiseEstimator` or `Filter`." ) - # Set threshold for whiten_filter. All values such that sqrt(noise_filter) < eps - # will be set to zero in the whiten_filter. - if epsilon is None: - epsilon = 100 * np.finfo(self.dtype).eps - logger.info("Whitening source object") # epsilon is squared to account for the PowerFilter applying the threshold # to noise_filter, not sqrt(noise_filter). - whiten_filter = PowerFilter(noise_filter, power=-0.5, epsilon=epsilon**2) + whiten_filter = PowerFilter(noise_filter, power=-0.5, epsilon=epsilon) logger.info("Transforming all CTF Filters into Multiplicative Filters") self.unique_filters = [ From 582077fefdf35ab4127e44422005f5942d53a1a1 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 11 Jun 2024 15:33:23 -0400 Subject: [PATCH 102/433] remove comment --- src/aspire/source/image.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/aspire/source/image.py b/src/aspire/source/image.py index b23b5c98e4..c60b64d701 100644 --- a/src/aspire/source/image.py +++ b/src/aspire/source/image.py @@ -831,8 +831,6 @@ def whiten(self, noise_estimate=None, epsilon=None): ) logger.info("Whitening source object") - # epsilon is squared to account for the PowerFilter applying the threshold - # to noise_filter, not sqrt(noise_filter). whiten_filter = PowerFilter(noise_filter, power=-0.5, epsilon=epsilon) logger.info("Transforming all CTF Filters into Multiplicative Filters") From 644de3c4b3b18e21a8ab29769db352d9fc266ce4 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 11 Jun 2024 15:44:35 -0400 Subject: [PATCH 103/433] set default epsilon inside whiten function. --- src/aspire/source/image.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/aspire/source/image.py b/src/aspire/source/image.py index c60b64d701..fa5be1f7f7 100644 --- a/src/aspire/source/image.py +++ b/src/aspire/source/image.py @@ -830,6 +830,9 @@ def whiten(self, noise_estimate=None, epsilon=None): " instead of `NoiseEstimator` or `Filter`." ) + if epsilon is None: + epsilon = np.finfo(self.dtype).eps + logger.info("Whitening source object") whiten_filter = PowerFilter(noise_filter, power=-0.5, epsilon=epsilon) From 1c09a39e98252259d2dea62f86fca595b4ed78d3 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 18 Jun 2024 09:03:49 -0400 Subject: [PATCH 104/433] test PowerFilter argument --- tests/test_filters.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/test_filters.py b/tests/test_filters.py index 33f8dc7349..8d9cac9e29 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -1,3 +1,4 @@ +import itertools import logging import os.path from unittest import TestCase @@ -332,20 +333,26 @@ def testFilterSigns(self): self.assertTrue(np.allclose(sign_filter.evaluate(self.omega), signs)) -@pytest.mark.parametrize("dtype", [np.float32, np.float64]) -def test_power_filter_safeguard(dtype, caplog): +params = list(itertools.product([np.float32, np.float64], [None, 0.01])) + + +@pytest.mark.parametrize("dtype, epsilon", params) +def test_power_filter_safeguard(dtype, epsilon, caplog): L = 25 arr = np.ones((L, L), dtype=dtype) # Set a few values below machine epsilon. num_eps = 3 - eps = np.finfo(dtype).eps + eps = epsilon + if eps is None: + eps = np.finfo(dtype).eps arr[L // 2, L // 2 : L // 2 + num_eps] = eps / 2 # For negative powers, values below machine eps will be set to zero. filt = PowerFilter( filter=ArrayFilter(arr), power=-0.5, + epsilon=epsilon, ) caplog.clear() From 61d79fb1268c94b0fd52426797b10e98723bfcf7 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 18 Jun 2024 09:18:42 -0400 Subject: [PATCH 105/433] smoke test for whiten epsilon param. --- tests/test_preprocess_pipeline.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_preprocess_pipeline.py b/tests/test_preprocess_pipeline.py index fb7d2427ec..a37b19210a 100644 --- a/tests/test_preprocess_pipeline.py +++ b/tests/test_preprocess_pipeline.py @@ -126,6 +126,15 @@ def testWhiten2(dtype): assert np.allclose(np.eye(2), corr_coef, atol=2e-1) +@pytest.mark.parametrize("dtype", [np.float32, np.float64]) +def test_whiten_epsilon(dtype): + """Smoke test for epsilon argument""" + L = 25 + sim = get_sim_object(L, dtype) + noise_estimator = AnisotropicNoiseEstimator(sim) + _ = sim.whiten(noise_estimator.filter, epsilon=0.01) + + @pytest.mark.parametrize("L, dtype", params) def testInvertContrast(L, dtype): sim1 = get_sim_object(L, dtype) From 75a232b2340caa6e23c24814ca3787ae8c8499c2 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 18 Jun 2024 15:38:45 -0400 Subject: [PATCH 106/433] bump scipy version. remove upcast. --- pyproject.toml | 2 +- src/aspire/operators/filters.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c9c25a9976..c674418ec1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ dependencies = [ "pyshtools<=4.10.4", # 4.11.7 might have a packaging bug "PyWavelets", "ray >= 2.9.2", - "scipy >= 1.10.0", + "scipy >= 1.10.1", "scikit-learn", "scikit-image", "setuptools >= 0.41", diff --git a/src/aspire/operators/filters.py b/src/aspire/operators/filters.py index df2d33b036..c93c34f9cb 100644 --- a/src/aspire/operators/filters.py +++ b/src/aspire/operators/filters.py @@ -333,8 +333,7 @@ def _evaluate(self, omega): # for values slightly outside the interpolation grid bounds. interpolator = RegularGridInterpolator( _input_pts, - # https://github.com/scipy/scipy/issues/17718 - self.xfer_fn_array.astype(np.float64), + self.xfer_fn_array, method="linear", bounds_error=False, fill_value=None, @@ -349,8 +348,8 @@ def _evaluate(self, omega): # Result is 1 x np.prod(self.sz) in shape; convert to a 1-d vector result = np.squeeze(result, 0) - # Recast result with correct dtype - return result.astype(self.xfer_fn_array.dtype) + # Scipy's interpolator will upcast singles. Recasting. + return result.astype(self.xfer_fn_array.dtype, copy=False) def evaluate_grid(self, L, *args, dtype=np.float32, **kwargs): """ From 53b06e368312ea1459af0817fc5af88970a6f87b Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 18 Jun 2024 16:18:30 -0400 Subject: [PATCH 107/433] test that whiten safeguard is actually working. --- tests/test_filters.py | 3 +-- tests/test_preprocess_pipeline.py | 26 +++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/tests/test_filters.py b/tests/test_filters.py index 8d9cac9e29..8674f13486 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -373,8 +373,7 @@ def test_power_filter_safeguard(dtype, epsilon, caplog): @pytest.mark.parametrize("dtype", [np.float32, np.float64]) def test_array_filter_dtype_passthrough(dtype): """ - Do to a bug in scipy versions < 1.10.1, scipy's interpolator crashes - in singles. We have a workaround that upcasts to doubles. This test + scipy's interpolator will upcast singles. This test ensures that we recast to the correct dtype during calculations. """ L = 8 diff --git a/tests/test_preprocess_pipeline.py b/tests/test_preprocess_pipeline.py index a37b19210a..17a4407008 100644 --- a/tests/test_preprocess_pipeline.py +++ b/tests/test_preprocess_pipeline.py @@ -127,12 +127,32 @@ def testWhiten2(dtype): @pytest.mark.parametrize("dtype", [np.float32, np.float64]) -def test_whiten_epsilon(dtype): - """Smoke test for epsilon argument""" +def test_whiten_safeguard(dtype): + """Test that whitening safeguard works as expected.""" L = 25 + epsilon = 0.02 sim = get_sim_object(L, dtype) noise_estimator = AnisotropicNoiseEstimator(sim) - _ = sim.whiten(noise_estimator.filter, epsilon=0.01) + sim = sim.whiten(noise_estimator.filter, epsilon=epsilon) + + # Get whitening_filter from generation pipeline. + whiten_filt = sim.generation_pipeline.xforms[0].filter.evaluate_grid(sim.L) + + # Generate whitening_filter without safeguard directly from noise_estimator. + filt_vals = noise_estimator.filter.xfer_fn_array + whiten_filt_unsafe = filt_vals**-0.5 + + # Get indices where safeguard should be applied + # and assert that they are not empty. + ind = np.where(filt_vals < epsilon) + np.testing.assert_array_less(0, len(ind[0])) + + # Check that whiten_filt and whiten_filt_unsafe agree up to safeguard indices. + disagree = np.where(whiten_filt != whiten_filt_unsafe) + np.testing.assert_array_equal(ind, disagree) + + # Check that whiten_filt is zero at safeguard indices. + np.testing.assert_allclose(whiten_filt[ind], 0.0) @pytest.mark.parametrize("L, dtype", params) From cf7a77855f64a77841937b428bbaa104471d936f Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 20 Jun 2024 09:27:20 -0400 Subject: [PATCH 108/433] use np.testing in suite that failed on arm. --- tests/test_preprocess_pipeline.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_preprocess_pipeline.py b/tests/test_preprocess_pipeline.py index 17a4407008..d7416095b0 100644 --- a/tests/test_preprocess_pipeline.py +++ b/tests/test_preprocess_pipeline.py @@ -101,7 +101,7 @@ def testWhiten(dtype): corr_coef = np.corrcoef(imgs_wt[:, L - 1, L - 1], imgs_wt[:, L - 2, L - 1]) # correlation matrix should be close to identity - assert np.allclose(np.eye(2), corr_coef, atol=1e-1) + np.testing.assert_allclose(np.eye(2), corr_coef, atol=1e-1) # dtype of returned images should be the same assert dtype == imgs_wt.dtype @@ -123,7 +123,7 @@ def testWhiten2(dtype): corr_coef = np.corrcoef(imgs_wt[:, L - 1, L - 1], imgs_wt[:, L - 2, L - 1]) # Correlation matrix should be close to identity - assert np.allclose(np.eye(2), corr_coef, atol=2e-1) + np.testing.assert_allclose(np.eye(2), corr_coef, atol=2e-1) @pytest.mark.parametrize("dtype", [np.float32, np.float64]) @@ -167,7 +167,9 @@ def testInvertContrast(L, dtype): imgs2_rc = sim2.images[:num_images] # all images should be the same after inverting contrast - assert np.allclose(imgs1_rc.asnumpy(), imgs2_rc.asnumpy()) + np.testing.assert_allclose( + imgs1_rc.asnumpy(), imgs2_rc.asnumpy(), rtol=1e-05, atol=1e-08 + ) # dtype of returned images should be the same assert dtype == imgs1_rc.dtype assert dtype == imgs2_rc.dtype From f58976c6a5d7ddb72017ea3f67fe54526b407764 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 20 Jun 2024 09:38:47 -0400 Subject: [PATCH 109/433] use np.testing in test_FLEbasis2D.py --- tests/test_FLEbasis2D.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_FLEbasis2D.py b/tests/test_FLEbasis2D.py index 7d6b3f5c47..ffb1f8f7d1 100644 --- a/tests/test_FLEbasis2D.py +++ b/tests/test_FLEbasis2D.py @@ -142,7 +142,7 @@ def testMatchFBEvaluate(basis): fb_images = fb_basis.evaluate(coefs) fle_images = basis.evaluate(coefs) - assert np.allclose(fb_images._data, fle_images._data, atol=1e-4) + np.testing.assert_allclose(fb_images._data, fle_images._data, atol=1e-4) @pytest.mark.parametrize("basis", test_bases_match_fb, ids=show_fle_params) @@ -159,8 +159,8 @@ def testMatchFBDenseEvaluate(basis): fle_images = Image(fle_out.T.reshape(-1, basis.nres, basis.nres)).asnumpy() # Matrix column reording in match_fb mode flips signs of some of the basis functions - assert np.allclose(np.abs(fb_images), np.abs(fle_images), atol=1e-3) - assert np.allclose(fb_images, fle_images, atol=1e-3) + np.testing.assert_allclose(np.abs(fb_images), np.abs(fle_images), atol=1e-3) + np.testing.assert_allclose(fb_images, fle_images, atol=1e-3) @pytest.mark.parametrize("basis", test_bases_match_fb, ids=show_fle_params) @@ -177,7 +177,7 @@ def testMatchFBEvaluate_t(basis): fb_coefs = fb_basis.evaluate_t(images) fle_coefs = basis.evaluate_t(images) - assert np.allclose(fb_coefs, fle_coefs, atol=1e-4) + np.testing.assert_allclose(fb_coefs, fle_coefs, atol=1e-4) @pytest.mark.parametrize("basis", test_bases_match_fb, ids=show_fle_params) @@ -197,7 +197,7 @@ def testMatchFBDenseEvaluate_t(basis): fle_coefs = basis._create_dense_matrix().T @ vec.T # Matrix column reording in match_fb mode flips signs of some of the basis coefficients - assert np.allclose(np.abs(fb_coefs), np.abs(fle_coefs), atol=1e-4) + np.testing.assert_allclose(np.abs(fb_coefs), np.abs(fle_coefs), atol=1e-4) def testLowPass(): @@ -265,4 +265,4 @@ def testRadialConvolution(): convolution_fft_pad[L // 2 : L // 2 + L, L // 2 : L // 2 + L] ) - assert np.allclose(imgs_convolved_fle, imgs_convolved_slow, atol=1e-5) + np.testing.assert_allclose(imgs_convolved_fle, imgs_convolved_slow, atol=1e-5) From 9984cac8deb4fcaeffc4594d058278bc663ebaa7 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 20 Jun 2024 11:35:10 -0400 Subject: [PATCH 110/433] revert to upcasting. --- src/aspire/operators/filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/operators/filters.py b/src/aspire/operators/filters.py index c93c34f9cb..5720867e49 100644 --- a/src/aspire/operators/filters.py +++ b/src/aspire/operators/filters.py @@ -333,7 +333,7 @@ def _evaluate(self, omega): # for values slightly outside the interpolation grid bounds. interpolator = RegularGridInterpolator( _input_pts, - self.xfer_fn_array, + self.xfer_fn_array.astype(np.float64), method="linear", bounds_error=False, fill_value=None, From 6cba85883d05b252f75335f813608de29099eb60 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 20 Jun 2024 12:08:49 -0400 Subject: [PATCH 111/433] update comments --- src/aspire/operators/filters.py | 1 + tests/test_filters.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/aspire/operators/filters.py b/src/aspire/operators/filters.py index 5720867e49..f11202d2f2 100644 --- a/src/aspire/operators/filters.py +++ b/src/aspire/operators/filters.py @@ -333,6 +333,7 @@ def _evaluate(self, omega): # for values slightly outside the interpolation grid bounds. interpolator = RegularGridInterpolator( _input_pts, + # scipy requires upcasting to use cython interpolator. self.xfer_fn_array.astype(np.float64), method="linear", bounds_error=False, diff --git a/tests/test_filters.py b/tests/test_filters.py index 8674f13486..83b68d86ca 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -373,7 +373,7 @@ def test_power_filter_safeguard(dtype, epsilon, caplog): @pytest.mark.parametrize("dtype", [np.float32, np.float64]) def test_array_filter_dtype_passthrough(dtype): """ - scipy's interpolator will upcast singles. This test + We upcast to use scipy's fast interpolator. This test ensures that we recast to the correct dtype during calculations. """ L = 8 From 6d18cec6e2b85eed9fbae02d11cf7a6537d34801 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 20 Jun 2024 13:28:50 -0400 Subject: [PATCH 112/433] remove scipy bump --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c674418ec1..c9c25a9976 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ dependencies = [ "pyshtools<=4.10.4", # 4.11.7 might have a packaging bug "PyWavelets", "ray >= 2.9.2", - "scipy >= 1.10.1", + "scipy >= 1.10.0", "scikit-learn", "scikit-image", "setuptools >= 0.41", From 5aeca45b6bfec814175c5be93ac1fa16d0bed5de Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 10 Jul 2024 13:50:36 -0400 Subject: [PATCH 113/433] Revert scipy workaround. --- src/aspire/operators/filters.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/aspire/operators/filters.py b/src/aspire/operators/filters.py index f11202d2f2..bb7491c780 100644 --- a/src/aspire/operators/filters.py +++ b/src/aspire/operators/filters.py @@ -333,7 +333,7 @@ def _evaluate(self, omega): # for values slightly outside the interpolation grid bounds. interpolator = RegularGridInterpolator( _input_pts, - # scipy requires upcasting to use cython interpolator. + # https://github.com/scipy/scipy/issues/17718 self.xfer_fn_array.astype(np.float64), method="linear", bounds_error=False, @@ -349,8 +349,7 @@ def _evaluate(self, omega): # Result is 1 x np.prod(self.sz) in shape; convert to a 1-d vector result = np.squeeze(result, 0) - # Scipy's interpolator will upcast singles. Recasting. - return result.astype(self.xfer_fn_array.dtype, copy=False) + return result def evaluate_grid(self, L, *args, dtype=np.float32, **kwargs): """ From 598d4408fda2e8477f9b0d299369da46e59f647f Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 10 Jul 2024 14:01:42 -0400 Subject: [PATCH 114/433] xfail ArrayFilter test for singles. --- tests/test_filters.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_filters.py b/tests/test_filters.py index 83b68d86ca..f68e261025 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -373,9 +373,12 @@ def test_power_filter_safeguard(dtype, epsilon, caplog): @pytest.mark.parametrize("dtype", [np.float32, np.float64]) def test_array_filter_dtype_passthrough(dtype): """ - We upcast to use scipy's fast interpolator. This test - ensures that we recast to the correct dtype during calculations. + We upcast to use scipy's fast interpolator. We do not recast + on exit, so this is an expected fail for singles. """ + if dtype == np.float32: + pytest.xfail(reason="ArrayFilter currently upcasts singles.") + L = 8 arr = np.ones((L, L), dtype=dtype) From 440cda26db86adcd267a956aeefb8fb8c54837fb Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 12 Jul 2024 09:14:23 -0400 Subject: [PATCH 115/433] make xfail strict --- tests/test_filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_filters.py b/tests/test_filters.py index f68e261025..e243fc0a18 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -377,7 +377,7 @@ def test_array_filter_dtype_passthrough(dtype): on exit, so this is an expected fail for singles. """ if dtype == np.float32: - pytest.xfail(reason="ArrayFilter currently upcasts singles.") + pytest.xfail(reason="ArrayFilter currently upcasts singles.", strict=True) L = 8 arr = np.ones((L, L), dtype=dtype) From 4be9032f585d294434d5b599091c2ed10f2cf836 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 12 Jul 2024 10:48:51 -0400 Subject: [PATCH 116/433] remove strict param --- tests/test_filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_filters.py b/tests/test_filters.py index e243fc0a18..f68e261025 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -377,7 +377,7 @@ def test_array_filter_dtype_passthrough(dtype): on exit, so this is an expected fail for singles. """ if dtype == np.float32: - pytest.xfail(reason="ArrayFilter currently upcasts singles.", strict=True) + pytest.xfail(reason="ArrayFilter currently upcasts singles.") L = 8 arr = np.ones((L, L), dtype=dtype) From 4ecf0924e2f467bbaa616ad5e168f1a26e5f40e1 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 23 Jul 2024 08:44:42 -0400 Subject: [PATCH 117/433] Use pytest fixtures. --- tests/test_filters.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/test_filters.py b/tests/test_filters.py index f68e261025..2abe391071 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -333,10 +333,20 @@ def testFilterSigns(self): self.assertTrue(np.allclose(sign_filter.evaluate(self.omega), signs)) -params = list(itertools.product([np.float32, np.float64], [None, 0.01])) +DTYPES = [np.float32, np.float64] +EPS = [None, 0.01] + + +@pytest.fixture(params=DTYPES, ids=lambda x: f"dtype={x}", scope="module") +def dtype(request): + return request.param + + +@pytest.fixture(params=EPS, ids=lambda x: f"epsilon={x}", scope="module") +def epsilon(request): + return request.param -@pytest.mark.parametrize("dtype, epsilon", params) def test_power_filter_safeguard(dtype, epsilon, caplog): L = 25 arr = np.ones((L, L), dtype=dtype) @@ -370,7 +380,6 @@ def test_power_filter_safeguard(dtype, epsilon, caplog): assert msg in caplog.text -@pytest.mark.parametrize("dtype", [np.float32, np.float64]) def test_array_filter_dtype_passthrough(dtype): """ We upcast to use scipy's fast interpolator. We do not recast From 2368196839334183e077ff554f8a89ab05a3ff58 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 23 Jul 2024 08:48:15 -0400 Subject: [PATCH 118/433] remove unused import --- tests/test_filters.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_filters.py b/tests/test_filters.py index 2abe391071..911e3b347b 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -1,4 +1,3 @@ -import itertools import logging import os.path from unittest import TestCase From 3ae167f92857351bf813dc9ecae9c5ce88d50d69 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 24 Jul 2024 14:31:15 -0400 Subject: [PATCH 119/433] minimal patch to support cupy install and disabled cufinufft --- src/aspire/nufft/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/nufft/__init__.py b/src/aspire/nufft/__init__.py index 07d92c736c..d38a0df96e 100644 --- a/src/aspire/nufft/__init__.py +++ b/src/aspire/nufft/__init__.py @@ -198,7 +198,7 @@ def anufft(sig_f, fourier_pts, sz, real=False, epsilon=1e-8): adjoint = adjoint.real if real else adjoint - if cp and not _keep_on_gpu: + if cp and isinstance(adjoint, cp.ndarray) and not _keep_on_gpu: adjoint = adjoint.get() return adjoint @@ -259,7 +259,7 @@ def nufft(sig_f, fourier_pts, real=False, epsilon=1e-8): transform = transform.real if real else transform - if cp and not _keep_on_gpu: + if cp and isinstance(transform, cp.ndarray) and not _keep_on_gpu: transform = transform.get() return transform From 57d34e0e67cad122c722b61b158540c23859ef90 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 24 Jul 2024 15:53:32 -0400 Subject: [PATCH 120/433] skip enormous FFB2D test on GPU --- tests/test_FFBbasis2D.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_FFBbasis2D.py b/tests/test_FFBbasis2D.py index 8acf7201d1..c3ee42dd75 100644 --- a/tests/test_FFBbasis2D.py +++ b/tests/test_FFBbasis2D.py @@ -6,6 +6,7 @@ from scipy.special import jv from aspire.basis import Coef, FFBBasis2D +from aspire.nufft import all_backends from aspire.source import Simulation from aspire.utils.misc import grid_2d from aspire.volume import Volume @@ -126,6 +127,9 @@ def testShift(self, basis): params = [pytest.param(512, np.float32, marks=pytest.mark.expensive)] +@pytest.mark.skipif( + all_backends()[0] == "cufinufft", reason="Not enough memory to run via GPU" +) @pytest.mark.parametrize( "L, dtype", params, @@ -136,6 +140,7 @@ def testHighResFFBBasis2D(L, dtype): sim = Simulation( n=1, L=L, + C=1, dtype=dtype, amplitudes=1, offsets=0, @@ -149,4 +154,6 @@ def testHighResFFBBasis2D(L, dtype): # Mask to compare inside disk of radius 1. mask = grid_2d(L, normalized=True)["r"] < 1 - assert np.allclose(im_ffb.asnumpy()[0][mask], im.asnumpy()[0][mask], atol=1e-4) + np.testing.assert_allclose( + im_ffb.asnumpy()[0][mask], im.asnumpy()[0][mask], rtol=1e-05, atol=1e-4 + ) From 325b1decbcdac9a66e3a37b74f671423b5addfa6 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 25 Jul 2024 10:36:14 -0400 Subject: [PATCH 121/433] simpler solution --- src/aspire/nufft/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/aspire/nufft/__init__.py b/src/aspire/nufft/__init__.py index d38a0df96e..23ebe2c115 100644 --- a/src/aspire/nufft/__init__.py +++ b/src/aspire/nufft/__init__.py @@ -3,6 +3,7 @@ import numpy as np from aspire import config +from aspire.numeric import xp from aspire.utils import LogFilterByCount, complex_type, real_type cp = None @@ -198,8 +199,8 @@ def anufft(sig_f, fourier_pts, sz, real=False, epsilon=1e-8): adjoint = adjoint.real if real else adjoint - if cp and isinstance(adjoint, cp.ndarray) and not _keep_on_gpu: - adjoint = adjoint.get() + if not _keep_on_gpu: + adjoint = xp.asnumpy(adjoint) return adjoint @@ -259,7 +260,7 @@ def nufft(sig_f, fourier_pts, real=False, epsilon=1e-8): transform = transform.real if real else transform - if cp and isinstance(transform, cp.ndarray) and not _keep_on_gpu: - transform = transform.get() + if not _keep_on_gpu: + transform = xp.asnumpy(transform) return transform From ff06daa8c6fb4186806544078d10f0d814fea0bd Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 25 Jul 2024 13:48:35 -0400 Subject: [PATCH 122/433] make the long workflow not so long --- .github/workflows/long_workflow.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/long_workflow.yml b/.github/workflows/long_workflow.yml index bf676b45fb..498d4a0535 100644 --- a/.github/workflows/long_workflow.yml +++ b/.github/workflows/long_workflow.yml @@ -33,8 +33,9 @@ jobs: cat ${WORK_DIR}/config.yaml - name: Run run: | + export OMP_NUM_THREADS=1 ASPIREDIR=${{ env.WORK_DIR }} python -c \ "import aspire; print(aspire.config['ray']['temp_dir'])" - ASPIREDIR=${{ env.WORK_DIR }} python -m pytest -m "expensive" --durations=0 + ASPIREDIR=${{ env.WORK_DIR }} python -m pytest -n8 -m "expensive" --durations=0 - name: Cleanup run: rm -rf ${{ env.WORK_DIR }} From 7ae2f27fc571c7239b40126656533ac7969408cf Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 25 Jul 2024 13:52:40 -0400 Subject: [PATCH 123/433] run long workflow on pull requests --- .github/workflows/long_workflow.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/long_workflow.yml b/.github/workflows/long_workflow.yml index 498d4a0535..ec5714a29e 100644 --- a/.github/workflows/long_workflow.yml +++ b/.github/workflows/long_workflow.yml @@ -1,14 +1,14 @@ name: ASPIRE Python Long Running Test Suite on: - push: - branches: - - 'main' - - 'develop' + pull_request: + types: [opened, synchronize, reopened, ready_for_review] jobs: expensive_tests: runs-on: self-hosted + # Only run on review ready pull_requests + if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == false }} timeout-minutes: 360 steps: - uses: actions/checkout@v4 From df4774f68d756587298413181ce08ca434659c25 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 25 Jul 2024 15:45:52 -0400 Subject: [PATCH 124/433] resolve conflicts --- src/aspire/image/image.py | 3 +- .../saved_test_data/rln_proj_64_shifted.mrcs | Bin 0 -> 66560 bytes .../saved_test_data/rln_proj_64_shifted.star | 32 ++++++++++++++++++ .../saved_test_data/rln_proj_65_shifted.mrcs | Bin 0 -> 68624 bytes .../saved_test_data/rln_proj_65_shifted.star | 32 ++++++++++++++++++ tests/test_anisotropic_noise.py | 4 +++ tests/test_image.py | 17 +++++----- tests/test_relion_interop.py | 17 ++++++---- tests/test_simulation.py | 5 +++ 9 files changed, 95 insertions(+), 15 deletions(-) create mode 100644 tests/saved_test_data/rln_proj_64_shifted.mrcs create mode 100644 tests/saved_test_data/rln_proj_64_shifted.star create mode 100644 tests/saved_test_data/rln_proj_65_shifted.mrcs create mode 100644 tests/saved_test_data/rln_proj_65_shifted.star diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index f03372b087..443a1b6b33 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -509,8 +509,9 @@ def _im_translate(self, shifts): grid_shifted = fft.ifftshift( xp.ceil(xp.arange(-L / 2, L / 2, dtype=self.dtype)) ) + grid_1d = grid_shifted * 2 * xp.pi / L - om_x, om_y = xp.meshgrid(grid_1d, grid_1d, indexing="ij") + om_x, om_y = xp.meshgrid(grid_1d, grid_1d, indexing="xy") phase_shifts_x = -shifts[:, 0].reshape((n_shifts, 1, 1)) phase_shifts_y = -shifts[:, 1].reshape((n_shifts, 1, 1)) diff --git a/tests/saved_test_data/rln_proj_64_shifted.mrcs b/tests/saved_test_data/rln_proj_64_shifted.mrcs new file mode 100644 index 0000000000000000000000000000000000000000..a896b6a8a93750134e1a3bdb39724b0e771566e8 GIT binary patch literal 66560 zcmeFY`8QTy{5Fn=GS5QDJQMEw?E7p=(LmB55>e8mL8XBPnS~6MF@==5h;Z-WG?7As z=DF0nkcwzfhK9#yeZN0E|H1S8@a(m&wf0_Topttl?X%ChUf1i|&LScr&f^dthuAp& z_vSo4_#cRlLqsHc_WzHWA|egr{r?aDbM1fbn=p=L`3>C9C12q1dJM*g|3})wS&Q{t zXNidXz0}P9&)k--+Y+)ZRByaZpKj&8dyAEw!~b+y9*^bm|BuY@|2_2oMd1IQ2z*)B zDm3>j6sG3q@?RP}XG(2dL8_Y^$l961{IRwMRwMHn?R|#i{@g;+8Bsu@tA!+7r;0cU zAgOqeOYD88(S3{7(*Dbt)MD;M+OzvP&6n(@Teke7{?d}1x1Ahk+^Wa@5p(21lmI8( zWWyV3e5W;_}t@}|*5=CTs` zyy+JHPw}Mi74wFvo7X3ta72S|tt|lxKD=idhuoQiDvqE?Ll<;ykl?GYID{$#lKJLe znwZO1{xMD;EJ07?RB(W%GCxauk@nshc$rHRTCKc;uV;A;S*RXDhi0xvu`Q`cGt12W){M`C#Ai2Ol&swEvw|7$Lz8%$o) zpm1q!d-hZ=y2FA?SBBiXTeG=N6DLmLHjm4nz~heDnR4%%%{cL>`P|))L0pOP1}@Ab zkh}3NfSYdM$;DTja~4uET*!rfy0NsC&N`b#7bNbY({${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*u%;Wy$ZaGXUp`Ysjv$^PZt{2bg&akt8i4!_bLMQSDU#7|N9jw#k$7PnQVr9_bARgKef#EO>kbxQ z92Cc6_o-vQgB$VCYHj@ftt5W(3W=1slcLbk4-O literal 0 HcmV?d00001 diff --git a/tests/saved_test_data/rln_proj_64_shifted.star b/tests/saved_test_data/rln_proj_64_shifted.star new file mode 100644 index 0000000000..4be5add306 --- /dev/null +++ b/tests/saved_test_data/rln_proj_64_shifted.star @@ -0,0 +1,32 @@ + +# version 30001 + +data_optics + +loop_ +_rlnOpticsGroup #1 +_rlnOpticsGroupName #2 +_rlnVoltage #3 +_rlnSphericalAberration #4 +_rlnImagePixelSize #5 +_rlnImageSize #6 +_rlnImageDimensionality #7 + 1 optics1 300.000000 2.700000 1.000000 64 2 + + +# version 30001 + +data_particles + +loop_ +_rlnAngleRot #1 +_rlnAngleTilt #2 +_rlnAnglePsi #3 +_rlnOriginX #4 +_rlnOriginY #5 +_rlnOpticsGroup #6 +_rlnImageName #7 + 235.820138 113.086030 50.468981 6.000000 10.000000 1 000001@rln_proj_64_shifted.mrcs + 86.698555 31.958115 139.545228 10.000000 -5.000000 1 000002@rln_proj_64_shifted.mrcs + 48.456166 71.176316 185.304830 -8.000000 11.000000 1 000003@rln_proj_64_shifted.mrcs + 215.714386 105.017323 154.043384 -13.000000 -3.000000 1 000004@rln_proj_64_shifted.mrcs diff --git a/tests/saved_test_data/rln_proj_65_shifted.mrcs b/tests/saved_test_data/rln_proj_65_shifted.mrcs new file mode 100644 index 0000000000000000000000000000000000000000..55ba195d48772560933ab21b56e3189f3dda8104 GIT binary patch literal 68624 zcmeFY`8!un{5LK_mXuHwtz=6iUT0osDocxs7Ai~Hq*Quq(Z1OCJ?)|_B_hi9n&-@E zp`=ZV6eTT0SxS@?ExtbY_m}%WxbGkCxvuA#>zZ@soVjM^%sift$2@JMq@-*HZ18|d z57_^n{-^wZY|#HI47Qb$`X39ll9DPO$p3%)pL_pPPiDZJ(u;*lc3-jmE&=_o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K+1d9B6O(l>po6oaX4D1Ap%$FmCsY!A2(y~R?EJh6E90EN@FtG; zM&RJb!Emwud2&eZ+nHi`4kLF>LtoEFFl@O;I(_Q6lc(;0rBVyGC6^%nTQ_8vUPrC# z2!_3J2zehVsxFA}utAs_lxxvf8jRec2*(-@fPW9=tFVucO8FZ04(7m%lQu|P@xmxK z7nJxFL-)}fVwKF1J04C>f7Bb)#~#3wT!Ch^Dxz(tbTl=yne&od&VEr8rlf$4uMcw_N&wA}YosBbdEA4BJHeQ25g IMI8+P1HTfp4FCWD literal 0 HcmV?d00001 diff --git a/tests/saved_test_data/rln_proj_65_shifted.star b/tests/saved_test_data/rln_proj_65_shifted.star new file mode 100644 index 0000000000..f36eb664cf --- /dev/null +++ b/tests/saved_test_data/rln_proj_65_shifted.star @@ -0,0 +1,32 @@ + +# version 30001 + +data_optics + +loop_ +_rlnOpticsGroup #1 +_rlnOpticsGroupName #2 +_rlnVoltage #3 +_rlnSphericalAberration #4 +_rlnImagePixelSize #5 +_rlnImageSize #6 +_rlnImageDimensionality #7 + 1 optics1 300.000000 2.700000 1.000000 65 2 + + +# version 30001 + +data_particles + +loop_ +_rlnAngleRot #1 +_rlnAngleTilt #2 +_rlnAnglePsi #3 +_rlnOriginX #4 +_rlnOriginY #5 +_rlnOpticsGroup #6 +_rlnImageName #7 + 235.820138 113.086030 50.468981 6.000000 10.000000 1 000001@rln_proj_65_shifted.mrcs + 86.698555 31.958115 139.545228 10.000000 -5.000000 1 000002@rln_proj_65_shifted.mrcs + 48.456166 71.176316 185.304830 -8.000000 11.000000 1 000003@rln_proj_65_shifted.mrcs + 215.714386 105.017323 154.043384 -13.000000 -3.000000 1 000004@rln_proj_65_shifted.mrcs diff --git a/tests/test_anisotropic_noise.py b/tests/test_anisotropic_noise.py index 12b52064ea..2fd1d13ca8 100644 --- a/tests/test_anisotropic_noise.py +++ b/tests/test_anisotropic_noise.py @@ -25,6 +25,10 @@ def setUp(self): dtype=self.dtype, ) + # Keep hardcoded tests passing after fixing swapped offsets. + # See github issue #1146. + self.sim = self.sim.update(offsets=self.sim.offsets[:, [1, 0]]) + def tearDown(self): pass diff --git a/tests/test_image.py b/tests/test_image.py index d9a062bbb7..de8375e8de 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -88,18 +88,19 @@ def testImShift(parity, dtype): # test that float input returns the same thing im2 = im.shift(shifts.astype(dtype)) # ground truth numpy roll - im3 = np.roll(im_np[0, :, :], -shifts, axis=(0, 1)) + im3 = np.roll(im_np[0, :, :], -shifts, axis=(1, 0)) atol = utest_tolerance(dtype) - assert np.allclose(im0.asnumpy(), im1.asnumpy(), atol=atol) - assert np.allclose(im1.asnumpy(), im2.asnumpy(), atol=atol) - assert np.allclose(im0.asnumpy()[0, :, :], im3, atol=atol) + np.testing.assert_allclose(im0.asnumpy(), im1.asnumpy(), atol=atol) + np.testing.assert_allclose(im1.asnumpy(), im2.asnumpy(), atol=atol) + np.testing.assert_allclose(im0.asnumpy()[0, :, :], im3, atol=atol) @pytest.mark.parametrize("parity,dtype", params) def testImShiftStack(parity, dtype): ims_np, ims = get_stacks(parity, dtype) + # test stack of shifts (same number as Image.num_img) # mix of odd and even shifts = np.array([[100, 200], [203, 150], [55, 307]]) @@ -112,14 +113,14 @@ def testImShiftStack(parity, dtype): im2 = ims.shift(shifts.astype(dtype)) # ground truth numpy roll im3 = np.array( - [np.roll(ims_np[i, :, :], -shifts[i], axis=(0, 1)) for i in range(n)] + [np.roll(ims_np[i, :, :], -shifts[i], axis=(1, 0)) for i in range(n)] ) atol = utest_tolerance(dtype) - assert np.allclose(im0.asnumpy(), im1.asnumpy(), atol=atol) - assert np.allclose(im1.asnumpy(), im2.asnumpy(), atol=atol) - assert np.allclose(im0.asnumpy(), im3, atol=atol) + np.testing.assert_allclose(im0.asnumpy(), im1.asnumpy(), atol=atol) + np.testing.assert_allclose(im1.asnumpy(), im2.asnumpy(), atol=atol) + np.testing.assert_allclose(im0.asnumpy(), im3, atol=atol) def testImageShiftErrors(): diff --git a/tests/test_relion_interop.py b/tests/test_relion_interop.py index a1a2796675..d1e71df674 100644 --- a/tests/test_relion_interop.py +++ b/tests/test_relion_interop.py @@ -9,7 +9,12 @@ DATA_DIR = os.path.join(os.path.dirname(__file__), "saved_test_data") -STARFILE = ["rln_proj_65.star", "rln_proj_64.star"] +STARFILE = [ + "rln_proj_65.star", + "rln_proj_64.star", + "rln_proj_65_shifted.star", + "rln_proj_64_shifted.star", +] @pytest.fixture(params=STARFILE, scope="module") @@ -24,9 +29,9 @@ def sources(request): # Create Simulation source using Volume and angles from Relion projections. # Note, for odd resolution Relion projections are shifted by 1 pixel in x and y. - offsets = 0 + offsets = rln_src.offsets if rln_src.L % 2 == 1: - offsets = -np.ones((rln_src.n, 2), dtype=rln_src.dtype) + offsets -= np.ones((rln_src.n, 2), dtype=rln_src.dtype) sim_src = Simulation( n=rln_src.n, @@ -51,11 +56,11 @@ def test_projections_relative_error(sources): rln_np = (rln_np - np.mean(rln_np)) / np.std(rln_np) sim_np = (sim_np - np.mean(sim_np)) / np.std(sim_np) - # Check that relative error is less than 3%. + # Check that relative error is less than 4%. error = np.linalg.norm(rln_np - sim_np, axis=(1, 2)) / np.linalg.norm( rln_np, axis=(1, 2) ) - np.testing.assert_array_less(error, 0.03) + np.testing.assert_array_less(error, 0.04) def test_projections_frc(sources): @@ -67,4 +72,4 @@ def test_projections_frc(sources): # Check that estimated resolution is high (< 2.5 pixels) and correlation is close to 1. np.testing.assert_array_less(res, 2.5) - np.testing.assert_array_less(1 - corr[:, -2], 0.02) + np.testing.assert_array_less(1 - corr[:, -2], 0.025) diff --git a/tests/test_simulation.py b/tests/test_simulation.py index 659ce95603..ad8a7ff4e1 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -123,6 +123,10 @@ def setUp(self): dtype=self.dtype, ) + # Keep hardcoded tests passing after fixing swapped offsets. + # See github issue #1146. + self.sim = self.sim.update(offsets=self.sim.offsets[:, [1, 0]]) + def tearDown(self): pass @@ -162,6 +166,7 @@ def testSimulationCached(self): n=self.n, L=self.L, vols=self.vols, + offsets=self.sim.offsets, unique_filters=[ RadialCTFFilter(defocus=d) for d in np.linspace(1.5e4, 2.5e4, 7) ], From e51bad00b7dff417f4f8d0a48987ab2f51330af5 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 18 Jul 2024 09:23:39 -0400 Subject: [PATCH 125/433] Add centered Relion generated files. Test centering of RelionSource. --- .../saved_test_data/rln_proj_64_centered.mrcs | Bin 0 -> 66560 bytes .../saved_test_data/rln_proj_64_centered.star | 33 +++++++++++++ .../saved_test_data/rln_proj_65_centered.mrcs | Bin 0 -> 68624 bytes .../saved_test_data/rln_proj_65_centered.star | 35 ++++++++++++++ tests/test_relion_interop.py | 45 ++++++++++++++++-- 5 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 tests/saved_test_data/rln_proj_64_centered.mrcs create mode 100644 tests/saved_test_data/rln_proj_64_centered.star create mode 100644 tests/saved_test_data/rln_proj_65_centered.mrcs create mode 100644 tests/saved_test_data/rln_proj_65_centered.star diff --git a/tests/saved_test_data/rln_proj_64_centered.mrcs b/tests/saved_test_data/rln_proj_64_centered.mrcs new file mode 100644 index 0000000000000000000000000000000000000000..643647d12fd4601beb8ee83d69ffa3d3b8a1843e GIT binary patch literal 66560 zcmeFY`8QWz_%@D+GEb2tnP)P*&VHRuDH=!`M5QQc(wqhwlsROmOr?-AM3KU4-+P}X zQqiD!F7+--MQKoIdVJRR`@{1eJkJl$Uh7)x>~+>zXRmv&z4m=w_jS8VNlCd6Kz0B! z1Nh&E`@rOXAUyynsptv+KgLN()eb!WfB2tw|MT6T0nE;;6@JY8gnO3(8kqhc8Pmqk zF!UTRCH41Q1OGp3o3(Ux*t)fb17i%b_1?VN*3sF}&;jvI9PcdtKeEFA_tXCuf&Y6V z5G_=YALujj{5lwBgl3SflS?IOwy$d++pZ_iX1RfX_eK~yr-5u)Ad9+_bkO2C3%Eg_ zqFnaf$b|arMrd=2hZz|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YBfN^Trlz|INnVGmC8VhkR- zGRHrEVKlWp*uI7P*iFfqOz=(tEBD)#{Ze4YTnzXuTHf;krQNVa!Rxhfnb8@1TOt%^ zjO@m~?mO@?v-!CHUm{*seG0dC*kk#Pk5PBd4s@&UBT`*H4yQ2_@t<$A@z~P+xL7t6 z`vjWe@tb8VZ!`8xc%Kyhoh!i44@uzuxveP6*MT(-$Y7reESZ1G%WzAUEzX+~%5x)1 zk!cmiFSmJ-9JvUhlx|IAPvx>UpEB7F_ek7yIE)1M-6A@lYsi5a!Q{&|1F~HIBOchH zO-}7nBWIsS31*IdM>pSn$LqC}h}ybI_(??`WBPcU=vQqBvpsYhBP-`4_^#N?$cT+$ z)ptK-rj02TxE@|9IQ-56r@V2*3f|N4TT3(SSGyU1Ph5o4cz)9&t1dKZyB51NhT)E> ze~@Ld6mITHMV@-EMaS%-kw&Qs?%b=6!>bhWvsqKIPCA1Hd)(1^-^a|D@)rW>SHY;E z@jeKqD zj}uc8I(ZH7JI4=k@u@H(dA5KY$`2#5TXS{ zo%*sDFCmq9c-{|WZ>oUyHB4fvk`>VLBll3`_Ic>`t4e0d+iOgsNw4Vb`_amrHp=Ie zpQE|E95G7c`B#2R@rNoUEW7v*QhOzjXEZuuj~0j*+RE{nHW7-lO&2xJiLPjfIEp%g z^3dixyU>t<8s4I&f`j&UqDAU)0*l8Z%!v^p(~o9U4tge|=ETkDMZS$8tIvo!9u_jEJpI|sIYDe$*u%;Wy$ZaGXUp`Ysjv$^PZt{2bg&akt8i4!_bLMQSDU#7|N9jw#k$7PnQVr9_bARgKef#EO>kbxQ z92Cc6_o-vQgB$VCYHj@ftt5W(3W=1slcLbk4-O diff --git a/tests/test_covar2d.py b/tests/test_covar2d.py index 05e0eda509..6ec5bf0b14 100644 --- a/tests/test_covar2d.py +++ b/tests/test_covar2d.py @@ -56,10 +56,10 @@ def img_size(request): def volume(dtype, img_size): # Get a volume v = Volume( - np.load(os.path.join(DATA_DIR, "clean70SRibosome_vol.npy")).astype(dtype) + np.load(os.path.join(DATA_DIR, "clean70SRibosome_vol_down8.npy")).astype(dtype) ) # 1e3 is hardcoded to match legacy test files. - return v.downsample(img_size) * 1.0e3 + return v * 1.0e3 @pytest.fixture(params=BASIS, ids=lambda x: f"basis={x}") diff --git a/tests/test_downsample.py b/tests/test_downsample.py index 13fad279df..1dc2c0d631 100644 --- a/tests/test_downsample.py +++ b/tests/test_downsample.py @@ -3,6 +3,7 @@ import numpy as np import pytest +from aspire.downloader import emdb_2660 from aspire.image import Image from aspire.source import Simulation from aspire.utils import utest_tolerance @@ -54,7 +55,7 @@ def checkCenterPoint(data_org, data_ds): center_org += (L // 2,) center_ds += (L_ds // 2,) # indeterminacy for 3D - tolerance = 5e-2 + tolerance = 1e-3 return np.allclose( data_org.asnumpy()[(..., *center_org)], data_ds.asnumpy()[(..., *center_ds)], @@ -107,3 +108,50 @@ def test_downsample_3d_case(L, L_ds): def test_integer_offsets(): sim = Simulation(offsets=0) _ = sim.downsample(3) + + +# Test that vol.downsample.project == vol.project.downsample. +DTYPES = [np.float32, pytest.param(np.float64, marks=pytest.mark.expensive)] +RES = [65, 66] +RES_DS = [32, 33] + + +@pytest.fixture(params=DTYPES, ids=lambda x: f"dtype={x}", scope="module") +def dtype(request): + return request.param + + +@pytest.fixture(params=RES, ids=lambda x: f"resolution={x}", scope="module") +def res(request): + return request.param + + +@pytest.fixture(params=RES_DS, ids=lambda x: f"resolution_ds={x}", scope="module") +def res_ds(request): + return request.param + + +@pytest.fixture(scope="module") +def emdb_vol(): + return emdb_2660() + + +@pytest.fixture(scope="module") +def volume(emdb_vol, res, dtype): + vol = emdb_vol.astype(dtype, copy=False) + vol = vol.downsample(res) + return vol + + +def test_downsample_project(volume, res_ds): + """ + Test that vol.downsample.project == vol.project.downsample. + """ + rot = np.eye(3, dtype=volume.dtype) # project along z-axis + im_ds_proj = volume.downsample(res_ds).project(rot) + im_proj_ds = volume.project(rot).downsample(res_ds) + + tol = 1e-07 + if volume.dtype == np.float64: + tol = 1e-09 + np.testing.assert_allclose(im_ds_proj, im_proj_ds, atol=tol) diff --git a/tests/test_relion_interop.py b/tests/test_relion_interop.py index 6a7fa36f96..a79176b8be 100644 --- a/tests/test_relion_interop.py +++ b/tests/test_relion_interop.py @@ -31,15 +31,16 @@ def sources(request): rln_src = RelionSource(starfile) # Generate Volume used for Relion projections. - # Note, `downsample` is a no-op for resolution 65. vol_path = os.path.join(DATA_DIR, "clean70SRibosome_vol.npy") - vol = Volume(np.load(vol_path), dtype=rln_src.dtype).downsample(rln_src.L) + vol = Volume(np.load(vol_path, allow_pickle=True), dtype=rln_src.dtype) + if rln_src.L == 64: + vol = vol.downsample(64) # Create Simulation source using Volume and angles from Relion projections. # Note, for odd resolution Relion projections are shifted by 1 pixel in x and y. offsets = rln_src.offsets if rln_src.L % 2 == 1: - offsets -= np.ones((rln_src.n, 2), dtype=rln_src.dtype) + offsets -= 1 sim_src = Simulation( n=rln_src.n, diff --git a/tests/test_volume.py b/tests/test_volume.py index ea52d1d67f..5c2d0ad3de 100644 --- a/tests/test_volume.py +++ b/tests/test_volume.py @@ -320,7 +320,7 @@ def test_project(vols_hot_cold): # Generate projection images. projections = vols.project(rots) - # Check that new hot/cold spots are within 1 pixel of expectecd locations. + # Check that new hot/cold spots are within 1 pixel of expected locations. for i in range(vols.n_vols): p = projections.asnumpy()[i] new_hot_loc = np.unravel_index(np.argmax(p), (L, L)) @@ -343,7 +343,7 @@ def test_project_axes(vols_1, dtype): # Project a Volume with all the test rotations vol_id = 1 # select a volume from Volume stack - img_stack = vols_1[vol_id].project(r_stack) + img_stack = vols_1[vol_id].project(r_stack, zero_nyquist=True) for r in range(len(r_stack)): # Get result of test projection at center of Image. @@ -371,7 +371,7 @@ def test_project_axes(vols_1, dtype): # Note, transforming rotations to compensate for legacy grid convention used in saved data. rots = _LegacySimulation.rots_zyx_to_legacy_aspire(rots) - imgs_clean = vols.project(rots).asnumpy() + imgs_clean = vols.project(rots, zero_nyquist=True).asnumpy() assert np.allclose(results, imgs_clean, atol=1e-7) @@ -546,20 +546,20 @@ def test_flip(vols_1, data_1): def test_downsample(res): vols = Volume(np.load(os.path.join(DATA_DIR, "clean70SRibosome_vol.npy"))) - result = vols.downsample(8) - res = vols.resolution + result = vols.downsample(res) + og_res = vols.resolution ds_res = result.resolution # check signal energy - assert np.allclose( - anorm(vols.asnumpy(), axes=(1, 2, 3)) / res, + np.testing.assert_allclose( + anorm(vols.asnumpy(), axes=(1, 2, 3)) / og_res, anorm(result.asnumpy(), axes=(1, 2, 3)) / ds_res, atol=1e-3, ) # check gridpoints - assert np.allclose( - vols.asnumpy()[:, res // 2, res // 2, res // 2], + np.testing.assert_allclose( + vols.asnumpy()[:, og_res // 2, og_res // 2, og_res // 2], result.asnumpy()[:, ds_res // 2, ds_res // 2, ds_res // 2], atol=1e-4, ) From 72ad711e59da876d6077f1a5625127253080e1a0 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 1 Aug 2024 15:04:36 -0400 Subject: [PATCH 135/433] removed unecessary axes. --- src/aspire/volume/volume.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index f6bd6f8dbd..5e89b63954 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -476,7 +476,7 @@ def downsample(self, ds_res, mask=None): v = self.stack_reshape(-1) # take 3D Fourier transform of each volume in the stack - fx = fft.centered_fftn(xp.asarray(v._data), axes=(1, 2, 3)) + fx = fft.centered_fftn(xp.asarray(v._data)) # crop each volume to the desired resolution in frequency space fx = crop_pad_3d(fx, ds_res) @@ -486,7 +486,7 @@ def downsample(self, ds_res, mask=None): fx = fx * xp.asarray(mask) # inverse Fourier transform of each volume - out = fft.centered_ifftn(fx, axes=(1, 2, 3)) + out = fft.centered_ifftn(fx) out = out.real * (ds_res**3 / self.resolution**3) # returns a new Volume object From 8ea0ed3725618ed7084f87583acbf347d9b38d0d Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 12 Aug 2024 13:46:51 -0400 Subject: [PATCH 136/433] Add zero_nyquist flag to 2D and 3D downsample. Keep defaults to False. --- src/aspire/image/image.py | 8 +++++++- src/aspire/volume/volume.py | 10 +++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index bd2610a604..450ed0cdc7 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -380,7 +380,7 @@ def shift(self, shifts): return self._im_translate(shifts) - def downsample(self, ds_res): + def downsample(self, ds_res, zero_nyquist=True): """ Downsample Image to a specific resolution. This method returns a new Image. @@ -400,6 +400,12 @@ def downsample(self, ds_res): fx = fft.centered_fft2(xp.asarray(im._data)) # crop 2D Fourier transform for each image crop_fx = crop_pad_2d(fx, ds_res) + + # If downsampled resolution is even, optionally zero out the nyquist frequency. + if ds_res % 2 == 0 and zero_nyquist is True: + crop_fx[:, 0, :] = 0 + crop_fx[:, :, 0] = 0 + # take back to real space, discard complex part, and scale out = fft.centered_ifft2(crop_fx).real * (ds_res**2 / self.resolution**2) out = xp.asnumpy(out) diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index 5e89b63954..1956d630b4 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -464,11 +464,13 @@ def flip(self, axis=-3): return self.__class__(np.flip(self._data, axis), symmetry_group=symmetry) - def downsample(self, ds_res, mask=None): + def downsample(self, ds_res, mask=None, zero_nyquist=False): """ Downsample each volume to a desired resolution (only cubic supported). :param ds_res: Desired resolution. + :param zero_nyquist: Option to keep or remove Nyquist frequency for even resolution. + Defaults to zero_nyquist=False, keeping the Nyquist frequency. :param mask: Optional NumPy array mask to multiply in Fourier space. """ @@ -481,6 +483,12 @@ def downsample(self, ds_res, mask=None): # crop each volume to the desired resolution in frequency space fx = crop_pad_3d(fx, ds_res) + # If downsample resolution is even, optionally zero out the nyquist frequency. + if ds_res % 2 == 0 and zero_nyquist is True: + fx[:, 0, :, :] = 0 + fx[:, :, 0, :] = 0 + fx[:, :, :, 0] = 0 + # Optionally apply mask if mask is not None: fx = fx * xp.asarray(mask) From 6686ba88f733d2fdbd31754a891aeee00ff657a1 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 12 Aug 2024 14:17:28 -0400 Subject: [PATCH 137/433] Add zero_nyquist flag to 2D downsample. Keep defaults to False. --- src/aspire/image/image.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 450ed0cdc7..af9460e7de 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -380,12 +380,14 @@ def shift(self, shifts): return self._im_translate(shifts) - def downsample(self, ds_res, zero_nyquist=True): + def downsample(self, ds_res, zero_nyquist=False): """ Downsample Image to a specific resolution. This method returns a new Image. :param ds_res: int - new resolution, should be <= the current resolution of this Image + :param zero_nyquist: Option to keep or remove Nyquist frequency for even resolution. + Defaults to zero_nyquist=False, keeping the Nyquist frequency. :return: The downsampled Image object. """ From 8d87a0e43fe0997670b35d639d5245cccad0cfc1 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 12 Aug 2024 14:57:16 -0400 Subject: [PATCH 138/433] Reset default for project and downsample to zero_nyquist=True. --- src/aspire/image/image.py | 8 ++++---- src/aspire/source/simulation.py | 13 ++----------- src/aspire/volume/volume.py | 8 ++++---- tests/test_downsample.py | 2 +- tests/test_volume.py | 4 ++-- 5 files changed, 13 insertions(+), 22 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index af9460e7de..cbab268cf6 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -380,14 +380,14 @@ def shift(self, shifts): return self._im_translate(shifts) - def downsample(self, ds_res, zero_nyquist=False): + def downsample(self, ds_res, zero_nyquist=True): """ Downsample Image to a specific resolution. This method returns a new Image. :param ds_res: int - new resolution, should be <= the current resolution of this Image :param zero_nyquist: Option to keep or remove Nyquist frequency for even resolution. - Defaults to zero_nyquist=False, keeping the Nyquist frequency. + Defaults to zero_nyquist=True, removing the Nyquist frequency. :return: The downsampled Image object. """ @@ -545,7 +545,7 @@ def size(self): # probably not needed, transition return np.size(self._data) - def backproject(self, rot_matrices, symmetry_group=None, zero_nyquist=False): + def backproject(self, rot_matrices, symmetry_group=None, zero_nyquist=True): """ Backproject images along rotations. If a symmetry group is provided, images used in back-projection are duplicated (boosted) for symmetric viewing directions. @@ -556,7 +556,7 @@ def backproject(self, rot_matrices, symmetry_group=None, zero_nyquist=False): :param symmetry_group: A SymmetryGroup instance or string indicating symmetry, ie. "C3". If supplied, uses symmetry to increase number of images used in back-projection. :param zero_nyquist: Option to keep or remove Nyquist frequency for even resolution. - Defaults to zero_nyquist=False, keeping the Nyquist frequency. + Defaults to zero_nyquist=True, removing the Nyquist frequency. :return: Volume instance corresonding to the backprojected images. """ diff --git a/src/aspire/source/simulation.py b/src/aspire/source/simulation.py index cbc2f37dc6..304d5be56d 100644 --- a/src/aspire/source/simulation.py +++ b/src/aspire/source/simulation.py @@ -243,10 +243,9 @@ def projections(self): """ return self._projections_accessor - def _projections(self, indices, legacy=False): + def _projections(self, indices): """ Accesses and returns projections as an `Image` instance. Called by self._projections_accessor. - For legacy=True we project with zero Nyquist frequency (used in _LegacySimulation). """ im = np.zeros( (len(indices), self._original_L, self._original_L), dtype=self.dtype @@ -258,7 +257,7 @@ def _projections(self, indices, legacy=False): idx_k = np.where(states == k)[0] rot = self.rotations[indices[idx_k], :, :] - im_k = self.vols[k - 1].project(rot_matrices=rot, zero_nyquist=legacy) + im_k = self.vols[k - 1].project(rot_matrices=rot) im[idx_k, :, :] = im_k.asnumpy() return Image(im) @@ -601,11 +600,3 @@ def rots_zyx_to_legacy_aspire(rots): new_rots = rots[:, ::-1] @ flip_xy return new_rots.reshape(og_shape) - - def _projections(self, indices): - """ - Accesses and returns projections as an `Image` instance. Called by self._projections_accessor - - Note: uses Volume.project(zero_nyquist=True) to match legacy projections. - """ - return super()._projections(indices, legacy=True) diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index 1956d630b4..989be9b6d2 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -309,7 +309,7 @@ def __rtruediv__(self, otherL): """ return otherL * Volume(1.0 / self._data) - def project(self, rot_matrices, zero_nyquist=False): + def project(self, rot_matrices, zero_nyquist=True): """ Using the stack of rot_matrices, project images of Volume. When projecting over a stack of volumes, a singleton Rotation or a Rotation with stack size @@ -319,7 +319,7 @@ def project(self, rot_matrices, zero_nyquist=False): :param rot_matrices: Stack of rotations. Rotation or ndarray instance. :param zero_nyquist: Option to keep or remove Nyquist frequency for even resolution. - Defaults to zero_nyquist=False, keeping the Nyquist frequency. + Defaults to zero_nyquist=True, removing the Nyquist frequency. :return: `Image` instance. """ # See Issue #727 @@ -464,13 +464,13 @@ def flip(self, axis=-3): return self.__class__(np.flip(self._data, axis), symmetry_group=symmetry) - def downsample(self, ds_res, mask=None, zero_nyquist=False): + def downsample(self, ds_res, mask=None, zero_nyquist=True): """ Downsample each volume to a desired resolution (only cubic supported). :param ds_res: Desired resolution. :param zero_nyquist: Option to keep or remove Nyquist frequency for even resolution. - Defaults to zero_nyquist=False, keeping the Nyquist frequency. + Defaults to zero_nyquist=True, removing the Nyquist frequency. :param mask: Optional NumPy array mask to multiply in Fourier space. """ diff --git a/tests/test_downsample.py b/tests/test_downsample.py index 1dc2c0d631..305f6e4ec4 100644 --- a/tests/test_downsample.py +++ b/tests/test_downsample.py @@ -55,7 +55,7 @@ def checkCenterPoint(data_org, data_ds): center_org += (L // 2,) center_ds += (L_ds // 2,) # indeterminacy for 3D - tolerance = 1e-3 + tolerance = 5e-2 return np.allclose( data_org.asnumpy()[(..., *center_org)], data_ds.asnumpy()[(..., *center_ds)], diff --git a/tests/test_volume.py b/tests/test_volume.py index 5c2d0ad3de..991cc3288e 100644 --- a/tests/test_volume.py +++ b/tests/test_volume.py @@ -343,7 +343,7 @@ def test_project_axes(vols_1, dtype): # Project a Volume with all the test rotations vol_id = 1 # select a volume from Volume stack - img_stack = vols_1[vol_id].project(r_stack, zero_nyquist=True) + img_stack = vols_1[vol_id].project(r_stack) for r in range(len(r_stack)): # Get result of test projection at center of Image. @@ -371,7 +371,7 @@ def test_project_axes(vols_1, dtype): # Note, transforming rotations to compensate for legacy grid convention used in saved data. rots = _LegacySimulation.rots_zyx_to_legacy_aspire(rots) - imgs_clean = vols.project(rots, zero_nyquist=True).asnumpy() + imgs_clean = vols.project(rots).asnumpy() assert np.allclose(results, imgs_clean, atol=1e-7) From d57f8146b1e8c99dc855737fc77d51d7fd9ccfe0 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 26 Aug 2024 09:10:01 -0400 Subject: [PATCH 139/433] default to zero-ing nyquist freq in vol.rotate --- src/aspire/volume/volume.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index 989be9b6d2..7e131a0190 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -506,7 +506,7 @@ def downsample(self, ds_res, mask=None, zero_nyquist=True): def shift(self): raise NotImplementedError - def rotate(self, rot_matrices, zero_nyquist=False): + def rotate(self, rot_matrices, zero_nyquist=True): """ Rotate volumes, within a fixed grid, by `rot_matrices`. If `rot_matrices` is a single rotation, each volume will be rotated by that rotation. If `rot_matrices` is a stack of @@ -514,7 +514,7 @@ def rotate(self, rot_matrices, zero_nyquist=False): :param rot_matrices: `Rotation` object of length 1 or n_vols. :param zero_nyquist: Option to keep or remove Nyquist frequency for even resolution. - Defaults to zero_nyquist=False, keeping the Nyquist frequency. + Defaults to zero_nyquist=True, removing the Nyquist frequency. :return: `Volume` instance. """ From 61f2aafc11fef2825b1ac97a80df9936e4f671d9 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 18 Jul 2024 11:16:28 -0400 Subject: [PATCH 140/433] add pixel_size attribute to Volume class --- src/aspire/volume/volume.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index 7e131a0190..4857e85bb9 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -58,7 +58,7 @@ class Volume: Volume is an (N1 x ...) x L x L x L array, along with associated utility methods. """ - def __init__(self, data, dtype=None, symmetry_group=None): + def __init__(self, data, dtype=None, pixel_size=None, symmetry_group=None): """ A stack of one or more volumes. @@ -76,6 +76,10 @@ def __init__(self, data, dtype=None, symmetry_group=None): `(..., resolution, resolution, resolution)`. :param dtype: Optionally cast `data` to this dtype. Defaults to `data.dtype`. + :param pixel_size: Optional voxel_size in Angstroms. + When provided will be saved with `map`/`mrc` metadata. + Default of `None` will not write to file, + but will be considered unit pixels (1) for FSC. :param symmetry_group: A SymmetryGroup instance or string indicating symmetry of the Volume. :return: A Volume instance holding `data`. @@ -107,6 +111,9 @@ def __init__(self, data, dtype=None, symmetry_group=None): self.n_vols = np.prod(self.stack_shape) self.resolution = self._data.shape[-1] self.size = self._data.size + self.pixel_size = None + if pixel_size is not None: + self.pixel_size = float(pixel_size) # Set symmetry_group. If None, default to 'C1'. self._set_symmetry_group(symmetry_group) @@ -497,10 +504,14 @@ def downsample(self, ds_res, mask=None, zero_nyquist=True): out = fft.centered_ifftn(fx) out = out.real * (ds_res**3 / self.resolution**3) + # Optionally scale pixel size + ds_pixel_size = self.pixel_size + if ds_pixel_size is not None: + ds_pixel_size *= self.resolution / ds_res + # returns a new Volume object return self.__class__( - xp.asnumpy(out), - symmetry_group=self.symmetry_group, + xp.asnumpy(out), pixel_size=ds_pixel_size, symmetry_group=self.symmetry_group ).stack_reshape(original_stack_shape) def shift(self): @@ -592,6 +603,8 @@ def save(self, filename, overwrite=False): ) with mrcfile.new(filename, overwrite=overwrite) as mrc: + if self.pixel_size is not None: + mrc.voxel_size(self.pixel_size) mrc.set_data(self._data.astype(np.float32)) if self.dtype != np.float32: @@ -624,7 +637,7 @@ def load(cls, filename, permissive=True, dtype=None, symmetry_group=None): return cls(loaded_data, symmetry_group=symmetry_group, dtype=dtype) - def fsc(self, other, cutoff=None, pixel_size=None, method="fft", plot=False): + def fsc(self, other, cutoff=None, method="fft", plot=False): r""" Compute the Fourier shell correlation between two volumes. @@ -641,8 +654,6 @@ def fsc(self, other, cutoff=None, pixel_size=None, method="fft", plot=False): :param cutoff: Cutoff value, traditionally `.143`. Default `None` implies `cutoff=1` and excludes plotting cutoff line. - :param pixel_size: Pixel size in angstrom. Default `None` - implies unit in pixels, equivalent to pixel_size=1. :param method: Selects either 'fft' (on cartesian grid), or 'nufft' (on polar grid). Defaults to 'fft'. :param plot: Optionally plot to screen or file. @@ -662,7 +673,7 @@ def fsc(self, other, cutoff=None, pixel_size=None, method="fft", plot=False): fsc = FourierShellCorrelation( a=self.asnumpy(), b=other.asnumpy(), - pixel_size=pixel_size, + pixel_size=self.pixel_size, method=method, ) @@ -681,7 +692,7 @@ def empty_like(v): :param v: Volume instance :return: Volume instance """ - return Volume(np.empty(v.shape, dtype=v.dtype)) + return Volume(np.empty(v.shape, dtype=v.dtype), pixel_size=v.pixel_size) @staticmethod def zeros_like(v): @@ -691,7 +702,7 @@ def zeros_like(v): :param v: Volume instance :return: Volume instance """ - return Volume(np.zeros(v.shape, dtype=v.dtype)) + return Volume(np.zeros(v.shape, dtype=v.dtype), pixel_size=v.pixel_size) class CartesianVolume(Volume): From e579bd40c17dd65c62ba694738a46cc77df73704 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 18 Jul 2024 11:25:05 -0400 Subject: [PATCH 141/433] volume load pixel size --- src/aspire/volume/volume.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index 4857e85bb9..5265fef9b7 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -625,6 +625,12 @@ def load(cls, filename, permissive=True, dtype=None, symmetry_group=None): """ with mrcfile.open(filename, permissive=permissive) as mrc: loaded_data = mrc.data + pixel_size = mrc.voxel_size + + # Handle default pixel_size. + # `mrcfile` defaults to zero, where we use `None`. + if pixel_size == 0: + pixel_size = None # FINUFFT work around if loaded_data.dtype == np.float32: @@ -635,7 +641,12 @@ def load(cls, filename, permissive=True, dtype=None, symmetry_group=None): if loaded_data.dtype != dtype: logger.info(f"{filename} with dtype {loaded_data.dtype} loaded as {dtype}") - return cls(loaded_data, symmetry_group=symmetry_group, dtype=dtype) + return cls( + loaded_data, + pixel_size=pixel_size, + symmetry_group=symmetry_group, + dtype=dtype, + ) def fsc(self, other, cutoff=None, method="fft", plot=False): r""" From fb73d6d258f63e92e1b9f5ae07d7d46bbc0438b2 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 18 Jul 2024 12:57:13 -0400 Subject: [PATCH 142/433] volume load pixel size --- src/aspire/volume/volume.py | 103 ++++++++++++++++++++++++++++-------- 1 file changed, 81 insertions(+), 22 deletions(-) diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index 5265fef9b7..315e3be2a0 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -147,7 +147,9 @@ def astype(self, dtype, copy=True): :return: Volume instance """ return self.__class__( - self.asnumpy().astype(dtype, copy=copy), symmetry_group=self.symmetry_group + self.asnumpy().astype(dtype, copy=copy), + pixel_size=self.pixel_size, + symmetry_group=self.symmetry_group, ) def _check_key_dims(self, key): @@ -158,7 +160,11 @@ def _check_key_dims(self, key): def __getitem__(self, key): self._check_key_dims(key) - return self.__class__(self._data[key], symmetry_group=self.symmetry_group) + return self.__class__( + self._data[key], + pixel_size=self.pixel_size, + symmetry_group=self.symmetry_group, + ) def __setitem__(self, key, value): self._check_key_dims(key) @@ -249,6 +255,7 @@ def stack_reshape(self, *args): return self.__class__( self._data.reshape(*shape, *self._data.shape[-3:]), + pixel_size=self.pixel_size, symmetry_group=self.symmetry_group, ) @@ -265,9 +272,15 @@ def __len__(self): def __add__(self, other): symmetry = self._result_symmetry(other) if isinstance(other, Volume): - res = self.__class__(self._data + other.asnumpy(), symmetry_group=symmetry) + res = self.__class__( + self._data + other.asnumpy(), + pixel_size=self.pixel_size, + symmetry_group=symmetry, + ) else: - res = self.__class__(self._data + other, symmetry_group=symmetry) + res = self.__class__( + self._data + other, pixel_size=self.pixel_size, symmetry_group=symmetry + ) return res @@ -277,21 +290,37 @@ def __radd__(self, otherL): def __sub__(self, other): symmetry = self._result_symmetry(other) if isinstance(other, Volume): - res = self.__class__(self._data - other.asnumpy(), symmetry_group=symmetry) + res = self.__class__( + self._data - other.asnumpy(), + pixel_size=self.pixel_size, + symmetry_group=symmetry, + ) else: - res = self.__class__(self._data - other, symmetry_group=symmetry) + res = self.__class__( + self._data - other, pixel_size=self.pixel_size, symmetry_group=symmetry + ) return res def __rsub__(self, otherL): - return self.__class__(otherL - self._data) + return self.__class__( + otherL - self._data, + pixel_size=self.pixel_size, + symmetry_group=self.symmetry_group, + ) def __mul__(self, other): symmetry = self._result_symmetry(other) if isinstance(other, Volume): - res = self.__class__(self._data * other.asnumpy(), symmetry_group=symmetry) + res = self.__class__( + self._data * other.asnumpy(), + pixel_size=self.pixel_size, + symmetry_group=symmetry, + ) else: - res = self.__class__(self._data * other, symmetry_group=symmetry) + res = self.__class__( + self._data * other, pixel_size=self.pixel_size, symmetry_group=symmetry + ) return res @@ -304,9 +333,15 @@ def __truediv__(self, other): """ symmetry = self._result_symmetry(other) if isinstance(other, Volume): - res = self.__class__(self._data / other.asnumpy(), symmetry_group=symmetry) + res = self.__class__( + self._data / other.asnumpy(), + pixel_size=self.pixel_size, + symmetry_group=symmetry, + ) else: - res = self.__class__(self._data / other, symmetry_group=symmetry) + res = self.__class__( + self._data / other, pixel_size=self.pixel_size, symmetry_group=symmetry + ) return res @@ -314,7 +349,10 @@ def __rtruediv__(self, otherL): """ Right scalar division, follows numpy semantics. """ - return otherL * Volume(1.0 / self._data) + return otherL * Volume( + 1.0 / self._data, + pixel_size=self.pixel_size, + ) def project(self, rot_matrices, zero_nyquist=True): """ @@ -381,7 +419,7 @@ def project(self, rot_matrices, zero_nyquist=True): im_f[:, :, 0] = 0 im_f = fft.centered_ifft2(im_f) - + # todo add pixel_size to Image return aspire.image.Image(xp.asnumpy(im_f.real)) def to_vec(self): @@ -426,7 +464,7 @@ def transpose(self): v = self._data.reshape(-1, *self._data.shape[-3:]) vt = np.transpose(v, (0, -1, -2, -3)) vt = vt.reshape(*original_stack_shape, *self._data.shape[-3:]) - return self.__class__(vt, symmetry_group=symmetry) + return self.__class__(vt, pixel_size=self.pixel_size, symmetry_group=symmetry) @property def T(self): @@ -469,7 +507,11 @@ def flip(self, axis=-3): f"Cannot flip axis {ax}: stack axis. Did you mean {ax-4}?" ) - return self.__class__(np.flip(self._data, axis), symmetry_group=symmetry) + return self.__class__( + np.flip(self._data, axis), + pixel_size=self.pixel_size, + symmetry_group=symmetry, + ) def downsample(self, ds_res, mask=None, zero_nyquist=True): """ @@ -583,7 +625,7 @@ def rotate(self, rot_matrices, zero_nyquist=True): np.real(fft.centered_ifftn(xp.asarray(vol_f), axes=(-3, -2, -1))) ) - return self.__class__(vol, symmetry_group=symmetry) + return self.__class__(vol, pixel_size=self.pixel_size, symmetry_group=symmetry) def denoise(self): raise NotImplementedError @@ -625,12 +667,7 @@ def load(cls, filename, permissive=True, dtype=None, symmetry_group=None): """ with mrcfile.open(filename, permissive=permissive) as mrc: loaded_data = mrc.data - pixel_size = mrc.voxel_size - - # Handle default pixel_size. - # `mrcfile` defaults to zero, where we use `None`. - if pixel_size == 0: - pixel_size = None + pixel_size = Volume._vx_array_to_size(mrc.voxel_size) # FINUFFT work around if loaded_data.dtype == np.float32: @@ -715,6 +752,28 @@ def zeros_like(v): """ return Volume(np.zeros(v.shape, dtype=v.dtype), pixel_size=v.pixel_size) + @staticmethod + def _vx_array_to_size(vx): + """ + Utility to convert from several possible `mrcfile.voxel_size` representations to a single (float) value or None. + """ + # Convert from recarray to single values, + # checks uniformity. + if isinstance(vx, np.recarray): + if vx.x != vx.y or vx.x != vx.z: + raise ValueError(f"Voxel sizes are not uniform: {vx}") + vx = vx.x + + # Convert `0` to `None` + if (isinstance(vx, int) or isinstance(vx, float)) and vx == 0: + vx = None + + # Consistently return a `float` when not None + if vx is not None: + vx = float(vx) + + return vx + class CartesianVolume(Volume): def expand(self, basis): From 68aead4809de3948e175b58e446cb5646e533941 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 18 Jul 2024 13:55:27 -0400 Subject: [PATCH 143/433] volume load pixel size --- src/aspire/volume/volume.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index 315e3be2a0..2dc0c9a309 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -645,9 +645,10 @@ def save(self, filename, overwrite=False): ) with mrcfile.new(filename, overwrite=overwrite) as mrc: - if self.pixel_size is not None: - mrc.voxel_size(self.pixel_size) mrc.set_data(self._data.astype(np.float32)) + # Note assigning voxel_size must come after `set_data` + if self.pixel_size is not None: + mrc.voxel_size = self.pixel_size if self.dtype != np.float32: logger.info(f"Volume with dtype {self.dtype} saved with dtype float32") @@ -757,6 +758,7 @@ def _vx_array_to_size(vx): """ Utility to convert from several possible `mrcfile.voxel_size` representations to a single (float) value or None. """ + # Convert from recarray to single values, # checks uniformity. if isinstance(vx, np.recarray): @@ -765,7 +767,9 @@ def _vx_array_to_size(vx): vx = vx.x # Convert `0` to `None` - if (isinstance(vx, int) or isinstance(vx, float)) and vx == 0: + if ( + isinstance(vx, int) or isinstance(vx, float) or isinstance(vx, np.ndarray) + ) and vx == 0: vx = None # Consistently return a `float` when not None From 8f73210a649eff96c763e0901f74314f87db2096 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 18 Jul 2024 14:14:44 -0400 Subject: [PATCH 144/433] rm old pixel_size attr from FSC calls --- tests/test_fourier_correlation.py | 18 ++++++------- tests/test_mean_estimator_boosting.py | 2 +- tests/test_volume.py | 39 +++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/tests/test_fourier_correlation.py b/tests/test_fourier_correlation.py index 282089ce12..c53ba40ae1 100644 --- a/tests/test_fourier_correlation.py +++ b/tests/test_fourier_correlation.py @@ -178,7 +178,7 @@ def test_frc_plot(image_fixture, method): def test_fsc_id(volume_fixture, method): vol, _ = volume_fixture - fsc_resolution, fsc = vol.fsc(vol, pixel_size=1, cutoff=0.143, method=method) + fsc_resolution, fsc = vol.fsc(vol, cutoff=0.143, method=method) assert np.isclose(fsc_resolution[0], 2, rtol=0.02) assert np.allclose(fsc, 1, rtol=0.01) @@ -186,11 +186,11 @@ def test_fsc_id(volume_fixture, method): def test_fsc_trunc(volume_fixture, method): vol_a, vol_b = volume_fixture - fsc_resolution, fsc = vol_a.fsc(vol_b, pixel_size=1, cutoff=0.143, method=method) + fsc_resolution, fsc = vol_a.fsc(vol_b, cutoff=0.143, method=method) assert fsc_resolution[0] > 3.0 # The follow should correspond to the test_fsc_plot below. - fsc_resolution, fsc = vol_a.fsc(vol_b, pixel_size=1, cutoff=0.5, method=method) + fsc_resolution, fsc = vol_a.fsc(vol_b, cutoff=0.5, method=method) assert fsc_resolution[0] > 3.9 @@ -202,13 +202,13 @@ def test_fsc_vol_plot(volume_fixture): # Plot to screen with matplotlib_no_gui(): - _ = vol_a.fsc(vol_b, pixel_size=1, cutoff=0.5, plot=True) + _ = vol_a.fsc(vol_b, cutoff=0.5, plot=True) # Plot to file # Also tests `cutoff=None` with tempfile.TemporaryDirectory() as tmp_input_dir: file_path = os.path.join(tmp_input_dir, "vol_fsc_curve.png") - vol_a.fsc(vol_b, pixel_size=1, cutoff=None, plot=file_path) + vol_a.fsc(vol_b, cutoff=None, plot=file_path) assert os.path.exists(file_path) @@ -218,9 +218,7 @@ def test_fsc_plot(volume_fixture, method): """ vol_a, vol_b = volume_fixture - fsc = FourierShellCorrelation( - vol_a.asnumpy(), vol_b.asnumpy(), pixel_size=1, method=method - ) + fsc = FourierShellCorrelation(vol_a.asnumpy(), vol_b.asnumpy(), method=method) with matplotlib_no_gui(): fsc.plot(cutoff=0.5) @@ -314,7 +312,7 @@ def test_vol_type_mismatch(): b = a.asnumpy() with pytest.raises(TypeError, match=r"`other` volume must be an `Volume` instance"): - _ = a.fsc(b, pixel_size=1, cutoff=0.143) + _ = a.fsc(b, cutoff=0.143) # Broadcasting @@ -378,7 +376,7 @@ def test_fsc_id_bcast(volume_fixture, method): k = 3 vol_b = Volume(np.tile(vol.asnumpy(), (3, 1, 1, 1))) - fsc_resolution, fsc = vol.fsc(vol_b, pixel_size=1, cutoff=0.143, method=method) + fsc_resolution, fsc = vol.fsc(vol_b, cutoff=0.143, method=method) assert np.allclose( fsc_resolution, [ diff --git a/tests/test_mean_estimator_boosting.py b/tests/test_mean_estimator_boosting.py index 9251dee09e..6eac159115 100644 --- a/tests/test_mean_estimator_boosting.py +++ b/tests/test_mean_estimator_boosting.py @@ -122,7 +122,7 @@ def weighted_source(weighted_volume): def test_fsc(source, estimated_volume): """Compare estimated volume to source volume with FSC.""" # Fourier Shell Correlation - fsc_resolution, fsc = source.vols.fsc(estimated_volume, pixel_size=1, cutoff=0.5) + fsc_resolution, fsc = source.vols.fsc(estimated_volume, cutoff=0.5) # Check that resolution is less than 2.1 pixels. np.testing.assert_array_less(fsc_resolution, 2.1) diff --git a/tests/test_volume.py b/tests/test_volume.py index 991cc3288e..bec31d6ed0 100644 --- a/tests/test_volume.py +++ b/tests/test_volume.py @@ -75,7 +75,7 @@ def vols_1(data_1): @pytest.fixture def vols_2(data_2): - return Volume(data_2) + return Volume(data_2, pixel_size=4.56) @pytest.fixture @@ -291,6 +291,32 @@ def test_save_load(vols_1): assert np.allclose(vols_1, vols_loaded_single) assert isinstance(vols_loaded_double, Volume) assert np.allclose(vols_1, vols_loaded_double) + assert vols_loaded_single.pixel_size is None, "Pixel size should be None" + assert vols_loaded_double.pixel_size is None, "Pixel size should be None" + + +def test_save_load_pixel_size(vols_2): + # Create a tmpdir in a context. It will be cleaned up on exit. + with tempfile.TemporaryDirectory() as tmpdir: + # Save the Volume object into an MRC files + mrcs_filepath = os.path.join(tmpdir, "test.mrc") + vols_2.save(mrcs_filepath) + + # Load saved MRC file as a Volume of dtypes single and double. + vols_loaded_single = Volume.load(mrcs_filepath, dtype=np.float32) + vols_loaded_double = Volume.load(mrcs_filepath, dtype=np.float64) + + # Confirm the pixel size is loaded + np.testing.assert_approx_equal( + vols_loaded_single.pixel_size, + vols_2.pixel_size, + err_msg="Incorrect pixel size in singles.", + ) + np.testing.assert_approx_equal( + vols_loaded_double.pixel_size, + vols_2.pixel_size, + err_msg="Incorrect pixel size in doubles.", + ) def test_project(vols_hot_cold): @@ -545,11 +571,20 @@ def test_flip(vols_1, data_1): def test_downsample(res): - vols = Volume(np.load(os.path.join(DATA_DIR, "clean70SRibosome_vol.npy"))) + vols = Volume( + np.load(os.path.join(DATA_DIR, "clean70SRibosome_vol.npy")), pixel_size=1.23 + ) result = vols.downsample(res) og_res = vols.resolution ds_res = result.resolution + # Confirm the pixel size is scaled + np.testing.assert_approx_equal( + result.pixel_size, + vols.pixel_size * res / ds_res, + err_msg="Incorrect pixel size.", + ) + # check signal energy np.testing.assert_allclose( anorm(vols.asnumpy(), axes=(1, 2, 3)) / og_res, From e433d4c2f898efd69d9a33d3b1468ab89e9533f2 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 18 Jul 2024 14:56:26 -0400 Subject: [PATCH 145/433] Add Image.voxel_size handling --- src/aspire/image/image.py | 115 +++++++++++++++++++++++------- src/aspire/volume/volume.py | 5 +- tests/test_fourier_correlation.py | 26 ++++--- 3 files changed, 104 insertions(+), 42 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index cbab268cf6..984b1e6540 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -80,7 +80,7 @@ def load_mrc(filepath): Load raw data from `.mrc` into an array. :param filepath: File path (string). - :return: numpy array of image data. + :return: (numpy array of image data, pixel_size) """ # mrcfile tends to yield many warnings about EMPIAR datasets being corrupt @@ -92,6 +92,7 @@ def load_mrc(filepath): with mrcfile.open(filepath, mode="r", permissive=True) as mrc: im = mrc.data + pixel_size = Image._vx_array_to_size(mrc.voxel_size) # Log each mrcfile warning to debug log, noting the associated file for w in ws: @@ -110,19 +111,29 @@ def load_mrc(filepath): f" Will attempt to continue processing {filepath}" ) - return im + return im, pixel_size def load_tiff(filepath): """ Load raw data from `.tiff` into an array. + Note, TIFF does not natively provide equivalent to pixel/voxel_size, + so users of TIFF files may need to manually assign `pixel_size` to + `Image` instances when required. Defaults to `pixel_size=None`. + :param filepath: File path (string). - :return: numpy array of image data. + :return: (numpy array of image data, pixel_size=None) """ + # Use PIL to open `filepath` + img = PILImage.open(filepath) + + # Future todo, extract `voxel_size` if available in TIFF tags (custom tag?) + # For now, default to `None`. + voxel_size = None - # Use PIL to open `filepath` and cast to numpy array. - return np.array(PILImage.open(filepath)) + # Cast image data as numpy array + return np.array(img), voxel_size class Image: @@ -133,7 +144,7 @@ class Image: ".tiff": load_tiff, } - def __init__(self, data, dtype=None): + def __init__(self, data, pixel_size=None, dtype=None): """ A stack of one or more images. @@ -149,6 +160,10 @@ def __init__(self, data, dtype=None): :param data: Numpy array containing image data with shape `(..., resolution, resolution)`. + :param pixel_size: Optional pixel size in Angstroms. + When provided will be saved with `mrc` metadata. + Default of `None` will not write to file, + but will be considered unit pixels (1) for FSC. :param dtype: Optionally cast `data` to this dtype. Defaults to `data.dtype`. @@ -180,6 +195,9 @@ def __init__(self, data, dtype=None): self.stack_shape = self._data.shape[:-2] self.n_images = np.prod(self.stack_shape) self.resolution = self._data.shape[-1] + self.pixel_size = None + if pixel_size is not None: + self.pixel_size = float(pixel_size) # Numpy interop # https://numpy.org/devdocs/user/basics.interoperability.html#the-array-interface-protocol @@ -238,7 +256,7 @@ def _check_key_dims(self, key): def __getitem__(self, key): self._check_key_dims(key) - return self.__class__(self._data[key]) + return self.__class__(self._data[key], pixel_size=self.pixel_size) def __setitem__(self, key, value): self._check_key_dims(key) @@ -266,31 +284,34 @@ def stack_reshape(self, *args): f"Number of images {self.n_images} cannot be reshaped to {shape}." ) - return self.__class__(self._data.reshape(*shape, *self._data.shape[-2:])) + return self.__class__( + self._data.reshape(*shape, *self._data.shape[-2:]), + pixel_size=self.pixel_size, + ) def __add__(self, other): if isinstance(other, Image): other = other._data - return self.__class__(self._data + other) + return self.__class__(self._data + other, pixel_size=self.pixel_size) def __sub__(self, other): if isinstance(other, Image): other = other._data - return self.__class__(self._data - other) + return self.__class__(self._data - other, pixel_size=self.pixel_size) def __mul__(self, other): if isinstance(other, Image): other = other._data - return self.__class__(self._data * other) + return self.__class__(self._data * other, pixel_size=self.pixel_size) def __neg__(self): - return self.__class__(-self._data) + return self.__class__(-self._data, pixel_size=self.pixel_size) def sqrt(self): - return self.__class__(np.sqrt(self._data)) + return self.__class__(np.sqrt(self._data), pixel_size=self.pixel_size) @property def T(self): @@ -312,7 +333,9 @@ def transpose(self): im = self.stack_reshape(-1) imt = np.transpose(im._data, (0, -1, -2)) - return self.__class__(imt).stack_reshape(original_stack_shape) + return self.__class__(imt, pixel_size=self.pixel_size).stack_reshape( + original_stack_shape + ) def flip(self, axis=-2): """ @@ -335,7 +358,7 @@ def flip(self, axis=-2): f"Cannot flip axis {ax}: stack axis. Did you mean {ax-3}?" ) - return self.__class__(np.flip(self._data, axis)) + return self.__class__(np.flip(self._data, axis), pixel_size=self.pixel_size) def __repr__(self): msg = f"{self.n_images} {self.dtype} images arranged as a {self.stack_shape} stack" @@ -355,7 +378,7 @@ def asnumpy(self): return view def copy(self): - return self.__class__(self._data.copy()) + return self.__class__(self._data.copy(), pixel_size=self.pixel_size) def shift(self, shifts): """ @@ -412,7 +435,14 @@ def downsample(self, ds_res, zero_nyquist=True): out = fft.centered_ifft2(crop_fx).real * (ds_res**2 / self.resolution**2) out = xp.asnumpy(out) - return self.__class__(out).stack_reshape(original_stack_shape) + # Optionally scale pixel size + ds_pixel_size = self.pixel_size + if ds_pixel_size is not None: + ds_pixel_size *= self.resolution / ds_res + + return self.__class__(out, pixel_size=ds_pixel_size).stack_reshape( + original_stack_shape + ) def filter(self, filter): """ @@ -441,7 +471,9 @@ def filter(self, filter): im = xp.asnumpy(im.real) - return self.__class__(im).stack_reshape(original_stack_shape) + return self.__class__(im, pixel_size=self.pixel_size).stack_reshape( + original_stack_shape + ) def rotate(self): raise NotImplementedError @@ -453,6 +485,9 @@ def save(self, mrcs_filepath, overwrite=False): with mrcfile.new(mrcs_filepath, overwrite=overwrite) as mrc: # original input format (the image index first) mrc.set_data(self._data.astype(np.float32)) + # Note assigning voxel_size must come after `set_data` + if self.pixel_size is not None: + mrc.voxel_size = self.pixel_size @staticmethod def load(filepath, dtype=None): @@ -477,14 +512,14 @@ def load(filepath, dtype=None): ) # Call the appropriate file reader - im = Image.extensions[ext](filepath) + im, pixel_size = Image.extensions[ext](filepath) # Attempt casting when user provides dtype if dtype is not None: im = im.astype(dtype, copy=False) # Return as Image instance - return Image(im) + return Image(im, pixel_size=pixel_size) def _im_translate(self, shifts): """ @@ -535,7 +570,9 @@ def _im_translate(self, shifts): im_translated = xp.asnumpy(im_translated.real) # Reshape to stack shape - return self.__class__(im_translated).stack_reshape(stack_shape) + return self.__class__(im_translated, pixel_size=self.pixel_size).stack_reshape( + stack_shape + ) def norm(self): return anorm(self._data) @@ -602,7 +639,9 @@ def backproject(self, rot_matrices, symmetry_group=None, zero_nyquist=True): vol /= L - return aspire.volume.Volume(vol, symmetry_group=symmetry_group) + return aspire.volume.Volume( + vol, pixel_size=self.pixel_size, symmetry_group=symmetry_group + ) def show(self, columns=5, figsize=(20, 10), colorbar=True): """ @@ -645,7 +684,7 @@ def show(self, columns=5, figsize=(20, 10), colorbar=True): plt.show() - def frc(self, other, cutoff=None, pixel_size=None, method="fft", plot=False): + def frc(self, other, cutoff=None, method="fft", plot=False): r""" Compute the Fourier ring correlation between two images. @@ -663,8 +702,6 @@ def frc(self, other, cutoff=None, pixel_size=None, method="fft", plot=False): Default `None` implies `cutoff=1` and excludes plotting cutoff line. - :param pixel_size: Pixel size in angstrom. Default `None` - implies unit in pixels, equivalent to pixel_size=1. :param method: Selects either 'fft' (on cartesian grid), or 'nufft' (on polar grid). Defaults to 'fft'. :param plot: Optionally plot to screen or file. @@ -684,7 +721,7 @@ def frc(self, other, cutoff=None, pixel_size=None, method="fft", plot=False): frc = FourierRingCorrelation( a=self.asnumpy(), b=other.asnumpy(), - pixel_size=pixel_size, + pixel_size=self.pixel_size, method=method, ) @@ -695,6 +732,32 @@ def frc(self, other, cutoff=None, pixel_size=None, method="fft", plot=False): return frc.analyze_correlations(cutoff), frc.correlations + @staticmethod + def _vx_array_to_size(vx): + """ + Utility to convert from several possible `mrcfile.voxel_size` + representations to a single (float) value or None. + """ + + # Convert from recarray to single values, + # checks uniformity. + if isinstance(vx, np.recarray): + if vx.x != vx.y: + raise ValueError(f"Voxel sizes are not uniform: {vx}") + vx = vx.x + + # Convert `0` to `None` + if ( + isinstance(vx, int) or isinstance(vx, float) or isinstance(vx, np.ndarray) + ) and vx == 0: + vx = None + + # Consistently return a `float` when not None + if vx is not None: + vx = float(vx) + + return vx + class CartesianImage(Image): def expand(self, basis): diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index 2dc0c9a309..1484a9c344 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -420,7 +420,7 @@ def project(self, rot_matrices, zero_nyquist=True): im_f = fft.centered_ifft2(im_f) # todo add pixel_size to Image - return aspire.image.Image(xp.asnumpy(im_f.real)) + return aspire.image.Image(xp.asnumpy(im_f.real), pixel_size=self.pixel_size) def to_vec(self): """Returns an N x resolution ** 3 array.""" @@ -756,7 +756,8 @@ def zeros_like(v): @staticmethod def _vx_array_to_size(vx): """ - Utility to convert from several possible `mrcfile.voxel_size` representations to a single (float) value or None. + Utility to convert from several possible `mrcfile.voxel_size` + representations to a single (float) value or None. """ # Convert from recarray to single values, diff --git a/tests/test_fourier_correlation.py b/tests/test_fourier_correlation.py index c53ba40ae1..79240572f8 100644 --- a/tests/test_fourier_correlation.py +++ b/tests/test_fourier_correlation.py @@ -115,7 +115,7 @@ def volume_fixture(img_size, dtype): def test_frc_id(image_fixture, method): img, _, _ = image_fixture - frc_resolution, frc = img.frc(img, pixel_size=1, cutoff=0.143, method=method) + frc_resolution, frc = img.frc(img, cutoff=0.143, method=method) assert np.isclose(frc_resolution[0], 2, rtol=0.02) assert np.allclose(frc, 1, rtol=0.01) @@ -123,14 +123,14 @@ def test_frc_id(image_fixture, method): def test_frc_trunc(image_fixture, method): img_a, img_b, _ = image_fixture assert img_a.dtype == img_b.dtype - frc_resolution, frc = img_a.frc(img_b, pixel_size=1, cutoff=0.143, method=method) + frc_resolution, frc = img_a.frc(img_b, cutoff=0.143, method=method) assert frc_resolution[0] > 3.0 def test_frc_noise(image_fixture, method): img_a, _, img_n = image_fixture - frc_resolution, frc = img_a.frc(img_n, pixel_size=1, cutoff=0.143, method=method) + frc_resolution, frc = img_a.frc(img_n, cutoff=0.143, method=method) assert frc_resolution[0] > 3.5 @@ -142,13 +142,13 @@ def test_frc_img_plot(image_fixture): # Plot to screen with matplotlib_no_gui(): - _ = img_a.frc(img_n, pixel_size=1, cutoff=0.143, plot=True) + _ = img_a.frc(img_n, cutoff=0.143, plot=True) # Plot to file # Also tests `cutoff=None` with tempfile.TemporaryDirectory() as tmp_input_dir: file_path = os.path.join(tmp_input_dir, "img_frc_curve.png") - img_a.frc(img_n, pixel_size=1, cutoff=None, plot=file_path) + img_a.frc(img_n, cutoff=None, plot=file_path) assert os.path.exists(file_path) @@ -160,9 +160,7 @@ def test_frc_plot(image_fixture, method): """ img_a, img_b, _ = image_fixture - frc = FourierRingCorrelation( - img_a.asnumpy(), img_b.asnumpy(), pixel_size=1, method=method - ) + frc = FourierRingCorrelation(img_a.asnumpy(), img_b.asnumpy(), method=method) with matplotlib_no_gui(): frc.plot(cutoff=0.5) @@ -304,7 +302,7 @@ def test_img_type_mismatch(): b = a.asnumpy() with pytest.raises(TypeError, match=r"`other` image must be an `Image` instance"): - _ = a.frc(b, pixel_size=1, cutoff=0.143) + _ = a.frc(b, cutoff=0.143) def test_vol_type_mismatch(): @@ -327,7 +325,7 @@ def test_frc_id_bcast(image_fixture, method): k = 3 img_b = Image(np.tile(img, (3, 1, 1))) - frc_resolution, frc = img.frc(img_b, pixel_size=1, cutoff=0.143, method=method) + frc_resolution, frc = img.frc(img_b, cutoff=0.143, method=method) assert np.allclose( frc_resolution, [ @@ -342,7 +340,7 @@ def test_frc_id_bcast(image_fixture, method): # (1) x (1,3) img_b = img_b.stack_reshape(1, 3) - frc_resolution, frc = img.frc(img_b, pixel_size=1, cutoff=0.143, method=method) + frc_resolution, frc = img.frc(img_b, cutoff=0.143, method=method) assert np.allclose( frc_resolution, [ @@ -357,7 +355,7 @@ def test_frc_id_bcast(image_fixture, method): # (1) x (3,1) img_b = img_b.stack_reshape(3, 1) - frc_resolution, frc = img.frc(img_b, pixel_size=1, cutoff=0.143, method=method) + frc_resolution, frc = img.frc(img_b, cutoff=0.143, method=method) assert np.allclose( frc_resolution, [ @@ -398,12 +396,12 @@ def test_frc_img_plot_bcast(image_fixture): # Plot to screen, one:many with matplotlib_no_gui(): - _ = img_a.frc(img_b, pixel_size=1, cutoff=0.143, plot=True) + _ = img_a.frc(img_b, cutoff=0.143, plot=True) # Plot to file, many elementwise with tempfile.TemporaryDirectory() as tmp_input_dir: file_path = os.path.join(tmp_input_dir, "img_frc_curve.png") - img_b.frc(img_b, pixel_size=1, cutoff=0.143, plot=file_path) + img_b.frc(img_b, cutoff=0.143, plot=file_path) assert os.path.exists(file_path) From 6b8dc9f8da777e0fd56ab7b96ade3104307dbd14 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 22 Jul 2024 09:34:39 -0400 Subject: [PATCH 146/433] cleanup image tests round 1 --- tests/test_image.py | 160 ++++++++++++++++++++++---------------------- 1 file changed, 81 insertions(+), 79 deletions(-) diff --git a/tests/test_image.py b/tests/test_image.py index 688d4169ec..6a9888479a 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -24,8 +24,22 @@ n = 3 mdim = 2 +PARITY = [0, 1] +DTYPES = [np.float32, np.float64] -def get_images(parity=0, dtype=np.float32): + +@pytest.fixture(params=PARITY, ids=lambda x: f"parity={x}", scope="module") +def parity(request): + return request.param + + +@pytest.fixture(params=DTYPES, ids=lambda x: f"dtype={x}", scope="module") +def dtype(request): + return request.param + + +@pytest.fixture(scope="module") +def get_images(parity, dtype): size = 768 - parity # numpy array for top-level functions that directly expect it im_np = face(gray=True).astype(dtype)[np.newaxis, :size, :size] @@ -33,36 +47,40 @@ def get_images(parity=0, dtype=np.float32): im_np /= denom # Normalize test image data to 0,1 # Independent Image object for testing Image methods - im = Image(im_np.copy()) + im = Image(im_np.copy(), pixel_size=1.23) return im_np, im -def get_stacks(parity=0, dtype=np.float32): - im_np, im = get_images(parity, dtype) +@pytest.fixture(scope="module") +def get_stacks(get_images, dtype): + im_np, im = get_images # Construct a simple stack of Images - ims_np = np.empty((n, *im_np.shape[1:]), dtype=dtype) + ims_np = np.empty((n, *im_np.shape[1:]), dtype=im_np.dtype) for i in range(n): ims_np[i] = im_np * (i + 1) / float(n) # Independent Image stack object for testing Image methods - ims = Image(ims_np) + ims = Image(ims_np.copy()) return ims_np, ims -def get_mdim_images(parity=0, dtype=np.float32): - ims_np, im = get_stacks(parity, dtype) +# Note that `get_mdim_images` is mutated by some tests, +# force per function scope. +@pytest.fixture(scope="function") +def get_mdim_images(get_stacks): + ims_np, im = get_stacks # Multi dimensional stack Image object mdim = 2 mdim_ims_np = np.concatenate([ims_np] * mdim).reshape(mdim, *ims_np.shape) # Independent multidimensional Image stack object for testing Image methods - mdim_ims = Image(mdim_ims_np) + mdim_ims = Image(mdim_ims_np.copy()) return mdim_ims_np, mdim_ims -def testRepr(): - _, mdim_ims = get_mdim_images() +def testRepr(get_mdim_images): + _, mdim_ims = get_mdim_images r = repr(mdim_ims) logger.info(f"Image repr:\n{r}") @@ -73,9 +91,8 @@ def testNonSquare(): _ = Image(np.empty((4, 5))) -@pytest.mark.parametrize("parity,dtype", params) -def testImShift(parity, dtype): - im_np, im = get_images(parity, dtype) +def testImShift(get_images, dtype): + im_np, im = get_images # Note that the _im_translate method can handle float input shifts, as it # computes the shifts in Fourier space, rather than performing a roll # However, NumPy's roll() only accepts integer inputs @@ -101,10 +118,8 @@ def testImShift(parity, dtype): np.testing.assert_allclose(im0.asnumpy()[0, :, :], im3, atol=atol) -@pytest.mark.parametrize("parity,dtype", params) -def testImShiftStack(parity, dtype): - ims_np, ims = get_stacks(parity, dtype) - +def testImShiftStack(get_stacks, dtype): + ims_np, ims = get_stacks # test stack of shifts (same number as Image.num_img) # mix of odd and even shifts = np.array([[100, 200], [203, 150], [55, 307]]) @@ -131,8 +146,8 @@ def testImShiftStack(parity, dtype): np.testing.assert_allclose(im0.asnumpy(), im3, atol=atol) -def testImageShiftErrors(): - _, im = get_images(0, np.float32) +def testImageShiftErrors(get_images): + _, im = get_images # test bad shift shape with pytest.raises(ValueError, match="Input shifts must be of shape"): _ = im.shift(np.array([100, 100, 100])) @@ -141,18 +156,16 @@ def testImageShiftErrors(): _ = im.shift(np.array([[100, 200], [100, 200]])) -@pytest.mark.parametrize("parity,dtype", params) -def testImageSqrt(parity, dtype): - im_np, im = get_images(parity, dtype) - ims_np, ims = get_stacks(parity, dtype) +def testImageSqrt(get_images, get_stacks): + im_np, im = get_images + ims_np, ims = get_stacks assert np.allclose(im.sqrt().asnumpy(), np.sqrt(im_np)) assert np.allclose(ims.sqrt().asnumpy(), np.sqrt(ims_np)) -@pytest.mark.parametrize("parity,dtype", params) -def testImageTranspose(parity, dtype): - im_np, im = get_images(parity, dtype) - ims_np, ims = get_stacks(parity, dtype) +def testImageTranspose(get_images, get_stacks): + im_np, im = get_images + ims_np, ims = get_stacks # test method and abbreviation assert np.allclose(im.T.asnumpy(), np.transpose(im_np, (0, 2, 1))) assert np.allclose(im.transpose().asnumpy(), np.transpose(im_np, (0, 2, 1))) @@ -163,10 +176,9 @@ def testImageTranspose(parity, dtype): assert np.allclose(ims.transpose()[i], ims_np[i].T) -@pytest.mark.parametrize("parity,dtype", params) -def testImageFlip(parity, dtype): - im_np, im = get_images(parity, dtype) - ims_np, ims = get_stacks(parity, dtype) +def testImageFlip(get_images, get_stacks): + im_np, im = get_images + ims_np, ims = get_stacks for axis in powerset(range(1, 3)): if not axis: # test default @@ -188,31 +200,31 @@ def testImageFlip(parity, dtype): _ = im.flip(axis) -def testShape(): - ims_np, ims = get_stacks() +def testShape(get_stacks): + ims_np, ims = get_stacks assert ims.shape == ims_np.shape assert ims.stack_shape == ims_np.shape[:-2] assert ims.stack_ndim == 1 -def testMultiDimShape(): - ims_np, ims = get_stacks() - mdim_ims_np, mdim_ims = get_mdim_images() +def testMultiDimShape(get_stacks, get_mdim_images): + ims_np, ims = get_stacks + mdim_ims_np, mdim_ims = get_mdim_images assert mdim_ims.shape == mdim_ims_np.shape assert mdim_ims.stack_shape == mdim_ims_np.shape[:-2] assert mdim_ims.stack_ndim == mdim assert mdim_ims.n_images == mdim * ims.n_images -def testBadKey(): - mdim_ims_np, mdim_ims = get_mdim_images() +def testBadKey(get_mdim_images): + mdim_ims_np, mdim_ims = get_mdim_images with pytest.raises(ValueError, match="slice length must be"): _ = mdim_ims[tuple(range(mdim_ims.ndim + 1))] -def testMultiDimGets(): - ims_np, ims = get_stacks() - mdim_ims_np, mdim_ims = get_mdim_images() +def testMultiDimGets(get_stacks, get_mdim_images): + ims_np, ims = get_stacks + mdim_ims_np, mdim_ims = get_mdim_images for X in mdim_ims: assert np.allclose(ims_np, X) @@ -220,9 +232,9 @@ def testMultiDimGets(): assert np.allclose(mdim_ims[:, 1:], ims[1:]) -def testMultiDimSets(): - ims_np, ims = get_stacks() - mdim_ims_np, mdim_ims = get_mdim_images() +def testMultiDimSets(get_stacks, get_mdim_images): + ims_np, ims = get_stacks + mdim_ims_np, mdim_ims = get_mdim_images mdim_ims[0, 1] = 123 # Check the values changed assert np.allclose(mdim_ims[0, 1], 123) @@ -232,9 +244,9 @@ def testMultiDimSets(): assert np.allclose(mdim_ims[1, :], ims_np) -def testMultiDimSetsSlice(): - ims_np, ims = get_stacks() - mdim_ims_np, mdim_ims = get_mdim_images() +def testMultiDimSetsSlice(get_stacks, get_mdim_images): + ims_np, ims = get_stacks + mdim_ims_np, mdim_ims = get_mdim_images # Test setting a slice mdim_ims[0, 1:] = 456 # Check the values changed @@ -244,9 +256,9 @@ def testMultiDimSetsSlice(): assert np.allclose(mdim_ims[1, :], ims_np) -def testMultiDimReshape(): +def testMultiDimReshape(get_mdim_images): # Try mdim reshape - mdim_ims_np, mdim_ims = get_mdim_images() + mdim_ims_np, mdim_ims = get_mdim_images X = mdim_ims.stack_reshape(*mdim_ims.stack_shape[::-1]) assert X.stack_shape == mdim_ims.stack_shape[::-1] # Compare with direct np.reshape of axes of ndarray @@ -254,22 +266,22 @@ def testMultiDimReshape(): assert np.allclose(X.asnumpy(), mdim_ims_np.reshape(shape)) -def testMultiDimFlattens(): - mdim_ims_np, mdim_ims = get_mdim_images() +def testMultiDimFlattens(get_mdim_images): + mdim_ims_np, mdim_ims = get_mdim_images # Try flattening X = mdim_ims.stack_reshape(mdim_ims.n_images) assert X.stack_shape, (mdim_ims.n_images,) -def testMultiDimFlattensTrick(): - mdim_ims_np, mdim_ims = get_mdim_images() +def testMultiDimFlattensTrick(get_mdim_images): + mdim_ims_np, mdim_ims = get_mdim_images # Try flattening with -1 X = mdim_ims.stack_reshape(-1) assert X.stack_shape == (mdim_ims.n_images,) -def testMultiDimReshapeTuples(): - mdim_ims_np, mdim_ims = get_mdim_images() +def testMultiDimReshapeTuples(get_mdim_images): + mdim_ims_np, mdim_ims = get_mdim_images # Try flattening with (-1,) X = mdim_ims.stack_reshape((-1,)) assert X.stack_shape, (mdim_ims.n_images,) @@ -279,8 +291,8 @@ def testMultiDimReshapeTuples(): assert X.stack_shape == mdim_ims.stack_shape[::-1] -def testMultiDimBadReshape(): - mdim_ims_np, mdim_ims = get_mdim_images() +def testMultiDimBadReshape(get_mdim_images): + mdim_ims_np, mdim_ims = get_mdim_images # Incorrect flat shape with pytest.raises(ValueError, match="Number of images"): _ = mdim_ims.stack_reshape(8675309) @@ -290,11 +302,11 @@ def testMultiDimBadReshape(): _ = mdim_ims.stack_reshape(42, 8675309) -def testMultiDimBroadcast(): - ims_np, ims = get_stacks() - mdim_ims_np, mdim_ims = get_mdim_images() +def testMultiDimBroadcast(get_stacks, get_mdim_images): + ims_np, ims = get_stacks + mdim_ims_np, mdim_ims = get_mdim_images X = mdim_ims + ims - assert np.allclose(X[0], 2 * ims.asnumpy()) + np.testing.assert_allclose(X[0], 2 * ims.asnumpy()) @matplotlib_dry_run @@ -306,12 +318,12 @@ def testShow(): im.show() -def test_backproject_symmetry_group(): +def test_backproject_symmetry_group(dtype): """ Test backproject SymmetryGroup pass through and error message. """ ary = np.random.random((5, 8, 8)) - im = Image(ary) + im = Image(ary, dtype=dtype) rots = Rotation.generate_random_rotations(5).matrices # Attempt backproject with bad symmetry group. @@ -324,9 +336,7 @@ def test_backproject_symmetry_group(): assert isinstance(vol.symmetry_group, CnSymmetryGroup) # Symmetry from instance. - vol = im.backproject( - rots, symmetry_group=CnSymmetryGroup(order=3, dtype=np.float32) - ) + vol = im.backproject(rots, symmetry_group=CnSymmetryGroup(order=3, dtype=dtype)) assert isinstance(vol.symmetry_group, CnSymmetryGroup) @@ -381,7 +391,7 @@ def test_load_bad_ext(): _ = Image.load("bad.ext") -def test_load_mrc(): +def test_load_mrc(dtype): """ Test `Image.load` round-trip. """ @@ -390,27 +400,19 @@ def test_load_mrc(): filepath = os.path.join(DATA_DIR, "sample.mrc") # Load data from file - im = Image.load(filepath) - im_64 = Image.load(filepath, dtype=np.float64) + im = Image.load(filepath, dtype=dtype) with tempfile.TemporaryDirectory() as tmpdir_name: # tmp filename test_filepath = os.path.join(tmpdir_name, "test.mrc") - test_filepath_64 = os.path.join(tmpdir_name, "test_64.mrc") im.save(test_filepath) - im_64.save(test_filepath_64) - im2 = Image.load(test_filepath) - im2_64 = Image.load(test_filepath_64, dtype=np.float64) + im2 = Image.load(test_filepath, dtype) # Check the single precision round-trip assert np.array_equal(im, im2) - assert im2.dtype == np.float32 - - # check the double precision round-trip - assert np.array_equal(im_64, im2_64) - assert im2_64.dtype == np.float64 + assert im2.dtype == dtype def test_load_tiff(): From d4b60b9f6299c843338c79850d555e0dd7a2f6d2 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 22 Jul 2024 09:46:43 -0400 Subject: [PATCH 147/433] add image save-load test --- tests/test_image.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/test_image.py b/tests/test_image.py index 6a9888479a..887e726c0d 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -438,3 +438,30 @@ def test_load_tiff(): # Check contents assert np.array_equal(im, im2) + + +def test_save_load_pixel_size(get_images, dtype): + """ + Test saving and loading an MRC with pixel size attribute + """ + + im_np, im = get_images + + with tempfile.TemporaryDirectory() as tmpdir_name: + # tmp filename + test_filepath = os.path.join(tmpdir_name, "test.mrc") + + # Save image to file + im.save(test_filepath) + + # Load image from file + im2 = Image.load(test_filepath, dtype) + + # Check we've loaded the image data + np.testing.assert_allclose(im2, im) + # Check we've loaded the image dtype + assert im2.dtype == im.dtype, "Image dtype mismatched on save-load" + # Check we've loaded the pixel size + np.testing.assert_almost_equal( + im2.pixel_size, im.pixel_size, err_msg="Image pixel_size incorrect save-load" + ) From f797c6c46dbf47387a531a4eab197124ea8a17f0 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 22 Jul 2024 10:06:19 -0400 Subject: [PATCH 148/433] add Image.downsample pixel_size test --- tests/test_downsample.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/test_downsample.py b/tests/test_downsample.py index 305f6e4ec4..276927d81c 100644 --- a/tests/test_downsample.py +++ b/tests/test_downsample.py @@ -90,6 +90,9 @@ def test_downsample_2d_case(L, L_ds): assert (N, L_ds, L_ds) == imgs_ds.shape # check center points for all images assert checkCenterPoint(imgs_org, imgs_ds) + # Confirm default `pixel_size` + assert imgs_org.pixel_size is None + assert imgs_ds.pixel_size is None @pytest.mark.parametrize("L", [65, 66]) @@ -103,6 +106,9 @@ def test_downsample_3d_case(L, L_ds): assert checkCenterPoint(vols_org, vols_ds) # check signal energy is conserved assert checkSignalEnergy(vols_org, vols_ds) + # Confirm default `pixel_size` + assert vols_org.pixel_size is None + assert vols_ds.pixel_size is None def test_integer_offsets(): @@ -155,3 +161,25 @@ def test_downsample_project(volume, res_ds): if volume.dtype == np.float64: tol = 1e-09 np.testing.assert_allclose(im_ds_proj, im_proj_ds, atol=tol) + +def test_pixel_size(): + """ + Test downsampling is rescaling the `pixel_size` attribute. + """ + # Image sizes in pixels + L = 8 # original + dsL = 5 # downsampled + + # Construct a small test Image + img = Image(np.random.random((1, L, L)).astype(DTYPE, copy=False), pixel_size=1.23) + + # Downsample the image + result = img.downsample(dsL) + + # Confirm the pixel size is scaled + np.testing.assert_approx_equal( + result.pixel_size, + img.pixel_size * L / dsL, + err_msg="Incorrect pixel size.", + ) + From f3663d831dab43ef2c6a7ffd17d342ab29b92c51 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 22 Jul 2024 16:13:02 -0400 Subject: [PATCH 149/433] Minimally add pixel_size to sources --- src/aspire/source/coordinates.py | 4 +++- src/aspire/source/image.py | 23 +++++++++++++++++++---- src/aspire/source/micrograph.py | 31 ++++++++++++++++++++++++------- src/aspire/source/relion.py | 6 ++++-- src/aspire/source/simulation.py | 2 +- 5 files changed, 51 insertions(+), 15 deletions(-) diff --git a/src/aspire/source/coordinates.py b/src/aspire/source/coordinates.py index dca7aaf873..299422df70 100644 --- a/src/aspire/source/coordinates.py +++ b/src/aspire/source/coordinates.py @@ -490,7 +490,9 @@ def _images(self, indices): cropped = self._crop_micrograph(arr, next(coord)) im[i] = cropped # Finally, apply transforms to resulting Image - return self.generation_pipeline.forward(Image(im), indices) + return self.generation_pipeline.forward( + Image(im, pixel_size=self.pixel_size), indices + ) @staticmethod def _is_number(text): diff --git a/src/aspire/source/image.py b/src/aspire/source/image.py index fa5be1f7f7..1c243a6f2e 100644 --- a/src/aspire/source/image.py +++ b/src/aspire/source/image.py @@ -150,7 +150,14 @@ class ImageSource(ABC): _mutable = True def __init__( - self, L, n, dtype="double", metadata=None, memory=None, symmetry_group=None + self, + L, + n, + dtype="double", + metadata=None, + memory=None, + symmetry_group=None, + pixel_size=None, ): """ A cryo-EM ImageSource object that supplies images along with other parameters for image manipulation. @@ -163,6 +170,7 @@ def __init__( The path of the base directory to use as a data store or None. If None is given, no caching is performed. :param symmetry_group: A SymmetryGroup instance or string indicating the underlying symmetry of the molecule. Defaults to the `IdentitySymmetryGroup`, which represents an asymmetric particle, if none provided. + :param pixel_size: Pixel size of the images in Angstroms, default `None`. """ # Instantiate the accessor for the `images` property @@ -172,6 +180,9 @@ def __init__( self._n = None self.n = n self.dtype = np.dtype(dtype) + if pixel_size is not None: + pixel_size = float(pixel_size) + self.pixel_size = pixel_size # The private attribute '_cached_im' can be populated by calling this object's cache() method explicitly self._cached_im = None @@ -736,7 +747,7 @@ def _apply_filters( f"_apply_filters() passed {type(im_orig)} instead of Image instance" ) # for now just convert it - im_orig = Image(im_orig) + im_orig = Image(im_orig, pixel_size=self.pixel_size) im = im_orig.copy() @@ -1481,6 +1492,7 @@ def __init__(self, src, indices, memory=None): dtype=src.dtype, metadata=metadata, memory=memory, + pixel_size=src.pixel_size, ) # Create filter indices, these are required to pass unharmed through filter eval code @@ -1650,7 +1662,9 @@ class ArrayImageSource(ImageSource): if available, is consulted directly by the parent class, bypassing `_images`. """ - def __init__(self, im, metadata=None, angles=None, symmetry_group=None): + def __init__( + self, im, metadata=None, angles=None, symmetry_group=None, pixel_size=None + ): """ Initialize from an `Image` object. @@ -1664,7 +1678,7 @@ def __init__(self, im, metadata=None, angles=None, symmetry_group=None): if not isinstance(im, Image): logger.info("Attempting to create an Image object from Numpy array.") try: - im = Image(im) + im = Image(im, pixel_size=pixel_size) except Exception as e: raise RuntimeError( "Creating Image object from Numpy array failed." @@ -1678,6 +1692,7 @@ def __init__(self, im, metadata=None, angles=None, symmetry_group=None): metadata=metadata, memory=None, symmetry_group=symmetry_group, + pixel_size=im.pixel_size, ) self._cached_im = im diff --git a/src/aspire/source/micrograph.py b/src/aspire/source/micrograph.py index 182133d982..dd4d9e497c 100644 --- a/src/aspire/source/micrograph.py +++ b/src/aspire/source/micrograph.py @@ -17,11 +17,14 @@ class MicrographSource(ABC): - def __init__(self, micrograph_count, micrograph_size, dtype): + def __init__(self, micrograph_count, micrograph_size, dtype, pixel_size=None): """ """ self.micrograph_count = int(micrograph_count) self.micrograph_size = int(micrograph_size) self.dtype = np.dtype(dtype) + if pixel_size is not None: + pixel_size = float(pixel_size) + self.pixel_size = pixel_size self._images_accessor = _ImageAccessor(self._images, self.micrograph_count) @@ -85,7 +88,7 @@ def show(self, *args, **kwargs): """ Helper function to display micrograph. See Image.show(). """ - Image(self.asnumpy()).show(*args, **kwargs) + Image(self.asnumpy(), pixel_size=self.pixel_size).show(*args, **kwargs) @property def images(self): @@ -107,7 +110,7 @@ def _images(self, indices): class ArrayMicrographSource(MicrographSource): - def __init__(self, micrographs, dtype=None): + def __init__(self, micrographs, dtype=None, pixel_size=None): """ Instantiate a `MicrographSource` with `micrographs`. @@ -140,6 +143,7 @@ def __init__(self, micrographs, dtype=None): micrograph_count=micrographs.shape[0], micrograph_size=micrographs.shape[-1], dtype=dtype or micrographs.dtype, + pixel_size=pixel_size, ) # We're already backed by an array, access it directly. @@ -152,11 +156,11 @@ def _images(self, indices): :param indices: A 1-D Numpy array of integer indices. :return: An array backed `MicrographSource` object representing the micrographs for `indices`. """ - return Image(self._data[indices]) + return Image(self._data[indices], pixel_size=self.pixel_size) class DiskMicrographSource(MicrographSource): - def __init__(self, micrographs_path, dtype=None): + def __init__(self, micrographs_path, dtype=None, pixel_size=None): """ Instantiate a `MicrographSource` with `micrographs_path`. @@ -190,11 +194,16 @@ def __init__(self, micrographs_path, dtype=None): # Load the first micrograph to infer shape/type # Size will be checked during on-the-fly loading of subsequent micrographs. micrograph0 = Image.load(self.micrograph_files[0]) + if micrograph0.pixel_size is not None and micrograph0.pixel_size != pixel_size: + raise NotImplementedError( + f"Mismatched pixel size. {micrograph0.pixel_size} defined in {self.micrograph_files[0]}, but provided {pixel_size}." + ) super().__init__( micrograph_count=len(self.micrograph_files), micrograph_size=micrograph0.resolution, dtype=dtype or micrograph0.dtype, + pixel_size=pixel_size, ) # Prepare accessor to load files from disk on the fly. @@ -262,8 +271,16 @@ def _images(self, indices): ) # Assign to array, implicitly performs casting to dtype micrographs[i] = micrograph.asnumpy() + # Assert pixel_size + if ( + micrograph.pixel_size is not None + and micrograph.pixel_size != pixel_size + ): + raise NotImplementedError( + f"Mismatched pixel size. {micrograph.pixel_size} defined in {self.micrograph_files[ind]}, but provided {pixel_size}." + ) - return Image(micrographs) + return Image(micrographs, pixel_size=self.pixel_size) class MicrographSimulation(MicrographSource): @@ -557,7 +574,7 @@ def _clean_images(self, indices): self.pad : self.micrograph_size + self.pad, self.pad : self.micrograph_size + self.pad, ] - return Image(clean_micrograph) + return Image(clean_micrograph, pixel_size=self.pixel_size) def get_micrograph_index(self, particle_index): """ diff --git a/src/aspire/source/relion.py b/src/aspire/source/relion.py index 99907cbf6a..bd6d660dd3 100644 --- a/src/aspire/source/relion.py +++ b/src/aspire/source/relion.py @@ -59,7 +59,6 @@ def __init__( self.filepath = filepath self.data_folder = data_folder - self.pixel_size = pixel_size self.B = B self.n_workers = n_workers self.max_rows = max_rows @@ -112,6 +111,7 @@ def __init__( metadata=metadata, symmetry_group=symmetry_group, memory=memory, + pixel_size=pixel_size, ) # CTF estimation parameters coming from Relion @@ -272,4 +272,6 @@ def load_single_mrcs(filepath, indices): logger.debug(f"Loading {len(indices)} images complete") # Finally, apply transforms to resulting Image - return self.generation_pipeline.forward(Image(im), indices) + return self.generation_pipeline.forward( + Image(im, pixel_size=self.pixel_size), indices + ) diff --git a/src/aspire/source/simulation.py b/src/aspire/source/simulation.py index 304d5be56d..c23d50df11 100644 --- a/src/aspire/source/simulation.py +++ b/src/aspire/source/simulation.py @@ -260,7 +260,7 @@ def _projections(self, indices): im_k = self.vols[k - 1].project(rot_matrices=rot) im[idx_k, :, :] = im_k.asnumpy() - return Image(im) + return Image(im, pixel_size=self.pixel_size) @property def clean_images(self): From 46ab7c5f5775c07230217b0df79c4ca532bff9d4 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 22 Jul 2024 16:14:59 -0400 Subject: [PATCH 150/433] tox caught incorrect var --- src/aspire/source/micrograph.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/source/micrograph.py b/src/aspire/source/micrograph.py index dd4d9e497c..8a8b616f6e 100644 --- a/src/aspire/source/micrograph.py +++ b/src/aspire/source/micrograph.py @@ -274,10 +274,10 @@ def _images(self, indices): # Assert pixel_size if ( micrograph.pixel_size is not None - and micrograph.pixel_size != pixel_size + and micrograph.pixel_size != self.pixel_size ): raise NotImplementedError( - f"Mismatched pixel size. {micrograph.pixel_size} defined in {self.micrograph_files[ind]}, but provided {pixel_size}." + f"Mismatched pixel size. {micrograph.pixel_size} defined in {self.micrograph_files[ind]}, but provided {self.pixel_size}." ) return Image(micrographs, pixel_size=self.pixel_size) From 2535076a5f5c4f133c700c553a4bac48a608863e Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 26 Jul 2024 09:11:52 -0400 Subject: [PATCH 151/433] lint --- src/aspire/volume/volume.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index 1484a9c344..bb04309d33 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -553,7 +553,9 @@ def downsample(self, ds_res, mask=None, zero_nyquist=True): # returns a new Volume object return self.__class__( - xp.asnumpy(out), pixel_size=ds_pixel_size, symmetry_group=self.symmetry_group + xp.asnumpy(out), + pixel_size=ds_pixel_size, + symmetry_group=self.symmetry_group, ).stack_reshape(original_stack_shape) def shift(self): From ad8f6c37325ff0a0d9c6377e3c77640b48f461b0 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 26 Jul 2024 09:32:59 -0400 Subject: [PATCH 152/433] Change default CTFFilter pixel_size from 10 to 1 --- gallery/tutorials/tutorials/cov3d_simulation.py | 4 +++- src/aspire/operators/filters.py | 8 ++++---- tests/test_anisotropic_noise.py | 4 +++- tests/test_filters.py | 8 ++++++-- tests/test_simulation.py | 8 ++++++-- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/gallery/tutorials/tutorials/cov3d_simulation.py b/gallery/tutorials/tutorials/cov3d_simulation.py index 5fced70fbb..741a47de99 100644 --- a/gallery/tutorials/tutorials/cov3d_simulation.py +++ b/gallery/tutorials/tutorials/cov3d_simulation.py @@ -47,7 +47,9 @@ L=img_size, n=num_imgs, vols=vols, - unique_filters=[RadialCTFFilter(defocus=d) for d in np.linspace(1.5e4, 2.5e4, 7)], + unique_filters=[ + RadialCTFFilter(pixel_size=10, defocus=d) for d in np.linspace(1.5e4, 2.5e4, 7) + ], dtype=dtype, ) diff --git a/src/aspire/operators/filters.py b/src/aspire/operators/filters.py index bb7491c780..e75187fb4a 100644 --- a/src/aspire/operators/filters.py +++ b/src/aspire/operators/filters.py @@ -403,7 +403,7 @@ def __init__(self, dim=None): class CTFFilter(Filter): def __init__( self, - pixel_size=10, + pixel_size=1, voltage=200, defocus_u=15000, defocus_v=15000, @@ -415,7 +415,7 @@ def __init__( """ A CTF (Contrast Transfer Function) Filter - :param pixel_size: Pixel size in angstrom + :param pixel_size: Pixel size in angstrom, default 1. :param voltage: Electron voltage in kV :param defocus_u: Defocus depth along the u-axis in angstrom :param defocus_v: Defocus depth along the v-axis in angstrom @@ -425,7 +425,7 @@ def __init__( :param B: Envelope decay in inverse square angstrom (default 0) """ super().__init__(dim=2, radial=defocus_u == defocus_v) - self.pixel_size = pixel_size + self.pixel_size = float(pixel_size) self.voltage = voltage self.wavelength = voltage_to_wavelength(self.voltage) self.defocus_u = defocus_u @@ -482,7 +482,7 @@ def scale(self, c=1): class RadialCTFFilter(CTFFilter): def __init__( - self, pixel_size=10, voltage=200, defocus=15000, Cs=2.26, alpha=0.07, B=0 + self, pixel_size=1, voltage=200, defocus=15000, Cs=2.26, alpha=0.07, B=0 ): super().__init__( pixel_size=pixel_size, diff --git a/tests/test_anisotropic_noise.py b/tests/test_anisotropic_noise.py index 2fd1d13ca8..caaedc4aff 100644 --- a/tests/test_anisotropic_noise.py +++ b/tests/test_anisotropic_noise.py @@ -20,7 +20,9 @@ def setUp(self): n=1024, vols=self.vol, unique_filters=[ - RadialCTFFilter(defocus=d) for d in np.linspace(1.5e4, 2.5e4, 7) + # Set legacy pixel size + RadialCTFFilter(pixel_size=10, defocus=d) + for d in np.linspace(1.5e4, 2.5e4, 7) ], dtype=self.dtype, ) diff --git a/tests/test_filters.py b/tests/test_filters.py index 911e3b347b..b0b23bb74f 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -118,7 +118,8 @@ def testRadialCTFFilter(self): self.assertEqual(result.shape, (256,)) def testRadialCTFFilterGrid(self): - filter = RadialCTFFilter(defocus=2.5e4) + # Set legacy pixel size + filter = RadialCTFFilter(pixel_size=10, defocus=2.5e4) result = filter.evaluate_grid(8, dtype=self.dtype) self.assertEqual(result.shape, (8, 8)) @@ -218,7 +219,10 @@ def testRadialCTFFilterGrid(self): ) def testRadialCTFFilterMultiplierGrid(self): - filter = RadialCTFFilter(defocus=2.5e4) * RadialCTFFilter(defocus=2.5e4) + # Set legacy pixel size + filter = RadialCTFFilter(pixel_size=10, defocus=2.5e4) * RadialCTFFilter( + pixel_size=10, defocus=2.5e4 + ) result = filter.evaluate_grid(8, dtype=self.dtype) self.assertEqual(result.shape, (8, 8)) diff --git a/tests/test_simulation.py b/tests/test_simulation.py index ad8a7ff4e1..69b0fef5d3 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -116,8 +116,10 @@ def setUp(self): n=self.n, L=self.L, vols=self.vols, + # Set legacy pixel_size unique_filters=[ - RadialCTFFilter(defocus=d) for d in np.linspace(1.5e4, 2.5e4, 7) + RadialCTFFilter(pixel_size=10, defocus=d) + for d in np.linspace(1.5e4, 2.5e4, 7) ], noise_adder=WhiteNoiseAdder(var=1), dtype=self.dtype, @@ -168,7 +170,9 @@ def testSimulationCached(self): vols=self.vols, offsets=self.sim.offsets, unique_filters=[ - RadialCTFFilter(defocus=d) for d in np.linspace(1.5e4, 2.5e4, 7) + # Set legacy pixel size + RadialCTFFilter(pixel_size=10, defocus=d) + for d in np.linspace(1.5e4, 2.5e4, 7) ], noise_adder=WhiteNoiseAdder(var=1), dtype=self.dtype, From 702c67a1bb8c68e72008d3e3987a7ca95f8ec9ee Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 29 Jul 2024 12:55:23 -0400 Subject: [PATCH 153/433] add pixel_size synth volume classes --- src/aspire/source/simulation.py | 28 ++++++++++++++++++++ src/aspire/volume/volume.py | 6 ++++- src/aspire/volume/volume_synthesis.py | 37 +++++++++++++++++++-------- tests/test_simulation.py | 32 ++++++++++++++++++----- tests/test_synthetic_volume.py | 15 +++++++++-- 5 files changed, 97 insertions(+), 21 deletions(-) diff --git a/src/aspire/source/simulation.py b/src/aspire/source/simulation.py index c23d50df11..2fc47e9afa 100644 --- a/src/aspire/source/simulation.py +++ b/src/aspire/source/simulation.py @@ -50,6 +50,7 @@ def __init__( memory=None, noise_adder=None, symmetry_group=None, + pixel_size=None, ): """ A `Simulation` object that supplies images along with other parameters for image manipulation. @@ -79,6 +80,7 @@ def __init__( :param noise_adder: Optionally append instance of `NoiseAdder` to generation pipeline. :param symmetry_group: A SymmetryGroup instance or string indicating symmetry of the molecule. + :param pixel_size: Pixel size of the images in Angstroms, default `None`. :return: A Simulation object. """ @@ -91,6 +93,7 @@ def __init__( self.vols = AsymmetricVolume( L=L or 8, C=C, + pixel_size=pixel_size, seed=self.seed, dtype=dtype or np.float32, ).generate() @@ -122,6 +125,7 @@ def __init__( dtype=self.vols.dtype, memory=memory, symmetry_group=symmetry_group, + pixel_size=self.vols.pixel_size, ) # If a user provides both `L` and `vols`, resolution should match. @@ -153,6 +157,7 @@ def __init__( if unique_filters is None: unique_filters = [] self.unique_filters = unique_filters + self._check_filter_pixel_size(unique_filters) # sim_filters must be a deep copy so that it is not changed # when unique_filters is changed self.sim_filters = copy.deepcopy(unique_filters) @@ -231,6 +236,29 @@ def _populate_ctf_metadata(self, filter_indices): filter_values, ) + def _check_filter_pixel_size(self, unique_filters): + """ + Private method to ensure user provided filters match `Simulation` pixel size. + + When `Simulation.pixel_size` is not `None`, any + `unique_filters` having a non-matching `pixel_size` attribute + will raise. + """ + + # Skip when Simulation pixel_size is not explicitly provided. + if self.pixel_size is None: + return + + for f in unique_filters: + f_pixel_size = getattr(f, "pixel_size", None) + if f_pixel_size is not None and not np.isclose( + f_pixel_size, self.pixel_size + ): + raise ValueError( + f"`Simulation.pixel_size` {self.pixel_size} does not match filter {f} {f_pixel_size}." + "Ensure provided `pixel_size` attributes match." + ) + @property def projections(self): """ diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index bb04309d33..05e08352c3 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -260,10 +260,14 @@ def stack_reshape(self, *args): ) def __repr__(self): + px_msg = "." + if self.pixel_size is not None: + px_msg = f" with pixel_size={self.pixel_size} Angstroms." + msg = ( f"{self.n_vols} {self.dtype} volumes arranged as a {self.stack_shape} stack" ) - msg += f" each of size {self.resolution}x{self.resolution}x{self.resolution}." + msg += f" each of size {self.resolution}x{self.resolution}x{self.resolution}{px_msg}" return msg def __len__(self): diff --git a/src/aspire/volume/volume_synthesis.py b/src/aspire/volume/volume_synthesis.py index b9514df5ea..e0f1ef84f7 100644 --- a/src/aspire/volume/volume_synthesis.py +++ b/src/aspire/volume/volume_synthesis.py @@ -16,11 +16,12 @@ class SyntheticVolumeBase(abc.ABC): - def __init__(self, L, C, seed=None, dtype=np.float64): + def __init__(self, L, C, pixel_size=None, seed=None, dtype=np.float64): self.L = L self.C = C self.seed = seed self.dtype = dtype + self.pixel_size = pixel_size @abc.abstractmethod def generate(self): @@ -39,18 +40,21 @@ class GaussianBlobsVolume(SyntheticVolumeBase): A base class for all volumes which are generated with randomized 3D Gaussians. """ - def __init__(self, L, C, K=16, alpha=1, seed=None, dtype=np.float64): + def __init__( + self, L, C, K=16, alpha=1, pixel_size=None, seed=None, dtype=np.float64 + ): """ :param L: Resolution of the Volume(s) in pixels. :param C: Number of Volumes to generate. :param K: Number of Gaussian blobs used to construct the Volume(s). :param alpha: Scaling factor for variance of Gaussian blobs. Default=1. + :param pixel_size: Optional voxel_size in Angstroms. Default=1. :param seed: Random seed for generating random Gaussian blobs. :param dtype: dtype for Volume(s) """ self.K = int(K) self.alpha = float(alpha) - super().__init__(L=L, C=C, seed=seed, dtype=dtype) + super().__init__(L=L, C=C, pixel_size=pixel_size, seed=seed, dtype=dtype) self._set_symmetry_group() @abc.abstractproperty @@ -75,7 +79,11 @@ def generate(self): """ vol = self._gaussian_blob_vols() bump_mask = bump_3d(self.L, spread=5, dtype=self.dtype) - return Volume(bump_mask * vol, symmetry_group=self.symmetry_group) + return Volume( + bump_mask * vol, + symmetry_group=self.symmetry_group, + pixel_size=self.pixel_size, + ) def _gaussian_blob_vols(self): """ @@ -168,18 +176,23 @@ class CnSymmetricVolume(GaussianBlobsVolume): A Volume object with cyclically symmetric volumes constructed of random 3D Gaussian blobs. """ - def __init__(self, L, C, order, K=16, alpha=1, seed=None, dtype=np.float64): + def __init__( + self, L, C, order, K=16, alpha=1, pixel_size=None, seed=None, dtype=np.float64 + ): """ :param L: Resolution of the Volume(s) in pixels. :param C: Number of Volumes to generate. :param order: An integer representing the cyclic order of the Volume(s). :param K: Number of Gaussian blobs used to construct the Volume(s). + :param pixel_size: Optional voxel_size in Angstroms. Default=1. :param seed: Random seed for generating random Gaussian blobs. :param dtype: dtype for Volume(s) """ self.order = int(order) self._check_order() - super().__init__(L=L, C=C, K=K, alpha=alpha, seed=seed, dtype=dtype) + super().__init__( + L=L, C=C, K=K, alpha=alpha, pixel_size=pixel_size, seed=seed, dtype=dtype + ) def _check_order(self): if self.order < 2: @@ -239,8 +252,10 @@ class AsymmetricVolume(CnSymmetricVolume): An asymmetric Volume constructed of random 3D Gaussian blobs with compact support in the unit sphere. """ - def __init__(self, L, C, K=64, seed=None, dtype=np.float64): - super().__init__(L=L, C=C, K=K, order=1, seed=seed, dtype=dtype) + def __init__(self, L, C, K=64, pixel_size=None, seed=None, dtype=np.float64): + super().__init__( + L=L, C=C, K=K, order=1, pixel_size=pixel_size, seed=seed, dtype=dtype + ) def _check_order(self): if self.order != 1: @@ -260,8 +275,8 @@ class LegacyVolume(AsymmetricVolume): An asymmetric Volume object used for testing of legacy code. """ - def __init__(self, L, C=2, K=16, seed=0, dtype=np.float64): - super().__init__(L=L, C=C, K=K, seed=seed, dtype=dtype) + def __init__(self, L, C=2, K=16, pixel_size=None, seed=0, dtype=np.float64): + super().__init__(L=L, C=C, K=K, pixel_size=pixel_size, seed=seed, dtype=dtype) def generate(self): """ @@ -272,4 +287,4 @@ def generate(self): # Swap axes to retain Legacy xyz-indexing. vols = np.swapaxes(vols, 1, 3) - return Volume(vols) + return Volume(vols, pixel_size=self.pixel_size) diff --git a/tests/test_simulation.py b/tests/test_simulation.py index 69b0fef5d3..92a29e225e 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -21,15 +21,19 @@ class SingleSimTestCase(TestCase): """Test we can construct a length 1 Sim.""" def setUp(self): - self.sim = Simulation( - n=1, - L=8, - ) + self._pixel_size = 1.23 # Test value + + self.sim = Simulation(n=1, L=8, pixel_size=self._pixel_size) def testImage(self): """Test we can get an Image from a length 1 Sim.""" _ = self.sim.images[0] + def testPixelSize(self): + """Test pixel_size is passing through Simulation.""" + self.assertTrue(self.sim.pixel_size == self._pixel_size) + self.assertTrue(self.sim.pixel_size == self.sim.vols.pixel_size) + @matplotlib_dry_run def testImageShow(self): self.sim.images[:].show() @@ -106,9 +110,12 @@ def setUp(self): self.n = 1024 self.L = 8 self.dtype = np.float32 + # Set legacy pixel_size + self._pixel_size = 10 self.vols = LegacyVolume( L=self.L, + pixel_size=self._pixel_size, dtype=self.dtype, ).generate() @@ -116,9 +123,8 @@ def setUp(self): n=self.n, L=self.L, vols=self.vols, - # Set legacy pixel_size unique_filters=[ - RadialCTFFilter(pixel_size=10, defocus=d) + RadialCTFFilter(pixel_size=self._pixel_size, defocus=d) for d in np.linspace(1.5e4, 2.5e4, 7) ], noise_adder=WhiteNoiseAdder(var=1), @@ -171,7 +177,7 @@ def testSimulationCached(self): offsets=self.sim.offsets, unique_filters=[ # Set legacy pixel size - RadialCTFFilter(pixel_size=10, defocus=d) + RadialCTFFilter(pixel_size=self._pixel_size, defocus=d) for d in np.linspace(1.5e4, 2.5e4, 7) ], noise_adder=WhiteNoiseAdder(var=1), @@ -663,3 +669,15 @@ def test_cached_image_accessors(): np.testing.assert_allclose(cached_src.projections[:], src.projections[:]) np.testing.assert_allclose(cached_src.images[:], src.images[:]) np.testing.assert_allclose(cached_src.clean_images[:], src.clean_images[:]) + + +def test_mismatched_pixel_size(): + """ + Confirm raises error when explicit Simulation and CTFFilter pixel sizes mismatch. + """ + # Create a CTF with a pixel_size + filts = [RadialCTFFilter(pixel_size=5)] + + # Try to create a Simulation with a different pixel_size + with raises(ValueError, match=r"pixel_size.*does not match filter.*"): + _ = Simulation(L=8, n=1, C=1, pixel_size=10, unique_filters=filts) diff --git a/tests/test_synthetic_volume.py b/tests/test_synthetic_volume.py index ddcdcbcab5..01fb74ec90 100644 --- a/tests/test_synthetic_volume.py +++ b/tests/test_synthetic_volume.py @@ -85,6 +85,10 @@ def vol_fixture(request, dtype_fixture): if len(params) > 2: vol_kwargs["order"] = params[2] + # Assign some volumes a pixel_size, leave others as default. + if res % 2: + vol_kwargs["pixel_size"] = 3.0 + return vol_class(**vol_kwargs) @@ -96,8 +100,15 @@ def test_volume_repr(vol_fixture): def test_volume_generate(vol_fixture): - """Test that a volume is generated""" - _ = vol_fixture.generate() + """ + Test that a volume is generated + and stores pixel_size when provided. + """ + v = vol_fixture.generate() + + # In vol_fixture, we assign pixel_size to volumes having odd voxel sizes. + if vol_fixture.L % 2: + assert v.pixel_size == 3 def test_simulation_init(vol_fixture): From 7eb468fc580fa53af5d7e0eb65e5c63ff015aa01 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 29 Jul 2024 14:49:45 -0400 Subject: [PATCH 154/433] self review cleanup --- gallery/tutorials/aspire_introduction.py | 2 +- gallery/tutorials/pipeline_demo.py | 2 +- src/aspire/image/image.py | 6 +++--- src/aspire/source/image.py | 3 ++- src/aspire/source/micrograph.py | 1 + src/aspire/source/simulation.py | 2 +- src/aspire/volume/volume.py | 5 ++--- src/aspire/volume/volume_synthesis.py | 4 ++-- 8 files changed, 13 insertions(+), 12 deletions(-) diff --git a/gallery/tutorials/aspire_introduction.py b/gallery/tutorials/aspire_introduction.py index 648750ac01..cffe6d544e 100644 --- a/gallery/tutorials/aspire_introduction.py +++ b/gallery/tutorials/aspire_introduction.py @@ -571,7 +571,7 @@ def noise_function(x, y): # Generate several CTFs. ctf_filters = [ - RadialCTFFilter(pixel_size=5, defocus=d) + RadialCTFFilter(pixel_size=vol_ds.pixel_size, defocus=d) for d in np.linspace(defocus_min, defocus_max, defocus_ct) ] diff --git a/gallery/tutorials/pipeline_demo.py b/gallery/tutorials/pipeline_demo.py index 8910436de2..77d304b156 100644 --- a/gallery/tutorials/pipeline_demo.py +++ b/gallery/tutorials/pipeline_demo.py @@ -63,7 +63,7 @@ defocus_ct = 7 ctf_filters = [ - RadialCTFFilter(pixel_size=5, defocus=d) + RadialCTFFilter(pixel_size=vol.pixel_size, defocus=d) for d in np.linspace(defocus_min, defocus_max, defocus_ct) ] diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 984b1e6540..bce9535665 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -130,10 +130,10 @@ def load_tiff(filepath): # Future todo, extract `voxel_size` if available in TIFF tags (custom tag?) # For now, default to `None`. - voxel_size = None + pixel_size = None # Cast image data as numpy array - return np.array(img), voxel_size + return np.array(img), pixel_size class Image: @@ -160,7 +160,7 @@ def __init__(self, data, pixel_size=None, dtype=None): :param data: Numpy array containing image data with shape `(..., resolution, resolution)`. - :param pixel_size: Optional pixel size in Angstroms. + :param pixel_size: Optional pixel size in angstroms. When provided will be saved with `mrc` metadata. Default of `None` will not write to file, but will be considered unit pixels (1) for FSC. diff --git a/src/aspire/source/image.py b/src/aspire/source/image.py index 1c243a6f2e..4d256bd414 100644 --- a/src/aspire/source/image.py +++ b/src/aspire/source/image.py @@ -170,7 +170,7 @@ def __init__( The path of the base directory to use as a data store or None. If None is given, no caching is performed. :param symmetry_group: A SymmetryGroup instance or string indicating the underlying symmetry of the molecule. Defaults to the `IdentitySymmetryGroup`, which represents an asymmetric particle, if none provided. - :param pixel_size: Pixel size of the images in Angstroms, default `None`. + :param pixel_size: Pixel size of the images in angstroms, default `None`. """ # Instantiate the accessor for the `images` property @@ -1673,6 +1673,7 @@ def __init__( :param metadata: A Dataframe of metadata information corresponding to this ImageSource's images :param angles: Optional n-by-3 array of rotation angles corresponding to `im`. :param symmetry_group: A SymmetryGroup instance or string indicating the underlying symmetry of the molecule. + :param pixel_size: Pixel size of the images in angstroms, default `None`. """ if not isinstance(im, Image): diff --git a/src/aspire/source/micrograph.py b/src/aspire/source/micrograph.py index 8a8b616f6e..ece811eb30 100644 --- a/src/aspire/source/micrograph.py +++ b/src/aspire/source/micrograph.py @@ -122,6 +122,7 @@ def __init__(self, micrographs, dtype=None, pixel_size=None): Currently only `float32` and `float64` are supported. Note, due to limitations of common MRC implementations, saving is limited to single precision. + :param pixel_size: Pixel size of the images in angstroms, default `None`. """ # Check micrographs is an array diff --git a/src/aspire/source/simulation.py b/src/aspire/source/simulation.py index 2fc47e9afa..7d80b570d2 100644 --- a/src/aspire/source/simulation.py +++ b/src/aspire/source/simulation.py @@ -80,7 +80,7 @@ def __init__( :param noise_adder: Optionally append instance of `NoiseAdder` to generation pipeline. :param symmetry_group: A SymmetryGroup instance or string indicating symmetry of the molecule. - :param pixel_size: Pixel size of the images in Angstroms, default `None`. + :param pixel_size: Pixel size of the images in angstroms, default `None`. :return: A Simulation object. """ diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index 05e08352c3..5e2212e958 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -76,7 +76,7 @@ def __init__(self, data, dtype=None, pixel_size=None, symmetry_group=None): `(..., resolution, resolution, resolution)`. :param dtype: Optionally cast `data` to this dtype. Defaults to `data.dtype`. - :param pixel_size: Optional voxel_size in Angstroms. + :param pixel_size: Optional voxel_size in angstroms. When provided will be saved with `map`/`mrc` metadata. Default of `None` will not write to file, but will be considered unit pixels (1) for FSC. @@ -262,7 +262,7 @@ def stack_reshape(self, *args): def __repr__(self): px_msg = "." if self.pixel_size is not None: - px_msg = f" with pixel_size={self.pixel_size} Angstroms." + px_msg = f" with pixel_size={self.pixel_size} angstroms." msg = ( f"{self.n_vols} {self.dtype} volumes arranged as a {self.stack_shape} stack" @@ -423,7 +423,6 @@ def project(self, rot_matrices, zero_nyquist=True): im_f[:, :, 0] = 0 im_f = fft.centered_ifft2(im_f) - # todo add pixel_size to Image return aspire.image.Image(xp.asnumpy(im_f.real), pixel_size=self.pixel_size) def to_vec(self): diff --git a/src/aspire/volume/volume_synthesis.py b/src/aspire/volume/volume_synthesis.py index e0f1ef84f7..59947b79ea 100644 --- a/src/aspire/volume/volume_synthesis.py +++ b/src/aspire/volume/volume_synthesis.py @@ -48,7 +48,7 @@ def __init__( :param C: Number of Volumes to generate. :param K: Number of Gaussian blobs used to construct the Volume(s). :param alpha: Scaling factor for variance of Gaussian blobs. Default=1. - :param pixel_size: Optional voxel_size in Angstroms. Default=1. + :param pixel_size: Optional voxel_size in angstroms. Default=1. :param seed: Random seed for generating random Gaussian blobs. :param dtype: dtype for Volume(s) """ @@ -184,7 +184,7 @@ def __init__( :param C: Number of Volumes to generate. :param order: An integer representing the cyclic order of the Volume(s). :param K: Number of Gaussian blobs used to construct the Volume(s). - :param pixel_size: Optional voxel_size in Angstroms. Default=1. + :param pixel_size: Optional voxel_size in angstroms. Default=1. :param seed: Random seed for generating random Gaussian blobs. :param dtype: dtype for Volume(s) """ From 47997a4204081a8619d95f4a28366ab6c6ae9835 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 1 Aug 2024 11:41:44 -0400 Subject: [PATCH 155/433] add units to error messages --- src/aspire/source/micrograph.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/source/micrograph.py b/src/aspire/source/micrograph.py index ece811eb30..521c416b4c 100644 --- a/src/aspire/source/micrograph.py +++ b/src/aspire/source/micrograph.py @@ -197,7 +197,7 @@ def __init__(self, micrographs_path, dtype=None, pixel_size=None): micrograph0 = Image.load(self.micrograph_files[0]) if micrograph0.pixel_size is not None and micrograph0.pixel_size != pixel_size: raise NotImplementedError( - f"Mismatched pixel size. {micrograph0.pixel_size} defined in {self.micrograph_files[0]}, but provided {pixel_size}." + f"Mismatched pixel size. {micrograph0.pixel_size} angstroms defined in {self.micrograph_files[0]}, but provided {pixel_size} angstroms." ) super().__init__( @@ -278,7 +278,7 @@ def _images(self, indices): and micrograph.pixel_size != self.pixel_size ): raise NotImplementedError( - f"Mismatched pixel size. {micrograph.pixel_size} defined in {self.micrograph_files[ind]}, but provided {self.pixel_size}." + f"Mismatched pixel size. {micrograph.pixel_size} angstroms defined in {self.micrograph_files[ind]}, but provided {self.pixel_size} angstroms." ) return Image(micrographs, pixel_size=self.pixel_size) From d8d8c44a4d74114e7d8e21feda933bf71a5b7652 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 1 Aug 2024 11:46:28 -0400 Subject: [PATCH 156/433] add units to error messages --- src/aspire/source/simulation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/source/simulation.py b/src/aspire/source/simulation.py index 7d80b570d2..331b86e442 100644 --- a/src/aspire/source/simulation.py +++ b/src/aspire/source/simulation.py @@ -255,7 +255,7 @@ def _check_filter_pixel_size(self, unique_filters): f_pixel_size, self.pixel_size ): raise ValueError( - f"`Simulation.pixel_size` {self.pixel_size} does not match filter {f} {f_pixel_size}." + f"`Simulation.pixel_size` {self.pixel_size} does not match filter {f} pixel size {f_pixel_size}." "Ensure provided `pixel_size` attributes match." ) From 90fe5e765416aa44610796c95d00c006d913085c Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 1 Aug 2024 11:49:02 -0400 Subject: [PATCH 157/433] add pixel_size to image repr --- src/aspire/image/image.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index bce9535665..1bbe2ba160 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -361,8 +361,12 @@ def flip(self, axis=-2): return self.__class__(np.flip(self._data, axis), pixel_size=self.pixel_size) def __repr__(self): + px_msg = "." + if self.pixel_size is not None: + px_msg = f" with pixel_size={self.pixel_size} angstroms." + msg = f"{self.n_images} {self.dtype} images arranged as a {self.stack_shape} stack" - msg += f" each of size {self.resolution}x{self.resolution}." + msg += f" each of size {self.resolution}x{self.resolution}{px_msg}" return msg def asnumpy(self): From 38b28787fc88e048d8ad8cd6e9115b7905466475 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 1 Aug 2024 11:51:32 -0400 Subject: [PATCH 158/433] correct synth vol doc strings --- src/aspire/volume/volume_synthesis.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/aspire/volume/volume_synthesis.py b/src/aspire/volume/volume_synthesis.py index 59947b79ea..43f794bfaf 100644 --- a/src/aspire/volume/volume_synthesis.py +++ b/src/aspire/volume/volume_synthesis.py @@ -48,7 +48,10 @@ def __init__( :param C: Number of Volumes to generate. :param K: Number of Gaussian blobs used to construct the Volume(s). :param alpha: Scaling factor for variance of Gaussian blobs. Default=1. - :param pixel_size: Optional voxel_size in angstroms. Default=1. + :param pixel_size: Optional voxel_size in angstroms. + When provided will be saved with `map`/`mrc` metadata. + Default of `None` will not write to file, + but will be considered unit pixels (1) for FSC. :param seed: Random seed for generating random Gaussian blobs. :param dtype: dtype for Volume(s) """ @@ -184,7 +187,10 @@ def __init__( :param C: Number of Volumes to generate. :param order: An integer representing the cyclic order of the Volume(s). :param K: Number of Gaussian blobs used to construct the Volume(s). - :param pixel_size: Optional voxel_size in angstroms. Default=1. + :param pixel_size: Optional voxel_size in angstroms. + When provided will be saved with `map`/`mrc` metadata. + Default of `None` will not write to file, + but will be considered unit pixels (1) for FSC. :param seed: Random seed for generating random Gaussian blobs. :param dtype: dtype for Volume(s) """ From cafb00b64b221419f4f8bb7d940d1fb59789313d Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 1 Aug 2024 11:57:59 -0400 Subject: [PATCH 159/433] add direct volume pixel_size attr test --- tests/test_volume.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test_volume.py b/tests/test_volume.py index bec31d6ed0..9059a89a67 100644 --- a/tests/test_volume.py +++ b/tests/test_volume.py @@ -30,6 +30,7 @@ def res_id(params): RES = [42, 43] +TEST_PX_SZ = 4.56 @pytest.fixture(params=RES, ids=res_id, scope="module") @@ -75,7 +76,7 @@ def vols_1(data_1): @pytest.fixture def vols_2(data_2): - return Volume(data_2, pixel_size=4.56) + return Volume(data_2, pixel_size=TEST_PX_SZ) @pytest.fixture @@ -295,6 +296,13 @@ def test_save_load(vols_1): assert vols_loaded_double.pixel_size is None, "Pixel size should be None" +def test_volume_pixel_size(vols_2): + """ + Test volume is storing pixel_size attribute. + """ + assert np.isclose(TEST_PX_SZ, vols_2.pixel_size), "Incorrect Volume pixel_size" + + def test_save_load_pixel_size(vols_2): # Create a tmpdir in a context. It will be cleaned up on exit. with tempfile.TemporaryDirectory() as tmpdir: From 4b688937353371cd96602ae9b1a67a105aefbc70 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 26 Aug 2024 08:45:58 -0400 Subject: [PATCH 160/433] Use ValueError for px sz mismatch --- src/aspire/source/micrograph.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/source/micrograph.py b/src/aspire/source/micrograph.py index 521c416b4c..2d654401b5 100644 --- a/src/aspire/source/micrograph.py +++ b/src/aspire/source/micrograph.py @@ -196,7 +196,7 @@ def __init__(self, micrographs_path, dtype=None, pixel_size=None): # Size will be checked during on-the-fly loading of subsequent micrographs. micrograph0 = Image.load(self.micrograph_files[0]) if micrograph0.pixel_size is not None and micrograph0.pixel_size != pixel_size: - raise NotImplementedError( + raise ValueError( f"Mismatched pixel size. {micrograph0.pixel_size} angstroms defined in {self.micrograph_files[0]}, but provided {pixel_size} angstroms." ) @@ -277,7 +277,7 @@ def _images(self, indices): micrograph.pixel_size is not None and micrograph.pixel_size != self.pixel_size ): - raise NotImplementedError( + raise ValueError( f"Mismatched pixel size. {micrograph.pixel_size} angstroms defined in {self.micrograph_files[ind]}, but provided {self.pixel_size} angstroms." ) From d2ff536386efbcebafc27c8af643f860ddddb6e2 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 26 Aug 2024 08:59:40 -0400 Subject: [PATCH 161/433] Test px sz assignment with assert_approx_equal --- tests/test_synthetic_volume.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_synthetic_volume.py b/tests/test_synthetic_volume.py index 01fb74ec90..fec7591764 100644 --- a/tests/test_synthetic_volume.py +++ b/tests/test_synthetic_volume.py @@ -20,6 +20,9 @@ # dtype fixture to pass into volume fixture. DTYPES = [np.float32, pytest.param(np.float64, marks=pytest.mark.expensive)] +# Pixel sized used to test assignment +PXSZ = 3.0 + @pytest.fixture(params=DTYPES) def dtype_fixture(request): @@ -87,7 +90,7 @@ def vol_fixture(request, dtype_fixture): # Assign some volumes a pixel_size, leave others as default. if res % 2: - vol_kwargs["pixel_size"] = 3.0 + vol_kwargs["pixel_size"] = PXSZ return vol_class(**vol_kwargs) @@ -108,7 +111,7 @@ def test_volume_generate(vol_fixture): # In vol_fixture, we assign pixel_size to volumes having odd voxel sizes. if vol_fixture.L % 2: - assert v.pixel_size == 3 + np.testing.assert_approx_equal(v.pixel_size, PXSZ) def test_simulation_init(vol_fixture): From 88d87015808662414f61448520d12024ac828570 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 26 Aug 2024 14:22:32 -0400 Subject: [PATCH 162/433] merge conflict lint --- tests/test_downsample.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_downsample.py b/tests/test_downsample.py index 276927d81c..4c990212ce 100644 --- a/tests/test_downsample.py +++ b/tests/test_downsample.py @@ -162,6 +162,7 @@ def test_downsample_project(volume, res_ds): tol = 1e-09 np.testing.assert_allclose(im_ds_proj, im_proj_ds, atol=tol) + def test_pixel_size(): """ Test downsampling is rescaling the `pixel_size` attribute. @@ -182,4 +183,3 @@ def test_pixel_size(): img.pixel_size * L / dsL, err_msg="Incorrect pixel size.", ) - From b843a31c650352020732fe01f90948e9522b9628 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 26 Aug 2024 14:35:09 -0400 Subject: [PATCH 163/433] merge conflict test --- tests/test_volume.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_volume.py b/tests/test_volume.py index 9059a89a67..ac86c4096b 100644 --- a/tests/test_volume.py +++ b/tests/test_volume.py @@ -589,7 +589,7 @@ def test_downsample(res): # Confirm the pixel size is scaled np.testing.assert_approx_equal( result.pixel_size, - vols.pixel_size * res / ds_res, + vols.pixel_size * og_res / ds_res, err_msg="Incorrect pixel size.", ) From 870a57880f5d77db9b81f42d39250118dec10558 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Mon, 22 Jul 2024 13:51:54 -0400 Subject: [PATCH 164/433] Added backproject script and stub in the image folder --- src/aspire/image/line.py | 96 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 src/aspire/image/line.py diff --git a/src/aspire/image/line.py b/src/aspire/image/line.py new file mode 100644 index 0000000000..078e6b37c3 --- /dev/null +++ b/src/aspire/image/line.py @@ -0,0 +1,96 @@ +import aspire +import numpy as np + + +class Line: + def __init__(self, data, dtype = np.float64): + """ + Initialize a Line Object. Change later (similar intuition from Image class) + Question: Is it a line or collection of line object? + + :param data: Numpy array containing image data with shape + `(..., resolution, resolution)`. + :param dtype: Optionally cast `data` to this dtype. + Defaults to `data.dtype`. + """ + self.dtype = np.dtype(dtype) + if data.ndim == 2: + data = data[np.newaxis, :, :] + if data.ndim < 3: + raise('Projection Dimensions should be more than Three-Dimensions') + self._data = data.astype(self.dtype, copy=False) + self.stack_shape = self._data.shape[:-2] + self.n_images = self._data.shape[0] #broken for higher dimensional stacks + self.n_lines = self._data.shape[-2] + self.n_points = self._data.shape[-1] + # self.n_dim = (self._data.shape[1], self._data.shape[2]) + + def __str__(self): + return f"Line(n_images = {self.n_images}, n_points = {self.n_points})" + + @property + def stack(self): + return self.n_images + + # talk about angles and if they're supposed to be a certain input/output + # why this method and not another (explain design choices) + def back_project(self, angles): + """ + Back Projection Method for a single stack of lines. + + :param filter_name: string, optional + Filter used in frequency domain filtering. Assign None to use no filter. + :param angles: array + assuming not perfectly radial angles + :return: stack of reconstructed + """ + assert len(angles) == self.n_lines, "Angles must match the number of lines." + original_stack = self.stack_shape + n_angles = len(angles) + + ## our implementation + n_img, n_angles, n_rad = sinogram.shape + assert n_angles == len(angles), "gonna have a bad time" + L = n_rad + sinogram = np.fft.ifftshift(self.n_images, axes= -1) + sinogram_ft = np.fft.rfft(self.n_images, axis= -1) + + #grid generation + y_idx = np.fft.rfftfreq(n_rad) * np.pi * 2 + n_real_points = len(y_idx) + pts = np.empty((2, len(angles), n_real_points), dtype=self.dtype) + pts[0] = y_idx[np.newaxis, :] * np.sin(angles)[:, np.newaxis] + pts[1] = y_idx[np.newaxis, :] * np.cos(angles)[:, np.newaxis] + + imgs = aspire.nufft.anufft( + sinogram_ft.reshape(n_img, -1), + pts.reshape(2, n_real_points * len(angles)), + sz=(L, L), + real=True + ).reshape(n_img, L, L) + + return aspire.image.Image(imgs) + + def image_filter(self, filter_name, projections): + """ + Filter Method for projections. Will apply filter to line projection to get collection of projections (ramp, cosine, ... , etc.) + :param projections: Collection of line projections that need to be filtered. + :return: Filtered Projections. + """ + if projections is None: + raise ValueError('The input projections must not be None') + + filter_types = ('ramp', 'shepp-i logan', 'cosine', 'hamming', 'hann', None) + if filter_name is not filter_type: + raise ValueError(f"Unknown filter: {filter_name}") + + # skimage filter + fourier_filter = _get_fourier_filter(projection_size_padded, filter_name) + projection = fft(img, axis=0) * fourier_filter + radon_filtered = np.real(ifft(projection, axis=0)[:img_shape, :]) + + """ + step 0: Look more into filter function from skimage + thoughts: apply filter to each point + """ + pass From bb76b216944943bc7ec3dc197eb4087aff9a9802 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Tue, 23 Jul 2024 03:42:36 -0400 Subject: [PATCH 165/433] Added One-Dimension Test for Backproject --- src/aspire/image/line.py | 71 +++++++++++++++------------------------- tests/test_sinogram.py | 32 ++++++++++++++++++ 2 files changed, 59 insertions(+), 44 deletions(-) diff --git a/src/aspire/image/line.py b/src/aspire/image/line.py index 078e6b37c3..9f2b30c800 100644 --- a/src/aspire/image/line.py +++ b/src/aspire/image/line.py @@ -1,9 +1,19 @@ -import aspire +import logging +import os +from pathlib import Path + import numpy as np +import aspire +from aspire.image import Image +from aspire.nufft import anufft, nufft + +# noticed a lot of classes had these already, might be helpful for pathing, logging info, etc. (inc. os, logging) +logger = logging.getLogger(__name__) + class Line: - def __init__(self, data, dtype = np.float64): + def __init__(self, data, dtype=np.float64): """ Initialize a Line Object. Change later (similar intuition from Image class) Question: Is it a line or collection of line object? @@ -17,11 +27,11 @@ def __init__(self, data, dtype = np.float64): if data.ndim == 2: data = data[np.newaxis, :, :] if data.ndim < 3: - raise('Projection Dimensions should be more than Three-Dimensions') + raise ("Projection Dimensions should be more than Three-Dimensions") self._data = data.astype(self.dtype, copy=False) self.stack_shape = self._data.shape[:-2] - self.n_images = self._data.shape[0] #broken for higher dimensional stacks - self.n_lines = self._data.shape[-2] + self.n_images = self._data.shape[0] # broken for higher dimensional stacks + self.n_lines = self._data.shape[-2] self.n_points = self._data.shape[-1] # self.n_dim = (self._data.shape[1], self._data.shape[2]) @@ -32,65 +42,38 @@ def __str__(self): def stack(self): return self.n_images - # talk about angles and if they're supposed to be a certain input/output - # why this method and not another (explain design choices) def back_project(self, angles): """ Back Projection Method for a single stack of lines. - + :param filter_name: string, optional Filter used in frequency domain filtering. Assign None to use no filter. :param angles: array assuming not perfectly radial angles :return: stack of reconstructed """ - assert len(angles) == self.n_lines, "Angles must match the number of lines." - original_stack = self.stack_shape - n_angles = len(angles) - - ## our implementation + sinogram = self._data n_img, n_angles, n_rad = sinogram.shape - assert n_angles == len(angles), "gonna have a bad time" + assert n_angles == len( + angles + ), "Number of angles must match the number of projections" + L = n_rad - sinogram = np.fft.ifftshift(self.n_images, axes= -1) - sinogram_ft = np.fft.rfft(self.n_images, axis= -1) + sinogram = np.fft.ifftshift(sinogram, axes=-1) + sinogram_ft = np.fft.rfft(sinogram, axis=-1) - #grid generation + # grid generation with real points y_idx = np.fft.rfftfreq(n_rad) * np.pi * 2 n_real_points = len(y_idx) pts = np.empty((2, len(angles), n_real_points), dtype=self.dtype) pts[0] = y_idx[np.newaxis, :] * np.sin(angles)[:, np.newaxis] pts[1] = y_idx[np.newaxis, :] * np.cos(angles)[:, np.newaxis] - + imgs = aspire.nufft.anufft( sinogram_ft.reshape(n_img, -1), pts.reshape(2, n_real_points * len(angles)), sz=(L, L), - real=True + real=True, ).reshape(n_img, L, L) - - return aspire.image.Image(imgs) - - def image_filter(self, filter_name, projections): - """ - Filter Method for projections. Will apply filter to line projection to get collection of projections (ramp, cosine, ... , etc.) - :param projections: Collection of line projections that need to be filtered. - :return: Filtered Projections. - """ - if projections is None: - raise ValueError('The input projections must not be None') - - filter_types = ('ramp', 'shepp-i logan', 'cosine', 'hamming', 'hann', None) - if filter_name is not filter_type: - raise ValueError(f"Unknown filter: {filter_name}") - # skimage filter - fourier_filter = _get_fourier_filter(projection_size_padded, filter_name) - projection = fft(img, axis=0) * fourier_filter - radon_filtered = np.real(ifft(projection, axis=0)[:img_shape, :]) - - """ - step 0: Look more into filter function from skimage - thoughts: apply filter to each point - """ - pass + return aspire.image.Image(imgs) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 56aa6776e0..6459145f52 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -4,6 +4,7 @@ from skimage.transform import radon from aspire.image import Image +from aspire.image.line import Line from aspire.utils import grid_2d # Relative tolerance comparing line projections to scikit @@ -136,3 +137,34 @@ def test_multidim(num_ang): reference_sinograms, axis=-1 ) np.testing.assert_array_less(_nrms, SK_TOL, "Error in image projections.") + + +def test_back_project_single(masked_image, num_ang): + """ + Test Line.backproject on a single stack of line projections or sinogram. Compares the reconstructed image to original image. + """ + # I'll be creating a sinogram representation of camera man + # reusing our grid fixture + # and testing the skimage's backwards project without a filter (note there currently is no filter so blurry + angles = np.linspace(0, 360, num_ang, endpoint=False) + rads = angles / 180 * np.pi + sinogram = Line(masked_image.project(rads)) + back_project = sinogram.back_project(num_ang) + + assert masked_img.shape == back_project.shape, "Shape must be the same." + + # no filter for now + sk_image_iradon = iradon(masked_image, theta=np.degrees(angles), filter_name=None) + + nrms = np.sqrt( + np.mean((sk_image_iradon - back_project) ** 2, axis=-1) + ) / np.linalg.norm(back_project, axis=-1) + np.testing.assert_array_less(nrms, SK_TOL, "Error in image reconstruction.") + + +def test_back_project_multidim(num_ang): + """ + Test Line.backproject on a stack of images. Extension of back_project_single but for multi-dimensional stacks. + """ + # assume once we can get this functioning for single stack + # we can get this working for multiple From 0dd278a3731e6b03231458a1331d2a70a2bbdd36 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Tue, 23 Jul 2024 11:12:00 -0400 Subject: [PATCH 166/433] Stashing --- src/aspire/image/line.py | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/aspire/image/line.py b/src/aspire/image/line.py index 9f2b30c800..435c0aff5e 100644 --- a/src/aspire/image/line.py +++ b/src/aspire/image/line.py @@ -2,18 +2,16 @@ import os from pathlib import Path -import numpy as np - -import aspire from aspire.image import Image from aspire.nufft import anufft, nufft +import aspire +import numpy as np # noticed a lot of classes had these already, might be helpful for pathing, logging info, etc. (inc. os, logging) logger = logging.getLogger(__name__) - class Line: - def __init__(self, data, dtype=np.float64): + def __init__(self, data, dtype = np.float64): """ Initialize a Line Object. Change later (similar intuition from Image class) Question: Is it a line or collection of line object? @@ -27,11 +25,11 @@ def __init__(self, data, dtype=np.float64): if data.ndim == 2: data = data[np.newaxis, :, :] if data.ndim < 3: - raise ("Projection Dimensions should be more than Three-Dimensions") + raise('Projection Dimensions should be more than Three-Dimensions') self._data = data.astype(self.dtype, copy=False) self.stack_shape = self._data.shape[:-2] - self.n_images = self._data.shape[0] # broken for higher dimensional stacks - self.n_lines = self._data.shape[-2] + self.n_images = self._data.shape[0] #broken for higher dimensional stacks + self.n_lines = self._data.shape[-2] self.n_points = self._data.shape[-1] # self.n_dim = (self._data.shape[1], self._data.shape[2]) @@ -45,7 +43,7 @@ def stack(self): def back_project(self, angles): """ Back Projection Method for a single stack of lines. - + :param filter_name: string, optional Filter used in frequency domain filtering. Assign None to use no filter. :param angles: array @@ -54,26 +52,25 @@ def back_project(self, angles): """ sinogram = self._data n_img, n_angles, n_rad = sinogram.shape - assert n_angles == len( - angles - ), "Number of angles must match the number of projections" + assert n_angles == len(angles), "Number of angles must match the number of projections" L = n_rad - sinogram = np.fft.ifftshift(sinogram, axes=-1) - sinogram_ft = np.fft.rfft(sinogram, axis=-1) + sinogram = np.fft.ifftshift(sinogram, axes= -1) + sinogram_ft = np.fft.rfft(sinogram, axis= -1) - # grid generation with real points + #grid generation with real points y_idx = np.fft.rfftfreq(n_rad) * np.pi * 2 n_real_points = len(y_idx) pts = np.empty((2, len(angles), n_real_points), dtype=self.dtype) pts[0] = y_idx[np.newaxis, :] * np.sin(angles)[:, np.newaxis] pts[1] = y_idx[np.newaxis, :] * np.cos(angles)[:, np.newaxis] - + imgs = aspire.nufft.anufft( sinogram_ft.reshape(n_img, -1), pts.reshape(2, n_real_points * len(angles)), sz=(L, L), - real=True, + real=True ).reshape(n_img, L, L) - + return aspire.image.Image(imgs) + From aa0a1d91871569ce31e0fe182639677f87a6f339 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Thu, 25 Jul 2024 17:16:10 -0400 Subject: [PATCH 167/433] Fixed Scaling Issue with BackProject and Integrated NRMSE to One Stack Test --- src/aspire/image/line.py | 45 +++++++++++++------------ tests/test_sinogram.py | 72 +++++++++++++++++++++++++++++----------- 2 files changed, 77 insertions(+), 40 deletions(-) diff --git a/src/aspire/image/line.py b/src/aspire/image/line.py index 435c0aff5e..b68a84383d 100644 --- a/src/aspire/image/line.py +++ b/src/aspire/image/line.py @@ -1,17 +1,15 @@ import logging -import os -from pathlib import Path -from aspire.image import Image -from aspire.nufft import anufft, nufft -import aspire import numpy as np +import aspire + # noticed a lot of classes had these already, might be helpful for pathing, logging info, etc. (inc. os, logging) logger = logging.getLogger(__name__) + class Line: - def __init__(self, data, dtype = np.float64): + def __init__(self, data, dtype=np.float64): """ Initialize a Line Object. Change later (similar intuition from Image class) Question: Is it a line or collection of line object? @@ -25,13 +23,14 @@ def __init__(self, data, dtype = np.float64): if data.ndim == 2: data = data[np.newaxis, :, :] if data.ndim < 3: - raise('Projection Dimensions should be more than Three-Dimensions') + assert "Projection Dimensions should be more than Three-Dimensions" self._data = data.astype(self.dtype, copy=False) - self.stack_shape = self._data.shape[:-2] - self.n_images = self._data.shape[0] #broken for higher dimensional stacks - self.n_lines = self._data.shape[-2] - self.n_points = self._data.shape[-1] - # self.n_dim = (self._data.shape[1], self._data.shape[2]) + + # self.stack_shape = self._data.shape[:-2] + # self.n_images = self._data.shape[0] #broken for higher dimensional stacks + # self.n_lines = self._data.shape[-2] + # self.n_points = self._data.shape[-1] + # self.n_dim = (self._data.shape[1], self._data.shape[2]) def __str__(self): return f"Line(n_images = {self.n_images}, n_points = {self.n_points})" @@ -43,7 +42,7 @@ def stack(self): def back_project(self, angles): """ Back Projection Method for a single stack of lines. - + :param filter_name: string, optional Filter used in frequency domain filtering. Assign None to use no filter. :param angles: array @@ -52,25 +51,29 @@ def back_project(self, angles): """ sinogram = self._data n_img, n_angles, n_rad = sinogram.shape - assert n_angles == len(angles), "Number of angles must match the number of projections" + assert n_angles == len( + angles + ), "Number of angles must match the number of projections" L = n_rad - sinogram = np.fft.ifftshift(sinogram, axes= -1) - sinogram_ft = np.fft.rfft(sinogram, axis= -1) + sinogram = np.fft.ifftshift(sinogram, axes=-1) + sinogram_ft = np.fft.rfft(sinogram, axis=-1) - #grid generation with real points + # grid generation with real points y_idx = np.fft.rfftfreq(n_rad) * np.pi * 2 n_real_points = len(y_idx) pts = np.empty((2, len(angles), n_real_points), dtype=self.dtype) pts[0] = y_idx[np.newaxis, :] * np.sin(angles)[:, np.newaxis] pts[1] = y_idx[np.newaxis, :] * np.cos(angles)[:, np.newaxis] - + imgs = aspire.nufft.anufft( sinogram_ft.reshape(n_img, -1), pts.reshape(2, n_real_points * len(angles)), sz=(L, L), - real=True + real=True, ).reshape(n_img, L, L) - + + # normalization which gives us roughly the same error regardless of angles + imgs = imgs / (n_real_points * len(angles)) + return aspire.image.Image(imgs) - diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 6459145f52..189a8266ae 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -1,15 +1,17 @@ import numpy as np import pytest from skimage import data -from skimage.transform import radon +from skimage.transform import iradon, radon from aspire.image import Image from aspire.image.line import Line from aspire.utils import grid_2d # Relative tolerance comparing line projections to scikit -# The same tolerance will be used in all scikit comparisons -SK_TOL = 0.005 +# The same tolerance will be used in all scikit forward and backward comparisons +SK_TOL_FORWARDPROJECT = 0.005 + +SK_TOL_BACKPROJECT = 0.2 IMG_SIZES = [ 511, @@ -95,7 +97,9 @@ def test_image_project(masked_image, num_ang): reference_sinogram, axis=-1 ) - np.testing.assert_array_less(nrms, SK_TOL, "Error in image projections.") + np.testing.assert_array_less( + nrms, SK_TOL_FORWARDPROJECT, "Error in image projections." + ) def test_multidim(num_ang): @@ -136,35 +140,65 @@ def test_multidim(num_ang): _nrms = np.sqrt(np.mean((s - reference_sinograms) ** 2, axis=-1)) / np.linalg.norm( reference_sinograms, axis=-1 ) - np.testing.assert_array_less(_nrms, SK_TOL, "Error in image projections.") + np.testing.assert_array_less( + _nrms, SK_TOL_FORWARDPROJECT, "Error in image projections." + ) def test_back_project_single(masked_image, num_ang): """ Test Line.backproject on a single stack of line projections or sinogram. Compares the reconstructed image to original image. """ - # I'll be creating a sinogram representation of camera man - # reusing our grid fixture - # and testing the skimage's backwards project without a filter (note there currently is no filter so blurry angles = np.linspace(0, 360, num_ang, endpoint=False) rads = angles / 180 * np.pi - sinogram = Line(masked_image.project(rads)) - back_project = sinogram.back_project(num_ang) + sinogram_np = masked_image.project(rads) + sinogram = Line(sinogram_np) + back_project = sinogram.back_project(rads) - assert masked_img.shape == back_project.shape, "Shape must be the same." + assert masked_image.shape == back_project.shape, "The shape must be the same." - # no filter for now - sk_image_iradon = iradon(masked_image, theta=np.degrees(angles), filter_name=None) + # generate circular mask w/ radius 1 to reconstructed image + # aim to remove discrepencies for the edges of the image + g = grid_2d(sinogram_np.shape[2], normalized=True, shifted=True) + mask = g["r"] < 1 + our_back_project = back_project.asnumpy()[0] * mask + + # generating sci-kit image backproject method w/ no filter + sk_image_iradon = iradon(sinogram_np[0].T, theta=angles[::-1], filter_name=None) - nrms = np.sqrt( - np.mean((sk_image_iradon - back_project) ** 2, axis=-1) - ) / np.linalg.norm(back_project, axis=-1) - np.testing.assert_array_less(nrms, SK_TOL, "Error in image reconstruction.") + # we apply a normalized root mean square error on the images to find relative error to range of ref. image + # Note: toleranc is typically < 0.2 regardless of angles, pixels, etc. + nrmse = np.sqrt(np.mean((our_back_project - sk_image_iradon) ** 2)) / ( + np.max(sk_image_iradon - np.min(sk_image_iradon)) + ) + assert ( + nrmse < SK_TOL_BACKPROJECT + ), f"NRMSE is too high: {nrmse}, expected less than {SK_TOL_BACKPROJECT}" def test_back_project_multidim(num_ang): """ Test Line.backproject on a stack of images. Extension of back_project_single but for multi-dimensional stacks. """ - # assume once we can get this functioning for single stack - # we can get this working for multiple + L = 512 # pixels + n = 3 + m = 2 + + # Generate a mask + g = grid_2d(L, normalized=True, shifted=True) + mask = g["r"] < 1 + + # Generate images + imgs = Image(np.random.random((m, n, L, L))) * mask + + # Generate line project angles + angles = np.linspace(0, 360, num_ang, endpoint=False) + rads = angles / 180.0 * np.pi + s = imgs.project(rads) + sinogram = Line(s) + return sinogram + # back project + grid + + # sci-kit back project + + # compare nrmse for all images in the stack From cc599a5ea6619ccbfeae09457581cade5ede1d9d Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Fri, 26 Jul 2024 11:11:13 -0400 Subject: [PATCH 168/433] fixed single back_project test --- tests/test_sinogram.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 189a8266ae..13b77c4a90 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -180,23 +180,11 @@ def test_back_project_multidim(num_ang): """ Test Line.backproject on a stack of images. Extension of back_project_single but for multi-dimensional stacks. """ - L = 512 # pixels - n = 3 - m = 2 - # Generate a mask - g = grid_2d(L, normalized=True, shifted=True) - mask = g["r"] < 1 # Generate images - imgs = Image(np.random.random((m, n, L, L))) * mask # Generate line project angles - angles = np.linspace(0, 360, num_ang, endpoint=False) - rads = angles / 180.0 * np.pi - s = imgs.project(rads) - sinogram = Line(s) - return sinogram # back project + grid # sci-kit back project From 46b1f74c58a1005fbf466f0cdf3dc1ab59e13560 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 26 Jul 2024 11:54:31 -0400 Subject: [PATCH 169/433] reorg Line to avoid circ import. Interop Image/Line classes --- src/aspire/image/image.py | 3 ++- src/aspire/line/__init__.py | 1 + src/aspire/{image => line}/line.py | 7 +++---- tests/test_sinogram.py | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 src/aspire/line/__init__.py rename src/aspire/{image => line}/line.py (94%) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 1bbe2ba160..263eaa1780 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -8,6 +8,7 @@ from PIL import Image as PILImage from scipy.linalg import lstsq +import aspire.line import aspire.volume from aspire.nufft import anufft, nufft from aspire.numeric import fft, xp @@ -238,7 +239,7 @@ def project(self, angles): # Radon transform, output: (stack size, angles, points) image_rt = np.fft.fftshift(np.fft.irfft(image_ft, n=n_points, axis=-1), axes=-1) image_rt = image_rt.reshape(*original_stack, n_angles, n_points) - return image_rt + return aspire.line.Line(image_rt) @property def res(self): diff --git a/src/aspire/line/__init__.py b/src/aspire/line/__init__.py new file mode 100644 index 0000000000..d3856d67ad --- /dev/null +++ b/src/aspire/line/__init__.py @@ -0,0 +1 @@ +from .line import Line diff --git a/src/aspire/image/line.py b/src/aspire/line/line.py similarity index 94% rename from src/aspire/image/line.py rename to src/aspire/line/line.py index b68a84383d..4b947592ed 100644 --- a/src/aspire/image/line.py +++ b/src/aspire/line/line.py @@ -2,9 +2,9 @@ import numpy as np -import aspire +import aspire.image +from aspire.nufft import anufft -# noticed a lot of classes had these already, might be helpful for pathing, logging info, etc. (inc. os, logging) logger = logging.getLogger(__name__) @@ -66,7 +66,7 @@ def back_project(self, angles): pts[0] = y_idx[np.newaxis, :] * np.sin(angles)[:, np.newaxis] pts[1] = y_idx[np.newaxis, :] * np.cos(angles)[:, np.newaxis] - imgs = aspire.nufft.anufft( + imgs = anufft( sinogram_ft.reshape(n_img, -1), pts.reshape(2, n_real_points * len(angles)), sz=(L, L), @@ -75,5 +75,4 @@ def back_project(self, angles): # normalization which gives us roughly the same error regardless of angles imgs = imgs / (n_real_points * len(angles)) - return aspire.image.Image(imgs) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 13b77c4a90..41259ea563 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -4,7 +4,7 @@ from skimage.transform import iradon, radon from aspire.image import Image -from aspire.image.line import Line +from aspire.line import Line from aspire.utils import grid_2d # Relative tolerance comparing line projections to scikit From 0e4f6cf2a1143a84878c6b1e5e463fa967309040 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 26 Jul 2024 12:10:50 -0400 Subject: [PATCH 170/433] adjust tests towards Line/Image interop [skip ci] Co-authored-by: Marc Karimi --- tests/test_sinogram.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 41259ea563..f410940180 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -151,15 +151,15 @@ def test_back_project_single(masked_image, num_ang): """ angles = np.linspace(0, 360, num_ang, endpoint=False) rads = angles / 180 * np.pi - sinogram_np = masked_image.project(rads) - sinogram = Line(sinogram_np) + sinogram = masked_image.project(rads) + sinogram_np = sinogram.asnumpy() back_project = sinogram.back_project(rads) assert masked_image.shape == back_project.shape, "The shape must be the same." # generate circular mask w/ radius 1 to reconstructed image # aim to remove discrepencies for the edges of the image - g = grid_2d(sinogram_np.shape[2], normalized=True, shifted=True) + g = grid_2d(back_project.resolution, normalized=True, shifted=True) mask = g["r"] < 1 our_back_project = back_project.asnumpy()[0] * mask From 195fbecabcd33abae9b712a8b9746a9f327d65c3 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Fri, 26 Jul 2024 15:50:31 -0400 Subject: [PATCH 171/433] passing the 20/20 test cases and added Attributes + Methods to the Line class [need fix] --- src/aspire/line/line.py | 118 +++++++++++++++++++++++++++++++++++++--- tests/test_sinogram.py | 6 +- 2 files changed, 114 insertions(+), 10 deletions(-) diff --git a/src/aspire/line/line.py b/src/aspire/line/line.py index 4b947592ed..6a19f03b94 100644 --- a/src/aspire/line/line.py +++ b/src/aspire/line/line.py @@ -1,5 +1,8 @@ import logging +import os +from warnings import catch_warnings, filterwarnings, simplefilter, warn +import mrcfile import numpy as np import aspire.image @@ -12,7 +15,6 @@ class Line: def __init__(self, data, dtype=np.float64): """ Initialize a Line Object. Change later (similar intuition from Image class) - Question: Is it a line or collection of line object? :param data: Numpy array containing image data with shape `(..., resolution, resolution)`. @@ -25,15 +27,117 @@ def __init__(self, data, dtype=np.float64): if data.ndim < 3: assert "Projection Dimensions should be more than Three-Dimensions" self._data = data.astype(self.dtype, copy=False) + self.ndim = self._data.ndim + self.shape = self._data.shape + self.stack_shape = self._data.shape[:-2] + self.stack_n_dim = self._data.ndim - 2 # fix + self.n = np.product(self.stack_shape) # stack number + self.n_angles = self._data.shape[-1] # fix + self.n_radial_points = self._data.shape[-1] - # self.stack_shape = self._data.shape[:-2] - # self.n_images = self._data.shape[0] #broken for higher dimensional stacks - # self.n_lines = self._data.shape[-2] - # self.n_points = self._data.shape[-1] - # self.n_dim = (self._data.shape[1], self._data.shape[2]) + # Numpy interop + # https://numpy.org/devdocs/user/basics.interoperability.html#the-array-interface-protocol + self.__array_interface__ = self._data.__array_interface__ + self.__array__ = self._data + + def _check_key_dims(self, key): + if isinstance(key, tuple) and (len(key) > self._data.ndim): + raise ValueError( + f"Line stack_dim is {self.stack_n_dim}, slice length must be =< {self.n_dim}" + ) + + def __getitem__(self, key): + self._check_key_dims(key) + return self.__class__(self._data[key]) + + def __setitem__(self, key, value): + self._check_key_dims(key) + self._data[key] = value + + def stack_reshape(self, *args): + """ + Reshape the stack axis. + + :*args: Integer(s) or tuple describing the intended shape. + + :returns: Line instance + """ + + # If we're passed a tuple, use that + if len(args) == 1 and isinstance(args[0], tuple): + shape = args[0] + else: + # Otherwise use the variadic args + shape = args + + # Sanity check the size + if shape != (-1,) and np.prod(shape) != self.n: + raise ValueError( + f"Number of sinogram images {self.n_images} cannot be reshaped to {shape}." + ) + + return self.__class__(self._data.reshape(*shape, *self._data.shape[-2:])) + + def asnumpy(self): + """ + Return image data as a (, angles, radians) + read-only array view. + + :return: read-only ndarray view + """ + + view = self._data.view() + view.flags.writeable = False + return view + + def copy(self): + return self.__class__(self._data.copy()) + + # fix later + def save(self, mrcs_filepath, overwrite=False): + if self.stack_ndim > 1: + raise NotImplementedError("`save` is currently limited to 1D image stacks.") + + with mrcfile.new(mrcs_filepath, overwrite=overwrite) as mrc: + # original input format (the image index first) + mrc.set_data(self._data.astype(np.float32)) + + # fix later + @staticmethod + def load(filepath, dtype=None): + """ + Load raw data from supported files. + + Currently MRC and TIFF are supported. + + :param filepath: File path (string). + :param dtype: Optionally force cast to `dtype`. + Default dtype is inferred from the file contents. + :return: numpy array of image data. + """ + + # Get the file extension + ext = os.path.splitext(filepath)[1] + + # On unsupported extension, raise with suggested file types + if ext not in Image.extensions: + raise RuntimeError( + f"Attempting to open unsupported file extension '{ext}', try {list(Image.extensions.keys())}." + ) + + # Call the appropriate file reader + im = Image.extensions[ext](filepath) + + # Attempt casting when user provides dtype + if dtype is not None: + im = im.astype(dtype, copy=False) + + # Return as Image instance + return Image(im) def __str__(self): - return f"Line(n_images = {self.n_images}, n_points = {self.n_points})" + # fix later + return f"Line(n_images = {self.n}, n_angles = {self.n_points}, n_radial_points = {self.n_radial_points})" @property def stack(self): diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index f410940180..e8dbf797df 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -93,9 +93,9 @@ def test_image_project(masked_image, num_ang): assert reference_sinogram.shape == (len(angles), ny), "Incorrect Shape" # compare project method on ski-image reference - nrms = np.sqrt(np.mean((s[0] - reference_sinogram) ** 2, axis=-1)) / np.linalg.norm( - reference_sinogram, axis=-1 - ) + nrms = np.sqrt( + np.mean((s[0]._data - reference_sinogram) ** 2, axis=-1) + ) / np.linalg.norm(reference_sinogram, axis=-1) np.testing.assert_array_less( nrms, SK_TOL_FORWARDPROJECT, "Error in image projections." From 059d874dfe5afbb61126084d9275e6501b935cc9 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Tue, 30 Jul 2024 05:04:39 -0400 Subject: [PATCH 172/433] finished multidim test --- src/aspire/line/line.py | 67 ++++++++--------------------------------- tests/test_sinogram.py | 49 ++++++++++++++++++++++++------ 2 files changed, 52 insertions(+), 64 deletions(-) diff --git a/src/aspire/line/line.py b/src/aspire/line/line.py index 6a19f03b94..58cdad88a3 100644 --- a/src/aspire/line/line.py +++ b/src/aspire/line/line.py @@ -30,9 +30,9 @@ def __init__(self, data, dtype=np.float64): self.ndim = self._data.ndim self.shape = self._data.shape self.stack_shape = self._data.shape[:-2] - self.stack_n_dim = self._data.ndim - 2 # fix - self.n = np.product(self.stack_shape) # stack number - self.n_angles = self._data.shape[-1] # fix + self.stack_n_dim = self._data.ndim - 2 + self.n = np.product(self.stack_shape) + self.n_angles = self._data.shape[-2] self.n_radial_points = self._data.shape[-1] # Numpy interop @@ -93,50 +93,7 @@ def asnumpy(self): def copy(self): return self.__class__(self._data.copy()) - # fix later - def save(self, mrcs_filepath, overwrite=False): - if self.stack_ndim > 1: - raise NotImplementedError("`save` is currently limited to 1D image stacks.") - - with mrcfile.new(mrcs_filepath, overwrite=overwrite) as mrc: - # original input format (the image index first) - mrc.set_data(self._data.astype(np.float32)) - - # fix later - @staticmethod - def load(filepath, dtype=None): - """ - Load raw data from supported files. - - Currently MRC and TIFF are supported. - - :param filepath: File path (string). - :param dtype: Optionally force cast to `dtype`. - Default dtype is inferred from the file contents. - :return: numpy array of image data. - """ - - # Get the file extension - ext = os.path.splitext(filepath)[1] - - # On unsupported extension, raise with suggested file types - if ext not in Image.extensions: - raise RuntimeError( - f"Attempting to open unsupported file extension '{ext}', try {list(Image.extensions.keys())}." - ) - - # Call the appropriate file reader - im = Image.extensions[ext](filepath) - - # Attempt casting when user provides dtype - if dtype is not None: - im = im.astype(dtype, copy=False) - - # Return as Image instance - return Image(im) - def __str__(self): - # fix later return f"Line(n_images = {self.n}, n_angles = {self.n_points}, n_radial_points = {self.n_radial_points})" @property @@ -153,30 +110,30 @@ def back_project(self, angles): assuming not perfectly radial angles :return: stack of reconstructed """ - sinogram = self._data - n_img, n_angles, n_rad = sinogram.shape - assert n_angles == len( - angles + assert ( + len(angles) == self.n_angles ), "Number of angles must match the number of projections" - L = n_rad + original_stack_shape = self.stack_shape + sinogram = self.stack_reshape(-1) + L = self.n_radial_points sinogram = np.fft.ifftshift(sinogram, axes=-1) sinogram_ft = np.fft.rfft(sinogram, axis=-1) # grid generation with real points - y_idx = np.fft.rfftfreq(n_rad) * np.pi * 2 + y_idx = np.fft.rfftfreq(self.n_radial_points) * np.pi * 2 n_real_points = len(y_idx) pts = np.empty((2, len(angles), n_real_points), dtype=self.dtype) pts[0] = y_idx[np.newaxis, :] * np.sin(angles)[:, np.newaxis] pts[1] = y_idx[np.newaxis, :] * np.cos(angles)[:, np.newaxis] imgs = anufft( - sinogram_ft.reshape(n_img, -1), + sinogram_ft.reshape(self.n, -1), pts.reshape(2, n_real_points * len(angles)), sz=(L, L), real=True, - ).reshape(n_img, L, L) + ).reshape(self.n, L, L) # normalization which gives us roughly the same error regardless of angles imgs = imgs / (n_real_points * len(angles)) - return aspire.image.Image(imgs) + return aspire.image.Image(imgs).stack_reshape(original_stack_shape) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index e8dbf797df..f9a24b1590 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -71,7 +71,7 @@ def masked_image(dtype, img_size): # Image.project and compare results to skimage.radon -def test_image_project(masked_image, num_ang): +def test_project_single(masked_image, num_ang): """ Test Image.project on a single stack of images. Compares project method output with skimage project. """ @@ -102,7 +102,7 @@ def test_image_project(masked_image, num_ang): ) -def test_multidim(num_ang): +def test_project_multidim(num_ang): """ Test Image.project on stacks of images. Extension of test_image_project but for multi-dimensional stacks. """ @@ -167,7 +167,7 @@ def test_back_project_single(masked_image, num_ang): sk_image_iradon = iradon(sinogram_np[0].T, theta=angles[::-1], filter_name=None) # we apply a normalized root mean square error on the images to find relative error to range of ref. image - # Note: toleranc is typically < 0.2 regardless of angles, pixels, etc. + # Note: tolerance is typically < 0.2 regardless of angles, pixels, etc. nrmse = np.sqrt(np.mean((our_back_project - sk_image_iradon) ** 2)) / ( np.max(sk_image_iradon - np.min(sk_image_iradon)) ) @@ -178,15 +178,46 @@ def test_back_project_single(masked_image, num_ang): def test_back_project_multidim(num_ang): """ - Test Line.backproject on a stack of images. Extension of back_project_single but for multi-dimensional stacks. + Test Line.backproject on a stack of images. Extension of back_project_single but for multi-dimensional stacks. Similar to forward_multidim test. """ - # Generate a mask + L = 512 # pixels + n = 3 + m = 2 + + g = grid_2d(L, normalized=True, shifted=True) + mask = g["r"] < 1 # Generate images + imgs = Image(np.random.random((m, n, L, L))) * mask + angles = np.linspace(0, 360, num_ang, endpoint=False) + rads = angles / 180 * np.pi - # Generate line project angles - # back project + grid + # apply a forward project on the image, then backwards + ours_forward = imgs.project(rads) + ours_backward = ours_forward.back_project(rads) - # sci-kit back project + # Compare + reference_back_projects = np.empty((m, n, L, L)) + for i in range(m): + for j in range(n): + img = imgs[i, j] + # Compute the singleton case, and compare with stack. + single_sinogram = img.project(rads) + back_project = single_sinogram.back_project(rads) + + # These should be allclose up to determinism. + np.testing.assert_allclose(ours_backward[i, j : j + 1], back_project[0]) + + # Next individually compute sk's iradon transform for each image. + reference_back_projects[i, j] = iradon( + single_sinogram.asnumpy()[0].T, theta=angles[::-1], filter_name=None + ) - # compare nrmse for all images in the stack + # apply a mask, then find the NRMSE on the collection of images + # similar tolerance level to single project test + nrmse = np.sqrt( + np.mean((ours_backward.asnumpy() * mask - reference_back_projects) ** 2) + ) / (np.max(reference_back_projects) - np.min(reference_back_projects)) + assert ( + nrmse < SK_TOL_BACKPROJECT + ), f"NRMSE is too high for image ({i},{j}): {nrmse}, expected less than {SK_TOL_BACKPROJECT}" From 4f7f64b7219d67df124aeb048c0c8905fe99dd69 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Tue, 30 Jul 2024 11:54:56 -0400 Subject: [PATCH 173/433] removed unused statements --- src/aspire/line/line.py | 3 --- tests/test_sinogram.py | 1 - 2 files changed, 4 deletions(-) diff --git a/src/aspire/line/line.py b/src/aspire/line/line.py index 58cdad88a3..f9c688f71d 100644 --- a/src/aspire/line/line.py +++ b/src/aspire/line/line.py @@ -1,8 +1,5 @@ import logging -import os -from warnings import catch_warnings, filterwarnings, simplefilter, warn -import mrcfile import numpy as np import aspire.image diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index f9a24b1590..9b27b10dca 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -4,7 +4,6 @@ from skimage.transform import iradon, radon from aspire.image import Image -from aspire.line import Line from aspire.utils import grid_2d # Relative tolerance comparing line projections to scikit From cca467469df0eb8fc98357a5f8b195a8f0414e53 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Tue, 30 Jul 2024 12:18:31 -0400 Subject: [PATCH 174/433] initial fft changes --- src/aspire/image/image.py | 14 +++++++------- src/aspire/numeric/cupy_fft.py | 12 ++++++++++++ src/aspire/numeric/scipy_fft.py | 9 +++++++++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 263eaa1780..b589471577 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -222,24 +222,24 @@ def project(self, angles): original_stack = self.stack_shape # 2-D grid - radial_idx = np.fft.rfftfreq(n_points) * np.pi * 2 + radial_idx = fft.rfftfreq(n_points) * xp.pi * 2 n_real_points = len(radial_idx) n_angles = len(angles) - pts = np.empty((2, n_angles, n_real_points), dtype=self.dtype) - pts[0] = radial_idx[np.newaxis, :] * np.sin(angles)[:, np.newaxis] - pts[1] = radial_idx[np.newaxis, :] * np.cos(angles)[:, np.newaxis] + pts = xp.empty((2, n_angles, n_real_points), dtype=self.dtype) + pts[0] = radial_idx[xp.newaxis, :] * xp.sin(angles)[:, xp.newaxis] + pts[1] = radial_idx[xp.newaxis, :] * xp.cos(angles)[:, xp.newaxis] pts = pts.reshape(2, n_real_points * n_angles) # compute the polar nufft (NUFFT) - image_ft = nufft(self.stack_reshape(-1)._data, pts).reshape( + image_ft = nufft(xp.asarray(self.stack_reshape(-1)._data), pts).reshape( self.n_images, n_angles, n_real_points ) # Radon transform, output: (stack size, angles, points) - image_rt = np.fft.fftshift(np.fft.irfft(image_ft, n=n_points, axis=-1), axes=-1) + image_rt = fft.fftshift(fft.irfft(image_ft, n=n_points, axis=-1), axes=-1) image_rt = image_rt.reshape(*original_stack, n_angles, n_points) - return aspire.line.Line(image_rt) + return aspire.line.Line(xp.asnumpy(image_rt)) @property def res(self): diff --git a/src/aspire/numeric/cupy_fft.py b/src/aspire/numeric/cupy_fft.py index 6ad6a4e9da..ce537a1cba 100644 --- a/src/aspire/numeric/cupy_fft.py +++ b/src/aspire/numeric/cupy_fft.py @@ -100,3 +100,15 @@ def dct(self, x, **kwargs): @_preserve_host def idct(self, x, **kwargs): return cufft.idct(x, **kwargs) + + @_preserve_host + def rfftfreq(self, x, **kwargs): + return cufft.rfftfreq(x, **kwargs) + + @_preserve_host + def irfft(self, x, **kwargs): + return cufft.irfft(x, **kwargs) + + @_preserve_host + def rfft(self, x, **kwargs): + return cufft.rfft(x, **kwargs) diff --git a/src/aspire/numeric/scipy_fft.py b/src/aspire/numeric/scipy_fft.py index 3891d45671..0ef5c95f16 100644 --- a/src/aspire/numeric/scipy_fft.py +++ b/src/aspire/numeric/scipy_fft.py @@ -39,3 +39,12 @@ def dct(self, x, **kwargs): def idct(self, x, **kwargs): return sp.fft.idct(x, **kwargs) + + def rfftfreq(self, x, **kwargs): + return sp.fft.rfftfreq(x, **kwargs) + + def irfft(self, x, **kwargs): + return sp.fft.irfft(x, **kwargs) + + def rfft(self, x, **kwargs): + return sp.fft.rfft(x, **kwargs) From 2f1c5e14ea10d178c6f7df338496a230a525fb41 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Tue, 30 Jul 2024 12:38:37 -0400 Subject: [PATCH 175/433] stashing gpu fixes --- src/aspire/image/image.py | 1 + src/aspire/numeric/cupy_fft.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index b589471577..09a7dc56cd 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -225,6 +225,7 @@ def project(self, angles): radial_idx = fft.rfftfreq(n_points) * xp.pi * 2 n_real_points = len(radial_idx) n_angles = len(angles) + angles = xp.asarray(angles) pts = xp.empty((2, n_angles, n_real_points), dtype=self.dtype) pts[0] = radial_idx[xp.newaxis, :] * xp.sin(angles)[:, xp.newaxis] diff --git a/src/aspire/numeric/cupy_fft.py b/src/aspire/numeric/cupy_fft.py index ce537a1cba..b491a0dcd1 100644 --- a/src/aspire/numeric/cupy_fft.py +++ b/src/aspire/numeric/cupy_fft.py @@ -101,9 +101,8 @@ def dct(self, x, **kwargs): def idct(self, x, **kwargs): return cufft.idct(x, **kwargs) - @_preserve_host - def rfftfreq(self, x, **kwargs): - return cufft.rfftfreq(x, **kwargs) + def rfftfreq(self, n, **kwargs): + return cufft.rfftfreq(n, **kwargs) @_preserve_host def irfft(self, x, **kwargs): From f09b671247ce196fa338047146468919c9a32ffe Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Tue, 30 Jul 2024 13:41:05 -0400 Subject: [PATCH 176/433] forward gpu --- src/aspire/config_default.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/config_default.yaml b/src/aspire/config_default.yaml index def78983c0..fed4cea50a 100644 --- a/src/aspire/config_default.yaml +++ b/src/aspire/config_default.yaml @@ -1,9 +1,9 @@ version: 0.12.3 common: # numeric module to use - one of numpy/cupy - numeric: numpy + numeric: cupy # fft backend to use - one of pyfftw/scipy/cupy/mkl - fft: scipy + fft: cupy # Set cache directory for ASPIRE example data. # By default the cache location will be set by pooch.os_cache(), From 668dae6af45bbf1d623684951febe4d6e4482c26 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Fri, 2 Aug 2024 00:52:32 -0400 Subject: [PATCH 177/433] changed backproject to run on gpu (cupy) --- src/aspire/line/line.py | 13 +++++++------ tests/test_sinogram.py | 15 ++++++++++----- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/aspire/line/line.py b/src/aspire/line/line.py index f9c688f71d..fb1b180a6b 100644 --- a/src/aspire/line/line.py +++ b/src/aspire/line/line.py @@ -4,6 +4,7 @@ import aspire.image from aspire.nufft import anufft +from aspire.numeric import fft, xp logger = logging.getLogger(__name__) @@ -114,15 +115,15 @@ def back_project(self, angles): original_stack_shape = self.stack_shape sinogram = self.stack_reshape(-1) L = self.n_radial_points - sinogram = np.fft.ifftshift(sinogram, axes=-1) - sinogram_ft = np.fft.rfft(sinogram, axis=-1) + sinogram = fft.ifftshift(sinogram, axes=-1) + sinogram_ft = fft.rfft(sinogram, axis=-1) # grid generation with real points - y_idx = np.fft.rfftfreq(self.n_radial_points) * np.pi * 2 + y_idx = xp.fft.rfftfreq(self.n_radial_points) * xp.pi * 2 n_real_points = len(y_idx) - pts = np.empty((2, len(angles), n_real_points), dtype=self.dtype) - pts[0] = y_idx[np.newaxis, :] * np.sin(angles)[:, np.newaxis] - pts[1] = y_idx[np.newaxis, :] * np.cos(angles)[:, np.newaxis] + pts = xp.empty((2, len(angles), n_real_points), dtype=self.dtype) + pts[0] = y_idx[xp.newaxis, :] * xp.sin(angles)[:, xp.newaxis] + pts[1] = y_idx[xp.newaxis, :] * xp.cos(angles)[:, xp.newaxis] imgs = anufft( sinogram_ft.reshape(self.n, -1), diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 9b27b10dca..d186866012 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -4,6 +4,7 @@ from skimage.transform import iradon, radon from aspire.image import Image +from aspire.numeric import xp from aspire.utils import grid_2d # Relative tolerance comparing line projections to scikit @@ -146,9 +147,12 @@ def test_project_multidim(num_ang): def test_back_project_single(masked_image, num_ang): """ - Test Line.backproject on a single stack of line projections or sinogram. Compares the reconstructed image to original image. + Test Line.backproject on a single stack of line projections or sinogram. Compares the reconstructed image to original. """ - angles = np.linspace(0, 360, num_ang, endpoint=False) + angles = xp.asarray(np.linspace(0, 360, num_ang, endpoint=False)) + angles_np = xp.asnumpy( + angles + ) # skimage requires numpy array while we're using cupy arrays rads = angles / 180 * np.pi sinogram = masked_image.project(rads) sinogram_np = sinogram.asnumpy() @@ -163,7 +167,7 @@ def test_back_project_single(masked_image, num_ang): our_back_project = back_project.asnumpy()[0] * mask # generating sci-kit image backproject method w/ no filter - sk_image_iradon = iradon(sinogram_np[0].T, theta=angles[::-1], filter_name=None) + sk_image_iradon = iradon(sinogram_np[0].T, theta=angles_np[::-1], filter_name=None) # we apply a normalized root mean square error on the images to find relative error to range of ref. image # Note: tolerance is typically < 0.2 regardless of angles, pixels, etc. @@ -188,7 +192,8 @@ def test_back_project_multidim(num_ang): # Generate images imgs = Image(np.random.random((m, n, L, L))) * mask - angles = np.linspace(0, 360, num_ang, endpoint=False) + angles = xp.asarray(np.linspace(0, 360, num_ang, endpoint=False)) + angles_np = xp.asnumpy(angles) # need this for the skimage transformations rads = angles / 180 * np.pi # apply a forward project on the image, then backwards @@ -209,7 +214,7 @@ def test_back_project_multidim(num_ang): # Next individually compute sk's iradon transform for each image. reference_back_projects[i, j] = iradon( - single_sinogram.asnumpy()[0].T, theta=angles[::-1], filter_name=None + single_sinogram.asnumpy()[0].T, theta=angles_np[::-1], filter_name=None ) # apply a mask, then find the NRMSE on the collection of images From ab0b395243c4ba60fa2d4d351ec6e6d649d4e629 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Fri, 2 Aug 2024 11:20:04 -0400 Subject: [PATCH 178/433] revert config --- src/aspire/config_default.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/config_default.yaml b/src/aspire/config_default.yaml index fed4cea50a..def78983c0 100644 --- a/src/aspire/config_default.yaml +++ b/src/aspire/config_default.yaml @@ -1,9 +1,9 @@ version: 0.12.3 common: # numeric module to use - one of numpy/cupy - numeric: cupy + numeric: numpy # fft backend to use - one of pyfftw/scipy/cupy/mkl - fft: cupy + fft: scipy # Set cache directory for ASPIRE example data. # By default the cache location will be set by pooch.os_cache(), From 7042f3adbad11a3870eb794a372ef38d22f47fd0 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Fri, 2 Aug 2024 12:47:05 -0400 Subject: [PATCH 179/433] fixed gpu issues --- src/aspire/line/line.py | 6 +++--- tests/test_sinogram.py | 13 ++++--------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/aspire/line/line.py b/src/aspire/line/line.py index fb1b180a6b..7787367c3c 100644 --- a/src/aspire/line/line.py +++ b/src/aspire/line/line.py @@ -113,13 +113,13 @@ def back_project(self, angles): ), "Number of angles must match the number of projections" original_stack_shape = self.stack_shape - sinogram = self.stack_reshape(-1) + sinogram = xp.asarray(self.stack_reshape(-1)._data) L = self.n_radial_points sinogram = fft.ifftshift(sinogram, axes=-1) sinogram_ft = fft.rfft(sinogram, axis=-1) # grid generation with real points - y_idx = xp.fft.rfftfreq(self.n_radial_points) * xp.pi * 2 + y_idx = fft.rfftfreq(self.n_radial_points) * xp.pi * 2 n_real_points = len(y_idx) pts = xp.empty((2, len(angles), n_real_points), dtype=self.dtype) pts[0] = y_idx[xp.newaxis, :] * xp.sin(angles)[:, xp.newaxis] @@ -134,4 +134,4 @@ def back_project(self, angles): # normalization which gives us roughly the same error regardless of angles imgs = imgs / (n_real_points * len(angles)) - return aspire.image.Image(imgs).stack_reshape(original_stack_shape) + return aspire.image.Image(xp.asnumpy(imgs)).stack_reshape(original_stack_shape) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index d186866012..ddef7c480f 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -4,7 +4,6 @@ from skimage.transform import iradon, radon from aspire.image import Image -from aspire.numeric import xp from aspire.utils import grid_2d # Relative tolerance comparing line projections to scikit @@ -149,10 +148,7 @@ def test_back_project_single(masked_image, num_ang): """ Test Line.backproject on a single stack of line projections or sinogram. Compares the reconstructed image to original. """ - angles = xp.asarray(np.linspace(0, 360, num_ang, endpoint=False)) - angles_np = xp.asnumpy( - angles - ) # skimage requires numpy array while we're using cupy arrays + angles = np.linspace(0, 360, num_ang, endpoint=False) rads = angles / 180 * np.pi sinogram = masked_image.project(rads) sinogram_np = sinogram.asnumpy() @@ -167,7 +163,7 @@ def test_back_project_single(masked_image, num_ang): our_back_project = back_project.asnumpy()[0] * mask # generating sci-kit image backproject method w/ no filter - sk_image_iradon = iradon(sinogram_np[0].T, theta=angles_np[::-1], filter_name=None) + sk_image_iradon = iradon(sinogram_np[0].T, theta=angles[::-1], filter_name=None) # we apply a normalized root mean square error on the images to find relative error to range of ref. image # Note: tolerance is typically < 0.2 regardless of angles, pixels, etc. @@ -192,8 +188,7 @@ def test_back_project_multidim(num_ang): # Generate images imgs = Image(np.random.random((m, n, L, L))) * mask - angles = xp.asarray(np.linspace(0, 360, num_ang, endpoint=False)) - angles_np = xp.asnumpy(angles) # need this for the skimage transformations + angles = np.linspace(0, 360, num_ang, endpoint=False) rads = angles / 180 * np.pi # apply a forward project on the image, then backwards @@ -214,7 +209,7 @@ def test_back_project_multidim(num_ang): # Next individually compute sk's iradon transform for each image. reference_back_projects[i, j] = iradon( - single_sinogram.asnumpy()[0].T, theta=angles_np[::-1], filter_name=None + single_sinogram.asnumpy()[0].T, theta=angles[::-1], filter_name=None ) # apply a mask, then find the NRMSE on the collection of images From a8d9bd5d7ad1660b65fc6906d530faac8d6cc62e Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Fri, 2 Aug 2024 17:17:39 -0400 Subject: [PATCH 180/433] added angles array --- src/aspire/line/line.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/aspire/line/line.py b/src/aspire/line/line.py index 7787367c3c..4b57867a04 100644 --- a/src/aspire/line/line.py +++ b/src/aspire/line/line.py @@ -117,6 +117,7 @@ def back_project(self, angles): L = self.n_radial_points sinogram = fft.ifftshift(sinogram, axes=-1) sinogram_ft = fft.rfft(sinogram, axis=-1) + angles = xp.asarray(angles) # grid generation with real points y_idx = fft.rfftfreq(self.n_radial_points) * xp.pi * 2 From 170257a1b22682b994ca550cfe36762e1a99b680 Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Tue, 6 Aug 2024 15:48:53 -0400 Subject: [PATCH 181/433] Pr and naming changes --- src/aspire/line/line.py | 34 +++++++++++++++++----------------- tests/test_sinogram.py | 32 +++++++++++++++++++------------- 2 files changed, 36 insertions(+), 30 deletions(-) diff --git a/src/aspire/line/line.py b/src/aspire/line/line.py index 4b57867a04..8efee5b679 100644 --- a/src/aspire/line/line.py +++ b/src/aspire/line/line.py @@ -12,10 +12,14 @@ class Line: def __init__(self, data, dtype=np.float64): """ - Initialize a Line Object. Change later (similar intuition from Image class) + Initialize a Line Object. This is a stack of one or more line projections or sinograms. + + The stack can be multidimensional with 'n' equal to the product + of the stack dimensions. Singletons will be expanded into a stack + with one entry. :param data: Numpy array containing image data with shape - `(..., resolution, resolution)`. + `(..., angles, radial points)`. :param dtype: Optionally cast `data` to this dtype. Defaults to `data.dtype`. """ @@ -23,7 +27,9 @@ def __init__(self, data, dtype=np.float64): if data.ndim == 2: data = data[np.newaxis, :, :] if data.ndim < 3: - assert "Projection Dimensions should be more than Three-Dimensions" + raise ValueError( + f"Invalid data shape: {data.shape}. Expected shape: (..., angles, radial_points), where '...' is the stack number." + ) self._data = data.astype(self.dtype, copy=False) self.ndim = self._data.ndim self.shape = self._data.shape @@ -71,7 +77,7 @@ def stack_reshape(self, *args): # Sanity check the size if shape != (-1,) and np.prod(shape) != self.n: raise ValueError( - f"Number of sinogram images {self.n_images} cannot be reshaped to {shape}." + f"Number of sinogram images {self.n} cannot be reshaped to {shape}." ) return self.__class__(self._data.reshape(*shape, *self._data.shape[-2:])) @@ -94,23 +100,17 @@ def copy(self): def __str__(self): return f"Line(n_images = {self.n}, n_angles = {self.n_points}, n_radial_points = {self.n_radial_points})" - @property - def stack(self): - return self.n_images - - def back_project(self, angles): + def backproject(self, angles): """ Back Projection Method for a single stack of lines. - :param filter_name: string, optional - Filter used in frequency domain filtering. Assign None to use no filter. - :param angles: array - assuming not perfectly radial angles - :return: stack of reconstructed + :param angles: np.ndarray + 1D array of angles in radians. Each entry in the array corresponds to a different number of angles which are used to reconstruct the image. + :return: Aspire Image + An Image object containing the original stack size with a newly reconstructed numpy array of the images. Expected return shape should be (n_images, n_angles, n_radial_points) """ - assert ( - len(angles) == self.n_angles - ), "Number of angles must match the number of projections" + if len(angles) != self.n_angles: + raise ValueError("Number of angles must match the number of projections.") original_stack_shape = self.stack_shape sinogram = xp.asarray(self.stack_reshape(-1)._data) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index ddef7c480f..ed729d0b6f 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -144,15 +144,18 @@ def test_project_multidim(num_ang): ) -def test_back_project_single(masked_image, num_ang): +def test_backproject_single(masked_image, num_ang): """ - Test Line.backproject on a single stack of line projections or sinogram. Compares the reconstructed image to original. + Test Line.backproject on a single stack of line projections (sinograms). + + This test compares the reconstructed image from the `backproject` method to + the skimage method `iradon.` """ angles = np.linspace(0, 360, num_ang, endpoint=False) rads = angles / 180 * np.pi sinogram = masked_image.project(rads) sinogram_np = sinogram.asnumpy() - back_project = sinogram.back_project(rads) + back_project = sinogram.backproject(rads) assert masked_image.shape == back_project.shape, "The shape must be the same." @@ -168,16 +171,18 @@ def test_back_project_single(masked_image, num_ang): # we apply a normalized root mean square error on the images to find relative error to range of ref. image # Note: tolerance is typically < 0.2 regardless of angles, pixels, etc. nrmse = np.sqrt(np.mean((our_back_project - sk_image_iradon) ** 2)) / ( - np.max(sk_image_iradon - np.min(sk_image_iradon)) + np.max(sk_image_iradon) - np.min(sk_image_iradon) ) assert ( nrmse < SK_TOL_BACKPROJECT ), f"NRMSE is too high: {nrmse}, expected less than {SK_TOL_BACKPROJECT}" -def test_back_project_multidim(num_ang): +def test_backproject_multidim(num_ang): """ - Test Line.backproject on a stack of images. Extension of back_project_single but for multi-dimensional stacks. Similar to forward_multidim test. + Test Line.backproject on a stack of line projections. + + Extension of the `backproject_single` test but checks for multi-dimensional stacks. """ L = 512 # pixels n = 3 @@ -193,7 +198,7 @@ def test_back_project_multidim(num_ang): # apply a forward project on the image, then backwards ours_forward = imgs.project(rads) - ours_backward = ours_forward.back_project(rads) + ours_backward = ours_forward.backproject(rads) # Compare reference_back_projects = np.empty((m, n, L, L)) @@ -202,7 +207,7 @@ def test_back_project_multidim(num_ang): img = imgs[i, j] # Compute the singleton case, and compare with stack. single_sinogram = img.project(rads) - back_project = single_sinogram.back_project(rads) + back_project = single_sinogram.backproject(rads) # These should be allclose up to determinism. np.testing.assert_allclose(ours_backward[i, j : j + 1], back_project[0]) @@ -212,11 +217,12 @@ def test_back_project_multidim(num_ang): single_sinogram.asnumpy()[0].T, theta=angles[::-1], filter_name=None ) - # apply a mask, then find the NRMSE on the collection of images - # similar tolerance level to single project test + # apply a mask, then find the NRMSE on the collection of images + # similar tolerance level to single project test nrmse = np.sqrt( np.mean((ours_backward.asnumpy() * mask - reference_back_projects) ** 2) ) / (np.max(reference_back_projects) - np.min(reference_back_projects)) - assert ( - nrmse < SK_TOL_BACKPROJECT - ), f"NRMSE is too high for image ({i},{j}): {nrmse}, expected less than {SK_TOL_BACKPROJECT}" + + np.testing.assert_array_less( + nrmse, SK_TOL_BACKPROJECT, "Error with the reconstructed images." + ) From af7ff4e75e085812447f7f50c1ec7417a7fa2ec0 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 8 Aug 2024 15:42:46 -0400 Subject: [PATCH 182/433] fixup backproject tranform and tests --- src/aspire/line/line.py | 4 +++- tests/test_sinogram.py | 30 +++++++++++++++++++----------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/aspire/line/line.py b/src/aspire/line/line.py index 8efee5b679..44202e04d8 100644 --- a/src/aspire/line/line.py +++ b/src/aspire/line/line.py @@ -117,6 +117,8 @@ def backproject(self, angles): L = self.n_radial_points sinogram = fft.ifftshift(sinogram, axes=-1) sinogram_ft = fft.rfft(sinogram, axis=-1) + sinogram_ft *= xp.pi # Fix scale to match + sinogram_ft[..., 0] /= 2 # Fix DC angles = xp.asarray(angles) # grid generation with real points @@ -134,5 +136,5 @@ def backproject(self, angles): ).reshape(self.n, L, L) # normalization which gives us roughly the same error regardless of angles - imgs = imgs / (n_real_points * len(angles)) + imgs = imgs / (self.n_radial_points * len(angles)) return aspire.image.Image(xp.asnumpy(imgs)).stack_reshape(original_stack_shape) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index ed729d0b6f..6da1ee8211 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -10,7 +10,7 @@ # The same tolerance will be used in all scikit forward and backward comparisons SK_TOL_FORWARDPROJECT = 0.005 -SK_TOL_BACKPROJECT = 0.2 +SK_TOL_BACKPROJECT = 0.0025 IMG_SIZES = [ 511, @@ -162,19 +162,18 @@ def test_backproject_single(masked_image, num_ang): # generate circular mask w/ radius 1 to reconstructed image # aim to remove discrepencies for the edges of the image g = grid_2d(back_project.resolution, normalized=True, shifted=True) - mask = g["r"] < 1 + mask = g["r"] < 0.99 our_back_project = back_project.asnumpy()[0] * mask # generating sci-kit image backproject method w/ no filter - sk_image_iradon = iradon(sinogram_np[0].T, theta=angles[::-1], filter_name=None) + sk_image_iradon = iradon(sinogram_np[0].T, theta=-angles, filter_name=None) * mask # we apply a normalized root mean square error on the images to find relative error to range of ref. image - # Note: tolerance is typically < 0.2 regardless of angles, pixels, etc. nrmse = np.sqrt(np.mean((our_back_project - sk_image_iradon) ** 2)) / ( np.max(sk_image_iradon) - np.min(sk_image_iradon) ) - assert ( - nrmse < SK_TOL_BACKPROJECT + np.testing.assert_array_less( + nrmse, SK_TOL_BACKPROJECT ), f"NRMSE is too high: {nrmse}, expected less than {SK_TOL_BACKPROJECT}" @@ -189,7 +188,7 @@ def test_backproject_multidim(num_ang): m = 2 g = grid_2d(L, normalized=True, shifted=True) - mask = g["r"] < 1 + mask = g["r"] < 0.99 # Generate images imgs = Image(np.random.random((m, n, L, L))) * mask @@ -213,15 +212,24 @@ def test_backproject_multidim(num_ang): np.testing.assert_allclose(ours_backward[i, j : j + 1], back_project[0]) # Next individually compute sk's iradon transform for each image. - reference_back_projects[i, j] = iradon( - single_sinogram.asnumpy()[0].T, theta=angles[::-1], filter_name=None + reference_back_projects[i, j] = ( + iradon( + single_sinogram.asnumpy()[0].T, theta=-1 * angles, filter_name=None + ) + * mask ) # apply a mask, then find the NRMSE on the collection of images # similar tolerance level to single project test nrmse = np.sqrt( - np.mean((ours_backward.asnumpy() * mask - reference_back_projects) ** 2) - ) / (np.max(reference_back_projects) - np.min(reference_back_projects)) + np.mean( + (ours_backward.asnumpy() * mask - reference_back_projects), axis=(-2, -1) + ) + ** 2 + ) / ( + np.max(reference_back_projects, axis=(-2, -1)) + - np.min(reference_back_projects, axis=(-2, -1)) + ) np.testing.assert_array_less( nrmse, SK_TOL_BACKPROJECT, "Error with the reconstructed images." From 771530f12d771ae484db725b14ed6f910b2689f3 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 9 Aug 2024 11:26:45 -0400 Subject: [PATCH 183/433] Changed name Line to Sinogram in dir/code/imports --- src/aspire/image/image.py | 4 ++-- src/aspire/line/__init__.py | 1 - src/aspire/sinogram/__init__.py | 1 + src/aspire/{line/line.py => sinogram/sinogram.py} | 10 +++++----- tests/test_sinogram.py | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 src/aspire/line/__init__.py create mode 100644 src/aspire/sinogram/__init__.py rename src/aspire/{line/line.py => sinogram/sinogram.py} (92%) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 09a7dc56cd..57b32041cd 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -8,7 +8,7 @@ from PIL import Image as PILImage from scipy.linalg import lstsq -import aspire.line +import aspire.sinogram import aspire.volume from aspire.nufft import anufft, nufft from aspire.numeric import fft, xp @@ -240,7 +240,7 @@ def project(self, angles): # Radon transform, output: (stack size, angles, points) image_rt = fft.fftshift(fft.irfft(image_ft, n=n_points, axis=-1), axes=-1) image_rt = image_rt.reshape(*original_stack, n_angles, n_points) - return aspire.line.Line(xp.asnumpy(image_rt)) + return aspire.sinogram.Sinogram(xp.asnumpy(image_rt)) @property def res(self): diff --git a/src/aspire/line/__init__.py b/src/aspire/line/__init__.py deleted file mode 100644 index d3856d67ad..0000000000 --- a/src/aspire/line/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .line import Line diff --git a/src/aspire/sinogram/__init__.py b/src/aspire/sinogram/__init__.py new file mode 100644 index 0000000000..98e489eedf --- /dev/null +++ b/src/aspire/sinogram/__init__.py @@ -0,0 +1 @@ +from .sinogram import Sinogram diff --git a/src/aspire/line/line.py b/src/aspire/sinogram/sinogram.py similarity index 92% rename from src/aspire/line/line.py rename to src/aspire/sinogram/sinogram.py index 44202e04d8..2eea4f0c1a 100644 --- a/src/aspire/line/line.py +++ b/src/aspire/sinogram/sinogram.py @@ -9,10 +9,10 @@ logger = logging.getLogger(__name__) -class Line: +class Sinogram: def __init__(self, data, dtype=np.float64): """ - Initialize a Line Object. This is a stack of one or more line projections or sinograms. + Initialize a Sinogram Object. This is a stack of one or more line projections or sinograms. The stack can be multidimensional with 'n' equal to the product of the stack dimensions. Singletons will be expanded into a stack @@ -47,7 +47,7 @@ def __init__(self, data, dtype=np.float64): def _check_key_dims(self, key): if isinstance(key, tuple) and (len(key) > self._data.ndim): raise ValueError( - f"Line stack_dim is {self.stack_n_dim}, slice length must be =< {self.n_dim}" + f"Sinogram stack_dim is {self.stack_n_dim}, slice length must be =< {self.n_dim}" ) def __getitem__(self, key): @@ -64,7 +64,7 @@ def stack_reshape(self, *args): :*args: Integer(s) or tuple describing the intended shape. - :returns: Line instance + :returns: Sinogram instance """ # If we're passed a tuple, use that @@ -98,7 +98,7 @@ def copy(self): return self.__class__(self._data.copy()) def __str__(self): - return f"Line(n_images = {self.n}, n_angles = {self.n_points}, n_radial_points = {self.n_radial_points})" + return f"Sinogram(n_images = {self.n}, n_angles = {self.n_points}, n_radial_points = {self.n_radial_points})" def backproject(self, angles): """ diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 6da1ee8211..a553034cdf 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -6,7 +6,7 @@ from aspire.image import Image from aspire.utils import grid_2d -# Relative tolerance comparing line projections to scikit +# Relative tolerance comparing sinogram projections to scikit # The same tolerance will be used in all scikit forward and backward comparisons SK_TOL_FORWARDPROJECT = 0.005 @@ -146,7 +146,7 @@ def test_project_multidim(num_ang): def test_backproject_single(masked_image, num_ang): """ - Test Line.backproject on a single stack of line projections (sinograms). + Test Sinogram.backproject on a single stack of line projections (sinograms). This test compares the reconstructed image from the `backproject` method to the skimage method `iradon.` @@ -179,7 +179,7 @@ def test_backproject_single(masked_image, num_ang): def test_backproject_multidim(num_ang): """ - Test Line.backproject on a stack of line projections. + Test Sinogram.backproject on a stack of line projections. Extension of the `backproject_single` test but checks for multi-dimensional stacks. """ From c8484a8b1fba12d27211bf0570002ceede04db21 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 9 Aug 2024 11:31:12 -0400 Subject: [PATCH 184/433] cleaned up tox syntax remarks --- tests/test_sinogram.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index a553034cdf..16241b5a14 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -97,7 +97,7 @@ def test_project_single(masked_image, num_ang): ) / np.linalg.norm(reference_sinogram, axis=-1) np.testing.assert_array_less( - nrms, SK_TOL_FORWARDPROJECT, "Error in image projections." + nrms, SK_TOL_FORWARDPROJECT, err_msg="Error in image projections." ) @@ -140,7 +140,7 @@ def test_project_multidim(num_ang): reference_sinograms, axis=-1 ) np.testing.assert_array_less( - _nrms, SK_TOL_FORWARDPROJECT, "Error in image projections." + _nrms, SK_TOL_FORWARDPROJECT, err_msg="Error in image projections." ) @@ -173,8 +173,10 @@ def test_backproject_single(masked_image, num_ang): np.max(sk_image_iradon) - np.min(sk_image_iradon) ) np.testing.assert_array_less( - nrmse, SK_TOL_BACKPROJECT - ), f"NRMSE is too high: {nrmse}, expected less than {SK_TOL_BACKPROJECT}" + nrmse, + SK_TOL_BACKPROJECT, + err_msg=f"NRMSE is too high: {nrmse}, expected less than {SK_TOL_BACKPROJECT}", + ) def test_backproject_multidim(num_ang): @@ -232,5 +234,5 @@ def test_backproject_multidim(num_ang): ) np.testing.assert_array_less( - nrmse, SK_TOL_BACKPROJECT, "Error with the reconstructed images." + nrmse, SK_TOL_BACKPROJECT, err_msg="Error with the reconstructed images." ) From d58d6fffa76b3ada89a5752b5e2087ed1d0352aa Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Thu, 15 Aug 2024 13:42:55 -0400 Subject: [PATCH 185/433] fixed docs --- src/aspire/sinogram/sinogram.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/aspire/sinogram/sinogram.py b/src/aspire/sinogram/sinogram.py index 2eea4f0c1a..404fcdd790 100644 --- a/src/aspire/sinogram/sinogram.py +++ b/src/aspire/sinogram/sinogram.py @@ -105,9 +105,12 @@ def backproject(self, angles): Back Projection Method for a single stack of lines. :param angles: np.ndarray - 1D array of angles in radians. Each entry in the array corresponds to a different number of angles which are used to reconstruct the image. - :return: Aspire Image - An Image object containing the original stack size with a newly reconstructed numpy array of the images. Expected return shape should be (n_images, n_angles, n_radial_points) + 1D array of angles in radians. Each entry in the array + corresponds to a different number of angles which are used to + reconstruct the image. + :return: An Image object containing the original stack size + with a newly reconstructed numpy array of the images. + Expected return shape should be (..., n_radial_points, n_radial_points) """ if len(angles) != self.n_angles: raise ValueError("Number of angles must match the number of projections.") From 700468bcbe8f3c38c8082eceb9c83f60bd49b3ca Mon Sep 17 00:00:00 2001 From: Marc Karimi Date: Mon, 19 Aug 2024 13:30:43 -0400 Subject: [PATCH 186/433] fixed minor errors and created tests for str, repr methods --- src/aspire/sinogram/sinogram.py | 26 +++++++++++++++++++------- tests/test_sinogram.py | 32 +++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 8 deletions(-) diff --git a/src/aspire/sinogram/sinogram.py b/src/aspire/sinogram/sinogram.py index 404fcdd790..e4d1f23784 100644 --- a/src/aspire/sinogram/sinogram.py +++ b/src/aspire/sinogram/sinogram.py @@ -10,11 +10,11 @@ class Sinogram: - def __init__(self, data, dtype=np.float64): + def __init__(self, data, dtype=None): """ Initialize a Sinogram Object. This is a stack of one or more line projections or sinograms. - The stack can be multidimensional with 'n' equal to the product + The stack can be multidimensional with 'self.n' equal to the product of the stack dimensions. Singletons will be expanded into a stack with one entry. @@ -22,14 +22,21 @@ def __init__(self, data, dtype=np.float64): `(..., angles, radial points)`. :param dtype: Optionally cast `data` to this dtype. Defaults to `data.dtype`. + + :return: Sinogram instance holding `data`. """ - self.dtype = np.dtype(dtype) + if dtype is None: + self.dtype = data.dtype + else: + self.dtype = np.dtype(dtype) + if data.ndim == 2: data = data[np.newaxis, :, :] if data.ndim < 3: raise ValueError( f"Invalid data shape: {data.shape}. Expected shape: (..., angles, radial_points), where '...' is the stack number." ) + self._data = data.astype(self.dtype, copy=False) self.ndim = self._data.ndim self.shape = self._data.shape @@ -64,7 +71,7 @@ def stack_reshape(self, *args): :*args: Integer(s) or tuple describing the intended shape. - :returns: Sinogram instance + :return: Sinogram instance """ # If we're passed a tuple, use that @@ -98,7 +105,13 @@ def copy(self): return self.__class__(self._data.copy()) def __str__(self): - return f"Sinogram(n_images = {self.n}, n_angles = {self.n_points}, n_radial_points = {self.n_radial_points})" + return f"Sinogram(n_images = {self.n}, n_angles = {self.n_angles}, n_radial_points = {self.n_radial_points})" + + def __repr__(self): + msg = f"Sinogram: {self.n} images of dtype {self.dtype}, " + msg += f"arranged as a stack with shape {self.stack_shape}. " + msg += f"Each image has {self.n_angles} angles and {self.n_radial_points} radial points." + return msg def backproject(self, angles): """ @@ -106,7 +119,7 @@ def backproject(self, angles): :param angles: np.ndarray 1D array of angles in radians. Each entry in the array - corresponds to a different number of angles which are used to + corresponds to different angles which are used to reconstruct the image. :return: An Image object containing the original stack size with a newly reconstructed numpy array of the images. @@ -138,6 +151,5 @@ def backproject(self, angles): real=True, ).reshape(self.n, L, L) - # normalization which gives us roughly the same error regardless of angles imgs = imgs / (self.n_radial_points * len(angles)) return aspire.image.Image(xp.asnumpy(imgs)).stack_reshape(original_stack_shape) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 16241b5a14..66b6ac830a 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -62,7 +62,7 @@ def masked_image(dtype, img_size): Creates a masked image fixture using camera data from Scikit-Image. """ g = grid_2d(img_size, normalized=True, shifted=True) - mask = g["r"] < 1 + mask = g["r"] < 0.99 image = data.camera().astype(dtype) image = image[:img_size, :img_size] @@ -236,3 +236,33 @@ def test_backproject_multidim(num_ang): np.testing.assert_array_less( nrmse, SK_TOL_BACKPROJECT, err_msg="Error with the reconstructed images." ) + + +# testing the str method +def test_sinogram_str_method(masked_image, num_ang): + angles = np.linspace(0, 360, num_ang, endpoint=False) + rads = angles / 180 * np.pi + sinogram = masked_image.project(rads) + n_images = sinogram.n + n_angles = sinogram.n_angles + n_radial_points = sinogram.n_radial_points + expected_str = f"Sinogram(n_images = {n_images}, n_angles = {n_angles}, n_radial_points = {n_radial_points})" + assert str(sinogram) == expected_str + + +# testing the repr method +def test_sinogram_repr_method(masked_image, num_ang): + angles = np.linspace(0, 360, num_ang, endpoint=False) + rads = angles / 180 * np.pi + sinogram = masked_image.project(rads) + n_images = sinogram.n + dtype = sinogram.dtype + stack_shape = sinogram.stack_shape + n_angles = sinogram.n_angles + n_radial_points = sinogram.n_radial_points + expected_repr = ( + f"Sinogram: {n_images} images of dtype {dtype}, " + f"arranged as a stack with shape {stack_shape}. " + f"Each image has {n_angles} angles and {n_radial_points} radial points." + ) + assert repr(sinogram) == expected_repr From ffd43c846f7cb39a2652e3c32e882945021e9516 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 26 Aug 2024 09:11:53 -0400 Subject: [PATCH 187/433] Back Project ~> Backproject --- src/aspire/sinogram/sinogram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/sinogram/sinogram.py b/src/aspire/sinogram/sinogram.py index e4d1f23784..34451a396d 100644 --- a/src/aspire/sinogram/sinogram.py +++ b/src/aspire/sinogram/sinogram.py @@ -115,7 +115,7 @@ def __repr__(self): def backproject(self, angles): """ - Back Projection Method for a single stack of lines. + Backprojection method for a single stack of lines. :param angles: np.ndarray 1D array of angles in radians. Each entry in the array From dfa708c31d92443a643a229aa9a70a887ef1a859 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 26 Aug 2024 09:12:29 -0400 Subject: [PATCH 188/433] replace `_data` in test_sinagram --- tests/test_sinogram.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 66b6ac830a..bbf448db97 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -88,12 +88,13 @@ def test_project_single(masked_image, num_ang): # the original author of this method. # # Note, transpose sk output to match (angles, points) - reference_sinogram = radon(masked_image._data[0], theta=angles[::-1]).T + # Note, `radon` does not admit read only views, so the slice is copied. + reference_sinogram = radon(masked_image.asnumpy()[0].copy(), theta=angles[::-1]).T assert reference_sinogram.shape == (len(angles), ny), "Incorrect Shape" # compare project method on ski-image reference nrms = np.sqrt( - np.mean((s[0]._data - reference_sinogram) ** 2, axis=-1) + np.mean((s[0].asnumpy() - reference_sinogram) ** 2, axis=-1) ) / np.linalg.norm(reference_sinogram, axis=-1) np.testing.assert_array_less( @@ -134,7 +135,10 @@ def test_project_multidim(num_ang): np.testing.assert_allclose(s[i, j : j + 1], single_sinogram) # Next individually compute sk's radon transform for each image. - reference_sinograms[i, j] = radon(img._data[0], theta=angles[::-1]).T + # Note, `radon` does not admit read only views, so the slice is copied. + reference_sinograms[i, j] = radon( + img.asnumpy()[0].copy(), theta=angles[::-1] + ).T _nrms = np.sqrt(np.mean((s - reference_sinograms) ** 2, axis=-1)) / np.linalg.norm( reference_sinograms, axis=-1 From 8af26fa994ec1ffa0d72096f00326c0e77023e74 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 27 Mar 2024 14:48:21 -0400 Subject: [PATCH 189/433] init add --- src/aspire/abinitio/commonline_sync3n.py | 269 +++++++++++++++++++++++ 1 file changed, 269 insertions(+) create mode 100644 src/aspire/abinitio/commonline_sync3n.py diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py new file mode 100644 index 0000000000..a31ec87032 --- /dev/null +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -0,0 +1,269 @@ +import logging + +import numpy as np +from numpy.linalg import eigh, norm, svd + +from aspire.abinitio import CLOrient3D, SyncVotingMixin +from aspire.operators import PolarFT +from aspire.utils import ( + J_conjugate, + Rotation, + all_pairs, + all_triplets, + anorm, + cyclic_rotations, + tqdm, + trange, +) +from aspire.utils.random import randn + +logger = logging.getLogger(__name__) + + +class CLSync3N(CLOrient3D, SyncVotingMixin): + """ + Define a class to estimate 3D orientations using common lines (2017) methods. + """ + + def __init__( + self, + src, + n_rad=None, + n_theta=None, + max_shift=0.15, + shift_step=1, + epsilon=1e-3, + max_iters=1000, + degree_res=1, + seed=None, + mask=True, + ): + """ + Initialize object for estimating 3D orientations. + + :param src: The source object of 2D denoised or class-averaged images with metadata + :param n_rad: The number of points in the radial direction + :param n_theta: The number of points in the theta direction + :param max_shift: Maximum range for shifts as a proportion of resolution. Default = 0.15. + :param shift_step: Resolution of shift estimation in pixels. Default = 1 pixel. + :param epsilon: Tolerance for the power method. + :param max_iter: Maximum iterations for the power method. + :param degree_res: Degree resolution for estimating in-plane rotations. + :param seed: Optional seed for RNG. + :param mask: Option to mask `src.images` with a fuzzy mask (boolean). + Default, `True`, applies a mask. + """ + + super().__init__( + src, + n_rad=n_rad, + n_theta=n_theta, + max_shift=max_shift, + shift_step=shift_step, + mask=mask, + ) + + self.epsilon = epsilon + self.max_iters = max_iters + self.degree_res = degree_res + self.seed = seed + + def estimate_rotations(self): + """ + Estimate rotation matrices for molecules with C3 or C4 symmetry. + + :return: Array of rotation matrices, size n_imgx3x3. + """ + Rij0 = self._estimate_relative_viewing_directions() + + logger.info("Performing global handedness synchronization.") + Rij = self._global_J_sync(Rij0) + + # sync3n + S = cryo_sync3n_syncmatrix(Rij) + + # optionally S weights + + # S to rot + # cryo_sync3n_S_to_rot(S) + + self.rotations = Ris + + ########################################### + # The hackberries taste like hackberries # + ########################################### + def cryo_sync3n_S_to_rot(S): + """ + S is (n_img, n_img, 3,3) + """ + + # Convert S to stupid shape + S = np.transpose(S, (0, 2, 1, 3)).reshape(3 * n_img, 3 * n_img) + + # Extract three eigenvectors corresponding to non-zero eigenvalues. + d, v = stable_eigsh(S, 10) + sort_idx = np.argsort(-d) + logger.info( + f"Top 10 eigenvalues from synchronization voting matrix: {d[sort_idx]}" + ) + + # Only need the top 3 eigen-vectors. + v = v[:, sort_idx[:3]] + + v1 = v[: 3 * n_img : 3].T.copy() + v2 = v[1 : 3 * n_img : 3].T.copy() + v3 = v[2 : 3 * n_img : 3].T.copy() + + rotations = np.empty((n_img, 3, 3), dtype=self.dtype) + rotations[:, :, 0] = v1.T + rotations[:, :, 1] = v2.T + rotations[:, :, 2] = v3.T + # Make sure that we got rotations by enforcing R to be + # a rotation (in case the error is large) + rotations = nearest_rotations(rotations) + + return rotations + + def cryo_sync3n_syncmatrix(Rij): + + S = np.zeros((self.n_img, self.n_img, 3, 3), dtype=self.dtype) + I = np.eye(3, dtype=self.dtype) + + idx = 0 + for i in range(self.n_img): + # S( (3*i-2):(3*i) , (3*i-2):(3*i) ) = I; % Rii = I + S[i, i] = I + for j in range(i + 1, N): + idx += 1 + # S( (3*i-2):(3*i) , (3*j-2):(3*j) ) = Rij(:,:,idx); % Rij + S[i, j] = Rij[idx] + # S( (3*j-2):(3*j) , (3*i-2):(3*i) ) = Rij(:,:,idx)'; % Rji = Rij' + S[j, i] = Rij[idx].T + + return S + + ########################################### + # Primary Methods # + ########################################### + + def _estimate_relative_viewing_directions(self): + """ + Estimate the relative viewing directions vij = vi*vj^T, i epsilon: + itr += 1 + vec_new = self._signs_times_v(vijs, vec) + vec_new = vec_new / norm(vec_new) + residual = norm(vec_new - vec) + vec = vec_new + logger.info( + f"Iteration {itr}, residual {round(residual, 5)} (target {epsilon})" + ) + + # We need only the signs of the eigenvector + J_sync = np.sign(vec) + + return J_sync From 08238c4341049f6e0a1c59fc7545d4f98a5a4e31 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 27 Mar 2024 16:19:48 -0400 Subject: [PATCH 190/433] fix typos --- src/aspire/abinitio/__init__.py | 1 + src/aspire/abinitio/commonline_sync3n.py | 112 ++++++++++++++++++++--- 2 files changed, 100 insertions(+), 13 deletions(-) diff --git a/src/aspire/abinitio/__init__.py b/src/aspire/abinitio/__init__.py index ff14cc2d45..9d4b0f483c 100644 --- a/src/aspire/abinitio/__init__.py +++ b/src/aspire/abinitio/__init__.py @@ -4,6 +4,7 @@ # isort: off from .commonline_sync import CLSyncVoting +from .commonline_sync3n import CLSync3N from .commonline_c3_c4 import CLSymmetryC3C4 from .commonline_cn import CLSymmetryCn from .commonline_c2 import CLSymmetryC2 diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index a31ec87032..efe6c8b179 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -16,6 +16,8 @@ trange, ) from aspire.utils.random import randn +from aspire.utils.matlab_compat import stable_eigsh +from aspire.utils import nearest_rotations logger = logging.getLogger(__name__) @@ -32,7 +34,7 @@ def __init__( n_theta=None, max_shift=0.15, shift_step=1, - epsilon=1e-3, + epsilon=1e-2, max_iters=1000, degree_res=1, seed=None, @@ -80,25 +82,25 @@ def estimate_rotations(self): Rij = self._global_J_sync(Rij0) # sync3n - S = cryo_sync3n_syncmatrix(Rij) + S = self.cryo_sync3n_syncmatrix(Rij) # optionally S weights # S to rot - # cryo_sync3n_S_to_rot(S) + Ris = self.cryo_sync3n_S_to_rot(S) self.rotations = Ris ########################################### # The hackberries taste like hackberries # ########################################### - def cryo_sync3n_S_to_rot(S): + def cryo_sync3n_S_to_rot(self, S): """ S is (n_img, n_img, 3,3) """ # Convert S to stupid shape - S = np.transpose(S, (0, 2, 1, 3)).reshape(3 * n_img, 3 * n_img) + S = np.transpose(S, (0, 2, 1, 3)).reshape(3 * self.n_img, 3 * self.n_img) # Extract three eigenvectors corresponding to non-zero eigenvalues. d, v = stable_eigsh(S, 10) @@ -110,11 +112,11 @@ def cryo_sync3n_S_to_rot(S): # Only need the top 3 eigen-vectors. v = v[:, sort_idx[:3]] - v1 = v[: 3 * n_img : 3].T.copy() - v2 = v[1 : 3 * n_img : 3].T.copy() - v3 = v[2 : 3 * n_img : 3].T.copy() + v1 = v[: 3 * self.n_img : 3].T.copy() + v2 = v[1 : 3 * self.n_img : 3].T.copy() + v3 = v[2 : 3 * self.n_img : 3].T.copy() - rotations = np.empty((n_img, 3, 3), dtype=self.dtype) + rotations = np.empty((self.n_img, 3, 3), dtype=self.dtype) rotations[:, :, 0] = v1.T rotations[:, :, 1] = v2.T rotations[:, :, 2] = v3.T @@ -124,7 +126,7 @@ def cryo_sync3n_S_to_rot(S): return rotations - def cryo_sync3n_syncmatrix(Rij): + def cryo_sync3n_syncmatrix(self, Rij): S = np.zeros((self.n_img, self.n_img, 3, 3), dtype=self.dtype) I = np.eye(3, dtype=self.dtype) @@ -133,12 +135,12 @@ def cryo_sync3n_syncmatrix(Rij): for i in range(self.n_img): # S( (3*i-2):(3*i) , (3*i-2):(3*i) ) = I; % Rii = I S[i, i] = I - for j in range(i + 1, N): - idx += 1 + for j in range(i + 1, self.n_img): # S( (3*i-2):(3*i) , (3*j-2):(3*j) ) = Rij(:,:,idx); % Rij S[i, j] = Rij[idx] # S( (3*j-2):(3*j) , (3*i-2):(3*i) ) = Rij(:,:,idx)'; % Rji = Rij' S[j, i] = Rij[idx].T + idx += 1 return S @@ -156,7 +158,7 @@ def _estimate_relative_viewing_directions(self): self.build_clmatrix() # Step 4: Calculate relative rotations - Rijs = self._estimate_all_Rijs_c3_c4(clmatrix) + Rijs = self._estimate_all_Rijs_c3_c4(self.clmatrix) return Rijs @@ -267,3 +269,87 @@ def _J_sync_power_method(self, vijs): J_sync = np.sign(vec) return J_sync + def _signs_times_v(self, vijs, vec): + """ + Multiplication of the J-synchronization matrix by a candidate eigenvector. + + The J-synchronization matrix is a matrix representation of the handedness graph, Gamma, whose set of + nodes consists of the estimates vijs and whose set of edges consists of the undirected edges between + all triplets of estimates vij, vjk, and vik, where i Date: Tue, 2 Apr 2024 11:33:49 -0400 Subject: [PATCH 191/433] cleanup S init and usage, func names, etc --- src/aspire/abinitio/commonline_sync3n.py | 103 +++++++++++------------ 1 file changed, 51 insertions(+), 52 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index efe6c8b179..ce41d687f0 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -1,30 +1,19 @@ import logging import numpy as np -from numpy.linalg import eigh, norm, svd +from numpy.linalg import norm from aspire.abinitio import CLOrient3D, SyncVotingMixin -from aspire.operators import PolarFT -from aspire.utils import ( - J_conjugate, - Rotation, - all_pairs, - all_triplets, - anorm, - cyclic_rotations, - tqdm, - trange, -) -from aspire.utils.random import randn +from aspire.utils import J_conjugate, all_pairs, all_triplets, nearest_rotations from aspire.utils.matlab_compat import stable_eigsh -from aspire.utils import nearest_rotations +from aspire.utils.random import randn logger = logging.getLogger(__name__) class CLSync3N(CLOrient3D, SyncVotingMixin): """ - Define a class to estimate 3D orientations using common lines (2017) methods. + Define a class to estimate 3D orientations using common lines Sync3N methods (2017). """ def __init__( @@ -70,78 +59,87 @@ def __init__( self.degree_res = degree_res self.seed = seed + ########################################### + # High level algorithm steps # + ########################################### def estimate_rotations(self): """ - Estimate rotation matrices for molecules with C3 or C4 symmetry. + Estimate rotation matrices. :return: Array of rotation matrices, size n_imgx3x3. """ + + # Initial estimate of viewing directions Rij0 = self._estimate_relative_viewing_directions() - logger.info("Performing global handedness synchronization.") + # Compute and apply global handedness Rij = self._global_J_sync(Rij0) - # sync3n - S = self.cryo_sync3n_syncmatrix(Rij) + # Build sync3n matrix + S = self._construct_sync3n_matrix(Rij) - # optionally S weights + # Optionally S weights + # todo - # S to rot - Ris = self.cryo_sync3n_S_to_rot(S) + # Yield rotations from S + Ris = self._sync3n_S_to_rot(S) self.rotations = Ris ########################################### # The hackberries taste like hackberries # ########################################### - def cryo_sync3n_S_to_rot(self, S): + def _sync3n_S_to_rot(self, S, n_eigs=4): """ - S is (n_img, n_img, 3,3) + Use eigen decomposition of S to estimate transforms, + then project transforms to nearest rotations. """ - # Convert S to stupid shape - S = np.transpose(S, (0, 2, 1, 3)).reshape(3 * self.n_img, 3 * self.n_img) + if n_eigs < 3: + raise ValueError( + f"n_eigs must be greater than 3, default is 4. Invoked with {n_eigs}" + ) # Extract three eigenvectors corresponding to non-zero eigenvalues. - d, v = stable_eigsh(S, 10) + d, v = stable_eigsh(S, n_eigs) sort_idx = np.argsort(-d) logger.info( - f"Top 10 eigenvalues from synchronization voting matrix: {d[sort_idx]}" + f"Top {n_eigs} eigenvalues from synchronization voting matrix: {d[sort_idx]}" ) # Only need the top 3 eigen-vectors. v = v[:, sort_idx[:3]] - v1 = v[: 3 * self.n_img : 3].T.copy() - v2 = v[1 : 3 * self.n_img : 3].T.copy() - v3 = v[2 : 3 * self.n_img : 3].T.copy() + # Yield estimated rotations from the eigen-vectors + v = v.reshape(3, self.n_img, 3) + rotations = np.transpose(v, (1, 0, 2)) # Check, may be (1, 2 , 0) for T - rotations = np.empty((self.n_img, 3, 3), dtype=self.dtype) - rotations[:, :, 0] = v1.T - rotations[:, :, 1] = v2.T - rotations[:, :, 2] = v3.T - # Make sure that we got rotations by enforcing R to be - # a rotation (in case the error is large) + # Enforce we are returning actual rotations rotations = nearest_rotations(rotations) return rotations - def cryo_sync3n_syncmatrix(self, Rij): + def _construct_sync3n_matrix(self, Rij): + """ + Construct sync3n matrix from estimated rotations Rij. + """ - S = np.zeros((self.n_img, self.n_img, 3, 3), dtype=self.dtype) - I = np.eye(3, dtype=self.dtype) + # Initialize S with diag identity blocks + n = self.n_img + S = np.eye(3 * n, dtype=self.dtype).reshape(n, 3, n, 3) idx = 0 - for i in range(self.n_img): - # S( (3*i-2):(3*i) , (3*i-2):(3*i) ) = I; % Rii = I - S[i, i] = I - for j in range(i + 1, self.n_img): + for i in range(n): + for j in range(i + 1, n): # S( (3*i-2):(3*i) , (3*j-2):(3*j) ) = Rij(:,:,idx); % Rij - S[i, j] = Rij[idx] + S[i, :, j, :] = Rij[idx] # S( (3*j-2):(3*j) , (3*i-2):(3*i) ) = Rij(:,:,idx)'; % Rji = Rij' - S[j, i] = Rij[idx].T + S[j, :, i, :] = Rij[idx].T idx += 1 + # Convert S shape to 3Nx3N + S = S.reshape(3 * n, 3 * n) + return S ########################################### @@ -154,22 +152,22 @@ def _estimate_relative_viewing_directions(self): vi is the third row of the i'th rotation matrix Ri. """ logger.info(f"Estimating relative viewing directions for {self.n_img} images.") - # Step 1: Detect a single pair of common-lines between each pair of images + # Detect a single pair of common-lines between each pair of images self.build_clmatrix() - # Step 4: Calculate relative rotations + # Calculate relative rotations Rijs = self._estimate_all_Rijs_c3_c4(self.clmatrix) return Rijs def _global_J_sync(self, vijs): """ """ - n_img = self.n_img # Determine relative handedness of vijs. sign_ij_J = self._J_sync_power_method(vijs) # Synchronize vijs + logger.info("Applying global handedness synchronization.") for i, sign in enumerate(sign_ij_J): if sign == -1: vijs[i] = J_conjugate(vijs[i]) @@ -240,6 +238,9 @@ def _J_sync_power_method(self, vijs): i'th entry indicates whether the i'th relative orientation matrix will be J-conjugated. """ + logger.info( + "Initiating power method to estimate J-synchronization matrix eigenvector." + ) # Set power method tolerance and maximum iterations. epsilon = self.epsilon max_iters = self.max_iters @@ -252,9 +253,6 @@ def _J_sync_power_method(self, vijs): itr = 0 # Power method iterations - logger.info( - "Initiating power method to estimate J-synchronization matrix eigenvector." - ) while itr < max_iters and residual > epsilon: itr += 1 vec_new = self._signs_times_v(vijs, vec) @@ -269,6 +267,7 @@ def _J_sync_power_method(self, vijs): J_sync = np.sign(vec) return J_sync + def _signs_times_v(self, vijs, vec): """ Multiplication of the J-synchronization matrix by a candidate eigenvector. From 1bbeefcff82d9d26f4d581a5fbd172147d95b8a8 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 4 Apr 2024 09:47:30 -0400 Subject: [PATCH 192/433] stub in W --- src/aspire/abinitio/commonline_sync3n.py | 47 ++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index ce41d687f0..0204886cd9 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -59,6 +59,10 @@ def __init__( self.degree_res = degree_res self.seed = seed + # Sync3N specific vars + self._W = None + self._D_null = 1e-13 + ########################################### # High level algorithm steps # ########################################### @@ -100,6 +104,42 @@ def _sync3n_S_to_rot(self, S, n_eigs=4): f"n_eigs must be greater than 3, default is 4. Invoked with {n_eigs}" ) + if self._W is not None: + W = self._W + if not W.shape == (self.n_img, self.n_img): + raise RuntimeError( + f"Shape of W should be {(self.n_img, self.n_img)}." + f" Received {W.shape}." + ) + # Initialize D + D = np.mean(W, axis=1) # D, check axis + + Dhalf = D + # Compute mask of trouble D values + nulls = np.abs(D) < self._D_null + # Avoid trouble values when exponentiating + Dhalf[~nulls] = Dhalf[~nulls] ** (-0.5) + # Flush trouble values to zero + Dhalf[nulls] = 0 + # expand diagonal + Dhalf = np.diag(Dhalf) + + # Report W Diagnostic + W_normalized = Dhalf**2 @ W + nzidx = np.sum(W_normalized, axis=1) != 0 + err = np.linalg.norm(np.sum(W_normalized[nzidx], axis=1) - self.n_img) + if err > 1e-10: + logger.warning(f"Large Weights Matrix Normalization Error: {err}") + + # Make W of size 3Nx3N + W = np.kron(W, np.ones((3, 3))) + + # Make Dhalf of size 3Nx3N + Dhalf = np.diag(np.kron(np.diag(Dhalf), np.ones((1, 3)))[0]) + + # Apply weights to S + S = Dhalf @ (W * S) @ Dhalf + # Extract three eigenvectors corresponding to non-zero eigenvalues. d, v = stable_eigsh(S, n_eigs) sort_idx = np.argsort(-d) @@ -110,6 +150,13 @@ def _sync3n_S_to_rot(self, S, n_eigs=4): # Only need the top 3 eigen-vectors. v = v[:, sort_idx[:3]] + # Cancel symmetrization when using weights W + if self._W is not None: + # Untill now we used a symmetrized variant of the weighted Sync matrix, + # thus we didn't get the right eigenvectors. to fix that we just need + # to multiply: + v = Dhalf @ v + # Yield estimated rotations from the eigen-vectors v = v.reshape(3, self.n_img, 3) rotations = np.transpose(v, (1, 0, 2)) # Check, may be (1, 2 , 0) for T From ca881b2031e45c4939f2a43e326844dabd66da59 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 5 Apr 2024 10:13:12 -0400 Subject: [PATCH 193/433] stub in W --- src/aspire/abinitio/commonline_sync3n.py | 31 +++++++++++++++++------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 0204886cd9..b66bb6a833 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -28,6 +28,7 @@ def __init__( degree_res=1, seed=None, mask=True, + S_weighting=False, ): """ Initialize object for estimating 3D orientations. @@ -60,7 +61,7 @@ def __init__( self.seed = seed # Sync3N specific vars - self._W = None + self.S_weighting = S_weighting self._D_null = 1e-13 ########################################### @@ -82,18 +83,20 @@ def estimate_rotations(self): # Build sync3n matrix S = self._construct_sync3n_matrix(Rij) - # Optionally S weights - # todo + # Optionally compute S weights + W = None + if self.S_weighting is True: + W = self._syncmatrix_weights(Rij) # Yield rotations from S - Ris = self._sync3n_S_to_rot(S) + Ris = self._sync3n_S_to_rot(S, W) self.rotations = Ris ########################################### # The hackberries taste like hackberries # ########################################### - def _sync3n_S_to_rot(self, S, n_eigs=4): + def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): """ Use eigen decomposition of S to estimate transforms, then project transforms to nearest rotations. @@ -104,8 +107,8 @@ def _sync3n_S_to_rot(self, S, n_eigs=4): f"n_eigs must be greater than 3, default is 4. Invoked with {n_eigs}" ) - if self._W is not None: - W = self._W + if W is not None: + logger.info("Applying weights to synchronization matrix.") if not W.shape == (self.n_img, self.n_img): raise RuntimeError( f"Shape of W should be {(self.n_img, self.n_img)}." @@ -151,7 +154,7 @@ def _sync3n_S_to_rot(self, S, n_eigs=4): v = v[:, sort_idx[:3]] # Cancel symmetrization when using weights W - if self._W is not None: + if W is not None: # Untill now we used a symmetrized variant of the weighted Sync matrix, # thus we didn't get the right eigenvectors. to fix that we just need # to multiply: @@ -159,7 +162,7 @@ def _sync3n_S_to_rot(self, S, n_eigs=4): # Yield estimated rotations from the eigen-vectors v = v.reshape(3, self.n_img, 3) - rotations = np.transpose(v, (1, 0, 2)) # Check, may be (1, 2 , 0) for T + rotations = np.transpose(v, (1, 0, 2)) # Enforce we are returning actual rotations rotations = nearest_rotations(rotations) @@ -189,6 +192,16 @@ def _construct_sync3n_matrix(self, Rij): return S + def _syncmatrix_weights(self, Rij): + """ + Given relative rotations matrix `Rij`, + compute probability weights for S. + """ + logger.info("Computing synchronization matrix weights.") + # Test with identity weights, + # todo, port cryo_sync3n_syncmatrix_weights + return np.ones((self.n_img, self.n_img)) + ########################################### # Primary Methods # ########################################### From 56a51c4dc534460c427771d52dff393141b47871 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 5 Apr 2024 15:48:31 -0400 Subject: [PATCH 194/433] begin stubbing in actual S weight computation --- src/aspire/abinitio/commonline_sync3n.py | 77 ++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 5 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index b66bb6a833..8deef9c790 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -192,15 +192,82 @@ def _construct_sync3n_matrix(self, Rij): return S - def _syncmatrix_weights(self, Rij): + def _syncmatrix_weights( + self, + Rij, + permitted_inconsistency=1.5, + p_domain_limit=0.7, + max_iterations=12, + min_p_permitted=0.04, + ): """ Given relative rotations matrix `Rij`, - compute probability weights for S. + compute and return probability weights for S. """ logger.info("Computing synchronization matrix weights.") - # Test with identity weights, - # todo, port cryo_sync3n_syncmatrix_weights - return np.ones((self.n_img, self.n_img)) + + def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): + # Get inistial estimate for Pij + P, sigma, Rsquare, Pij, hist, fit, cum_scores = self._triangle_scores( + Rij, hist, Pmin, Pmax + ) + + # Check if P and Pij are consistent + mean_Pij = np.mean(Pij) + too_low = P < mean_Pij / permitted_inconsistency + too_high = P > mean_Pij * permitted_inconsistency + inconsistent = too_low | too_high + + # Check trend + if prev_too_low is not None and too_low != prev_too_low: + p_domain_limit = np.sqrt(p_domain_limit) + + # define limits for next P estimation + if too_high: + if P < min_p_permitted: + logger.error( + "Triangles Scores are too bad distributed, whatever small P we force." + ) + + Pmax = P + if Pmax is not None: + Pmax = Pmax * p_domain_limit + + Pmin = Pmax * p_domain_limit + else: + Pmin = P + if Pmin is not None: + Pmin = Pmin / p_domain_limit + + Pmax = Pmin / p_domain_limit + + return inconsistent, Pij, (too_low, Pmin, Pmax, hist) + + # Repeat iteratively until estimations of P & Pij are consistent + i = 0 + res = (None,) * 4 + inconsistent = True + while inconsistent and i < max_iterations: + inconsistent, Pij, res = body(*res) + + # Pack W + # N = 0.5 * (1 + np.sqrt(1+8*Rij.shape[2])) #? what + W = np.zeros((self.n_img, self.n_img)) + idx = 0 + for i in range(self.n_img): + for j in range(i, self.n_img): + W[i, j] = Pij[idx] + W[j, i] = Pij[idx] + idx += 1 + + return W + + def _triangle_scores(self, Rij, hist, Pmin, Pmax): + """ + Todo + """ + # return P, sigma, Rsquare, Pij, hist, fit, cum_scores + pass ########################################### # Primary Methods # From fa708df5e76500d1d47d7c0fa8b9edf046c5aa66 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 8 Apr 2024 10:02:35 -0400 Subject: [PATCH 195/433] fix typo bug --- src/aspire/abinitio/commonline_sync3n.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 8deef9c790..68b13dd747 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -226,18 +226,20 @@ def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): if too_high: if P < min_p_permitted: logger.error( - "Triangles Scores are too bad distributed, whatever small P we force." + "Triangles Scores are poorly distributed, whatever small P we force." ) - Pmax = P if Pmax is not None: Pmax = Pmax * p_domain_limit + else: + Pmax = P Pmin = Pmax * p_domain_limit - else: - Pmin = P + else: # too low if Pmin is not None: Pmin = Pmin / p_domain_limit + else: + Pmin = P Pmax = Pmin / p_domain_limit @@ -251,7 +253,6 @@ def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): inconsistent, Pij, res = body(*res) # Pack W - # N = 0.5 * (1 + np.sqrt(1+8*Rij.shape[2])) #? what W = np.zeros((self.n_img, self.n_img)) idx = 0 for i in range(self.n_img): From 8b27e65c933447bfd71260924bf92c1e9e90628e Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 8 Apr 2024 16:06:44 -0400 Subject: [PATCH 196/433] fix rot reshape bug and stub in probability_scores --- src/aspire/abinitio/commonline_sync3n.py | 190 ++++++++++++++++++++++- 1 file changed, 183 insertions(+), 7 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 68b13dd747..2f21c7da4b 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -2,6 +2,7 @@ import numpy as np from numpy.linalg import norm +from scipy.optimize import curve_fit from aspire.abinitio import CLOrient3D, SyncVotingMixin from aspire.utils import J_conjugate, all_pairs, all_triplets, nearest_rotations @@ -96,7 +97,7 @@ def estimate_rotations(self): ########################################### # The hackberries taste like hackberries # ########################################### - def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): + def _sync3n_S_to_rot(self, S, W=None, n_eigs=10): """ Use eigen decomposition of S to estimate transforms, then project transforms to nearest rotations. @@ -104,7 +105,7 @@ def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): if n_eigs < 3: raise ValueError( - f"n_eigs must be greater than 3, default is 4. Invoked with {n_eigs}" + f"n_eigs must be greater than 3, default is 10. Invoked with {n_eigs}" ) if W is not None: @@ -161,8 +162,7 @@ def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): v = Dhalf @ v # Yield estimated rotations from the eigen-vectors - v = v.reshape(3, self.n_img, 3) - rotations = np.transpose(v, (1, 0, 2)) + rotations = v.reshape(self.n_img, 3, 3).transpose(0, 2, 1) # Enforce we are returning actual rotations rotations = nearest_rotations(rotations) @@ -263,12 +263,188 @@ def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): return W - def _triangle_scores(self, Rij, hist, Pmin, Pmax): + def _triangle_scores_mex(self, Rijs, hist_intervals): + pass + # return cum_scores, hist_scores + + def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0): + # The following is adopted from Matlab parias_probabilities_mex.c `looper` + # The code should be thread/parallel safe over `i` when results are gathered (via sum). + + # Initialize probability result arrays + ln_f_ind = np.zeros(len(Rij), dtype=self.dtype) + ln_f_arb = np.zeros(len(Rij), dtype=self.dtype) + + c = np.empty((4), dtype=self.dtype) + for i in range(self.n_img): + for j in range(i, self.n_img): + Rij = Rijs[i * self.n_img + j] + for k in range(j, self.n_img): + Rik = Rijs[i * self.n_img + k] + Rjk = Rijs[j * self.n_img + k] + + # Compute conjugated rotats + Rij_J = J_conjugate(Rij) + Rik_J = J_conjugate(Rik) + Rjk_J = J_conjugate(Rjk) + + # Compute R muls and norms + c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) + c[1] = np.sum(((Rij_J @ Rjk) - Rjk) ** 2) + c[3] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) + c[4] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) + + # Find best match + best_i = np.argmin(c) + best_val = c[best_i] + + # For each triangle side, find the best alternative + + # Compute scores + s_ij_jk = 1 - np.sqrt(best_val / alt_ij_jk) + s_ik_jk = 1 - np.sqrt(best_val / alt_ik_jk) + s_ij_ik = 1 - np.sqrt(best_val / alt_ij_ik) + + # Update probabilities + # # Probability of pair ij having score given indicicative common line + # P2, B, b, x0, A, a + f_ij_jk = np.log( + P2 + * ( + B + * np.pow(1 - s_ij_jk, b) + * np.exp(-b / (1 - x0) * (1 - s_ij_jk)) + ) + + (1 - P2) * A * np.pow((1 - s_ij_jk), a) + ) + f_ik_jk = np.log( + P2 + * ( + B + * np.pow(1 - s_ik_jk, b) + * np.exp(-b / (1 - x0) * (1 - s_ik_jk)) + ) + + (1 - P2) * A * np.pow((1 - s_ik_jk), a) + ) + f_ij_ik = np.log( + P2 + * ( + B + * np.pow(1 - s_ij_ik, b) + * np.exp(-b / (1 - x0) * (1 - s_ij_ik)) + ) + + (1 - P2) * A * np.pow((1 - s_ij_ik), a) + ) + ln_f_ind[ij] += f_ij_jk + f_ij_ik + ln_f_ind[jk] += f_ij_jk + f_ik_jk + ln_f_ind[ik] += f_ik_jk + f_ij_ik + + # # Probability of pair ij having score given arbitrary common line + f_ij_jk = np.log(A * np.pow((1 - s_ij_jk), a)) + f_ik_jk = np.log(A * np.pow((1 - s_ik_jk), a)) + f_ij_ik = np.log(A * np.pow((1 - s_ij_ik), a)) + ln_f_arb[ij] += f_ij_jk + f_ij_ik + ln_f_arb[jk] += f_ij_jk + f_ik_jk + ln_f_arb[ik] += f_ik_jk + f_ij_ik + + return ln_f_ind, ln_f_arb + + def _triangle_scores( + self, + Rijs, + hist, + Pmin, + Pmax, + hist_intervals=100, + a=2.2, + peak2sigma=2.43e-2, + P=0.5, + b=2.5, + x0=0.78, + ): """ Todo + + :param a: magic number + :param peak2sigma: empirical relation between the location of + the peak of the histigram, and the mean error in the + common lines estimations. + AKA, magic number + :param P: + :param b: + :param x0: """ - # return P, sigma, Rsquare, Pij, hist, fit, cum_scores - pass + + Pmin = Pmin or 0 + Pmin = max(Pmin, 0) # Clamp probability to [0,1] + Pmax = Pmax or 1 + Pmax = min(Pmax, 1) # Clamp probability to [0,1] + + if hist is not None: + cum_scores, scores_hist = self._triangle_scores_mex(Rijs, hist_intervals) + + # Normalize cumulated scores + cum_scores /= len(Rij) + + # Histogram decomposition: P & sigma evaluation + h = 1 / hist_intervals + hist_x = np.arange(h / 2, 1, h) + # normalization factor of one component of the histogram + A = ( + (self.n_img * (self.n_img - 1) * (self.n_img - 2) / 2) + / hist_intervals + * (a + 1) + ) + # normalization of 2nd component: B = P*N_delta/sum(f), where f is the component formula + B0 = P ** (self.n_img * (self.n_img - 1) * (self.n_img - 2) / 2) / np.sum( + ((1 - hist_x) ** b) * np.exp(-b / (1 - x0) * (1 - hist_x)) + ) + start_values = np.array([B0, P, b, x0], dtype=np.float64) + lower_bounds = np.array([0, Pmin**3, 2, 0], dtype=np.float64) + upper_bounds = np.array([np.inf, Pmax**3, np.inf, 1], dtype=np.float64) + + # Fit distribution + def fun(x, B, P, b, x0, A=A, a=a): + """Function to fit. x is data vector.""" + return (1 - P) @ A * (1 - x) ** a + P * B * (1 - x) ** b * np.exp( + -b / (1 - x0) * (1 - x) + ) + + popt, pcov = curve_fit( + fun, + hist_x.astype(np.float64, copy=False), + scores_hist.astype(np.float64, copy=False), + p0=start_values, + bounds=(lower_bounds, upper_bounds), + ) + B, P, b, x0 = popt + + # Derive P and sigma + P = P ** (1 / 3) + peak = x0 # can rm later + sigma = (1 - peak) / peak2sigma + + # Initialize probability computations + # Local histograms analysis + A = a + 1 # distribution 1st component normalization factor + # distribution 2nd component normalization factor + B = B / ( + (self.n_img * (self.n_img - 1) * (self.n_img - 2) / 2) / hist_intervals + ) + + # Calculate probabilities + ln_f_ind, ln_f_arb = self._pairs_probabilities(Rij, P**2, A, a, B, b, x0) + Pij = 1 / (1 + (1 - P) / P * np.exp(ln_f_arb - ln_f_ind)) + + # Fix singular output + num_nan = np.sum(np.isnan(Pij)) + if num_nan > 0: + logger.error( + f"NaN probabilities occurred {num_nan} times out of {size(Pij)}. Setting NaNs to zero." + ) + Pij = np.nan_to_num(Pij) + + return P, sigma, Rsquare, Pij, scores_hist, fit, cum_scores ########################################### # Primary Methods # From 138ece9b68756ee4c9b14af27b7bb7c7b2daab50 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 9 Apr 2024 13:07:48 -0400 Subject: [PATCH 197/433] stub in triangle scores and pair probabilities --- src/aspire/abinitio/commonline_sync3n.py | 212 ++++++++++++++++++----- 1 file changed, 170 insertions(+), 42 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 2f21c7da4b..4aba3102ce 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -5,12 +5,47 @@ from scipy.optimize import curve_fit from aspire.abinitio import CLOrient3D, SyncVotingMixin -from aspire.utils import J_conjugate, all_pairs, all_triplets, nearest_rotations +from aspire.utils import J_conjugate, all_pairs, all_triplets, nearest_rotations, trange from aspire.utils.matlab_compat import stable_eigsh from aspire.utils.random import randn logger = logging.getLogger(__name__) +# Initialize alternatives +# +# When we find the best J-configuration, we also compare it to the alternative 2nd best one. +# this comparison is done for every pair in the triplete independently. to make sure that the +# alternative is indeed different in relation to the pair, we document the differences between +# the configurations in advance: +# ALTS(:,best_conf,pair) = the two configurations in which J-sync differs from best_conf in relation to pair + +_ALTS = np.empty((3, 4, 3), dtype=int) +# Rewrite this later. +_ALTS[0][0][0] = 1 +_ALTS[0][1][0] = 0 +_ALTS[0][2][0] = 0 +_ALTS[0][3][0] = 1 +_ALTS[1][0][0] = 2 +_ALTS[1][1][0] = 3 +_ALTS[1][2][0] = 3 +_ALTS[1][3][0] = 2 +_ALTS[0][0][1] = 2 +_ALTS[0][1][1] = 2 +_ALTS[0][2][1] = 0 +_ALTS[0][3][1] = 0 +_ALTS[1][0][1] = 3 +_ALTS[1][1][1] = 3 +_ALTS[1][2][1] = 1 +_ALTS[1][3][1] = 1 +_ALTS[0][0][2] = 1 +_ALTS[0][1][2] = 0 +_ALTS[0][2][2] = 1 +_ALTS[0][3][2] = 0 +_ALTS[1][0][2] = 3 +_ALTS[1][1][2] = 2 +_ALTS[1][2][2] = 3 +_ALTS[1][3][2] = 2 + class CLSync3N(CLOrient3D, SyncVotingMixin): """ @@ -56,6 +91,9 @@ def __init__( mask=mask, ) + # Generate pair mappings + self._pairs, self._pairs_to_linear = all_pairs(self.n_img, return_map=True) + self.epsilon = epsilon self.max_iters = max_iters self.degree_res = degree_res @@ -208,7 +246,7 @@ def _syncmatrix_weights( def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): # Get inistial estimate for Pij - P, sigma, Rsquare, Pij, hist, fit, cum_scores = self._triangle_scores( + P, sigma, Pij, hist, cum_scores = self._triangle_scores( Rij, hist, Pmin, Pmax ) @@ -249,14 +287,15 @@ def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): i = 0 res = (None,) * 4 inconsistent = True - while inconsistent and i < max_iterations: + while inconsistent and i < 1: # max_iterations: inconsistent, Pij, res = body(*res) + i += 1 # Pack W W = np.zeros((self.n_img, self.n_img)) idx = 0 for i in range(self.n_img): - for j in range(i, self.n_img): + for j in range(i + 1, self.n_img): W[i, j] = Pij[idx] W[j, i] = Pij[idx] idx += 1 @@ -264,24 +303,104 @@ def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): return W def _triangle_scores_mex(self, Rijs, hist_intervals): - pass - # return cum_scores, hist_scores + # The following is adopted from Matlab triangle_scores_mex.c + # The code should be thread/parallel safe over `i` when results are gathered (via sum). + + # Initialize probability result arrays + cum_scores = np.zeros(len(Rijs), dtype=self.dtype) + scores_hist = np.zeros(hist_intervals, dtype=self.dtype) + h = 1 / hist_intervals + + c = np.empty((4), dtype=self.dtype) + for i in trange(self.n_img, desc="Computing triangle scores"): + for j in range( + i + 1, self.n_img - 1 + ): # check bound (taken from MATLAB mex) + ij = self._pairs_to_linear[i, j] + Rij = Rijs[ij] + for k in range(j + 1, self.n_img): + ik = self._pairs_to_linear[i, k] + jk = self._pairs_to_linear[j, k] + Rik = Rijs[ik] + Rjk = Rijs[jk] + + # Compute conjugated rotats + Rij_J = J_conjugate(Rij) + Rik_J = J_conjugate(Rik) + Rjk_J = J_conjugate(Rjk) + + # Compute R muls and norms + c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) + c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) + c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) + c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) + + # Find best match + best_i = np.argmin(c) + best_val = c[best_i] + + # For each triangle side, find the best alternative + alt_ij_jk = c[_ALTS[0][best_i][0]] + if c[_ALTS[1][best_i][0]] < alt_ij_jk: + alt_ij_jk = c[_ALTS[1][best_i][0]] + alt_ik_jk = c[_ALTS[0][best_i][1]] + if c[_ALTS[1][best_i][1]] < alt_ik_jk: + alt_ik_jk = c[_ALTS[1][best_i][1]] + alt_ij_ik = c[_ALTS[0][best_i][2]] + if c[_ALTS[1][best_i][2]] < alt_ij_ik: + alt_ij_ik = c[_ALTS[1][best_i][2]] + + # Compute scores + s_ij_jk = 1 - np.sqrt(best_val / alt_ij_jk) + s_ik_jk = 1 - np.sqrt(best_val / alt_ik_jk) + s_ij_ik = 1 - np.sqrt(best_val / alt_ij_ik) + + # Update cumulated scores + cum_scores[ij] += s_ij_jk + s_ij_ik + cum_scores[jk] += s_ij_jk + s_ik_jk + cum_scores[ik] += s_ik_jk + s_ij_ik + + # Update histogram + threshold = 0 + for l1 in range(hist_intervals): + threshold += h + if s_ij_jk < threshold: + break + + for l2 in range(hist_intervals): + threshold += h + if s_ik_jk < threshold: + break + + for l3 in range(hist_intervals): + threshold += h + if s_ij_ik < threshold: + break + + scores_hist[l1] += 1 + scores_hist[l2] += 1 + scores_hist[l3] += 1 + + return cum_scores, scores_hist def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0): - # The following is adopted from Matlab parias_probabilities_mex.c `looper` + # The following is adopted from Matlab pairas_probabilities_mex.c `looper` # The code should be thread/parallel safe over `i` when results are gathered (via sum). # Initialize probability result arrays - ln_f_ind = np.zeros(len(Rij), dtype=self.dtype) - ln_f_arb = np.zeros(len(Rij), dtype=self.dtype) + ln_f_ind = np.zeros(len(Rijs), dtype=self.dtype) + ln_f_arb = np.zeros(len(Rijs), dtype=self.dtype) c = np.empty((4), dtype=self.dtype) - for i in range(self.n_img): - for j in range(i, self.n_img): - Rij = Rijs[i * self.n_img + j] - for k in range(j, self.n_img): - Rik = Rijs[i * self.n_img + k] - Rjk = Rijs[j * self.n_img + k] + for i in trange(self.n_img, desc="Computing pair probabilities"): + for j in range(i + 1, self.n_img - 1): + ij = self._pairs_to_linear[i, j] + Rij = Rijs[ij] + for k in range(j + 1, self.n_img): + ik = self._pairs_to_linear[i, k] + jk = self._pairs_to_linear[j, k] + Rik = Rijs[ik] + Rjk = Rijs[jk] # Compute conjugated rotats Rij_J = J_conjugate(Rij) @@ -290,15 +409,24 @@ def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0): # Compute R muls and norms c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) - c[1] = np.sum(((Rij_J @ Rjk) - Rjk) ** 2) - c[3] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) - c[4] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) + c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) + c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) + c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) # Find best match best_i = np.argmin(c) best_val = c[best_i] # For each triangle side, find the best alternative + alt_ij_jk = c[_ALTS[0][best_i][0]] + if c[_ALTS[1][best_i][0]] < alt_ij_jk: + alt_ij_jk = c[_ALTS[1][best_i][0]] + alt_ik_jk = c[_ALTS[0][best_i][1]] + if c[_ALTS[1][best_i][1]] < alt_ik_jk: + alt_ik_jk = c[_ALTS[1][best_i][1]] + alt_ij_ik = c[_ALTS[0][best_i][2]] + if c[_ALTS[1][best_i][2]] < alt_ij_ik: + alt_ij_ik = c[_ALTS[1][best_i][2]] # Compute scores s_ij_jk = 1 - np.sqrt(best_val / alt_ij_jk) @@ -312,37 +440,37 @@ def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0): P2 * ( B - * np.pow(1 - s_ij_jk, b) + * np.power(1 - s_ij_jk, b) * np.exp(-b / (1 - x0) * (1 - s_ij_jk)) ) - + (1 - P2) * A * np.pow((1 - s_ij_jk), a) + + (1 - P2) * A * np.power((1 - s_ij_jk), a) ) f_ik_jk = np.log( P2 * ( B - * np.pow(1 - s_ik_jk, b) + * np.power(1 - s_ik_jk, b) * np.exp(-b / (1 - x0) * (1 - s_ik_jk)) ) - + (1 - P2) * A * np.pow((1 - s_ik_jk), a) + + (1 - P2) * A * np.power((1 - s_ik_jk), a) ) f_ij_ik = np.log( P2 * ( B - * np.pow(1 - s_ij_ik, b) + * np.power(1 - s_ij_ik, b) * np.exp(-b / (1 - x0) * (1 - s_ij_ik)) ) - + (1 - P2) * A * np.pow((1 - s_ij_ik), a) + + (1 - P2) * A * np.power((1 - s_ij_ik), a) ) ln_f_ind[ij] += f_ij_jk + f_ij_ik ln_f_ind[jk] += f_ij_jk + f_ik_jk ln_f_ind[ik] += f_ik_jk + f_ij_ik # # Probability of pair ij having score given arbitrary common line - f_ij_jk = np.log(A * np.pow((1 - s_ij_jk), a)) - f_ik_jk = np.log(A * np.pow((1 - s_ik_jk), a)) - f_ij_ik = np.log(A * np.pow((1 - s_ij_ik), a)) + f_ij_jk = np.log(A * np.power((1 - s_ij_jk), a)) + f_ik_jk = np.log(A * np.power((1 - s_ik_jk), a)) + f_ij_ik = np.log(A * np.power((1 - s_ij_ik), a)) ln_f_arb[ij] += f_ij_jk + f_ij_ik ln_f_arb[jk] += f_ij_jk + f_ik_jk ln_f_arb[ik] += f_ik_jk + f_ij_ik @@ -352,7 +480,7 @@ def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0): def _triangle_scores( self, Rijs, - hist, + scores_hist, Pmin, Pmax, hist_intervals=100, @@ -380,11 +508,12 @@ def _triangle_scores( Pmax = Pmax or 1 Pmax = min(Pmax, 1) # Clamp probability to [0,1] - if hist is not None: + cum_scores = None # XXX Why do we even need cum_scores? + if scores_hist is None: cum_scores, scores_hist = self._triangle_scores_mex(Rijs, hist_intervals) # Normalize cumulated scores - cum_scores /= len(Rij) + cum_scores /= len(Rijs) # Histogram decomposition: P & sigma evaluation h = 1 / hist_intervals @@ -406,10 +535,11 @@ def _triangle_scores( # Fit distribution def fun(x, B, P, b, x0, A=A, a=a): """Function to fit. x is data vector.""" - return (1 - P) @ A * (1 - x) ** a + P * B * (1 - x) ** b * np.exp( + return (1 - P) * A * (1 - x) ** a + P * B * (1 - x) ** b * np.exp( -b / (1 - x0) * (1 - x) ) + breakpoint() popt, pcov = curve_fit( fun, hist_x.astype(np.float64, copy=False), @@ -433,18 +563,18 @@ def fun(x, B, P, b, x0, A=A, a=a): ) # Calculate probabilities - ln_f_ind, ln_f_arb = self._pairs_probabilities(Rij, P**2, A, a, B, b, x0) + ln_f_ind, ln_f_arb = self._pairs_probabilities(Rijs, P**2, A, a, B, b, x0) Pij = 1 / (1 + (1 - P) / P * np.exp(ln_f_arb - ln_f_ind)) # Fix singular output num_nan = np.sum(np.isnan(Pij)) if num_nan > 0: logger.error( - f"NaN probabilities occurred {num_nan} times out of {size(Pij)}. Setting NaNs to zero." + f"NaN probabilities occurred {num_nan} times out of {np.size(Pij)}. Setting NaNs to zero." ) Pij = np.nan_to_num(Pij) - return P, sigma, Rsquare, Pij, scores_hist, fit, cum_scores + return P, sigma, Pij, scores_hist, cum_scores ########################################### # Primary Methods # @@ -484,10 +614,9 @@ def _estimate_all_Rijs_c3_c4(self, clmatrix): """ n_img = self.n_img n_theta = self.n_theta - pairs = all_pairs(n_img) - Rijs = np.zeros((len(pairs), 3, 3)) + Rijs = np.zeros((len(self._pairs), 3, 3)) - for idx, (i, j) in enumerate(pairs): + for idx, (i, j) in enumerate(self._pairs): Rijs[idx] = self._syncmatrix_ij_vote_3n( clmatrix, i, j, np.arange(n_img), n_theta ) @@ -599,10 +728,9 @@ def _signs_times_v(self, vijs, vec): :return: New candidate eigenvector of length n-choose-2. The product of the J-sync matrix and vec. """ - # All pairs (i,j) and triplets (i,j,k) where i Date: Tue, 9 Apr 2024 13:10:10 -0400 Subject: [PATCH 198/433] tox checks [skip ci] --- src/aspire/abinitio/commonline_sync3n.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 4aba3102ce..263d104d0f 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -362,24 +362,24 @@ def _triangle_scores_mex(self, Rijs, hist_intervals): # Update histogram threshold = 0 - for l1 in range(hist_intervals): + for _l1 in range(hist_intervals): threshold += h if s_ij_jk < threshold: break - for l2 in range(hist_intervals): + for _l2 in range(hist_intervals): threshold += h if s_ik_jk < threshold: break - for l3 in range(hist_intervals): + for _l3 in range(hist_intervals): threshold += h if s_ij_ik < threshold: break - scores_hist[l1] += 1 - scores_hist[l2] += 1 - scores_hist[l3] += 1 + scores_hist[_l1] += 1 + scores_hist[_l2] += 1 + scores_hist[_l3] += 1 return cum_scores, scores_hist From 5856562ebe8ccdc7ac4568cbc5484c6572bf514f Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 9 Apr 2024 14:09:24 -0400 Subject: [PATCH 199/433] light cleanup --- src/aspire/abinitio/commonline_sync3n.py | 66 +++++++++--------------- 1 file changed, 25 insertions(+), 41 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 263d104d0f..f1f3cc0d3a 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -19,32 +19,13 @@ # the configurations in advance: # ALTS(:,best_conf,pair) = the two configurations in which J-sync differs from best_conf in relation to pair -_ALTS = np.empty((3, 4, 3), dtype=int) -# Rewrite this later. -_ALTS[0][0][0] = 1 -_ALTS[0][1][0] = 0 -_ALTS[0][2][0] = 0 -_ALTS[0][3][0] = 1 -_ALTS[1][0][0] = 2 -_ALTS[1][1][0] = 3 -_ALTS[1][2][0] = 3 -_ALTS[1][3][0] = 2 -_ALTS[0][0][1] = 2 -_ALTS[0][1][1] = 2 -_ALTS[0][2][1] = 0 -_ALTS[0][3][1] = 0 -_ALTS[1][0][1] = 3 -_ALTS[1][1][1] = 3 -_ALTS[1][2][1] = 1 -_ALTS[1][3][1] = 1 -_ALTS[0][0][2] = 1 -_ALTS[0][1][2] = 0 -_ALTS[0][2][2] = 1 -_ALTS[0][3][2] = 0 -_ALTS[1][0][2] = 3 -_ALTS[1][1][2] = 2 -_ALTS[1][2][2] = 3 -_ALTS[1][3][2] = 2 +_ALTS = np.array( + [ + [[1, 2, 1], [0, 2, 0], [0, 0, 1], [1, 0, 0]], + [[2, 3, 3], [3, 3, 2], [3, 1, 3], [2, 1, 2]], + ], + dtype=int, +) class CLSync3N(CLOrient3D, SyncVotingMixin): @@ -114,28 +95,26 @@ def estimate_rotations(self): """ # Initial estimate of viewing directions - Rij0 = self._estimate_relative_viewing_directions() + Rijs0 = self._estimate_relative_viewing_directions() # Compute and apply global handedness - Rij = self._global_J_sync(Rij0) + Rijs = self._global_J_sync(Rijs0) # Build sync3n matrix - S = self._construct_sync3n_matrix(Rij) + S = self._construct_sync3n_matrix(Rijs) # Optionally compute S weights W = None if self.S_weighting is True: - W = self._syncmatrix_weights(Rij) + W = self._syncmatrix_weights(Rijs) # Yield rotations from S - Ris = self._sync3n_S_to_rot(S, W) - - self.rotations = Ris + self.rotations = self._sync3n_S_to_rot(S, W) ########################################### # The hackberries taste like hackberries # ########################################### - def _sync3n_S_to_rot(self, S, W=None, n_eigs=10): + def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): """ Use eigen decomposition of S to estimate transforms, then project transforms to nearest rotations. @@ -143,7 +122,7 @@ def _sync3n_S_to_rot(self, S, W=None, n_eigs=10): if n_eigs < 3: raise ValueError( - f"n_eigs must be greater than 3, default is 10. Invoked with {n_eigs}" + f"n_eigs must be greater than 3, default is 4. Invoked with {n_eigs}" ) if W is not None: @@ -232,7 +211,7 @@ def _construct_sync3n_matrix(self, Rij): def _syncmatrix_weights( self, - Rij, + Rijs, permitted_inconsistency=1.5, p_domain_limit=0.7, max_iterations=12, @@ -247,7 +226,7 @@ def _syncmatrix_weights( def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): # Get inistial estimate for Pij P, sigma, Pij, hist, cum_scores = self._triangle_scores( - Rij, hist, Pmin, Pmax + Rijs, hist, Pmin, Pmax ) # Check if P and Pij are consistent @@ -287,7 +266,7 @@ def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): i = 0 res = (None,) * 4 inconsistent = True - while inconsistent and i < 1: # max_iterations: + while inconsistent and i < max_iterations: inconsistent, Pij, res = body(*res) i += 1 @@ -343,9 +322,11 @@ def _triangle_scores_mex(self, Rijs, hist_intervals): alt_ij_jk = c[_ALTS[0][best_i][0]] if c[_ALTS[1][best_i][0]] < alt_ij_jk: alt_ij_jk = c[_ALTS[1][best_i][0]] + alt_ik_jk = c[_ALTS[0][best_i][1]] if c[_ALTS[1][best_i][1]] < alt_ik_jk: alt_ik_jk = c[_ALTS[1][best_i][1]] + alt_ij_ik = c[_ALTS[0][best_i][2]] if c[_ALTS[1][best_i][2]] < alt_ij_ik: alt_ij_ik = c[_ALTS[1][best_i][2]] @@ -539,7 +520,6 @@ def fun(x, B, P, b, x0, A=A, a=a): -b / (1 - x0) * (1 - x) ) - breakpoint() popt, pcov = curve_fit( fun, hist_x.astype(np.float64, copy=False), @@ -590,7 +570,7 @@ def _estimate_relative_viewing_directions(self): self.build_clmatrix() # Calculate relative rotations - Rijs = self._estimate_all_Rijs_c3_c4(self.clmatrix) + Rijs = self._estimate_all_Rijs(self.clmatrix) return Rijs @@ -608,7 +588,7 @@ def _global_J_sync(self, vijs): return vijs - def _estimate_all_Rijs_c3_c4(self, clmatrix): + def _estimate_all_Rijs(self, clmatrix): """ Estimate Rijs using the voting method. """ @@ -685,6 +665,10 @@ def _J_sync_power_method(self, vijs): residual = 1 itr = 0 + # XXX, I don't like that epsilon>1 (residual) returns signs of random vector + # maybe force to run once? or return vec as zeros in that case? + # Seems unintended, but easy to do. + # Power method iterations while itr < max_iters and residual > epsilon: itr += 1 From dbedd9564ea517506e20d1d347d964ad18699a31 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 10 Apr 2024 10:40:40 -0400 Subject: [PATCH 200/433] J weighting --- src/aspire/abinitio/commonline_sync3n.py | 167 +++++++++++------------ src/aspire/utils/misc.py | 8 +- 2 files changed, 83 insertions(+), 92 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index f1f3cc0d3a..b382ada6b0 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -5,7 +5,7 @@ from scipy.optimize import curve_fit from aspire.abinitio import CLOrient3D, SyncVotingMixin -from aspire.utils import J_conjugate, all_pairs, all_triplets, nearest_rotations, trange +from aspire.utils import J_conjugate, all_pairs, nearest_rotations, trange from aspire.utils.matlab_compat import stable_eigsh from aspire.utils.random import randn @@ -27,6 +27,8 @@ dtype=int, ) +_signs_confs = np.array([[1, 1, 1], [-1, 1, -1], [-1, -1, 1], [1, -1, -1]], dtype=int) + class CLSync3N(CLOrient3D, SyncVotingMixin): """ @@ -46,6 +48,7 @@ def __init__( seed=None, mask=True, S_weighting=False, + J_weighting=False, ): """ Initialize object for estimating 3D orientations. @@ -82,6 +85,7 @@ def __init__( # Sync3N specific vars self.S_weighting = S_weighting + self.J_weighting = J_weighting self._D_null = 1e-13 ########################################### @@ -574,19 +578,18 @@ def _estimate_relative_viewing_directions(self): return Rijs - def _global_J_sync(self, vijs): + def _global_J_sync(self, Rijs): """ """ - # Determine relative handedness of vijs. - sign_ij_J = self._J_sync_power_method(vijs) + # Determine relative handedness of Rijs. + sign_ij_J = self._J_sync_power_method(Rijs) - # Synchronize vijs + # Synchronize Rijs logger.info("Applying global handedness synchronization.") - for i, sign in enumerate(sign_ij_J): - if sign == -1: - vijs[i] = J_conjugate(vijs[i]) + mask = sign_ij_J == -1 + Rijs[mask] = J_conjugate(Rijs[mask]) - return vijs + return Rijs def _estimate_all_Rijs(self, clmatrix): """ @@ -636,7 +639,7 @@ def _syncmatrix_ij_vote_3n(self, clmatrix, i, j, k_list, n_theta): # Secondary Methods for Global J Sync # ####################################### - def _J_sync_power_method(self, vijs): + def _J_sync_power_method(self, Rijs): """ Calculate the leading eigenvector of the J-synchronization matrix using the power method. @@ -645,7 +648,7 @@ def _J_sync_power_method(self, vijs): use the power method to compute the eigenvalues and eigenvectors, while constructing the matrix on-the-fly. - :param vijs: (n-choose-2)x3x3 array of estimates of relative orientation matrices. + :param Rijs: (n-choose-2)x3x3 array of estimates of relative orientation matrices. :return: An array of length n-choose-2 consisting of 1 or -1, where the sign of the i'th entry indicates whether the i'th relative orientation matrix will be J-conjugated. @@ -659,8 +662,8 @@ def _J_sync_power_method(self, vijs): max_iters = self.max_iters # Initialize candidate eigenvectors - n_vijs = vijs.shape[0] - vec = randn(n_vijs, seed=self.seed) + n_Rijs = Rijs.shape[0] + vec = randn(n_Rijs, seed=self.seed) vec = vec / norm(vec) residual = 1 itr = 0 @@ -672,7 +675,7 @@ def _J_sync_power_method(self, vijs): # Power method iterations while itr < max_iters and residual > epsilon: itr += 1 - vec_new = self._signs_times_v(vijs, vec) + vec_new = self._signs_times_v(Rijs, vec) vec_new = vec_new / norm(vec_new) residual = norm(vec_new - vec) vec = vec_new @@ -685,86 +688,74 @@ def _J_sync_power_method(self, vijs): return J_sync - def _signs_times_v(self, vijs, vec): + def _signs_times_v(self, Rijs, vec): """ - Multiplication of the J-synchronization matrix by a candidate eigenvector. - - The J-synchronization matrix is a matrix representation of the handedness graph, Gamma, whose set of - nodes consists of the estimates vijs and whose set of edges consists of the undirected edges between - all triplets of estimates vij, vjk, and vik, where i Date: Wed, 10 Apr 2024 16:04:24 -0400 Subject: [PATCH 201/433] add note about possible ij jk bug [skip ci] --- src/aspire/abinitio/commonline_sync3n.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index b382ada6b0..880e63567a 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -756,6 +756,6 @@ def _signs_times_v(self, Rijs, vec): # Update vector entries new_vec[ij] += s_ij_jk * vec[jk] + s_ij_ik * vec[ik] new_vec[jk] += s_ij_jk * vec[ij] + s_ik_jk * vec[ik] - new_vec[ik] += s_ij_jk * vec[ij] + s_ik_jk * vec[jk] + new_vec[ik] += s_ij_jk * vec[ij] + s_ik_jk * vec[jk] # jk/ik? was a bug?? worked better with s_ij_jk... return new_vec From f33ddf7328399a2b30201a76ea7263bafbaad3bd Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 11 Apr 2024 15:00:00 -0400 Subject: [PATCH 202/433] hack in cupy kernel --- src/aspire/abinitio/commonline_sync3n.py | 298 ++++++++++++++++++----- 1 file changed, 234 insertions(+), 64 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 880e63567a..c0e31f39a2 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -1,6 +1,7 @@ import logging import numpy as np +import cupy as cp from numpy.linalg import norm from scipy.optimize import curve_fit @@ -689,73 +690,242 @@ def _J_sync_power_method(self, Rijs): return J_sync def _signs_times_v(self, Rijs, vec): - """ - Ported from _signs_times_v_mex.c - """ - # The code should be thread/parallel safe over `i`. - new_vec = np.zeros_like(vec) - c = np.empty((4), dtype=self.dtype) - desc = "Computing signs_times_v" - if self.J_weighting: - desc += " with J_weighting" - for i in trange(self.n_img, desc=desc): - for j in range( - i + 1, self.n_img - 1 - ): # check bound (taken from MATLAB mex) - ij = self._pairs_to_linear[i, j] - Rij = Rijs[ij] - for k in range(j + 1, self.n_img): - ik = self._pairs_to_linear[i, k] - jk = self._pairs_to_linear[j, k] - Rik = Rijs[ik] - Rjk = Rijs[jk] + # host/gpu dispatch + new_vec = _signs_times_v_host(self.n_img, Rijs, vec, self.J_weighting, _ALTS, _signs_confs) - # Compute conjugated rotats - Rij_J = J_conjugate(Rij) - Rik_J = J_conjugate(Rik) - Rjk_J = J_conjugate(Rjk) + return new_vec - # Compute R muls and norms - c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) - c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) - c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) - c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) +def PAIR_IDX(N,I,J): + return ((2*N-I-1)*I//2+J-I-1) + +def _signs_times_v_host(n, Rijs, vec,J_weighting, _ALTS, _signs_confs): + """ + Ported from _signs_times_v_mex.c + + n: n_img + Rijs: nchoose2x3x3 array + vec: input array + new_vec: output array + J_weighting: bool + _ALTS= 2x4x3 const lut array + _signs_confs = 4x3 const lut array + """ + # The code should be thread/parallel safe over `i`. + + new_vec = np.zeros_like(vec) + + c = np.empty((4)) + desc = "Computing signs_times_v" + if J_weighting: + desc += " with J_weighting" + for i in trange(n, desc=desc): + for j in range( + i + 1, n - 1 + ): # check bound (taken from MATLAB mex) + #ij = self._pairs_to_linear[i, j] + ij = PAIR_IDX(n, i, j) + Rij = Rijs[ij] + for k in range(j + 1, n): + #ik = self._pairs_to_linear[i, k] + #jk = self._pairs_to_linear[j, k] + ik = PAIR_IDX(n, i, k) + jk = PAIR_IDX(n, j, k) + Rik = Rijs[ik] + Rjk = Rijs[jk] + + # Compute conjugated rotats + Rij_J = J_conjugate(Rij) + Rik_J = J_conjugate(Rik) + Rjk_J = J_conjugate(Rjk) + + # Compute R muls and norms + c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) + c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) + c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) + c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) + + # Find best match + best_i = np.argmin(c) + best_val = c[best_i] + + # MATLAB: scores_as_entries == 0 + s_ij_jk = _signs_confs[best_i][0] + s_ik_jk = _signs_confs[best_i][1] + s_ij_ik = _signs_confs[best_i][2] + + # Note there was a third J_weighting option (2) in MATLAB, + # but it was not exposed at top level. + if J_weighting: + # MATLAB: scores_as_entries == 1 + # For each triangle side, find the best alternative + alt_ij_jk = c[_ALTS[0][best_i][0]] + if c[_ALTS[1][best_i][0]] < alt_ij_jk: + alt_ij_jk = c[_ALTS[1][best_i][0]] - # Find best match - best_i = np.argmin(c) - best_val = c[best_i] + alt_ik_jk = c[_ALTS[0][best_i][1]] + if c[_ALTS[1][best_i][1]] < alt_ik_jk: + alt_ik_jk = c[_ALTS[1][best_i][1]] - # MATLAB: scores_as_entries == 0 - s_ij_jk = _signs_confs[best_i][0] - s_ik_jk = _signs_confs[best_i][1] - s_ij_ik = _signs_confs[best_i][2] - - # Note there was a third J_weighting option (2) in MATLAB, - # but it was not exposed at top level. - if self.J_weighting: - # MATLAB: scores_as_entries == 1 - # For each triangle side, find the best alternative - alt_ij_jk = c[_ALTS[0][best_i][0]] - if c[_ALTS[1][best_i][0]] < alt_ij_jk: - alt_ij_jk = c[_ALTS[1][best_i][0]] - - alt_ik_jk = c[_ALTS[0][best_i][1]] - if c[_ALTS[1][best_i][1]] < alt_ik_jk: - alt_ik_jk = c[_ALTS[1][best_i][1]] - - alt_ij_ik = c[_ALTS[0][best_i][2]] - if c[_ALTS[1][best_i][2]] < alt_ij_ik: - alt_ij_ik = c[_ALTS[1][best_i][2]] - - # Compute scores - s_ij_jk *= 1 - np.sqrt(best_val / alt_ij_jk) - s_ik_jk *= 1 - np.sqrt(best_val / alt_ik_jk) - s_ij_ik *= 1 - np.sqrt(best_val / alt_ij_ik) - - # Update vector entries - new_vec[ij] += s_ij_jk * vec[jk] + s_ij_ik * vec[ik] - new_vec[jk] += s_ij_jk * vec[ij] + s_ik_jk * vec[ik] - new_vec[ik] += s_ij_jk * vec[ij] + s_ik_jk * vec[jk] # jk/ik? was a bug?? worked better with s_ij_jk... + alt_ij_ik = c[_ALTS[0][best_i][2]] + if c[_ALTS[1][best_i][2]] < alt_ij_ik: + alt_ij_ik = c[_ALTS[1][best_i][2]] - return new_vec + # Compute scores + s_ij_jk *= 1 - np.sqrt(best_val / alt_ij_jk) + s_ik_jk *= 1 - np.sqrt(best_val / alt_ik_jk) + s_ij_ik *= 1 - np.sqrt(best_val / alt_ij_ik) + + # Update vector entries + new_vec[ij] += s_ij_jk * vec[jk] + s_ij_ik * vec[ik] + new_vec[jk] += s_ij_jk * vec[ij] + s_ik_jk * vec[ik] + new_vec[ik] += s_ij_jk * vec[ij] + s_ik_jk * vec[jk] # jk/ik? was a bug?? worked better with s_ij_jk... + + return new_vec + +def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS, _signs_confs): + """ + Ported from _signs_times_v_mex.c + + n: n_img + Rijs: nchoose2x3x3 array + vec: input array + new_vec: output array + #todo J_weighting: bool + #todo _ALTS= 2x4x3 const lut array + #todo _signs_confs = 4x3 const lut array + """ + # The code should be thread/parallel safe over `i`. + + + code = r''' + +/* from i,j indoces to the common index in the N-choose-2 sized array */ +#define PAIR_IDX(N,I,J) ((2*N-I-1)*I/2+J-I-1) + +inline void mult_3x3(double *out, double *R1, double *R2) { +/* 3X3 matrices multiplication: out = R1*R2 */ + int i,j; + for (i=0; i<3; i++) { + for (j=0;j<3;j++) { + out[3*j+i] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; + } + } +} + +inline void JRJ(double *R, double *A) { +/* multiple 3X3 matrix by J from both sizes: A = JRJ */ + A[0]=R[0]; + A[1]=R[1]; + A[2]=-R[2]; + A[3]=R[3]; + A[4]=R[4]; + A[5]=-R[5]; + A[6]=-R[6]; + A[7]=-R[7]; + A[8]=R[8]; +} + +inline double diff_norm_3x3(const double *R1, const double *R2) { +/* difference 2 matrices and return squared norm: ||R1-R2||^2 */ + int i; + double norm = 0; + for (i=0; i<9; i++) {norm += (R1[i]-R2[i])*(R1[i]-R2[i]);} + return norm; +} + + +extern "C" __global__ +void signs_times_v(int n, double* Rijs, const double* vec, double* new_vec) +{ + /* thread index (1d), represents "i" index */ + unsigned int i = blockDim.x * blockIdx.x + threadIdx.x; + + /* no-op when out of bounds */ + if(i >= n) return; + + unsigned long n_pairs = n*(n-1)/2; + double c[4]={0,0,0,0}; + unsigned int ij, jk, ik; + unsigned int eig; + int best_i; + double best_val; + int s_ij_jk, s_ik_jk, s_ij_ik; + + double *Rij, *Rjk, *Rik; + double JRijJ[9], JRjkJ[9], JRikJ[9]; + double tmp[9]; + + /* le sigh */ + int signs_confs[4][3]; + signs_confs[2-1][1-1]=-1; signs_confs[2-1][3-1]=-1; + signs_confs[3-1][1-1]=-1; signs_confs[3-1][2-1]=-1; + signs_confs[4-1][2-1]=-1; signs_confs[4-1][3-1]=-1; + + for(int j=i+1; j< n - 1; j++){ + ij = PAIR_IDX(n, i, j); + for(int k=j+1; k< n; k++){ + ik = PAIR_IDX(n, i, k); + jk = PAIR_IDX(n, j, k); + + /* compute configurations matches scores */ + Rij = Rijs + 9*ij; + Rjk = Rijs + 9*jk; + Rik = Rijs + 9*ik; + + JRJ(Rij, JRijJ); + JRJ(Rjk, JRjkJ); + JRJ(Rik, JRikJ); + + mult_3x3(tmp,Rij,Rjk); + c[0] = diff_norm_3x3(tmp,Rik); + + mult_3x3(tmp,JRijJ,Rjk); + c[1] = diff_norm_3x3(tmp,Rik); + + mult_3x3(tmp,Rij,JRjkJ); + c[2] = diff_norm_3x3(tmp,Rik); + + mult_3x3(tmp,Rij,Rjk); + c[3] = diff_norm_3x3(tmp,JRikJ); + + /* find best match */ + best_i=0; best_val=c[0]; + if (c[1] Date: Thu, 11 Apr 2024 15:00:18 -0400 Subject: [PATCH 203/433] quick test file --- x.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 x.py diff --git a/x.py b/x.py new file mode 100644 index 0000000000..1c024e8de9 --- /dev/null +++ b/x.py @@ -0,0 +1,15 @@ +from aspire.abinitio.commonline_sync3n import _signs_times_v_cupy +import numpy as np +import cupy as cp + +n = 7 +n_pairs = n*(n-1)//2 +vec = np.ones(n_pairs, dtype=np.float64) +new_vec = np.zeros(n_pairs, dtype=np.float64) +#Rijs = np.random.randn(n_pairs*3*3).astype(dtype=np.float64) +Rijs = np.arange(n_pairs*3*3).astype(dtype=np.float64) + + +new_vec = _signs_times_v_cupy(n, Rijs, vec, J_weighting=None, _ALTS=None, _signs_confs=None) + +print(new_vec) From 6c639bcdf6510f35ab2fa278ab7c296008b36b1e Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 11 Apr 2024 15:24:23 -0400 Subject: [PATCH 204/433] stashing --- src/aspire/abinitio/commonline_sync3n.py | 23 +++++++++++++++-------- x.py | 11 +++++++++-- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index c0e31f39a2..b3eb882270 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -28,8 +28,6 @@ dtype=int, ) -_signs_confs = np.array([[1, 1, 1], [-1, 1, -1], [-1, -1, 1], [1, -1, -1]], dtype=int) - class CLSync3N(CLOrient3D, SyncVotingMixin): """ @@ -692,14 +690,17 @@ def _J_sync_power_method(self, Rijs): def _signs_times_v(self, Rijs, vec): # host/gpu dispatch - new_vec = _signs_times_v_host(self.n_img, Rijs, vec, self.J_weighting, _ALTS, _signs_confs) + #new_vec = _signs_times_v_host(self.n_img, Rijs, vec, self.J_weighting, _ALTS) + + assert self.J_weighting ==False, "not implemented yet" + new_vec = _signs_times_v_cupy(self.n_img, Rijs, vec, self.J_weighting, _ALTS) return new_vec def PAIR_IDX(N,I,J): return ((2*N-I-1)*I//2+J-I-1) -def _signs_times_v_host(n, Rijs, vec,J_weighting, _ALTS, _signs_confs): +def _signs_times_v_host(n, Rijs, vec,J_weighting, _ALTS): """ Ported from _signs_times_v_mex.c @@ -715,6 +716,7 @@ def _signs_times_v_host(n, Rijs, vec,J_weighting, _ALTS, _signs_confs): new_vec = np.zeros_like(vec) + _signs_confs = np.array([[1, 1, 1], [-1, 1, -1], [-1, -1, 1], [1, -1, -1]], dtype=int) c = np.empty((4)) desc = "Computing signs_times_v" if J_weighting: @@ -779,11 +781,12 @@ def _signs_times_v_host(n, Rijs, vec,J_weighting, _ALTS, _signs_confs): # Update vector entries new_vec[ij] += s_ij_jk * vec[jk] + s_ij_ik * vec[ik] new_vec[jk] += s_ij_jk * vec[ij] + s_ik_jk * vec[ik] - new_vec[ik] += s_ij_jk * vec[ij] + s_ik_jk * vec[jk] # jk/ik? was a bug?? worked better with s_ij_jk... + #new_vec[ik] += s_ij_jk * vec[ij] + s_ik_jk * vec[jk] # jk/ik? was a bug?? worked better with s_ij_jk... + new_vec[ik] += s_ij_ik * vec[ij] + s_ik_jk * vec[jk] # jk/ik? was a bug?? worked better with s_ij_jk... return new_vec -def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS, _signs_confs): +def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): """ Ported from _signs_times_v_mex.c @@ -840,9 +843,12 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS, _signs_confs): { /* thread index (1d), represents "i" index */ unsigned int i = blockDim.x * blockIdx.x + threadIdx.x; + //unsigned int j = blockDim.y * blockIdx.y + threadIdx.y; /* no-op when out of bounds */ if(i >= n) return; + //if(j >= n-1) return; + //if(j < i+1) return; unsigned long n_pairs = n*(n-1)/2; double c[4]={0,0,0,0}; @@ -919,11 +925,12 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS, _signs_confs): new_vec_dev = cp.zeros_like(vec) # call the kernel - blkszx = 512 + blkszx = 128 nblkx = (n+blkszx-1)//blkszx - # blkszy = 512 + # blkszy = 2 # nblky = (n+blkszy-1)//blkszy + #signs_times_v((nblkx,nblky), (blkszx,blkszy), (n, Rijs_dev, vec_dev, new_vec_dev)) signs_times_v((nblkx,), (blkszx,), (n, Rijs_dev, vec_dev, new_vec_dev)) new_vec= new_vec_dev.get() diff --git a/x.py b/x.py index 1c024e8de9..e8a3a78a70 100644 --- a/x.py +++ b/x.py @@ -1,4 +1,5 @@ from aspire.abinitio.commonline_sync3n import _signs_times_v_cupy +from aspire.abinitio.commonline_sync3n import _signs_times_v_host import numpy as np import cupy as cp @@ -7,9 +8,15 @@ vec = np.ones(n_pairs, dtype=np.float64) new_vec = np.zeros(n_pairs, dtype=np.float64) #Rijs = np.random.randn(n_pairs*3*3).astype(dtype=np.float64) -Rijs = np.arange(n_pairs*3*3).astype(dtype=np.float64) +Rijs = np.arange(n_pairs*3*3).reshape(n_pairs,3,3).astype(dtype=np.float64) -new_vec = _signs_times_v_cupy(n, Rijs, vec, J_weighting=None, _ALTS=None, _signs_confs=None) +new_vec = _signs_times_v_cupy(n, Rijs, vec, J_weighting=None, _ALTS=None) +print("gpu\n") print(new_vec) + +new_vec_host = _signs_times_v_host(n, Rijs, vec, J_weighting=None, _ALTS=None) + +print("host\n",new_vec_host) + From e70fe737b5d0f5099900e5a6a1d379a32e56b1a2 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 11 Apr 2024 15:25:01 -0400 Subject: [PATCH 205/433] black --- src/aspire/abinitio/commonline_sync3n.py | 50 +++++++++++++----------- x.py | 15 ++++--- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index b3eb882270..6769d54550 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -1,7 +1,7 @@ import logging -import numpy as np import cupy as cp +import numpy as np from numpy.linalg import norm from scipy.optimize import curve_fit @@ -690,17 +690,19 @@ def _J_sync_power_method(self, Rijs): def _signs_times_v(self, Rijs, vec): # host/gpu dispatch - #new_vec = _signs_times_v_host(self.n_img, Rijs, vec, self.J_weighting, _ALTS) + # new_vec = _signs_times_v_host(self.n_img, Rijs, vec, self.J_weighting, _ALTS) - assert self.J_weighting ==False, "not implemented yet" + assert self.J_weighting == False, "not implemented yet" new_vec = _signs_times_v_cupy(self.n_img, Rijs, vec, self.J_weighting, _ALTS) return new_vec -def PAIR_IDX(N,I,J): - return ((2*N-I-1)*I//2+J-I-1) - -def _signs_times_v_host(n, Rijs, vec,J_weighting, _ALTS): + +def PAIR_IDX(N, I, J): + return (2 * N - I - 1) * I // 2 + J - I - 1 + + +def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS): """ Ported from _signs_times_v_mex.c @@ -716,21 +718,21 @@ def _signs_times_v_host(n, Rijs, vec,J_weighting, _ALTS): new_vec = np.zeros_like(vec) - _signs_confs = np.array([[1, 1, 1], [-1, 1, -1], [-1, -1, 1], [1, -1, -1]], dtype=int) + _signs_confs = np.array( + [[1, 1, 1], [-1, 1, -1], [-1, -1, 1], [1, -1, -1]], dtype=int + ) c = np.empty((4)) desc = "Computing signs_times_v" if J_weighting: desc += " with J_weighting" for i in trange(n, desc=desc): - for j in range( - i + 1, n - 1 - ): # check bound (taken from MATLAB mex) - #ij = self._pairs_to_linear[i, j] + for j in range(i + 1, n - 1): # check bound (taken from MATLAB mex) + # ij = self._pairs_to_linear[i, j] ij = PAIR_IDX(n, i, j) Rij = Rijs[ij] for k in range(j + 1, n): - #ik = self._pairs_to_linear[i, k] - #jk = self._pairs_to_linear[j, k] + # ik = self._pairs_to_linear[i, k] + # jk = self._pairs_to_linear[j, k] ik = PAIR_IDX(n, i, k) jk = PAIR_IDX(n, j, k) Rik = Rijs[ik] @@ -781,11 +783,14 @@ def _signs_times_v_host(n, Rijs, vec,J_weighting, _ALTS): # Update vector entries new_vec[ij] += s_ij_jk * vec[jk] + s_ij_ik * vec[ik] new_vec[jk] += s_ij_jk * vec[ij] + s_ik_jk * vec[ik] - #new_vec[ik] += s_ij_jk * vec[ij] + s_ik_jk * vec[jk] # jk/ik? was a bug?? worked better with s_ij_jk... - new_vec[ik] += s_ij_ik * vec[ij] + s_ik_jk * vec[jk] # jk/ik? was a bug?? worked better with s_ij_jk... + # new_vec[ik] += s_ij_jk * vec[ij] + s_ik_jk * vec[jk] # jk/ik? was a bug?? worked better with s_ij_jk... + new_vec[ik] += ( + s_ij_ik * vec[ij] + s_ik_jk * vec[jk] + ) # jk/ik? was a bug?? worked better with s_ij_jk... return new_vec + def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): """ Ported from _signs_times_v_mex.c @@ -800,8 +805,7 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): """ # The code should be thread/parallel safe over `i`. - - code = r''' + code = r""" /* from i,j indoces to the common index in the N-choose-2 sized array */ #define PAIR_IDX(N,I,J) ((2*N-I-1)*I/2+J-I-1) @@ -915,10 +919,10 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): } /* j */ return; }; -''' +""" module = cp.RawModule(code=code) - signs_times_v = module.get_function('signs_times_v') + signs_times_v = module.get_function("signs_times_v") Rijs_dev = cp.array(Rijs) vec_dev = cp.array(vec) @@ -926,13 +930,13 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): # call the kernel blkszx = 128 - nblkx = (n+blkszx-1)//blkszx + nblkx = (n + blkszx - 1) // blkszx # blkszy = 2 # nblky = (n+blkszy-1)//blkszy - #signs_times_v((nblkx,nblky), (blkszx,blkszy), (n, Rijs_dev, vec_dev, new_vec_dev)) + # signs_times_v((nblkx,nblky), (blkszx,blkszy), (n, Rijs_dev, vec_dev, new_vec_dev)) signs_times_v((nblkx,), (blkszx,), (n, Rijs_dev, vec_dev, new_vec_dev)) - new_vec= new_vec_dev.get() + new_vec = new_vec_dev.get() return new_vec diff --git a/x.py b/x.py index e8a3a78a70..7aab023007 100644 --- a/x.py +++ b/x.py @@ -1,14 +1,14 @@ -from aspire.abinitio.commonline_sync3n import _signs_times_v_cupy -from aspire.abinitio.commonline_sync3n import _signs_times_v_host -import numpy as np import cupy as cp +import numpy as np + +from aspire.abinitio.commonline_sync3n import _signs_times_v_cupy, _signs_times_v_host n = 7 -n_pairs = n*(n-1)//2 +n_pairs = n * (n - 1) // 2 vec = np.ones(n_pairs, dtype=np.float64) new_vec = np.zeros(n_pairs, dtype=np.float64) -#Rijs = np.random.randn(n_pairs*3*3).astype(dtype=np.float64) -Rijs = np.arange(n_pairs*3*3).reshape(n_pairs,3,3).astype(dtype=np.float64) +# Rijs = np.random.randn(n_pairs*3*3).astype(dtype=np.float64) +Rijs = np.arange(n_pairs * 3 * 3).reshape(n_pairs, 3, 3).astype(dtype=np.float64) new_vec = _signs_times_v_cupy(n, Rijs, vec, J_weighting=None, _ALTS=None) @@ -18,5 +18,4 @@ new_vec_host = _signs_times_v_host(n, Rijs, vec, J_weighting=None, _ALTS=None) -print("host\n",new_vec_host) - +print("host\n", new_vec_host) From a1b2c95e5551ef52e3fd8421ce4aad6e6ea308b8 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 11 Apr 2024 16:36:58 -0400 Subject: [PATCH 206/433] debug --- src/aspire/abinitio/commonline_sync3n.py | 39 +++++++++++++----------- x.py | 12 ++++---- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 6769d54550..ac7a84238a 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -690,7 +690,7 @@ def _J_sync_power_method(self, Rijs): def _signs_times_v(self, Rijs, vec): # host/gpu dispatch - # new_vec = _signs_times_v_host(self.n_img, Rijs, vec, self.J_weighting, _ALTS) + # new_vec = _signs_times_v_host(self.n_img, Rijs, vec, self.J_weighting, _ALTS, self._pairs_to_linear) assert self.J_weighting == False, "not implemented yet" new_vec = _signs_times_v_cupy(self.n_img, Rijs, vec, self.J_weighting, _ALTS) @@ -702,7 +702,7 @@ def PAIR_IDX(N, I, J): return (2 * N - I - 1) * I // 2 + J - I - 1 -def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS): +def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): """ Ported from _signs_times_v_mex.c @@ -727,14 +727,14 @@ def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS): desc += " with J_weighting" for i in trange(n, desc=desc): for j in range(i + 1, n - 1): # check bound (taken from MATLAB mex) - # ij = self._pairs_to_linear[i, j] - ij = PAIR_IDX(n, i, j) + ij = _pairs_to_linear[i, j] + #ij = PAIR_IDX(n, i, j) Rij = Rijs[ij] for k in range(j + 1, n): - # ik = self._pairs_to_linear[i, k] - # jk = self._pairs_to_linear[j, k] - ik = PAIR_IDX(n, i, k) - jk = PAIR_IDX(n, j, k) + ik = _pairs_to_linear[i, k] + jk = _pairs_to_linear[j, k] + #ik = PAIR_IDX(n, i, k) + #jk = PAIR_IDX(n, j, k) Rik = Rijs[ik] Rjk = Rijs[jk] @@ -784,9 +784,8 @@ def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS): new_vec[ij] += s_ij_jk * vec[jk] + s_ij_ik * vec[ik] new_vec[jk] += s_ij_jk * vec[ij] + s_ik_jk * vec[ik] # new_vec[ik] += s_ij_jk * vec[ij] + s_ik_jk * vec[jk] # jk/ik? was a bug?? worked better with s_ij_jk... - new_vec[ik] += ( - s_ij_ik * vec[ij] + s_ik_jk * vec[jk] - ) # jk/ik? was a bug?? worked better with s_ij_jk... + # jk/ik? was a bug?? worked better with s_ij_jk... + new_vec[ik] += s_ij_ik * vec[ij] + s_ik_jk * vec[jk] return new_vec @@ -808,7 +807,8 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): code = r""" /* from i,j indoces to the common index in the N-choose-2 sized array */ -#define PAIR_IDX(N,I,J) ((2*N-I-1)*I/2+J-I-1) +#define PAIR_IDX(N,I,J) ((2*N-I-1)*I/2 + J-I-1) + inline void mult_3x3(double *out, double *R1, double *R2) { /* 3X3 matrices multiplication: out = R1*R2 */ @@ -854,10 +854,10 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): //if(j >= n-1) return; //if(j < i+1) return; - unsigned long n_pairs = n*(n-1)/2; - double c[4]={0,0,0,0}; - unsigned int ij, jk, ik; - unsigned int eig; + double c[4]; + int j, k; + for(k=0;k<4;k++){c[k]=0;} + unsigned long ij, jk, ik; int best_i; double best_val; int s_ij_jk, s_ik_jk, s_ij_ik; @@ -868,13 +868,15 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): /* le sigh */ int signs_confs[4][3]; + for(int a=0; a<4; a++) { for(k=0; k<3; k++) { signs_confs[a][k]=1; } } signs_confs[2-1][1-1]=-1; signs_confs[2-1][3-1]=-1; signs_confs[3-1][1-1]=-1; signs_confs[3-1][2-1]=-1; signs_confs[4-1][2-1]=-1; signs_confs[4-1][3-1]=-1; - for(int j=i+1; j< n - 1; j++){ + + for(j=i+1; j< n - 1; j++){ ij = PAIR_IDX(n, i, j); - for(int k=j+1; k< n; k++){ + for(k=j+1; k< n; k++){ ik = PAIR_IDX(n, i, k); jk = PAIR_IDX(n, j, k); @@ -917,6 +919,7 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): } /* k */ } /* j */ + return; }; """ diff --git a/x.py b/x.py index 7aab023007..ea15631e36 100644 --- a/x.py +++ b/x.py @@ -2,20 +2,20 @@ import numpy as np from aspire.abinitio.commonline_sync3n import _signs_times_v_cupy, _signs_times_v_host +from aspire.utils import all_pairs -n = 7 +n = 4 n_pairs = n * (n - 1) // 2 +_, _pairs_to_linear = all_pairs(n, return_map=True) + vec = np.ones(n_pairs, dtype=np.float64) -new_vec = np.zeros(n_pairs, dtype=np.float64) # Rijs = np.random.randn(n_pairs*3*3).astype(dtype=np.float64) Rijs = np.arange(n_pairs * 3 * 3).reshape(n_pairs, 3, 3).astype(dtype=np.float64) new_vec = _signs_times_v_cupy(n, Rijs, vec, J_weighting=None, _ALTS=None) +print("gpu\n", new_vec) -print("gpu\n") -print(new_vec) - -new_vec_host = _signs_times_v_host(n, Rijs, vec, J_weighting=None, _ALTS=None) +new_vec_host = _signs_times_v_host(n, Rijs, vec, J_weighting=None, _ALTS=None, _pairs_to_linear=_pairs_to_linear) print("host\n", new_vec_host) From d0ce1d861a37117dd5f9025bf9e9e3d0a70cb003 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 12 Apr 2024 11:00:11 -0400 Subject: [PATCH 207/433] stashing, cupy code mostly works --- src/aspire/abinitio/commonline_sync3n.py | 67 ++++++++++--------- x.py | 85 +++++++++++++++++++++--- 2 files changed, 111 insertions(+), 41 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index ac7a84238a..bf35c9c73e 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -312,10 +312,10 @@ def _triangle_scores_mex(self, Rijs, hist_intervals): Rjk_J = J_conjugate(Rjk) # Compute R muls and norms - c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) - c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) - c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) - c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) + c[0] = np.sum(((Rij @ Rjk.T) - Rik) ** 2) + c[1] = np.sum(((Rij_J @ Rjk.T) - Rik) ** 2) + c[2] = np.sum(((Rij @ Rjk_J.T) - Rik) ** 2) + c[3] = np.sum(((Rij @ Rjk.T) - Rik_J) ** 2) # Find best match best_i = np.argmin(c) @@ -392,10 +392,10 @@ def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0): Rjk_J = J_conjugate(Rjk) # Compute R muls and norms - c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) - c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) - c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) - c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) + c[0] = np.sum(((Rij @ Rjk.T) - Rik) ** 2) + c[1] = np.sum(((Rij_J @ Rjk.T) - Rik) ** 2) + c[2] = np.sum(((Rij @ Rjk_J.T) - Rik) ** 2) + c[3] = np.sum(((Rij @ Rjk.T) - Rik_J) ** 2) # Find best match best_i = np.argmin(c) @@ -728,13 +728,13 @@ def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): for i in trange(n, desc=desc): for j in range(i + 1, n - 1): # check bound (taken from MATLAB mex) ij = _pairs_to_linear[i, j] - #ij = PAIR_IDX(n, i, j) + # ij = PAIR_IDX(n, i, j) Rij = Rijs[ij] for k in range(j + 1, n): ik = _pairs_to_linear[i, k] jk = _pairs_to_linear[j, k] - #ik = PAIR_IDX(n, i, k) - #jk = PAIR_IDX(n, j, k) + # ik = PAIR_IDX(n, i, k) + # jk = PAIR_IDX(n, j, k) Rik = Rijs[ik] Rjk = Rijs[jk] @@ -744,10 +744,10 @@ def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): Rjk_J = J_conjugate(Rjk) # Compute R muls and norms - c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) - c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) - c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) - c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) + c[0] = np.sum(((Rij @ Rjk.T) - Rik) ** 2) + c[1] = np.sum(((Rij_J @ Rjk.T) - Rik) ** 2) + c[2] = np.sum(((Rij @ Rjk_J.T) - Rik) ** 2) + c[3] = np.sum(((Rij @ Rjk.T) - Rik_J) ** 2) # Find best match best_i = np.argmin(c) @@ -810,12 +810,16 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): #define PAIR_IDX(N,I,J) ((2*N-I-1)*I/2 + J-I-1) +// DEBUG TRANS BUGS inline void mult_3x3(double *out, double *R1, double *R2) { -/* 3X3 matrices multiplication: out = R1*R2 */ +// /* 3X3 matrices multiplication: out = R1*R2 */ +// out.T = R1.T @ R2.T ? int i,j; for (i=0; i<3; i++) { for (j=0;j<3;j++) { - out[3*j+i] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; +// out[3*j+i] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; + out[3*i+j] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; + } } } @@ -847,15 +851,13 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): { /* thread index (1d), represents "i" index */ unsigned int i = blockDim.x * blockIdx.x + threadIdx.x; - //unsigned int j = blockDim.y * blockIdx.y + threadIdx.y; /* no-op when out of bounds */ if(i >= n) return; - //if(j >= n-1) return; - //if(j < i+1) return; double c[4]; - int j, k; + int j; + int k; for(k=0;k<4;k++){c[k]=0;} unsigned long ij, jk, ik; int best_i; @@ -874,7 +876,7 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): signs_confs[4-1][2-1]=-1; signs_confs[4-1][3-1]=-1; - for(j=i+1; j< n - 1; j++){ + for(j=i+1; j< (n - 1); j++){ ij = PAIR_IDX(n, i, j); for(k=j+1; k< n; k++){ ik = PAIR_IDX(n, i, k); @@ -913,9 +915,10 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): s_ij_ik = signs_confs[best_i][2]; /* update multiplication */ - new_vec[ij] += s_ij_jk*vec[jk] + s_ij_ik*vec[ik]; - new_vec[jk] += s_ij_jk*vec[ij] + s_ik_jk*vec[ik]; - new_vec[ik] += s_ij_ik*vec[ij] + s_ik_jk*vec[jk]; /* ij jk bug? */ + new_vec[ij*n + i] += s_ij_jk*vec[jk] + s_ij_ik*vec[ik]; + new_vec[jk*n + i] += s_ij_jk*vec[ij] + s_ik_jk*vec[ik]; + new_vec[ik*n + i] += s_ij_ik*vec[ij] + s_ik_jk*vec[jk]; /* ij jk bug?, relating to mat mul T? */ + //new_vec[ik*n + i] += s_ij_jk*vec[ij] + s_ik_jk*vec[jk]; /* ij jk bug? */ } /* k */ } /* j */ @@ -929,17 +932,19 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): Rijs_dev = cp.array(Rijs) vec_dev = cp.array(vec) - new_vec_dev = cp.zeros_like(vec) + # 2d over i then accum to avoid race on i + new_vec_dev = cp.zeros((vec.shape[0], n)) # call the kernel - blkszx = 128 + blkszx = 512 nblkx = (n + blkszx - 1) // blkszx - # blkszy = 2 - # nblky = (n+blkszy-1)//blkszy - # signs_times_v((nblkx,nblky), (blkszx,blkszy), (n, Rijs_dev, vec_dev, new_vec_dev)) signs_times_v((nblkx,), (blkszx,), (n, Rijs_dev, vec_dev, new_vec_dev)) - new_vec = new_vec_dev.get() + # accumulate, can reuse the vec_dev array now. + cp.sum(new_vec_dev, axis=1, out=vec_dev) + + # dtoh + new_vec = vec_dev.get() return new_vec diff --git a/x.py b/x.py index ea15631e36..02d39fe255 100644 --- a/x.py +++ b/x.py @@ -1,21 +1,86 @@ +import pickle +import time +from collections import defaultdict + import cupy as cp +import matplotlib.pyplot as plt import numpy as np from aspire.abinitio.commonline_sync3n import _signs_times_v_cupy, _signs_times_v_host from aspire.utils import all_pairs -n = 4 -n_pairs = n * (n - 1) // 2 -_, _pairs_to_linear = all_pairs(n, return_map=True) -vec = np.ones(n_pairs, dtype=np.float64) -# Rijs = np.random.randn(n_pairs*3*3).astype(dtype=np.float64) -Rijs = np.arange(n_pairs * 3 * 3).reshape(n_pairs, 3, 3).astype(dtype=np.float64) +def time_test(n): + n_pairs = n * (n - 1) // 2 + _, _pairs_to_linear = all_pairs(n, return_map=True) + + vec = np.ones(n_pairs, dtype=np.float64) + # Rijs = np.random.randn(n_pairs*3*3).astype(dtype=np.float64) + Rijs = np.arange(n_pairs * 3 * 3).reshape(n_pairs, 3, 3).astype(dtype=np.float64) + + tic0 = time.perf_counter() + new_vec = _signs_times_v_cupy(n, Rijs, vec, J_weighting=None, _ALTS=None) + tic1 = time.perf_counter() + gpu_time = tic1 - tic0 + print("gpu\n", new_vec) + + tic2 = time.perf_counter() + new_vec_host = _signs_times_v_host( + n, Rijs, vec, J_weighting=None, _ALTS=None, _pairs_to_linear=_pairs_to_linear + ) + tic3 = time.perf_counter() + host_time = tic3 - tic2 + print("host\n", new_vec_host) + + print(f"\n\n\nSize:\t{n}") + print("Allclose? ", np.allclose(new_vec_host, new_vec)) + print(f"gpu_time: {gpu_time}") + print(f"host_time: {host_time}") + speedup = host_time / gpu_time + print(f"speedup: {speedup}") + + return host_time, gpu_time, speedup + + +def plotit(results): + N = np.array(list(results.keys())) + H = np.array([v["host"] for v in results.values()]) + G = np.array([v["gpu"] for v in results.values()]) + S = np.array([v["speedup"] for v in results.values()]) + + plt.plot(N, H, label="host python") + plt.plot(N, G, label="cuda") + plt.title("Walltimes (s)") + plt.legend() + plt.show() + plt.savefig("walltimes.png") + plt.clf() + + plt.plot(N, S) + plt.title("Speedup Ratio") + plt.show() + plt.savefig("speedups.png") + plt.clf() + + +def main(): + results = defaultdict(dict) + # too long...! for n in [4,16,64,100,128,200,256,512,1024,2048,3000, 4096, 10000]: + # for n in [4,16]: # test + for n in [4, 16, 64, 100, 128, 200, 512]: + h, g, s = time_test(n) + results[n]["host"] = h + results[n]["gpu"] = g + results[n]["speedup"] = s + # save in case we cancel + with open("saved_results.pkl", "wb") as f: + pickle.dump(results, f) -new_vec = _signs_times_v_cupy(n, Rijs, vec, J_weighting=None, _ALTS=None) -print("gpu\n", new_vec) + print() + print(results) + print() + plotit(results) -new_vec_host = _signs_times_v_host(n, Rijs, vec, J_weighting=None, _ALTS=None, _pairs_to_linear=_pairs_to_linear) -print("host\n", new_vec_host) +time_test(64) From 88e6d5db4a7c3b5b7cd650943064e017d8c7e22a Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 12 Apr 2024 11:45:37 -0400 Subject: [PATCH 208/433] still debating that bug, but stashing here --- src/aspire/abinitio/commonline_sync3n.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index bf35c9c73e..68bc7dce9e 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -744,10 +744,10 @@ def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): Rjk_J = J_conjugate(Rjk) # Compute R muls and norms - c[0] = np.sum(((Rij @ Rjk.T) - Rik) ** 2) - c[1] = np.sum(((Rij_J @ Rjk.T) - Rik) ** 2) - c[2] = np.sum(((Rij @ Rjk_J.T) - Rik) ** 2) - c[3] = np.sum(((Rij @ Rjk.T) - Rik_J) ** 2) + c[0] = np.sum(((Rjk @ Rij) - Rik) ** 2) + c[1] = np.sum(((Rjk @ Rij_J) - Rik) ** 2) + c[2] = np.sum(((Rjk_J @ Rij) - Rik) ** 2) + c[3] = np.sum(((Rjk @ Rij ) - Rik_J) ** 2) # Find best match best_i = np.argmin(c) @@ -817,8 +817,8 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): int i,j; for (i=0; i<3; i++) { for (j=0;j<3;j++) { -// out[3*j+i] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; - out[3*i+j] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; + out[3*j+i] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; +// out[3*i+j] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; } } From b7a9a64c1cfade88ec8f565b58e2c1376dff4681 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 16 Apr 2024 08:19:03 -0400 Subject: [PATCH 209/433] autoconf gpu [skip ci] --- src/aspire/abinitio/commonline_sync3n.py | 106 +++++++++++++---------- x.py | 1 + 2 files changed, 59 insertions(+), 48 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 68bc7dce9e..fb5722f4e5 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -1,6 +1,5 @@ import logging -import cupy as cp import numpy as np from numpy.linalg import norm from scipy.optimize import curve_fit @@ -87,6 +86,22 @@ def __init__( self.J_weighting = J_weighting self._D_null = 1e-13 + # Auto configure GPU + self._use_gpu = False + try: + import cupy as cp + + if cp.cuda.runtime.getDeviceCount() >= 1: + gpu_id = cp.cuda.runtime.getDevice() + logger.info( + f"cupy and GPU {gpu_id} found by cuda runtime; enabling cupy." + ) + self._use_gpu = True + else: + logger.info("GPU not found, defaulting to numpy.") + except ModuleNotFoundError: + logger.info("cupy not found, defaulting numpy.") + ########################################### # High level algorithm steps # ########################################### @@ -286,7 +301,6 @@ def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): def _triangle_scores_mex(self, Rijs, hist_intervals): # The following is adopted from Matlab triangle_scores_mex.c - # The code should be thread/parallel safe over `i` when results are gathered (via sum). # Initialize probability result arrays cum_scores = np.zeros(len(Rijs), dtype=self.dtype) @@ -369,7 +383,6 @@ def _triangle_scores_mex(self, Rijs, hist_intervals): def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0): # The following is adopted from Matlab pairas_probabilities_mex.c `looper` - # The code should be thread/parallel safe over `i` when results are gathered (via sum). # Initialize probability result arrays ln_f_ind = np.zeros(len(Rijs), dtype=self.dtype) @@ -690,18 +703,19 @@ def _J_sync_power_method(self, Rijs): def _signs_times_v(self, Rijs, vec): # host/gpu dispatch - # new_vec = _signs_times_v_host(self.n_img, Rijs, vec, self.J_weighting, _ALTS, self._pairs_to_linear) - - assert self.J_weighting == False, "not implemented yet" - new_vec = _signs_times_v_cupy(self.n_img, Rijs, vec, self.J_weighting, _ALTS) + if self._use_gpu: + assert self.J_weighting is False, "not implemented yet" + new_vec = _signs_times_v_cupy( + self.n_img, Rijs, vec, self.J_weighting, _ALTS + ) + else: + new_vec = _signs_times_v_host( + self.n_img, Rijs, vec, self.J_weighting, _ALTS, self._pairs_to_linear + ) return new_vec -def PAIR_IDX(N, I, J): - return (2 * N - I - 1) * I // 2 + J - I - 1 - - def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): """ Ported from _signs_times_v_mex.c @@ -714,7 +728,6 @@ def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): _ALTS= 2x4x3 const lut array _signs_confs = 4x3 const lut array """ - # The code should be thread/parallel safe over `i`. new_vec = np.zeros_like(vec) @@ -728,13 +741,10 @@ def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): for i in trange(n, desc=desc): for j in range(i + 1, n - 1): # check bound (taken from MATLAB mex) ij = _pairs_to_linear[i, j] - # ij = PAIR_IDX(n, i, j) Rij = Rijs[ij] for k in range(j + 1, n): ik = _pairs_to_linear[i, k] jk = _pairs_to_linear[j, k] - # ik = PAIR_IDX(n, i, k) - # jk = PAIR_IDX(n, j, k) Rik = Rijs[ik] Rjk = Rijs[jk] @@ -747,7 +757,7 @@ def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): c[0] = np.sum(((Rjk @ Rij) - Rik) ** 2) c[1] = np.sum(((Rjk @ Rij_J) - Rik) ** 2) c[2] = np.sum(((Rjk_J @ Rij) - Rik) ** 2) - c[3] = np.sum(((Rjk @ Rij ) - Rik_J) ** 2) + c[3] = np.sum(((Rjk @ Rij) - Rik_J) ** 2) # Find best match best_i = np.argmin(c) @@ -802,7 +812,7 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): #todo _ALTS= 2x4x3 const lut array #todo _signs_confs = 4x3 const lut array """ - # The code should be thread/parallel safe over `i`. + import cupy as cp code = r""" @@ -814,35 +824,35 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): inline void mult_3x3(double *out, double *R1, double *R2) { // /* 3X3 matrices multiplication: out = R1*R2 */ // out.T = R1.T @ R2.T ? - int i,j; - for (i=0; i<3; i++) { - for (j=0;j<3;j++) { - out[3*j+i] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; -// out[3*i+j] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; - - } - } + int i,j; + for (i=0; i<3; i++) { + for (j=0;j<3;j++) { + out[3*j+i] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; +// out[3*i+j] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; + + } + } } inline void JRJ(double *R, double *A) { /* multiple 3X3 matrix by J from both sizes: A = JRJ */ - A[0]=R[0]; - A[1]=R[1]; - A[2]=-R[2]; - A[3]=R[3]; - A[4]=R[4]; - A[5]=-R[5]; - A[6]=-R[6]; - A[7]=-R[7]; - A[8]=R[8]; + A[0]=R[0]; + A[1]=R[1]; + A[2]=-R[2]; + A[3]=R[3]; + A[4]=R[4]; + A[5]=-R[5]; + A[6]=-R[6]; + A[7]=-R[7]; + A[8]=R[8]; } inline double diff_norm_3x3(const double *R1, const double *R2) { /* difference 2 matrices and return squared norm: ||R1-R2||^2 */ - int i; - double norm = 0; - for (i=0; i<9; i++) {norm += (R1[i]-R2[i])*(R1[i]-R2[i]);} - return norm; + int i; + double norm = 0; + for (i=0; i<9; i++) {norm += (R1[i]-R2[i])*(R1[i]-R2[i]);} + return norm; } @@ -874,7 +884,7 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): signs_confs[2-1][1-1]=-1; signs_confs[2-1][3-1]=-1; signs_confs[3-1][1-1]=-1; signs_confs[3-1][2-1]=-1; signs_confs[4-1][2-1]=-1; signs_confs[4-1][3-1]=-1; - + for(j=i+1; j< (n - 1); j++){ ij = PAIR_IDX(n, i, j); @@ -883,32 +893,32 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): jk = PAIR_IDX(n, j, k); /* compute configurations matches scores */ - Rij = Rijs + 9*ij; - Rjk = Rijs + 9*jk; + Rij = Rijs + 9*ij; + Rjk = Rijs + 9*jk; Rik = Rijs + 9*ik; - + JRJ(Rij, JRijJ); JRJ(Rjk, JRjkJ); JRJ(Rik, JRikJ); - + mult_3x3(tmp,Rij,Rjk); c[0] = diff_norm_3x3(tmp,Rik); - + mult_3x3(tmp,JRijJ,Rjk); c[1] = diff_norm_3x3(tmp,Rik); - + mult_3x3(tmp,Rij,JRjkJ); c[2] = diff_norm_3x3(tmp,Rik); - + mult_3x3(tmp,Rij,Rjk); c[3] = diff_norm_3x3(tmp,JRikJ); - + /* find best match */ best_i=0; best_val=c[0]; if (c[1] Date: Tue, 23 Apr 2024 14:20:18 -0400 Subject: [PATCH 210/433] rm debug comments after checking matmul --- src/aspire/abinitio/commonline_sync3n.py | 23 ++++++++--------------- x.py | 2 +- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index fb5722f4e5..ee39d732cc 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -793,8 +793,6 @@ def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): # Update vector entries new_vec[ij] += s_ij_jk * vec[jk] + s_ij_ik * vec[ik] new_vec[jk] += s_ij_jk * vec[ij] + s_ik_jk * vec[ik] - # new_vec[ik] += s_ij_jk * vec[ij] + s_ik_jk * vec[jk] # jk/ik? was a bug?? worked better with s_ij_jk... - # jk/ik? was a bug?? worked better with s_ij_jk... new_vec[ik] += s_ij_ik * vec[ij] + s_ik_jk * vec[jk] return new_vec @@ -820,18 +818,14 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): #define PAIR_IDX(N,I,J) ((2*N-I-1)*I/2 + J-I-1) -// DEBUG TRANS BUGS inline void mult_3x3(double *out, double *R1, double *R2) { -// /* 3X3 matrices multiplication: out = R1*R2 */ -// out.T = R1.T @ R2.T ? - int i,j; - for (i=0; i<3; i++) { - for (j=0;j<3;j++) { - out[3*j+i] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; -// out[3*i+j] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; - - } - } + /* 3X3 matrices multiplication: out = R1*R2 */ + int i,j; + for (i=0; i<3; i++) { + for (j=0;j<3;j++) { + out[3*j+i] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; + } + } } inline void JRJ(double *R, double *A) { @@ -927,8 +921,7 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): /* update multiplication */ new_vec[ij*n + i] += s_ij_jk*vec[jk] + s_ij_ik*vec[ik]; new_vec[jk*n + i] += s_ij_jk*vec[ij] + s_ik_jk*vec[ik]; - new_vec[ik*n + i] += s_ij_ik*vec[ij] + s_ik_jk*vec[jk]; /* ij jk bug?, relating to mat mul T? */ - //new_vec[ik*n + i] += s_ij_jk*vec[ij] + s_ik_jk*vec[jk]; /* ij jk bug? */ + new_vec[ik*n + i] += s_ij_ik*vec[ij] + s_ik_jk*vec[jk]; } /* k */ } /* j */ diff --git a/x.py b/x.py index 9bdbaf7182..a82da49ae7 100644 --- a/x.py +++ b/x.py @@ -84,4 +84,4 @@ def main(): plotit(results) -time_test(64) +time_test(128) From 00433302358b203d4ec19b78920a47142f7dcc70 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 23 Apr 2024 15:57:19 -0400 Subject: [PATCH 211/433] fixup Rijk_lmnop muls [skip ci] --- src/aspire/abinitio/commonline_sync3n.py | 88 +++++++++++++++++------- x.py | 6 +- 2 files changed, 65 insertions(+), 29 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index ee39d732cc..277b87bfd5 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -705,9 +705,7 @@ def _signs_times_v(self, Rijs, vec): # host/gpu dispatch if self._use_gpu: assert self.J_weighting is False, "not implemented yet" - new_vec = _signs_times_v_cupy( - self.n_img, Rijs, vec, self.J_weighting, _ALTS - ) + new_vec = _signs_times_v_cupy(self.n_img, Rijs, vec, self.J_weighting) else: new_vec = _signs_times_v_host( self.n_img, Rijs, vec, self.J_weighting, _ALTS, self._pairs_to_linear @@ -726,7 +724,6 @@ def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): new_vec: output array J_weighting: bool _ALTS= 2x4x3 const lut array - _signs_confs = 4x3 const lut array """ new_vec = np.zeros_like(vec) @@ -734,6 +731,7 @@ def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): _signs_confs = np.array( [[1, 1, 1], [-1, 1, -1], [-1, -1, 1], [1, -1, -1]], dtype=int ) + c = np.empty((4)) desc = "Computing signs_times_v" if J_weighting: @@ -754,10 +752,10 @@ def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): Rjk_J = J_conjugate(Rjk) # Compute R muls and norms - c[0] = np.sum(((Rjk @ Rij) - Rik) ** 2) - c[1] = np.sum(((Rjk @ Rij_J) - Rik) ** 2) - c[2] = np.sum(((Rjk_J @ Rij) - Rik) ** 2) - c[3] = np.sum(((Rjk @ Rij) - Rik_J) ** 2) + c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) + c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) + c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) + c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) # Find best match best_i = np.argmin(c) @@ -798,7 +796,7 @@ def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): return new_vec -def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): +def _signs_times_v_cupy(n, Rijs, vec, J_weighting): """ Ported from _signs_times_v_mex.c @@ -806,9 +804,7 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): Rijs: nchoose2x3x3 array vec: input array new_vec: output array - #todo J_weighting: bool - #todo _ALTS= 2x4x3 const lut array - #todo _signs_confs = 4x3 const lut array + J_weighting: bool """ import cupy as cp @@ -851,7 +847,7 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): extern "C" __global__ -void signs_times_v(int n, double* Rijs, const double* vec, double* new_vec) +void signs_times_v(int n, double* Rijs, const double* vec, double* new_vec, bool J_weighting) { /* thread index (1d), represents "i" index */ unsigned int i = blockDim.x * blockIdx.x + threadIdx.x; @@ -860,24 +856,40 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): if(i >= n) return; double c[4]; - int j; - int k; + unsigned int j; + unsigned int k; for(k=0;k<4;k++){c[k]=0;} unsigned long ij, jk, ik; int best_i; double best_val; - int s_ij_jk, s_ik_jk, s_ij_ik; + double s_ij_jk, s_ik_jk, s_ij_ik; + double alt_ij_jk, alt_ij_ik, alt_ik_jk; double *Rij, *Rjk, *Rik; double JRijJ[9], JRjkJ[9], JRikJ[9]; double tmp[9]; - /* le sigh */ int signs_confs[4][3]; for(int a=0; a<4; a++) { for(k=0; k<3; k++) { signs_confs[a][k]=1; } } - signs_confs[2-1][1-1]=-1; signs_confs[2-1][3-1]=-1; - signs_confs[3-1][1-1]=-1; signs_confs[3-1][2-1]=-1; - signs_confs[4-1][2-1]=-1; signs_confs[4-1][3-1]=-1; + signs_confs[1][0]=-1; signs_confs[1][2]=-1; + signs_confs[2][0]=-1; signs_confs[2][1]=-1; + signs_confs[3][1]=-1; signs_confs[3][2]=-1; + + /* initialize alternatives */ + /* when we find the best J-configuration, we also compare it to the alternative 2nd best one. + * this comparison is done for every pair in the triplete independently. to make sure that the + * alternative is indeed different in relation to the pair, we document the differences between + * the configurations in advance: + * ALTS(:,best_conf,pair) = the two configurations in which J-sync differs from + * best_conf in relation to pair */ + + int ALTS[2][4][3]; + ALTS[0][0][0]=1; ALTS[0][1][0]=0; ALTS[0][2][0]=0; ALTS[0][3][0]=1; + ALTS[1][0][0]=2; ALTS[1][1][0]=3; ALTS[1][2][0]=3; ALTS[1][3][0]=2; + ALTS[0][0][1]=2; ALTS[0][1][1]=2; ALTS[0][2][1]=0; ALTS[0][3][1]=0; + ALTS[1][0][1]=3; ALTS[1][1][1]=3; ALTS[1][2][1]=1; ALTS[1][3][1]=1; + ALTS[0][0][2]=1; ALTS[0][1][2]=0; ALTS[0][2][2]=1; ALTS[0][3][2]=0; + ALTS[1][0][2]=3; ALTS[1][1][2]=2; ALTS[1][2][2]=3; ALTS[1][3][2]=2; for(j=i+1; j< (n - 1); j++){ @@ -895,16 +907,16 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): JRJ(Rjk, JRjkJ); JRJ(Rik, JRikJ); - mult_3x3(tmp,Rij,Rjk); + mult_3x3(tmp,Rjk,Rij); c[0] = diff_norm_3x3(tmp,Rik); - mult_3x3(tmp,JRijJ,Rjk); + mult_3x3(tmp,Rjk,JRijJ); c[1] = diff_norm_3x3(tmp,Rik); - mult_3x3(tmp,Rij,JRjkJ); + mult_3x3(tmp,JRjkJ,Rij); c[2] = diff_norm_3x3(tmp,Rik); - mult_3x3(tmp,Rij,Rjk); + mult_3x3(tmp,Rjk,Rij); c[3] = diff_norm_3x3(tmp,JRikJ); /* find best match */ @@ -918,6 +930,30 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): s_ik_jk = signs_confs[best_i][1]; s_ij_ik = signs_confs[best_i][2]; + /* J weighting */ + if(J_weighting){ + /* for each triangle side, find the best alternative */ + alt_ij_jk = c[ALTS[0][best_i][0]]; + if (c[ALTS[1][best_i][0]] < alt_ij_jk){ + alt_ij_jk = c[ALTS[1][best_i][0]]; + } + + alt_ik_jk = c[ALTS[0][best_i][1]]; + if (c[ALTS[1][best_i][1]] < alt_ik_jk){ + alt_ik_jk = c[ALTS[1][best_i][1]]; + } + alt_ij_ik = c[ALTS[0][best_i][2]]; + if (c[ALTS[1][best_i][2]] < alt_ij_ik){ + alt_ij_ik = c[ALTS[1][best_i][2]]; + } + + /* Update scores */ + s_ij_jk *= 1 - sqrt(best_val / alt_ij_jk); + s_ik_jk *= 1 - sqrt(best_val / alt_ik_jk); + s_ij_ik *= 1 - sqrt(best_val / alt_ij_ik); + } + + /* update multiplication */ new_vec[ij*n + i] += s_ij_jk*vec[jk] + s_ij_ik*vec[ik]; new_vec[jk*n + i] += s_ij_jk*vec[ij] + s_ik_jk*vec[ik]; @@ -941,8 +977,8 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting, _ALTS): # call the kernel blkszx = 512 nblkx = (n + blkszx - 1) // blkszx - - signs_times_v((nblkx,), (blkszx,), (n, Rijs_dev, vec_dev, new_vec_dev)) + assert J_weighting == False + signs_times_v((nblkx,), (blkszx,), (n, Rijs_dev, vec_dev, new_vec_dev, J_weighting)) # accumulate, can reuse the vec_dev array now. cp.sum(new_vec_dev, axis=1, out=vec_dev) diff --git a/x.py b/x.py index a82da49ae7..ebc5e6d768 100644 --- a/x.py +++ b/x.py @@ -19,14 +19,14 @@ def time_test(n): Rijs = np.arange(n_pairs * 3 * 3).reshape(n_pairs, 3, 3).astype(dtype=np.float64) tic0 = time.perf_counter() - new_vec = _signs_times_v_cupy(n, Rijs, vec, J_weighting=None, _ALTS=None) + new_vec = _signs_times_v_cupy(n, Rijs, vec, J_weighting=False) tic1 = time.perf_counter() gpu_time = tic1 - tic0 print("gpu\n", new_vec) tic2 = time.perf_counter() new_vec_host = _signs_times_v_host( - n, Rijs, vec, J_weighting=None, _ALTS=None, _pairs_to_linear=_pairs_to_linear + n, Rijs, vec, J_weighting=False, _ALTS=None, _pairs_to_linear=_pairs_to_linear ) tic3 = time.perf_counter() host_time = tic3 - tic2 @@ -84,4 +84,4 @@ def main(): plotit(results) -time_test(128) +time_test(64) From 2e598cfd017b03a52c128c55bc1444e48fd606ec Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 24 Apr 2024 09:58:57 -0400 Subject: [PATCH 212/433] re-implement matmul [skip ci] --- src/aspire/abinitio/commonline_sync3n.py | 33 ++++++++++++++---------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 277b87bfd5..510d789ac8 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -815,11 +815,18 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting): inline void mult_3x3(double *out, double *R1, double *R2) { - /* 3X3 matrices multiplication: out = R1*R2 */ - int i,j; - for (i=0; i<3; i++) { - for (j=0;j<3;j++) { - out[3*j+i] = R1[3*0+i]*R2[3*j+0] + R1[3*1+i]*R2[3*j+1] + R1[3*2+i]*R2[3*j+2]; + /* 3X3 matrices multiplication: out = R1*R2 + * Note, this differs from the MATLAB mult_3x3. + */ + + int i,j,k; + + for(i=0; i<3; i++){ + for(j=0; j<3; j++){ + out[i*3 + j] = 0; + for (k=0; k<3; k++){ + out[i*3 + j] += R1[i*3+k] * R2[k*3+j]; + } } } } @@ -907,17 +914,17 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting): JRJ(Rjk, JRjkJ); JRJ(Rik, JRikJ); - mult_3x3(tmp,Rjk,Rij); - c[0] = diff_norm_3x3(tmp,Rik); + mult_3x3(tmp, Rij, Rjk); + c[0] = diff_norm_3x3(tmp, Rik); - mult_3x3(tmp,Rjk,JRijJ); - c[1] = diff_norm_3x3(tmp,Rik); + mult_3x3(tmp, JRijJ, Rjk); + c[1] = diff_norm_3x3(tmp, Rik); - mult_3x3(tmp,JRjkJ,Rij); - c[2] = diff_norm_3x3(tmp,Rik); + mult_3x3(tmp, Rij, JRjkJ); + c[2] = diff_norm_3x3(tmp, Rik); - mult_3x3(tmp,Rjk,Rij); - c[3] = diff_norm_3x3(tmp,JRikJ); + mult_3x3(tmp, Rij, Rjk); + c[3] = diff_norm_3x3(tmp, JRikJ); /* find best match */ best_i=0; best_val=c[0]; From ca8d7b1b75d0c3fac18049daec2174b8753c460f Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 24 Apr 2024 16:43:38 -0400 Subject: [PATCH 213/433] add pairs prob kernel [skip ci] --- src/aspire/abinitio/commonline_sync3n.py | 405 ++++++++++++++++------- 1 file changed, 294 insertions(+), 111 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 510d789ac8..1f64cf7e12 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -299,7 +299,7 @@ def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): return W - def _triangle_scores_mex(self, Rijs, hist_intervals): + def _triangle_scores_inner(self, Rijs, hist_intervals): # The following is adopted from Matlab triangle_scores_mex.c # Initialize probability result arrays @@ -326,10 +326,10 @@ def _triangle_scores_mex(self, Rijs, hist_intervals): Rjk_J = J_conjugate(Rjk) # Compute R muls and norms - c[0] = np.sum(((Rij @ Rjk.T) - Rik) ** 2) - c[1] = np.sum(((Rij_J @ Rjk.T) - Rik) ** 2) - c[2] = np.sum(((Rij @ Rjk_J.T) - Rik) ** 2) - c[3] = np.sum(((Rij @ Rjk.T) - Rik_J) ** 2) + c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) + c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) + c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) + c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) # Find best match best_i = np.argmin(c) @@ -382,95 +382,15 @@ def _triangle_scores_mex(self, Rijs, hist_intervals): return cum_scores, scores_hist def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0): - # The following is adopted from Matlab pairas_probabilities_mex.c `looper` - - # Initialize probability result arrays - ln_f_ind = np.zeros(len(Rijs), dtype=self.dtype) - ln_f_arb = np.zeros(len(Rijs), dtype=self.dtype) - - c = np.empty((4), dtype=self.dtype) - for i in trange(self.n_img, desc="Computing pair probabilities"): - for j in range(i + 1, self.n_img - 1): - ij = self._pairs_to_linear[i, j] - Rij = Rijs[ij] - for k in range(j + 1, self.n_img): - ik = self._pairs_to_linear[i, k] - jk = self._pairs_to_linear[j, k] - Rik = Rijs[ik] - Rjk = Rijs[jk] - - # Compute conjugated rotats - Rij_J = J_conjugate(Rij) - Rik_J = J_conjugate(Rik) - Rjk_J = J_conjugate(Rjk) - - # Compute R muls and norms - c[0] = np.sum(((Rij @ Rjk.T) - Rik) ** 2) - c[1] = np.sum(((Rij_J @ Rjk.T) - Rik) ** 2) - c[2] = np.sum(((Rij @ Rjk_J.T) - Rik) ** 2) - c[3] = np.sum(((Rij @ Rjk.T) - Rik_J) ** 2) - - # Find best match - best_i = np.argmin(c) - best_val = c[best_i] - - # For each triangle side, find the best alternative - alt_ij_jk = c[_ALTS[0][best_i][0]] - if c[_ALTS[1][best_i][0]] < alt_ij_jk: - alt_ij_jk = c[_ALTS[1][best_i][0]] - alt_ik_jk = c[_ALTS[0][best_i][1]] - if c[_ALTS[1][best_i][1]] < alt_ik_jk: - alt_ik_jk = c[_ALTS[1][best_i][1]] - alt_ij_ik = c[_ALTS[0][best_i][2]] - if c[_ALTS[1][best_i][2]] < alt_ij_ik: - alt_ij_ik = c[_ALTS[1][best_i][2]] - - # Compute scores - s_ij_jk = 1 - np.sqrt(best_val / alt_ij_jk) - s_ik_jk = 1 - np.sqrt(best_val / alt_ik_jk) - s_ij_ik = 1 - np.sqrt(best_val / alt_ij_ik) - - # Update probabilities - # # Probability of pair ij having score given indicicative common line - # P2, B, b, x0, A, a - f_ij_jk = np.log( - P2 - * ( - B - * np.power(1 - s_ij_jk, b) - * np.exp(-b / (1 - x0) * (1 - s_ij_jk)) - ) - + (1 - P2) * A * np.power((1 - s_ij_jk), a) - ) - f_ik_jk = np.log( - P2 - * ( - B - * np.power(1 - s_ik_jk, b) - * np.exp(-b / (1 - x0) * (1 - s_ik_jk)) - ) - + (1 - P2) * A * np.power((1 - s_ik_jk), a) - ) - f_ij_ik = np.log( - P2 - * ( - B - * np.power(1 - s_ij_ik, b) - * np.exp(-b / (1 - x0) * (1 - s_ij_ik)) - ) - + (1 - P2) * A * np.power((1 - s_ij_ik), a) - ) - ln_f_ind[ij] += f_ij_jk + f_ij_ik - ln_f_ind[jk] += f_ij_jk + f_ik_jk - ln_f_ind[ik] += f_ik_jk + f_ij_ik - - # # Probability of pair ij having score given arbitrary common line - f_ij_jk = np.log(A * np.power((1 - s_ij_jk), a)) - f_ik_jk = np.log(A * np.power((1 - s_ik_jk), a)) - f_ij_ik = np.log(A * np.power((1 - s_ij_ik), a)) - ln_f_arb[ij] += f_ij_jk + f_ij_ik - ln_f_arb[jk] += f_ij_jk + f_ik_jk - ln_f_arb[ik] += f_ik_jk + f_ij_ik + # dtype is critical for passing into C code... + params = np.arary([P2, A, a, B, b, x0], dtype=np.float64) + # host/gpu dispatch + if self._use_gpu: + ln_f_ind, ln_f_arb = _pairs_probabilities_cupy(self.n_img, Rijs, *params) + else: + ln_f_ind, ln_f_arb = _pairs_probabilities_host( + self.n_img, Rijs, *params, _ALTS, self._pairs_to_linear + ) return ln_f_ind, ln_f_arb @@ -507,7 +427,7 @@ def _triangle_scores( cum_scores = None # XXX Why do we even need cum_scores? if scores_hist is None: - cum_scores, scores_hist = self._triangle_scores_mex(Rijs, hist_intervals) + cum_scores, scores_hist = self._triangle_scores_inner(Rijs, hist_intervals) # Normalize cumulated scores cum_scores /= len(Rijs) @@ -704,7 +624,6 @@ def _signs_times_v(self, Rijs, vec): # host/gpu dispatch if self._use_gpu: - assert self.J_weighting is False, "not implemented yet" new_vec = _signs_times_v_cupy(self.n_img, Rijs, vec, self.J_weighting) else: new_vec = _signs_times_v_host( @@ -796,19 +715,8 @@ def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): return new_vec -def _signs_times_v_cupy(n, Rijs, vec, J_weighting): - """ - Ported from _signs_times_v_mex.c - - n: n_img - Rijs: nchoose2x3x3 array - vec: input array - new_vec: output array - J_weighting: bool - """ - import cupy as cp - - code = r""" +def _init_cupy_module(): + module_code = r""" /* from i,j indoces to the common index in the N-choose-2 sized array */ #define PAIR_IDX(N,I,J) ((2*N-I-1)*I/2 + J-I-1) @@ -971,9 +879,157 @@ def _signs_times_v_cupy(n, Rijs, vec, J_weighting): return; }; + +extern "C" __global__ +void pairs_probabilities(int n, double* Rijs, double P2, double A, double a, double B, double b, double x0, double* ln_f_ind, double* ln_f_arb) +{ + /* thread index (1d), represents "i" index */ + unsigned int i = blockDim.x * blockIdx.x + threadIdx.x; + + /* no-op when out of bounds */ + if(i >= n) return; + + double c[4]; + unsigned int j; + unsigned int k; + for(k=0;k<4;k++){c[k]=0;} + unsigned long ij, jk, ik; + int best_i; + double best_val; + double s_ij_jk, s_ik_jk, s_ij_ik; + double alt_ij_jk, alt_ij_ik, alt_ik_jk; + double f_ij_jk, f_ik_jk, f_ij_ik; + + + double *Rij, *Rjk, *Rik; + double JRijJ[9], JRjkJ[9], JRikJ[9]; + double tmp[9]; + + int signs_confs[4][3]; + for(int a=0; a<4; a++) { for(k=0; k<3; k++) { signs_confs[a][k]=1; } } + signs_confs[1][0]=-1; signs_confs[1][2]=-1; + signs_confs[2][0]=-1; signs_confs[2][1]=-1; + signs_confs[3][1]=-1; signs_confs[3][2]=-1; + + /* initialize alternatives */ + /* when we find the best J-configuration, we also compare it to the alternative 2nd best one. + * this comparison is done for every pair in the triplete independently. to make sure that the + * alternative is indeed different in relation to the pair, we document the differences between + * the configurations in advance: + * ALTS(:,best_conf,pair) = the two configurations in which J-sync differs from + * best_conf in relation to pair */ + + int ALTS[2][4][3]; + ALTS[0][0][0]=1; ALTS[0][1][0]=0; ALTS[0][2][0]=0; ALTS[0][3][0]=1; + ALTS[1][0][0]=2; ALTS[1][1][0]=3; ALTS[1][2][0]=3; ALTS[1][3][0]=2; + ALTS[0][0][1]=2; ALTS[0][1][1]=2; ALTS[0][2][1]=0; ALTS[0][3][1]=0; + ALTS[1][0][1]=3; ALTS[1][1][1]=3; ALTS[1][2][1]=1; ALTS[1][3][1]=1; + ALTS[0][0][2]=1; ALTS[0][1][2]=0; ALTS[0][2][2]=1; ALTS[0][3][2]=0; + ALTS[1][0][2]=3; ALTS[1][1][2]=2; ALTS[1][2][2]=3; ALTS[1][3][2]=2; + + + for(j=i+1; j< (n - 1); j++){ + ij = PAIR_IDX(n, i, j); + for(k=j+1; k< n; k++){ + ik = PAIR_IDX(n, i, k); + jk = PAIR_IDX(n, j, k); + + /* compute configurations matches scores */ + Rij = Rijs + 9*ij; + Rjk = Rijs + 9*jk; + Rik = Rijs + 9*ik; + + JRJ(Rij, JRijJ); + JRJ(Rjk, JRjkJ); + JRJ(Rik, JRikJ); + + mult_3x3(tmp, Rij, Rjk); + c[0] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, JRijJ, Rjk); + c[1] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, Rij, JRjkJ); + c[2] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, Rij, Rjk); + c[3] = diff_norm_3x3(tmp, JRikJ); + + /* find best match */ + best_i=0; best_val=c[0]; + if (c[1] Date: Fri, 26 Apr 2024 08:59:29 -0400 Subject: [PATCH 214/433] add triangle scores cupy kernel --- src/aspire/abinitio/commonline_sync3n.py | 358 +++++++++++++++++------ 1 file changed, 271 insertions(+), 87 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 1f64cf7e12..948accdd7f 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -300,84 +300,16 @@ def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): return W def _triangle_scores_inner(self, Rijs, hist_intervals): - # The following is adopted from Matlab triangle_scores_mex.c - # Initialize probability result arrays - cum_scores = np.zeros(len(Rijs), dtype=self.dtype) - scores_hist = np.zeros(hist_intervals, dtype=self.dtype) - h = 1 / hist_intervals - - c = np.empty((4), dtype=self.dtype) - for i in trange(self.n_img, desc="Computing triangle scores"): - for j in range( - i + 1, self.n_img - 1 - ): # check bound (taken from MATLAB mex) - ij = self._pairs_to_linear[i, j] - Rij = Rijs[ij] - for k in range(j + 1, self.n_img): - ik = self._pairs_to_linear[i, k] - jk = self._pairs_to_linear[j, k] - Rik = Rijs[ik] - Rjk = Rijs[jk] - - # Compute conjugated rotats - Rij_J = J_conjugate(Rij) - Rik_J = J_conjugate(Rik) - Rjk_J = J_conjugate(Rjk) - - # Compute R muls and norms - c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) - c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) - c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) - c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) - - # Find best match - best_i = np.argmin(c) - best_val = c[best_i] - - # For each triangle side, find the best alternative - alt_ij_jk = c[_ALTS[0][best_i][0]] - if c[_ALTS[1][best_i][0]] < alt_ij_jk: - alt_ij_jk = c[_ALTS[1][best_i][0]] - - alt_ik_jk = c[_ALTS[0][best_i][1]] - if c[_ALTS[1][best_i][1]] < alt_ik_jk: - alt_ik_jk = c[_ALTS[1][best_i][1]] - - alt_ij_ik = c[_ALTS[0][best_i][2]] - if c[_ALTS[1][best_i][2]] < alt_ij_ik: - alt_ij_ik = c[_ALTS[1][best_i][2]] - - # Compute scores - s_ij_jk = 1 - np.sqrt(best_val / alt_ij_jk) - s_ik_jk = 1 - np.sqrt(best_val / alt_ik_jk) - s_ij_ik = 1 - np.sqrt(best_val / alt_ij_ik) - - # Update cumulated scores - cum_scores[ij] += s_ij_jk + s_ij_ik - cum_scores[jk] += s_ij_jk + s_ik_jk - cum_scores[ik] += s_ik_jk + s_ij_ik - - # Update histogram - threshold = 0 - for _l1 in range(hist_intervals): - threshold += h - if s_ij_jk < threshold: - break - - for _l2 in range(hist_intervals): - threshold += h - if s_ik_jk < threshold: - break - - for _l3 in range(hist_intervals): - threshold += h - if s_ij_ik < threshold: - break - - scores_hist[_l1] += 1 - scores_hist[_l2] += 1 - scores_hist[_l3] += 1 + # host/gpu dispatch + if self._use_gpu: + cum_scores, scores_hist = _triangle_scores_inner_cupy( + self.n_img, Rijs, hist_intervals + ) + else: + cum_scores, scores_hist = _triangle_scores_inner_host( + self.n_img, Rijs, hist_intervals, _ALTS, self._pairs_to_linear + ) return cum_scores, scores_hist @@ -980,24 +912,24 @@ def _init_cupy_module(): s_ij_jk = 1 - sqrt(best_val / alt_ij_jk); s_ik_jk = 1 - sqrt(best_val / alt_ik_jk); s_ij_ik = 1 - sqrt(best_val / alt_ij_ik); - + /* the probability of a pair ij to have the observed triangles scores, given it has an indicative common line */ f_ij_jk = log( P2*(B*pow(1-s_ij_jk,b)*exp(-b/(1-x0)*(1-s_ij_jk))) + (1-P2)*A*pow((1-s_ij_jk),a) ); f_ik_jk = log( P2*(B*pow(1-s_ik_jk,b)*exp(-b/(1-x0)*(1-s_ik_jk))) + (1-P2)*A*pow((1-s_ik_jk),a) ); f_ij_ik = log( P2*(B*pow(1-s_ij_ik,b)*exp(-b/(1-x0)*(1-s_ij_ik))) + (1-P2)*A*pow((1-s_ij_ik),a) ); - ln_f_ind[ij*n +i] += f_ij_jk + f_ij_ik; - ln_f_ind[jk*n +i] += f_ij_jk + f_ik_jk; - ln_f_ind[ik*n +i] += f_ik_jk + f_ij_ik; - + ln_f_ind[ij*n +i] += f_ij_jk + f_ij_ik; + ln_f_ind[jk*n +i] += f_ij_jk + f_ik_jk; + ln_f_ind[ik*n +i] += f_ik_jk + f_ij_ik; + /* the probability of a pair ij to have the observed triangles scores, given it has an arbitrary common line */ f_ij_jk = log( A*pow((1-s_ij_jk),a) ); - f_ik_jk = log( A*pow((1-s_ik_jk),a) ); - f_ij_ik = log( A*pow((1-s_ij_ik),a) ); - ln_f_arb[ij*n +i] += f_ij_jk + f_ij_ik; - ln_f_arb[jk*n +i] += f_ij_jk + f_ik_jk; + f_ik_jk = log( A*pow((1-s_ik_jk),a) ); + f_ij_ik = log( A*pow((1-s_ij_ik),a) ); + ln_f_arb[ij*n +i] += f_ij_jk + f_ij_ik; + ln_f_arb[jk*n +i] += f_ij_jk + f_ik_jk; ln_f_arb[ik*n +i] += f_ik_jk + f_ij_ik; @@ -1007,6 +939,138 @@ def _init_cupy_module(): return; }; + +extern "C" __global__ +void triangle_scores_inner(int n, double* Rijs, int n_intervals, double* cum_scores, double* scores_hist) +{ + /* thread index (1d), represents "i" index */ + unsigned int i = blockDim.x * blockIdx.x + threadIdx.x; + + /* no-op when out of bounds */ + if(i >= n) return; + + double c[4]; + unsigned int j; + unsigned int k; + for(k=0;k<4;k++){c[k]=0;} + unsigned long ij, jk, ik; + int best_i; + double best_val; + double s_ij_jk, s_ik_jk, s_ij_ik; + double alt_ij_jk, alt_ij_ik, alt_ik_jk; + unsigned int l1,l2,l3; + double threshold; + double h = 1. / n_intervals; + + double *Rij, *Rjk, *Rik; + double JRijJ[9], JRjkJ[9], JRikJ[9]; + double tmp[9]; + + /* initialize alternatives */ + /* when we find the best J-configuration, we also compare it to the alternative 2nd best one. + * this comparison is done for every pair in the triplete independently. to make sure that the + * alternative is indeed different in relation to the pair, we document the differences between + * the configurations in advance: + * ALTS(:,best_conf,pair) = the two configurations in which J-sync differs from + * best_conf in relation to pair */ + + int ALTS[2][4][3]; + ALTS[0][0][0]=1; ALTS[0][1][0]=0; ALTS[0][2][0]=0; ALTS[0][3][0]=1; + ALTS[1][0][0]=2; ALTS[1][1][0]=3; ALTS[1][2][0]=3; ALTS[1][3][0]=2; + ALTS[0][0][1]=2; ALTS[0][1][1]=2; ALTS[0][2][1]=0; ALTS[0][3][1]=0; + ALTS[1][0][1]=3; ALTS[1][1][1]=3; ALTS[1][2][1]=1; ALTS[1][3][1]=1; + ALTS[0][0][2]=1; ALTS[0][1][2]=0; ALTS[0][2][2]=1; ALTS[0][3][2]=0; + ALTS[1][0][2]=3; ALTS[1][1][2]=2; ALTS[1][2][2]=3; ALTS[1][3][2]=2; + + + for(j=i+1; j< (n - 1); j++){ + ij = PAIR_IDX(n, i, j); + for(k=j+1; k< n; k++){ + ik = PAIR_IDX(n, i, k); + jk = PAIR_IDX(n, j, k); + + /* compute configurations matches scores */ + Rij = Rijs + 9*ij; + Rjk = Rijs + 9*jk; + Rik = Rijs + 9*ik; + + JRJ(Rij, JRijJ); + JRJ(Rjk, JRjkJ); + JRJ(Rik, JRikJ); + + mult_3x3(tmp, Rij, Rjk); + c[0] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, JRijJ, Rjk); + c[1] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, Rij, JRjkJ); + c[2] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, Rij, Rjk); + c[3] = diff_norm_3x3(tmp, JRikJ); + + /* find best match */ + best_i=0; best_val=c[0]; + if (c[1] Date: Fri, 26 Apr 2024 09:32:52 -0400 Subject: [PATCH 215/433] initial bulk refactor --- src/aspire/abinitio/commonline_sync3n.py | 1219 +++++++--------------- 1 file changed, 400 insertions(+), 819 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 948accdd7f..7c9d65c81b 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -11,28 +11,28 @@ logger = logging.getLogger(__name__) -# Initialize alternatives -# -# When we find the best J-configuration, we also compare it to the alternative 2nd best one. -# this comparison is done for every pair in the triplete independently. to make sure that the -# alternative is indeed different in relation to the pair, we document the differences between -# the configurations in advance: -# ALTS(:,best_conf,pair) = the two configurations in which J-sync differs from best_conf in relation to pair - -_ALTS = np.array( - [ - [[1, 2, 1], [0, 2, 0], [0, 0, 1], [1, 0, 0]], - [[2, 3, 3], [3, 3, 2], [3, 1, 3], [2, 1, 2]], - ], - dtype=int, -) - class CLSync3N(CLOrient3D, SyncVotingMixin): """ Define a class to estimate 3D orientations using common lines Sync3N methods (2017). """ + # Initialize alternatives + # + # When we find the best J-configuration, we also compare it to the alternative 2nd best one. + # this comparison is done for every pair in the triplete independently. to make sure that the + # alternative is indeed different in relation to the pair, we document the differences between + # the configurations in advance: + # ALTS(:,best_conf,pair) = the two configurations in which J-sync differs from best_conf in relation to pair + + _ALTS = np.array( + [ + [[1, 2, 1], [0, 2, 0], [0, 0, 1], [1, 0, 0]], + [[2, 3, 3], [3, 3, 2], [3, 1, 3], [2, 1, 2]], + ], + dtype=int, + ) + def __init__( self, src, @@ -47,6 +47,7 @@ def __init__( mask=True, S_weighting=False, J_weighting=False, + hist_intervals=100, ): """ Initialize object for estimating 3D orientations. @@ -85,9 +86,10 @@ def __init__( self.S_weighting = S_weighting self.J_weighting = J_weighting self._D_null = 1e-13 + self.hist_intervals = hist_intervals # Auto configure GPU - self._use_gpu = False + self._gpu_module = None try: import cupy as cp @@ -96,9 +98,10 @@ def __init__( logger.info( f"cupy and GPU {gpu_id} found by cuda runtime; enabling cupy." ) - self._use_gpu = True + self._gpu_module = _init_cupy_module() else: logger.info("GPU not found, defaulting to numpy.") + except ModuleNotFoundError: logger.info("cupy not found, defaulting numpy.") @@ -299,17 +302,140 @@ def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): return W - def _triangle_scores_inner(self, Rijs, hist_intervals): + def _triangle_scores_inner(self, Rijs): # host/gpu dispatch - if self._use_gpu: - cum_scores, scores_hist = _triangle_scores_inner_cupy( - self.n_img, Rijs, hist_intervals - ) + if self._gpu_module: + cum_scores, scores_hist = self._triangle_scores_inner_cupy(Rijs) else: - cum_scores, scores_hist = _triangle_scores_inner_host( - self.n_img, Rijs, hist_intervals, _ALTS, self._pairs_to_linear - ) + cum_scores, scores_hist = self._triangle_scores_inner_host(Rijs) + + return cum_scores, scores_hist + + def _triangle_scores_inner_host(self, Rijs): + + # The following is adopted from Matlab triangle_scores_mex.c + + # Initialize probability result arrays + cum_scores = np.zeros(len(Rijs), dtype=Rijs.dtype) + scores_hist = np.zeros(self.hist_intervals, dtype=Rijs.dtype) + h = 1 / self.hist_intervals + + c = np.empty((4), dtype=Rijs.dtype) + for i in trange(self.n_img, desc="Computing triangle scores"): + for j in range( + i + 1, self.n_img - 1 + ): # check bound (taken from MATLAB mex) + ij = self._pairs_to_linear[i, j] + Rij = Rijs[ij] + for k in range(j + 1, self.n_img): + ik = self._pairs_to_linear[i, k] + jk = self._pairs_to_linear[j, k] + Rik = Rijs[ik] + Rjk = Rijs[jk] + + # Compute conjugated rotats + Rij_J = J_conjugate(Rij) + Rik_J = J_conjugate(Rik) + Rjk_J = J_conjugate(Rjk) + + # Compute R muls and norms + c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) + c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) + c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) + c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) + + # Find best match + best_i = np.argmin(c) + best_val = c[best_i] + + # For each triangle side, find the best alternative + alt_ij_jk = c[self._ALTS[0][best_i][0]] + if c[self._ALTS[1][best_i][0]] < alt_ij_jk: + alt_ij_jk = c[self._ALTS[1][best_i][0]] + + alt_ik_jk = c[self._ALTS[0][best_i][1]] + if c[self._ALTS[1][best_i][1]] < alt_ik_jk: + alt_ik_jk = c[self._ALTS[1][best_i][1]] + + alt_ij_ik = c[self._ALTS[0][best_i][2]] + if c[self._ALTS[1][best_i][2]] < alt_ij_ik: + alt_ij_ik = c[self._ALTS[1][best_i][2]] + + # Compute scores + s_ij_jk = 1 - np.sqrt(best_val / alt_ij_jk) + s_ik_jk = 1 - np.sqrt(best_val / alt_ik_jk) + s_ij_ik = 1 - np.sqrt(best_val / alt_ij_ik) + + # Update cumulated scores + cum_scores[ij] += s_ij_jk + s_ij_ik + cum_scores[jk] += s_ij_jk + s_ik_jk + cum_scores[ik] += s_ik_jk + s_ij_ik + + # Update histogram + threshold = 0 + for _l1 in range(self.hist_intervals - 1): + threshold += h + if s_ij_jk < threshold: + break + + threshold = 0 + for _l2 in range(self.hist_intervals - 1): + threshold += h + if s_ik_jk < threshold: + break + + threshold = 0 + for _l3 in range(self.hist_intervals - 1): + threshold += h + if s_ij_ik < threshold: + break + + scores_hist[_l1] += 1 + scores_hist[_l2] += 1 + scores_hist[_l3] += 1 + + return cum_scores, scores_hist + + def _triangle_scores_inner_cupy(self, Rijs): + """ + n: n_img + Rijs: nchoose2x3x3 array + + """ + import cupy as cp + + triangle_scores = self._gpu_module.get_function("triangle_scores_inner") + + Rijs_dev = cp.array(Rijs) + + # xxx I think we can safely remove cum_scores + cum_scores_dev = cp.zeros( + (n_img * (n_img - 1) // 2, n_img), dtype=np.float64 + ) # n is for thread safety + + scores_hist_dev = cp.zeros( + (hist_intervals, n_img), dtype=np.float64 + ) # n is for thread safety + + # call the kernel + blkszx = 512 + nblkx = (n_img + blkszx - 1) // blkszx + triangle_scores( + (nblkx,), + (blkszx,), + ( + self.n_img, + Rijs_dev, + self.hist_intervals, + cum_scores_dev, + scores_hist_dev, + ), + ) + + # accumulate over thread results + cum_scores = cp.sum(cum_scores_dev, axis=1).get() + scores_hist = cp.sum(scores_hist_dev, axis=1).get() return cum_scores, scores_hist @@ -317,12 +443,136 @@ def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0): # dtype is critical for passing into C code... params = np.arary([P2, A, a, B, b, x0], dtype=np.float64) # host/gpu dispatch - if self._use_gpu: - ln_f_ind, ln_f_arb = _pairs_probabilities_cupy(self.n_img, Rijs, *params) + if self._gpu_module: + ln_f_ind, ln_f_arb = self._pairs_probabilities_cupy(Rijs, *params) else: - ln_f_ind, ln_f_arb = _pairs_probabilities_host( - self.n_img, Rijs, *params, _ALTS, self._pairs_to_linear - ) + ln_f_ind, ln_f_arb = self._pairs_probabilities_host(Rijs, *params) + + return ln_f_ind, ln_f_arb + + def _pairs_probabilities_host(self, Rijs, P2, A, a, B, b, x0): + # The following is adopted from Matlab pairs_probabilities_mex.c `looper` + + # Initialize probability result arrays + ln_f_ind = np.zeros(len(Rijs), dtype=Rijs.dtype) + ln_f_arb = np.zeros(len(Rijs), dtype=Rijs.dtype) + + c = np.empty((4), dtype=Rijs.dtype) + for i in trange(self.n_img, desc="Computing pair probabilities"): + for j in range(i + 1, self.n_img - 1): + ij = self._pairs_to_linear[i, j] + Rij = Rijs[ij] + for k in range(j + 1, self.n_img): + ik = self._pairs_to_linear[i, k] + jk = self._pairs_to_linear[j, k] + Rik = Rijs[ik] + Rjk = Rijs[jk] + + # Compute conjugated rotats + Rij_J = J_conjugate(Rij) + Rik_J = J_conjugate(Rik) + Rjk_J = J_conjugate(Rjk) + + # Compute R muls and norms + c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) + c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) + c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) + c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) + + # Find best match + best_i = np.argmin(c) + best_val = c[best_i] + + # For each triangle side, find the best alternative + alt_ij_jk = c[self._ALTS[0][best_i][0]] + if c[self._ALTS[1][best_i][0]] < alt_ij_jk: + alt_ij_jk = c[self._ALTS[1][best_i][0]] + alt_ik_jk = c[self._ALTS[0][best_i][1]] + if c[self._ALTS[1][best_i][1]] < alt_ik_jk: + alt_ik_jk = c[self._ALTS[1][best_i][1]] + alt_ij_ik = c[self._ALTS[0][best_i][2]] + if c[self._ALTS[1][best_i][2]] < alt_ij_ik: + alt_ij_ik = c[self._ALTS[1][best_i][2]] + + # Compute scores + s_ij_jk = 1 - np.sqrt(best_val / alt_ij_jk) + s_ik_jk = 1 - np.sqrt(best_val / alt_ik_jk) + s_ij_ik = 1 - np.sqrt(best_val / alt_ij_ik) + + # Update probabilities + # # Probability of pair ij having score given indicicative common line + # P2, B, b, x0, A, a + f_ij_jk = np.log( + P2 + * ( + B + * np.power(1 - s_ij_jk, b) + * np.exp(-b / (1 - x0) * (1 - s_ij_jk)) + ) + + (1 - P2) * A * np.power((1 - s_ij_jk), a) + ) + f_ik_jk = np.log( + P2 + * ( + B + * np.power(1 - s_ik_jk, b) + * np.exp(-b / (1 - x0) * (1 - s_ik_jk)) + ) + + (1 - P2) * A * np.power((1 - s_ik_jk), a) + ) + f_ij_ik = np.log( + P2 + * ( + B + * np.power(1 - s_ij_ik, b) + * np.exp(-b / (1 - x0) * (1 - s_ij_ik)) + ) + + (1 - P2) * A * np.power((1 - s_ij_ik), a) + ) + ln_f_ind[ij] += f_ij_jk + f_ij_ik + ln_f_ind[jk] += f_ij_jk + f_ik_jk + ln_f_ind[ik] += f_ik_jk + f_ij_ik + + # # Probability of pair ij having score given arbitrary common line + f_ij_jk = np.log(A * np.power((1 - s_ij_jk), a)) + f_ik_jk = np.log(A * np.power((1 - s_ik_jk), a)) + f_ij_ik = np.log(A * np.power((1 - s_ij_ik), a)) + ln_f_arb[ij] += f_ij_jk + f_ij_ik + ln_f_arb[jk] += f_ij_jk + f_ik_jk + ln_f_arb[ik] += f_ik_jk + f_ij_ik + + return ln_f_ind, ln_f_arb + + def _pairs_probabilities_cupy(self, Rijs, P2, A, a, B, b, x0): + """ + n: n_img + Rijs: nchoose2x3x3 array + + """ + import cupy as cp + + pairs_probabilities = self._gpu_module.get_function("pairs_probabilities") + + Rijs_dev = cp.array(Rijs) + ln_f_ind_dev = cp.zeros( + (self.n_img * (self.n_img - 1) // 2, self.n_img) + ) # second dim is for thread safety + ln_f_arb_dev = cp.zeros( + (self.n_img * (self.n_img - 1) // 2, self.n_img) + ) # second dim is for thread safety + + # call the kernel + blkszx = 512 + nblkx = (self.n_img + blkszx - 1) // blkszx + pairs_probabilities( + (nblkx,), + (blkszx,), + (self.n_img, Rijs_dev, P2, A, a, B, b, x0, ln_f_ind_dev, ln_f_arb_dev), + ) + + # accumulate over thread results + ln_f_arb = cp.sum(ln_f_arb_dev, axis=1).get() + ln_f_ind = cp.sum(ln_f_ind_dev, axis=1).get() return ln_f_ind, ln_f_arb @@ -332,7 +582,6 @@ def _triangle_scores( scores_hist, Pmin, Pmax, - hist_intervals=100, a=2.2, peak2sigma=2.43e-2, P=0.5, @@ -359,7 +608,7 @@ def _triangle_scores( cum_scores = None # XXX Why do we even need cum_scores? if scores_hist is None: - cum_scores, scores_hist = self._triangle_scores_inner(Rijs, hist_intervals) + cum_scores, scores_hist = self._triangle_scores_inner(Rijs) # Normalize cumulated scores cum_scores /= len(Rijs) @@ -555,809 +804,141 @@ def _J_sync_power_method(self, Rijs): def _signs_times_v(self, Rijs, vec): # host/gpu dispatch - if self._use_gpu: - new_vec = _signs_times_v_cupy(self.n_img, Rijs, vec, self.J_weighting) + if self._gpu_module: + new_vec = self._signs_times_v_cupy(Rijs, vec) else: - new_vec = _signs_times_v_host( - self.n_img, Rijs, vec, self.J_weighting, _ALTS, self._pairs_to_linear - ) + new_vec = self._signs_times_v_host(Rijs, vec) return new_vec + def _signs_times_v_host(self, Rijs, vec): + """ + Ported from _signs_times_v_mex.c + + n: n_img + Rijs: nchoose2x3x3 array + vec: input array + new_vec: output array + J_weighting: bool + _ALTS= 2x4x3 const lut array + """ -def _signs_times_v_host(n, Rijs, vec, J_weighting, _ALTS, _pairs_to_linear): - """ - Ported from _signs_times_v_mex.c - - n: n_img - Rijs: nchoose2x3x3 array - vec: input array - new_vec: output array - J_weighting: bool - _ALTS= 2x4x3 const lut array - """ - - new_vec = np.zeros_like(vec) - - _signs_confs = np.array( - [[1, 1, 1], [-1, 1, -1], [-1, -1, 1], [1, -1, -1]], dtype=int - ) - - c = np.empty((4)) - desc = "Computing signs_times_v" - if J_weighting: - desc += " with J_weighting" - for i in trange(n, desc=desc): - for j in range(i + 1, n - 1): # check bound (taken from MATLAB mex) - ij = _pairs_to_linear[i, j] - Rij = Rijs[ij] - for k in range(j + 1, n): - ik = _pairs_to_linear[i, k] - jk = _pairs_to_linear[j, k] - Rik = Rijs[ik] - Rjk = Rijs[jk] - - # Compute conjugated rotats - Rij_J = J_conjugate(Rij) - Rik_J = J_conjugate(Rik) - Rjk_J = J_conjugate(Rjk) - - # Compute R muls and norms - c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) - c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) - c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) - c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) - - # Find best match - best_i = np.argmin(c) - best_val = c[best_i] - - # MATLAB: scores_as_entries == 0 - s_ij_jk = _signs_confs[best_i][0] - s_ik_jk = _signs_confs[best_i][1] - s_ij_ik = _signs_confs[best_i][2] - - # Note there was a third J_weighting option (2) in MATLAB, - # but it was not exposed at top level. - if J_weighting: - # MATLAB: scores_as_entries == 1 - # For each triangle side, find the best alternative - alt_ij_jk = c[_ALTS[0][best_i][0]] - if c[_ALTS[1][best_i][0]] < alt_ij_jk: - alt_ij_jk = c[_ALTS[1][best_i][0]] - - alt_ik_jk = c[_ALTS[0][best_i][1]] - if c[_ALTS[1][best_i][1]] < alt_ik_jk: - alt_ik_jk = c[_ALTS[1][best_i][1]] - - alt_ij_ik = c[_ALTS[0][best_i][2]] - if c[_ALTS[1][best_i][2]] < alt_ij_ik: - alt_ij_ik = c[_ALTS[1][best_i][2]] - - # Compute scores - s_ij_jk *= 1 - np.sqrt(best_val / alt_ij_jk) - s_ik_jk *= 1 - np.sqrt(best_val / alt_ik_jk) - s_ij_ik *= 1 - np.sqrt(best_val / alt_ij_ik) - - # Update vector entries - new_vec[ij] += s_ij_jk * vec[jk] + s_ij_ik * vec[ik] - new_vec[jk] += s_ij_jk * vec[ij] + s_ik_jk * vec[ik] - new_vec[ik] += s_ij_ik * vec[ij] + s_ik_jk * vec[jk] - - return new_vec - - -def _init_cupy_module(): - module_code = r""" - -/* from i,j indoces to the common index in the N-choose-2 sized array */ -#define PAIR_IDX(N,I,J) ((2*N-I-1)*I/2 + J-I-1) - - -inline void mult_3x3(double *out, double *R1, double *R2) { - /* 3X3 matrices multiplication: out = R1*R2 - * Note, this differs from the MATLAB mult_3x3. - */ - - int i,j,k; - - for(i=0; i<3; i++){ - for(j=0; j<3; j++){ - out[i*3 + j] = 0; - for (k=0; k<3; k++){ - out[i*3 + j] += R1[i*3+k] * R2[k*3+j]; - } - } - } -} - -inline void JRJ(double *R, double *A) { -/* multiple 3X3 matrix by J from both sizes: A = JRJ */ - A[0]=R[0]; - A[1]=R[1]; - A[2]=-R[2]; - A[3]=R[3]; - A[4]=R[4]; - A[5]=-R[5]; - A[6]=-R[6]; - A[7]=-R[7]; - A[8]=R[8]; -} - -inline double diff_norm_3x3(const double *R1, const double *R2) { -/* difference 2 matrices and return squared norm: ||R1-R2||^2 */ - int i; - double norm = 0; - for (i=0; i<9; i++) {norm += (R1[i]-R2[i])*(R1[i]-R2[i]);} - return norm; -} - - -extern "C" __global__ -void signs_times_v(int n, double* Rijs, const double* vec, double* new_vec, bool J_weighting) -{ - /* thread index (1d), represents "i" index */ - unsigned int i = blockDim.x * blockIdx.x + threadIdx.x; - - /* no-op when out of bounds */ - if(i >= n) return; - - double c[4]; - unsigned int j; - unsigned int k; - for(k=0;k<4;k++){c[k]=0;} - unsigned long ij, jk, ik; - int best_i; - double best_val; - double s_ij_jk, s_ik_jk, s_ij_ik; - double alt_ij_jk, alt_ij_ik, alt_ik_jk; - - double *Rij, *Rjk, *Rik; - double JRijJ[9], JRjkJ[9], JRikJ[9]; - double tmp[9]; - - int signs_confs[4][3]; - for(int a=0; a<4; a++) { for(k=0; k<3; k++) { signs_confs[a][k]=1; } } - signs_confs[1][0]=-1; signs_confs[1][2]=-1; - signs_confs[2][0]=-1; signs_confs[2][1]=-1; - signs_confs[3][1]=-1; signs_confs[3][2]=-1; - - /* initialize alternatives */ - /* when we find the best J-configuration, we also compare it to the alternative 2nd best one. - * this comparison is done for every pair in the triplete independently. to make sure that the - * alternative is indeed different in relation to the pair, we document the differences between - * the configurations in advance: - * ALTS(:,best_conf,pair) = the two configurations in which J-sync differs from - * best_conf in relation to pair */ - - int ALTS[2][4][3]; - ALTS[0][0][0]=1; ALTS[0][1][0]=0; ALTS[0][2][0]=0; ALTS[0][3][0]=1; - ALTS[1][0][0]=2; ALTS[1][1][0]=3; ALTS[1][2][0]=3; ALTS[1][3][0]=2; - ALTS[0][0][1]=2; ALTS[0][1][1]=2; ALTS[0][2][1]=0; ALTS[0][3][1]=0; - ALTS[1][0][1]=3; ALTS[1][1][1]=3; ALTS[1][2][1]=1; ALTS[1][3][1]=1; - ALTS[0][0][2]=1; ALTS[0][1][2]=0; ALTS[0][2][2]=1; ALTS[0][3][2]=0; - ALTS[1][0][2]=3; ALTS[1][1][2]=2; ALTS[1][2][2]=3; ALTS[1][3][2]=2; - - - for(j=i+1; j< (n - 1); j++){ - ij = PAIR_IDX(n, i, j); - for(k=j+1; k< n; k++){ - ik = PAIR_IDX(n, i, k); - jk = PAIR_IDX(n, j, k); - - /* compute configurations matches scores */ - Rij = Rijs + 9*ij; - Rjk = Rijs + 9*jk; - Rik = Rijs + 9*ik; - - JRJ(Rij, JRijJ); - JRJ(Rjk, JRjkJ); - JRJ(Rik, JRikJ); - - mult_3x3(tmp, Rij, Rjk); - c[0] = diff_norm_3x3(tmp, Rik); - - mult_3x3(tmp, JRijJ, Rjk); - c[1] = diff_norm_3x3(tmp, Rik); - - mult_3x3(tmp, Rij, JRjkJ); - c[2] = diff_norm_3x3(tmp, Rik); - - mult_3x3(tmp, Rij, Rjk); - c[3] = diff_norm_3x3(tmp, JRikJ); - - /* find best match */ - best_i=0; best_val=c[0]; - if (c[1]= n) return; - - double c[4]; - unsigned int j; - unsigned int k; - for(k=0;k<4;k++){c[k]=0;} - unsigned long ij, jk, ik; - int best_i; - double best_val; - double s_ij_jk, s_ik_jk, s_ij_ik; - double alt_ij_jk, alt_ij_ik, alt_ik_jk; - double f_ij_jk, f_ik_jk, f_ij_ik; - - - double *Rij, *Rjk, *Rik; - double JRijJ[9], JRjkJ[9], JRikJ[9]; - double tmp[9]; - - int signs_confs[4][3]; - for(int a=0; a<4; a++) { for(k=0; k<3; k++) { signs_confs[a][k]=1; } } - signs_confs[1][0]=-1; signs_confs[1][2]=-1; - signs_confs[2][0]=-1; signs_confs[2][1]=-1; - signs_confs[3][1]=-1; signs_confs[3][2]=-1; - - /* initialize alternatives */ - /* when we find the best J-configuration, we also compare it to the alternative 2nd best one. - * this comparison is done for every pair in the triplete independently. to make sure that the - * alternative is indeed different in relation to the pair, we document the differences between - * the configurations in advance: - * ALTS(:,best_conf,pair) = the two configurations in which J-sync differs from - * best_conf in relation to pair */ - - int ALTS[2][4][3]; - ALTS[0][0][0]=1; ALTS[0][1][0]=0; ALTS[0][2][0]=0; ALTS[0][3][0]=1; - ALTS[1][0][0]=2; ALTS[1][1][0]=3; ALTS[1][2][0]=3; ALTS[1][3][0]=2; - ALTS[0][0][1]=2; ALTS[0][1][1]=2; ALTS[0][2][1]=0; ALTS[0][3][1]=0; - ALTS[1][0][1]=3; ALTS[1][1][1]=3; ALTS[1][2][1]=1; ALTS[1][3][1]=1; - ALTS[0][0][2]=1; ALTS[0][1][2]=0; ALTS[0][2][2]=1; ALTS[0][3][2]=0; - ALTS[1][0][2]=3; ALTS[1][1][2]=2; ALTS[1][2][2]=3; ALTS[1][3][2]=2; - - - for(j=i+1; j< (n - 1); j++){ - ij = PAIR_IDX(n, i, j); - for(k=j+1; k< n; k++){ - ik = PAIR_IDX(n, i, k); - jk = PAIR_IDX(n, j, k); - - /* compute configurations matches scores */ - Rij = Rijs + 9*ij; - Rjk = Rijs + 9*jk; - Rik = Rijs + 9*ik; - - JRJ(Rij, JRijJ); - JRJ(Rjk, JRjkJ); - JRJ(Rik, JRikJ); - - mult_3x3(tmp, Rij, Rjk); - c[0] = diff_norm_3x3(tmp, Rik); - - mult_3x3(tmp, JRijJ, Rjk); - c[1] = diff_norm_3x3(tmp, Rik); - - mult_3x3(tmp, Rij, JRjkJ); - c[2] = diff_norm_3x3(tmp, Rik); - - mult_3x3(tmp, Rij, Rjk); - c[3] = diff_norm_3x3(tmp, JRikJ); - - /* find best match */ - best_i=0; best_val=c[0]; - if (c[1]= n) return; - - double c[4]; - unsigned int j; - unsigned int k; - for(k=0;k<4;k++){c[k]=0;} - unsigned long ij, jk, ik; - int best_i; - double best_val; - double s_ij_jk, s_ik_jk, s_ij_ik; - double alt_ij_jk, alt_ij_ik, alt_ik_jk; - unsigned int l1,l2,l3; - double threshold; - double h = 1. / n_intervals; - - double *Rij, *Rjk, *Rik; - double JRijJ[9], JRjkJ[9], JRikJ[9]; - double tmp[9]; - - /* initialize alternatives */ - /* when we find the best J-configuration, we also compare it to the alternative 2nd best one. - * this comparison is done for every pair in the triplete independently. to make sure that the - * alternative is indeed different in relation to the pair, we document the differences between - * the configurations in advance: - * ALTS(:,best_conf,pair) = the two configurations in which J-sync differs from - * best_conf in relation to pair */ - - int ALTS[2][4][3]; - ALTS[0][0][0]=1; ALTS[0][1][0]=0; ALTS[0][2][0]=0; ALTS[0][3][0]=1; - ALTS[1][0][0]=2; ALTS[1][1][0]=3; ALTS[1][2][0]=3; ALTS[1][3][0]=2; - ALTS[0][0][1]=2; ALTS[0][1][1]=2; ALTS[0][2][1]=0; ALTS[0][3][1]=0; - ALTS[1][0][1]=3; ALTS[1][1][1]=3; ALTS[1][2][1]=1; ALTS[1][3][1]=1; - ALTS[0][0][2]=1; ALTS[0][1][2]=0; ALTS[0][2][2]=1; ALTS[0][3][2]=0; - ALTS[1][0][2]=3; ALTS[1][1][2]=2; ALTS[1][2][2]=3; ALTS[1][3][2]=2; - - - for(j=i+1; j< (n - 1); j++){ - ij = PAIR_IDX(n, i, j); - for(k=j+1; k< n; k++){ - ik = PAIR_IDX(n, i, k); - jk = PAIR_IDX(n, j, k); - - /* compute configurations matches scores */ - Rij = Rijs + 9*ij; - Rjk = Rijs + 9*jk; - Rik = Rijs + 9*ik; - - JRJ(Rij, JRijJ); - JRJ(Rjk, JRjkJ); - JRJ(Rik, JRikJ); - - mult_3x3(tmp, Rij, Rjk); - c[0] = diff_norm_3x3(tmp, Rik); - - mult_3x3(tmp, JRijJ, Rjk); - c[1] = diff_norm_3x3(tmp, Rik); - - mult_3x3(tmp, Rij, JRjkJ); - c[2] = diff_norm_3x3(tmp, Rik); - - mult_3x3(tmp, Rij, Rjk); - c[3] = diff_norm_3x3(tmp, JRikJ); - - /* find best match */ - best_i=0; best_val=c[0]; - if (c[1] Date: Fri, 26 Apr 2024 10:42:49 -0400 Subject: [PATCH 216/433] initial cupy comparison test add --- src/aspire/abinitio/commonline_sync3n.cu | 421 +++++++++++++++++++++++ src/aspire/abinitio/commonline_sync3n.py | 30 +- tests/test_commonline_sync3n_cupy.py | 104 ++++++ 3 files changed, 541 insertions(+), 14 deletions(-) create mode 100644 src/aspire/abinitio/commonline_sync3n.cu create mode 100644 tests/test_commonline_sync3n_cupy.py diff --git a/src/aspire/abinitio/commonline_sync3n.cu b/src/aspire/abinitio/commonline_sync3n.cu new file mode 100644 index 0000000000..3c0b0b9001 --- /dev/null +++ b/src/aspire/abinitio/commonline_sync3n.cu @@ -0,0 +1,421 @@ + +/* from i,j indoces to the common index in the N-choose-2 sized array */ +#define PAIR_IDX(N,I,J) ((2*N-I-1)*I/2 + J-I-1) + + +inline void mult_3x3(double *out, double *R1, double *R2) { + /* 3X3 matrices multiplication: out = R1*R2 + * Note, this differs from the MATLAB mult_3x3. + */ + + int i,j,k; + + for(i=0; i<3; i++){ + for(j=0; j<3; j++){ + out[i*3 + j] = 0; + for (k=0; k<3; k++){ + out[i*3 + j] += R1[i*3+k] * R2[k*3+j]; + } + } + } +} + +inline void JRJ(double *R, double *A) { + /* multiple 3X3 matrix by J from both sizes: A = JRJ */ + A[0]=R[0]; + A[1]=R[1]; + A[2]=-R[2]; + A[3]=R[3]; + A[4]=R[4]; + A[5]=-R[5]; + A[6]=-R[6]; + A[7]=-R[7]; + A[8]=R[8]; +} + +inline double diff_norm_3x3(const double *R1, const double *R2) { + /* difference 2 matrices and return squared norm: ||R1-R2||^2 */ + int i; + double norm = 0; + for (i=0; i<9; i++) {norm += (R1[i]-R2[i])*(R1[i]-R2[i]);} + return norm; +} + + +extern "C" __global__ +void signs_times_v(int n, double* Rijs, const double* vec, double* new_vec, bool J_weighting) +{ + /* thread index (1d), represents "i" index */ + unsigned int i = blockDim.x * blockIdx.x + threadIdx.x; + + /* no-op when out of bounds */ + if(i >= n) return; + + double c[4]; + unsigned int j; + unsigned int k; + for(k=0;k<4;k++){c[k]=0;} + unsigned long ij, jk, ik; + int best_i; + double best_val; + double s_ij_jk, s_ik_jk, s_ij_ik; + double alt_ij_jk, alt_ij_ik, alt_ik_jk; + + double *Rij, *Rjk, *Rik; + double JRijJ[9], JRjkJ[9], JRikJ[9]; + double tmp[9]; + + int signs_confs[4][3]; + for(int a=0; a<4; a++) { for(k=0; k<3; k++) { signs_confs[a][k]=1; } } + signs_confs[1][0]=-1; signs_confs[1][2]=-1; + signs_confs[2][0]=-1; signs_confs[2][1]=-1; + signs_confs[3][1]=-1; signs_confs[3][2]=-1; + + /* initialize alternatives */ + /* when we find the best J-configuration, we also compare it to the alternative 2nd best one. + * this comparison is done for every pair in the triplete independently. to make sure that the + * alternative is indeed different in relation to the pair, we document the differences between + * the configurations in advance: + * ALTS(:,best_conf,pair) = the two configurations in which J-sync differs from + * best_conf in relation to pair */ + + int ALTS[2][4][3]; + ALTS[0][0][0]=1; ALTS[0][1][0]=0; ALTS[0][2][0]=0; ALTS[0][3][0]=1; + ALTS[1][0][0]=2; ALTS[1][1][0]=3; ALTS[1][2][0]=3; ALTS[1][3][0]=2; + ALTS[0][0][1]=2; ALTS[0][1][1]=2; ALTS[0][2][1]=0; ALTS[0][3][1]=0; + ALTS[1][0][1]=3; ALTS[1][1][1]=3; ALTS[1][2][1]=1; ALTS[1][3][1]=1; + ALTS[0][0][2]=1; ALTS[0][1][2]=0; ALTS[0][2][2]=1; ALTS[0][3][2]=0; + ALTS[1][0][2]=3; ALTS[1][1][2]=2; ALTS[1][2][2]=3; ALTS[1][3][2]=2; + + + for(j=i+1; j< (n - 1); j++){ + ij = PAIR_IDX(n, i, j); + for(k=j+1; k< n; k++){ + ik = PAIR_IDX(n, i, k); + jk = PAIR_IDX(n, j, k); + + /* compute configurations matches scores */ + Rij = Rijs + 9*ij; + Rjk = Rijs + 9*jk; + Rik = Rijs + 9*ik; + + JRJ(Rij, JRijJ); + JRJ(Rjk, JRjkJ); + JRJ(Rik, JRikJ); + + mult_3x3(tmp, Rij, Rjk); + c[0] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, JRijJ, Rjk); + c[1] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, Rij, JRjkJ); + c[2] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, Rij, Rjk); + c[3] = diff_norm_3x3(tmp, JRikJ); + + /* find best match */ + best_i=0; best_val=c[0]; + if (c[1]= n) return; + + double c[4]; + unsigned int j; + unsigned int k; + for(k=0;k<4;k++){c[k]=0;} + unsigned long ij, jk, ik; + int best_i; + double best_val; + double s_ij_jk, s_ik_jk, s_ij_ik; + double alt_ij_jk, alt_ij_ik, alt_ik_jk; + double f_ij_jk, f_ik_jk, f_ij_ik; + + + double *Rij, *Rjk, *Rik; + double JRijJ[9], JRjkJ[9], JRikJ[9]; + double tmp[9]; + + int signs_confs[4][3]; + for(int a=0; a<4; a++) { for(k=0; k<3; k++) { signs_confs[a][k]=1; } } + signs_confs[1][0]=-1; signs_confs[1][2]=-1; + signs_confs[2][0]=-1; signs_confs[2][1]=-1; + signs_confs[3][1]=-1; signs_confs[3][2]=-1; + + /* initialize alternatives */ + /* when we find the best J-configuration, we also compare it to the alternative 2nd best one. + * this comparison is done for every pair in the triplete independently. to make sure that the + * alternative is indeed different in relation to the pair, we document the differences between + * the configurations in advance: + * ALTS(:,best_conf,pair) = the two configurations in which J-sync differs from + * best_conf in relation to pair */ + + int ALTS[2][4][3]; + ALTS[0][0][0]=1; ALTS[0][1][0]=0; ALTS[0][2][0]=0; ALTS[0][3][0]=1; + ALTS[1][0][0]=2; ALTS[1][1][0]=3; ALTS[1][2][0]=3; ALTS[1][3][0]=2; + ALTS[0][0][1]=2; ALTS[0][1][1]=2; ALTS[0][2][1]=0; ALTS[0][3][1]=0; + ALTS[1][0][1]=3; ALTS[1][1][1]=3; ALTS[1][2][1]=1; ALTS[1][3][1]=1; + ALTS[0][0][2]=1; ALTS[0][1][2]=0; ALTS[0][2][2]=1; ALTS[0][3][2]=0; + ALTS[1][0][2]=3; ALTS[1][1][2]=2; ALTS[1][2][2]=3; ALTS[1][3][2]=2; + + + for(j=i+1; j< (n - 1); j++){ + ij = PAIR_IDX(n, i, j); + for(k=j+1; k< n; k++){ + ik = PAIR_IDX(n, i, k); + jk = PAIR_IDX(n, j, k); + + /* compute configurations matches scores */ + Rij = Rijs + 9*ij; + Rjk = Rijs + 9*jk; + Rik = Rijs + 9*ik; + + JRJ(Rij, JRijJ); + JRJ(Rjk, JRjkJ); + JRJ(Rik, JRikJ); + + mult_3x3(tmp, Rij, Rjk); + c[0] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, JRijJ, Rjk); + c[1] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, Rij, JRjkJ); + c[2] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, Rij, Rjk); + c[3] = diff_norm_3x3(tmp, JRikJ); + + /* find best match */ + best_i=0; best_val=c[0]; + if (c[1]= n) return; + + double c[4]; + unsigned int j; + unsigned int k; + for(k=0;k<4;k++){c[k]=0;} + unsigned long ij, jk, ik; + int best_i; + double best_val; + double s_ij_jk, s_ik_jk, s_ij_ik; + double alt_ij_jk, alt_ij_ik, alt_ik_jk; + unsigned int l1,l2,l3; + double threshold; + double h = 1. / n_intervals; + + double *Rij, *Rjk, *Rik; + double JRijJ[9], JRjkJ[9], JRikJ[9]; + double tmp[9]; + + /* initialize alternatives */ + /* when we find the best J-configuration, we also compare it to the alternative 2nd best one. + * this comparison is done for every pair in the triplete independently. to make sure that the + * alternative is indeed different in relation to the pair, we document the differences between + * the configurations in advance: + * ALTS(:,best_conf,pair) = the two configurations in which J-sync differs from + * best_conf in relation to pair */ + + int ALTS[2][4][3]; + ALTS[0][0][0]=1; ALTS[0][1][0]=0; ALTS[0][2][0]=0; ALTS[0][3][0]=1; + ALTS[1][0][0]=2; ALTS[1][1][0]=3; ALTS[1][2][0]=3; ALTS[1][3][0]=2; + ALTS[0][0][1]=2; ALTS[0][1][1]=2; ALTS[0][2][1]=0; ALTS[0][3][1]=0; + ALTS[1][0][1]=3; ALTS[1][1][1]=3; ALTS[1][2][1]=1; ALTS[1][3][1]=1; + ALTS[0][0][2]=1; ALTS[0][1][2]=0; ALTS[0][2][2]=1; ALTS[0][3][2]=0; + ALTS[1][0][2]=3; ALTS[1][1][2]=2; ALTS[1][2][2]=3; ALTS[1][3][2]=2; + + + for(j=i+1; j< (n - 1); j++){ + ij = PAIR_IDX(n, i, j); + for(k=j+1; k< n; k++){ + ik = PAIR_IDX(n, i, k); + jk = PAIR_IDX(n, j, k); + + /* compute configurations matches scores */ + Rij = Rijs + 9*ij; + Rjk = Rijs + 9*jk; + Rik = Rijs + 9*ik; + + JRJ(Rij, JRijJ); + JRJ(Rjk, JRjkJ); + JRJ(Rik, JRikJ); + + mult_3x3(tmp, Rij, Rjk); + c[0] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, JRijJ, Rjk); + c[1] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, Rij, JRjkJ); + c[2] = diff_norm_3x3(tmp, Rik); + + mult_3x3(tmp, Rij, Rjk); + c[3] = diff_norm_3x3(tmp, JRikJ); + + /* find best match */ + best_i=0; best_val=c[0]; + if (c[1] Date: Fri, 26 Apr 2024 10:47:29 -0400 Subject: [PATCH 217/433] cleanup cl3n compare test a little --- src/aspire/abinitio/commonline_sync3n.py | 6 ++++-- tests/test_commonline_sync3n_cupy.py | 25 +++++++++++++++--------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 1f957168d0..bc6f7634d8 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -918,7 +918,9 @@ def _signs_times_v_cupy(self, Rijs, vec): blkszx = 512 nblkx = (self.n_img + blkszx - 1) // blkszx signs_times_v( - (nblkx,), (blkszx,), (self.n_img, Rijs_dev, vec_dev, new_vec_dev, self.J_weighting) + (nblkx,), + (blkszx,), + (self.n_img, Rijs_dev, vec_dev, new_vec_dev, self.J_weighting), ) # accumulate, can reuse the vec_dev array now. @@ -939,7 +941,7 @@ def _init_cupy_module(): # Read in contents of file fp = os.path.join(os.path.dirname(__file__), "commonline_sync3n.cu") - with open(fp, 'r') as fh: + with open(fp, "r") as fh: module_code = fh.read() # CUPY compile the CUDA code diff --git a/tests/test_commonline_sync3n_cupy.py b/tests/test_commonline_sync3n_cupy.py index f80f6b12fc..8068266e65 100644 --- a/tests/test_commonline_sync3n_cupy.py +++ b/tests/test_commonline_sync3n_cupy.py @@ -1,35 +1,39 @@ import numpy as np import pytest -from aspire.source import Simulation from aspire.abinitio.commonline_sync3n import CLSync3N +from aspire.source import Simulation -DTYPE = np.float64 -N = 64 +DTYPE = np.float64 # TODO, consider single precision. +N = 64 # Number of images n_pairs = N * (N - 1) // 2 + @pytest.fixture def src_fixture(): src = Simulation(n=N, L=32, C=1, dtype=DTYPE) src = src.cache() return src + @pytest.fixture def cl3n_fixture(src_fixture): cl = CLSync3N(src_fixture) return cl + @pytest.fixture def rijs_fixture(): Rijs = np.arange(n_pairs * 3 * 3).reshape(n_pairs, 3, 3) Rijs = Rijs.astype(dtype=DTYPE, copy=False) return Rijs + def test_pairs_prob_host_vs_cupy(cl3n_fixture, rijs_fixture): """ Compares pairs_probabilities between host and cupy implementations. """ - + P2, A, a, B, b, x0 = 1, 2, 3, 4, 5, 6 # DTYPE is critical here (manually calling private method @@ -45,6 +49,7 @@ def test_pairs_prob_host_vs_cupy(cl3n_fixture, rijs_fixture): np.testing.assert_allclose(indsh, indscp) np.testing.assert_allclose(arbh, arbcp) + def test_triangle_scores_host_vs_cupy(cl3n_fixture, rijs_fixture): """ Compares triangle_scores between host and cupy implementations. @@ -58,8 +63,9 @@ def test_triangle_scores_host_vs_cupy(cl3n_fixture, rijs_fixture): cuh, hih = cl3n_fixture._triangle_scores_inner_host(rijs_fixture) # Compare host to cupy calls - np.testing.assert_allclose(cucp,cuh) - np.testing.assert_allclose(hicp,hih) + np.testing.assert_allclose(cucp, cuh) + np.testing.assert_allclose(hicp, hih) + def test_stv_host_vs_cupy(cl3n_fixture, rijs_fixture): """ @@ -68,10 +74,10 @@ def test_stv_host_vs_cupy(cl3n_fixture, rijs_fixture): Default J_weighting=False """ # dummy data vector - vec = np.ones(n_pairs, dtype=DTYPE) + vec = np.random.random(n_pairs).astype(dtype=DTYPE, copy=False) # J_weighting=False - assert cl3n_fixture.J_weighting == False + assert cl3n_fixture.J_weighting is False # Execute CUPY new_vec_cp = cl3n_fixture._signs_times_v_cupy(rijs_fixture, vec) @@ -82,6 +88,7 @@ def test_stv_host_vs_cupy(cl3n_fixture, rijs_fixture): # Compare host to cupy calls np.testing.assert_allclose(new_vec_cp, new_vec_h) + def test_stvJwt_host_vs_cupy(cl3n_fixture, rijs_fixture): """ Compares signs_times_v between host and cupy implementations. @@ -89,7 +96,7 @@ def test_stvJwt_host_vs_cupy(cl3n_fixture, rijs_fixture): Force J_weighting=True """ # dummy data vector - vec = np.ones(n_pairs, dtype=DTYPE) + vec = np.random.random(n_pairs).astype(dtype=DTYPE, copy=False) # J_weighting=True cl3n_fixture.J_weighting = True From db74da5f60b9574701c6037e8eb2b076712bee56 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 26 Apr 2024 10:49:42 -0400 Subject: [PATCH 218/433] rm merged test file --- x.py | 87 ------------------------------------------------------------ 1 file changed, 87 deletions(-) delete mode 100644 x.py diff --git a/x.py b/x.py deleted file mode 100644 index ebc5e6d768..0000000000 --- a/x.py +++ /dev/null @@ -1,87 +0,0 @@ -import pickle -import time -from collections import defaultdict - -import cupy as cp -import matplotlib.pyplot as plt -import numpy as np - -from aspire.abinitio.commonline_sync3n import _signs_times_v_cupy, _signs_times_v_host -from aspire.utils import all_pairs - - -def time_test(n): - n_pairs = n * (n - 1) // 2 - _, _pairs_to_linear = all_pairs(n, return_map=True) - - vec = np.ones(n_pairs, dtype=np.float64) - # Rijs = np.random.randn(n_pairs*3*3).astype(dtype=np.float64) - Rijs = np.arange(n_pairs * 3 * 3).reshape(n_pairs, 3, 3).astype(dtype=np.float64) - - tic0 = time.perf_counter() - new_vec = _signs_times_v_cupy(n, Rijs, vec, J_weighting=False) - tic1 = time.perf_counter() - gpu_time = tic1 - tic0 - print("gpu\n", new_vec) - - tic2 = time.perf_counter() - new_vec_host = _signs_times_v_host( - n, Rijs, vec, J_weighting=False, _ALTS=None, _pairs_to_linear=_pairs_to_linear - ) - tic3 = time.perf_counter() - host_time = tic3 - tic2 - print("host\n", new_vec_host) - - print(f"\n\n\nSize:\t{n}") - print("Allclose? ", np.allclose(new_vec_host, new_vec)) - print(f"gpu_time: {gpu_time}") - print(f"host_time: {host_time}") - speedup = host_time / gpu_time - print(f"speedup: {speedup}") - - return host_time, gpu_time, speedup - - -def plotit(results): - N = np.array(list(results.keys())) - H = np.array([v["host"] for v in results.values()]) - G = np.array([v["gpu"] for v in results.values()]) - S = np.array([v["speedup"] for v in results.values()]) - - plt.plot(N, H, label="host python") - plt.plot(N, G, label="cuda") - plt.title("Walltimes (s)") - plt.legend() - plt.show() - plt.savefig("walltimes.png") - plt.clf() - - plt.plot(N, S) - plt.title("Speedup Ratio") - plt.show() - plt.savefig("speedups.png") - plt.clf() - - -def main(): - results = defaultdict(dict) - # too long...! for n in [4,16,64,100,128,200,256,512,1024,2048,3000, 4096, 10000]: - # for n in [4,16]: # test - for n in [4, 16, 64, 100, 128, 200, 512]: - h, g, s = time_test(n) - results[n]["host"] = h - results[n]["gpu"] = g - results[n]["speedup"] = s - - # save in case we cancel - with open("saved_results.pkl", "wb") as f: - pickle.dump(results, f) - - print() - print(results) - print() - - plotit(results) - - -time_test(64) From d47251b420662ae613034d4e11ed23517529d780 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 26 Apr 2024 10:53:52 -0400 Subject: [PATCH 219/433] fixup manifest --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index 4477aa87c0..ecc7484b40 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -17,6 +17,7 @@ recursive-include docs *.rst recursive-include docs Makefile recursive-include docs *.sh recursive-include src *.conf +recursive-include src *.cu recursive-include src *.yaml prune docs/build prune docs/source From d1fe91cbc0e192c8de6923158bb1d0c6204e585a Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 26 Apr 2024 10:58:00 -0400 Subject: [PATCH 220/433] remove unused cum_scores --- src/aspire/abinitio/commonline_sync3n.cu | 8 +----- src/aspire/abinitio/commonline_sync3n.py | 35 ++++++------------------ tests/test_commonline_sync3n_cupy.py | 10 ++++--- 3 files changed, 15 insertions(+), 38 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.cu b/src/aspire/abinitio/commonline_sync3n.cu index 3c0b0b9001..58ee75a98e 100644 --- a/src/aspire/abinitio/commonline_sync3n.cu +++ b/src/aspire/abinitio/commonline_sync3n.cu @@ -290,7 +290,7 @@ void pairs_probabilities(int n, double* Rijs, double P2, double A, double a, dou extern "C" __global__ -void triangle_scores_inner(int n, double* Rijs, int n_intervals, double* cum_scores, double* scores_hist) +void triangle_scores_inner(int n, double* Rijs, int n_intervals, double* scores_hist) { /* thread index (1d), represents "i" index */ unsigned int i = blockDim.x * blockIdx.x + threadIdx.x; @@ -385,12 +385,6 @@ void triangle_scores_inner(int n, double* Rijs, int n_intervals, double* cum_sco s_ik_jk = 1 - sqrt(best_val / alt_ik_jk); s_ij_ik = 1 - sqrt(best_val / alt_ij_ik); - - /* update cumulated scores */ - cum_scores[ij*n+i] += s_ij_jk + s_ij_ik; - cum_scores[jk*n+i] += s_ij_jk + s_ik_jk; - cum_scores[ik*n+i] += s_ik_jk + s_ij_ik; - /* update scores histogram */ threshold = 0; for (l1=0; l1 Date: Mon, 29 Apr 2024 08:42:52 -0400 Subject: [PATCH 221/433] atomic stv --- src/aspire/abinitio/commonline_sync3n.cu | 6 +++--- src/aspire/abinitio/commonline_sync3n.py | 8 ++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.cu b/src/aspire/abinitio/commonline_sync3n.cu index 58ee75a98e..884e5b44f4 100644 --- a/src/aspire/abinitio/commonline_sync3n.cu +++ b/src/aspire/abinitio/commonline_sync3n.cu @@ -151,9 +151,9 @@ void signs_times_v(int n, double* Rijs, const double* vec, double* new_vec, bool /* update multiplication */ - new_vec[ij*n + i] += s_ij_jk*vec[jk] + s_ij_ik*vec[ik]; - new_vec[jk*n + i] += s_ij_jk*vec[ij] + s_ik_jk*vec[ik]; - new_vec[ik*n + i] += s_ij_ik*vec[ij] + s_ik_jk*vec[jk]; + atomicAdd(&(new_vec[ij]), s_ij_jk*vec[jk] + s_ij_ik*vec[ik]); + atomicAdd(&(new_vec[jk]), s_ij_jk*vec[ij] + s_ik_jk*vec[ik]); + atomicAdd(&(new_vec[ik]), s_ij_ik*vec[ij] + s_ik_jk*vec[jk]); } /* k */ } /* j */ diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 6f09350589..8bc41cc4ca 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -892,8 +892,7 @@ def _signs_times_v_cupy(self, Rijs, vec): Rijs_dev = cp.array(Rijs) vec_dev = cp.array(vec) - # 2d over i then accum to avoid race on i - new_vec_dev = cp.zeros((vec.shape[0], self.n_img)) + new_vec_dev = cp.zeros((vec.shape[0])) # call the kernel blkszx = 512 @@ -904,11 +903,8 @@ def _signs_times_v_cupy(self, Rijs, vec): (self.n_img, Rijs_dev, vec_dev, new_vec_dev, self.J_weighting), ) - # accumulate, can reuse the vec_dev array now. - cp.sum(new_vec_dev, axis=1, out=vec_dev) - # dtoh - new_vec = vec_dev.get() + new_vec = new_vec_dev.get() return new_vec From f4680e1626ccd3bbd665cfff7acf34114980f97c Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 29 Apr 2024 10:01:37 -0400 Subject: [PATCH 222/433] convert remaining kernels to use atomics instead of naive array safety --- src/aspire/abinitio/commonline_sync3n.cu | 18 +++++++++--------- src/aspire/abinitio/commonline_sync3n.py | 20 +++++++------------- tests/test_commonline_sync3n_cupy.py | 6 +++--- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.cu b/src/aspire/abinitio/commonline_sync3n.cu index 884e5b44f4..aaff3d0e76 100644 --- a/src/aspire/abinitio/commonline_sync3n.cu +++ b/src/aspire/abinitio/commonline_sync3n.cu @@ -268,18 +268,18 @@ void pairs_probabilities(int n, double* Rijs, double P2, double A, double a, dou f_ij_jk = log( P2*(B*pow(1-s_ij_jk,b)*exp(-b/(1-x0)*(1-s_ij_jk))) + (1-P2)*A*pow((1-s_ij_jk),a) ); f_ik_jk = log( P2*(B*pow(1-s_ik_jk,b)*exp(-b/(1-x0)*(1-s_ik_jk))) + (1-P2)*A*pow((1-s_ik_jk),a) ); f_ij_ik = log( P2*(B*pow(1-s_ij_ik,b)*exp(-b/(1-x0)*(1-s_ij_ik))) + (1-P2)*A*pow((1-s_ij_ik),a) ); - ln_f_ind[ij*n +i] += f_ij_jk + f_ij_ik; - ln_f_ind[jk*n +i] += f_ij_jk + f_ik_jk; - ln_f_ind[ik*n +i] += f_ik_jk + f_ij_ik; + atomicAdd(&(ln_f_ind[ij]), f_ij_jk + f_ij_ik); + atomicAdd(&(ln_f_ind[jk]), f_ij_jk + f_ik_jk); + atomicAdd(&(ln_f_ind[ik]), f_ik_jk + f_ij_ik); /* the probability of a pair ij to have the observed triangles scores, given it has an arbitrary common line */ f_ij_jk = log( A*pow((1-s_ij_jk),a) ); f_ik_jk = log( A*pow((1-s_ik_jk),a) ); f_ij_ik = log( A*pow((1-s_ij_ik),a) ); - ln_f_arb[ij*n +i] += f_ij_jk + f_ij_ik; - ln_f_arb[jk*n +i] += f_ij_jk + f_ik_jk; - ln_f_arb[ik*n +i] += f_ik_jk + f_ij_ik; + atomicAdd(&(ln_f_arb[ij]), f_ij_jk + f_ij_ik); + atomicAdd(&(ln_f_arb[jk]), f_ij_jk + f_ik_jk); + atomicAdd(&(ln_f_arb[ik]), f_ik_jk + f_ij_ik); } /* k */ @@ -404,9 +404,9 @@ void triangle_scores_inner(int n, double* Rijs, int n_intervals, double* scores_ if (s_ij_ik < threshold) {break;} } - scores_hist[l1*n+i] += 1; - scores_hist[l2*n+i] += 1; - scores_hist[l3*n+i] += 1; + atomicAdd(&(scores_hist[l1]), 1); + atomicAdd(&(scores_hist[l2]), 1); + atomicAdd(&(scores_hist[l3]), 1); } /* k */ } /* j */ diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 8bc41cc4ca..463dc52d9c 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -402,9 +402,7 @@ def _triangle_scores_inner_cupy(self, Rijs): Rijs_dev = cp.array(Rijs) - scores_hist_dev = cp.zeros( - (self.hist_intervals, self.n_img), dtype=np.float64 - ) # n is for thread safety + scores_hist_dev = cp.zeros((self.hist_intervals), dtype=np.float64) # call the kernel blkszx = 512 @@ -420,8 +418,8 @@ def _triangle_scores_inner_cupy(self, Rijs): ), ) - # accumulate over thread results - scores_hist = cp.sum(scores_hist_dev, axis=1).get() + # d2h + scores_hist = scores_hist_dev.get() return scores_hist @@ -540,12 +538,8 @@ def _pairs_probabilities_cupy(self, Rijs, P2, A, a, B, b, x0): pairs_probabilities = self._gpu_module.get_function("pairs_probabilities") Rijs_dev = cp.array(Rijs) - ln_f_ind_dev = cp.zeros( - (self.n_img * (self.n_img - 1) // 2, self.n_img) - ) # second dim is for thread safety - ln_f_arb_dev = cp.zeros( - (self.n_img * (self.n_img - 1) // 2, self.n_img) - ) # second dim is for thread safety + ln_f_ind_dev = cp.zeros((self.n_img * (self.n_img - 1) // 2), dtype=np.float64) + ln_f_arb_dev = cp.zeros((self.n_img * (self.n_img - 1) // 2), dtype=np.float64) # call the kernel blkszx = 512 @@ -557,8 +551,8 @@ def _pairs_probabilities_cupy(self, Rijs, P2, A, a, B, b, x0): ) # accumulate over thread results - ln_f_arb = cp.sum(ln_f_arb_dev, axis=1).get() - ln_f_ind = cp.sum(ln_f_ind_dev, axis=1).get() + ln_f_arb = ln_f_arb_dev.get() + ln_f_ind = ln_f_ind_dev.get() return ln_f_ind, ln_f_arb diff --git a/tests/test_commonline_sync3n_cupy.py b/tests/test_commonline_sync3n_cupy.py index 3cc0245ad7..81d967aa8e 100644 --- a/tests/test_commonline_sync3n_cupy.py +++ b/tests/test_commonline_sync3n_cupy.py @@ -12,20 +12,20 @@ # XXX TODO, conditionally run these only if GPU present. -@pytest.fixture +@pytest.fixture(scope="module") def src_fixture(): src = Simulation(n=N, L=32, C=1, dtype=DTYPE) src = src.cache() return src -@pytest.fixture +@pytest.fixture(scope="module") def cl3n_fixture(src_fixture): cl = CLSync3N(src_fixture) return cl -@pytest.fixture +@pytest.fixture(scope="module") def rijs_fixture(): Rijs = np.arange(n_pairs * 3 * 3).reshape(n_pairs, 3, 3) Rijs = Rijs.astype(dtype=DTYPE, copy=False) From 7eb9d17fbf42d024f228ad5fa57ae209b848a2fd Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 29 Apr 2024 10:55:05 -0400 Subject: [PATCH 223/433] add some documentation --- src/aspire/abinitio/commonline_sync3n.py | 115 +++++++++++++++++------ 1 file changed, 85 insertions(+), 30 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 463dc52d9c..a7066a4abe 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -21,7 +21,7 @@ class CLSync3N(CLOrient3D, SyncVotingMixin): # Initialize alternatives # # When we find the best J-configuration, we also compare it to the alternative 2nd best one. - # this comparison is done for every pair in the triplete independently. to make sure that the + # this comparison is done for every pair in the triplet independently. to make sure that the # alternative is indeed different in relation to the pair, we document the differences between # the configurations in advance: # ALTS(:,best_conf,pair) = the two configurations in which J-sync differs from best_conf in relation to pair @@ -43,7 +43,6 @@ def __init__( shift_step=1, epsilon=1e-2, max_iters=1000, - degree_res=1, seed=None, mask=True, S_weighting=False, @@ -60,10 +59,15 @@ def __init__( :param shift_step: Resolution of shift estimation in pixels. Default = 1 pixel. :param epsilon: Tolerance for the power method. :param max_iter: Maximum iterations for the power method. - :param degree_res: Degree resolution for estimating in-plane rotations. :param seed: Optional seed for RNG. :param mask: Option to mask `src.images` with a fuzzy mask (boolean). Default, `True`, applies a mask. + :param S_weighting: Optionally apply probabilistic weighting + to the `S` matrix. + :param J_weighting: Optionally use `J` weights instead of + signs when computing `signs_times_v`. + :param hist_intervals: Number of histogram bins used to + compute triangle scores when `S_weighting` enabled. """ super().__init__( @@ -80,7 +84,6 @@ def __init__( self.epsilon = epsilon self.max_iters = max_iters - self.degree_res = degree_res self.seed = seed # Sync3N specific vars @@ -241,11 +244,27 @@ def _syncmatrix_weights( ): """ Given relative rotations matrix `Rij`, - compute and return probability weights for S. + compute and return probability weights `P` for S. + + Default parameters here were taken from those in the MATLAB + code, with the original author noting they were found + empirically. + + :param permitted_inconsistency: Consistency condition is + `mean(Pij)/permitted_inconsistency < P < + mean(Pij)*permitted_inconsistency`. + :param p_domain_limit: Domain of P is [Pmin,Pmax], with + Pmin=p_domain_limit*Pmax + :param max_iterations: Maximum iterations for P estimation. + :param min_p_permitted: Small value at which to stop + attempting to synchronize P. """ logger.info("Computing synchronization matrix weights.") - def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): + def _body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): + """ + Helper function to run and test triangle_scores. + """ # Get inistial estimate for Pij P, sigma, Pij, hist = self._triangle_scores(Rijs, hist, Pmin, Pmax) @@ -287,7 +306,7 @@ def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): res = (None,) * 4 inconsistent = True while inconsistent and i < max_iterations: - inconsistent, Pij, res = body(*res) + inconsistent, Pij, res = _body(*res) i += 1 # Pack W @@ -302,6 +321,13 @@ def body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): return W def _triangle_scores_inner(self, Rijs): + """ + Computes histogram of `triangle scores`. + + Wrapper for cpu/gpu dispatch. + + :param Rijs: nchoose2 by 3 by 3 array of rotations. + """ # host/gpu dispatch if self._gpu_module: @@ -312,6 +338,11 @@ def _triangle_scores_inner(self, Rijs): return scores_hist def _triangle_scores_inner_host(self, Rijs): + """ + See _triangle_scores_inner. + + CPU implementation. + """ # The following is adopted from Matlab triangle_scores_mex.c @@ -392,10 +423,11 @@ def _triangle_scores_inner_host(self, Rijs): def _triangle_scores_inner_cupy(self, Rijs): """ - n: n_img - Rijs: nchoose2x3x3 array + See _triangle_scores_inner. + GPU implementation. """ + import cupy as cp triangle_scores = self._gpu_module.get_function("triangle_scores_inner") @@ -424,6 +456,20 @@ def _triangle_scores_inner_cupy(self, Rijs): return scores_hist def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0): + """ + This function computes the probability of a pair `ij` having + an observed value of triangles score under two priors. Once + given it has an indicative common line, and again once given + it has an arbitrary common line. + + The probability of the common line to be indicative can then + be derived by Bayes Theorem. + + Wrapper for cpu/gpu dispatch. + + :param Rijs: nchoose2 by 3 by 3 array of rotations. + XXX + """ # dtype is critical for passing into C code... params = np.arary([P2, A, a, B, b, x0], dtype=np.float64) # host/gpu dispatch @@ -435,6 +481,11 @@ def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0): return ln_f_ind, ln_f_arb def _pairs_probabilities_host(self, Rijs, P2, A, a, B, b, x0): + """ + See _pairs_probabilities. + + CPU implementation. + """ # The following is adopted from Matlab pairs_probabilities_mex.c `looper` # Initialize probability result arrays @@ -529,10 +580,11 @@ def _pairs_probabilities_host(self, Rijs, P2, A, a, B, b, x0): def _pairs_probabilities_cupy(self, Rijs, P2, A, a, B, b, x0): """ - n: n_img - Rijs: nchoose2x3x3 array + See _pairs_probabilities. + GPU implementation. """ + import cupy as cp pairs_probabilities = self._gpu_module.get_function("pairs_probabilities") @@ -569,16 +621,19 @@ def _triangle_scores( x0=0.78, ): """ - Todo + Computes `triangle_scores`, attempts to fit curve to distribution, and uses estimated distribution to compute `pairs_probabilities`. + + Default parameters here were taken from those in the MATLAB + code, with the original author noting they were found + empirically. - :param a: magic number + :param a: :param peak2sigma: empirical relation between the location of the peak of the histigram, and the mean error in the common lines estimations. - AKA, magic number :param P: :param b: - :param x0: + :param x0: Initial guess """ Pmin = Pmin or 0 @@ -757,7 +812,8 @@ def _J_sync_power_method(self, Rijs): residual = 1 itr = 0 - # XXX, I don't like that epsilon>1 (residual) returns signs of random vector + # Todo + # I don't like that epsilon>1 (residual) returns signs of random vector # maybe force to run once? or return vec as zeros in that case? # Seems unintended, but easy to do. @@ -778,7 +834,14 @@ def _J_sync_power_method(self, Rijs): return J_sync def _signs_times_v(self, Rijs, vec): + """ + Multiplication of the J-synchronization matrix by a candidate eigenvector `vec` + Wrapper for cpu/gpu dispatch. + + :param Rijs: An n-choose-2x3x3 array of estimates of relative rotations + :param vec: The current candidate eigenvector of length n-choose-2 from the power method. + """ # host/gpu dispatch if self._gpu_module: new_vec = self._signs_times_v_cupy(Rijs, vec) @@ -789,14 +852,9 @@ def _signs_times_v(self, Rijs, vec): def _signs_times_v_host(self, Rijs, vec): """ - Ported from _signs_times_v_mex.c + See `_signs_times_v`. - n: n_img - Rijs: nchoose2x3x3 array - vec: input array - new_vec: output array - J_weighting: bool - _ALTS= 2x4x3 const lut array + CPU implementation. """ new_vec = np.zeros_like(vec) @@ -872,13 +930,9 @@ def _signs_times_v_host(self, Rijs, vec): def _signs_times_v_cupy(self, Rijs, vec): """ - Ported from _signs_times_v_mex.c + See `_signs_times_v`. - n: n_img - Rijs: nchoose2x3x3 array - vec: input array - new_vec: output array - J_weighting: bool + CPU implementation. """ import cupy as cp @@ -905,7 +959,8 @@ def _signs_times_v_cupy(self, Rijs, vec): @staticmethod def _init_cupy_module(): """ - Private utility method to read in CUDA source and return as compiled CUPY module. + Private utility method to read in CUDA source and return as + compiled CUPY module. """ import cupy as cp From d67c4675863d79fe1adc7ea1db210d5cc3cc6c91 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 29 Apr 2024 11:18:40 -0400 Subject: [PATCH 224/433] more cleanup --- src/aspire/abinitio/commonline_sync3n.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index a7066a4abe..33cb7a292a 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -451,7 +451,7 @@ def _triangle_scores_inner_cupy(self, Rijs): ) # d2h - scores_hist = scores_hist_dev.get() + scores_hist = scores_hist_dev.get().astype(self.dtype, copy=False) return scores_hist @@ -468,10 +468,17 @@ def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0): Wrapper for cpu/gpu dispatch. :param Rijs: nchoose2 by 3 by 3 array of rotations. - XXX + :param P2: distribution parameter + :param A: distribution parameter + :param a: distribution parameter + :param B: distribution parameter + :param b: distribution parameter + :param x0: Initial guess + """ - # dtype is critical for passing into C code... - params = np.arary([P2, A, a, B, b, x0], dtype=np.float64) + # These param values are passed to C, force doubles. + params = np.array([P2, A, a, B, b, x0], dtype=np.float64) + # host/gpu dispatch if self._gpu_module: ln_f_ind, ln_f_arb = self._pairs_probabilities_cupy(Rijs, *params) @@ -603,8 +610,8 @@ def _pairs_probabilities_cupy(self, Rijs, P2, A, a, B, b, x0): ) # accumulate over thread results - ln_f_arb = ln_f_arb_dev.get() - ln_f_ind = ln_f_ind_dev.get() + ln_f_arb = ln_f_arb_dev.get().astype(self.dtype, copy=False) + ln_f_ind = ln_f_ind_dev.get().astype(self.dtype, copy=False) return ln_f_ind, ln_f_arb @@ -952,7 +959,7 @@ def _signs_times_v_cupy(self, Rijs, vec): ) # dtoh - new_vec = new_vec_dev.get() + new_vec = new_vec_dev.get().astype(self.dtype, copy=False) return new_vec From de38338d2b2e465be8f3fed25b9a6fa9f7bca629 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 29 Apr 2024 11:31:37 -0400 Subject: [PATCH 225/433] looks like this actually needs double precision. --- src/aspire/abinitio/commonline_sync3n.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 33cb7a292a..4729bf7785 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -451,7 +451,7 @@ def _triangle_scores_inner_cupy(self, Rijs): ) # d2h - scores_hist = scores_hist_dev.get().astype(self.dtype, copy=False) + scores_hist = scores_hist_dev.get() return scores_hist @@ -610,8 +610,8 @@ def _pairs_probabilities_cupy(self, Rijs, P2, A, a, B, b, x0): ) # accumulate over thread results - ln_f_arb = ln_f_arb_dev.get().astype(self.dtype, copy=False) - ln_f_ind = ln_f_ind_dev.get().astype(self.dtype, copy=False) + ln_f_arb = ln_f_arb_dev.get() + ln_f_ind = ln_f_ind_dev.get() return ln_f_ind, ln_f_arb @@ -959,7 +959,7 @@ def _signs_times_v_cupy(self, Rijs, vec): ) # dtoh - new_vec = new_vec_dev.get().astype(self.dtype, copy=False) + new_vec = new_vec_dev.get() return new_vec From 06e2b36950ef49c09828be0e1996a7efcb8e5713 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 29 Apr 2024 13:00:03 -0400 Subject: [PATCH 226/433] fix precision bug in CL sync3n power method. --- src/aspire/abinitio/commonline_sync3n.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 4729bf7785..6793c146ee 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -827,7 +827,8 @@ def _J_sync_power_method(self, Rijs): # Power method iterations while itr < max_iters and residual > epsilon: itr += 1 - vec_new = self._signs_times_v(Rijs, vec) + # Todo, this code code actually needs double precision for accuracy... forcing. + vec_new = self._signs_times_v(Rijs, vec).astype(np.float64, copy=False) vec_new = vec_new / norm(vec_new) residual = norm(vec_new - vec) vec = vec_new From fe9de1e2c67b5f8605cf98891a9719c41c11894c Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 29 Apr 2024 13:50:18 -0400 Subject: [PATCH 227/433] fixup some of the dtypes --- src/aspire/abinitio/commonline_sync3n.cu | 2 +- src/aspire/abinitio/commonline_sync3n.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.cu b/src/aspire/abinitio/commonline_sync3n.cu index aaff3d0e76..99582b3f24 100644 --- a/src/aspire/abinitio/commonline_sync3n.cu +++ b/src/aspire/abinitio/commonline_sync3n.cu @@ -290,7 +290,7 @@ void pairs_probabilities(int n, double* Rijs, double P2, double A, double a, dou extern "C" __global__ -void triangle_scores_inner(int n, double* Rijs, int n_intervals, double* scores_hist) +void triangle_scores_inner(int n, double* Rijs, int n_intervals, unsigned int* scores_hist) { /* thread index (1d), represents "i" index */ unsigned int i = blockDim.x * blockIdx.x + threadIdx.x; diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 6793c146ee..886557630f 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -347,7 +347,7 @@ def _triangle_scores_inner_host(self, Rijs): # The following is adopted from Matlab triangle_scores_mex.c # Initialize probability result arrays - scores_hist = np.zeros(self.hist_intervals, dtype=Rijs.dtype) + scores_hist = np.zeros(self.hist_intervals, dtype=np.uint32) h = 1 / self.hist_intervals c = np.empty((4), dtype=Rijs.dtype) @@ -432,9 +432,10 @@ def _triangle_scores_inner_cupy(self, Rijs): triangle_scores = self._gpu_module.get_function("triangle_scores_inner") - Rijs_dev = cp.array(Rijs) + Rijs_dev = cp.array(Rijs, dtype=np.float64) - scores_hist_dev = cp.zeros((self.hist_intervals), dtype=np.float64) + # This holds integer counts + scores_hist_dev = cp.zeros((self.hist_intervals), dtype=np.uint32) # call the kernel blkszx = 512 @@ -596,7 +597,7 @@ def _pairs_probabilities_cupy(self, Rijs, P2, A, a, B, b, x0): pairs_probabilities = self._gpu_module.get_function("pairs_probabilities") - Rijs_dev = cp.array(Rijs) + Rijs_dev = cp.array(Rijs, dtype=np.float64) ln_f_ind_dev = cp.zeros((self.n_img * (self.n_img - 1) // 2), dtype=np.float64) ln_f_arb_dev = cp.zeros((self.n_img * (self.n_img - 1) // 2), dtype=np.float64) @@ -946,9 +947,9 @@ def _signs_times_v_cupy(self, Rijs, vec): signs_times_v = self._gpu_module.get_function("signs_times_v") - Rijs_dev = cp.array(Rijs) - vec_dev = cp.array(vec) - new_vec_dev = cp.zeros((vec.shape[0])) + Rijs_dev = cp.array(Rijs, dtype=np.float64) + vec_dev = cp.array(vec, dtype=np.float64) + new_vec_dev = cp.zeros((vec.shape[0]), dtype=np.float64) # call the kernel blkszx = 512 From eaa15a9102a33a13fe9dc928f01e2e2df7f62712 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 29 Apr 2024 14:22:24 -0400 Subject: [PATCH 228/433] conditionally run host-gpu comparison --- tests/test_commonline_sync3n_cupy.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_commonline_sync3n_cupy.py b/tests/test_commonline_sync3n_cupy.py index 81d967aa8e..e13147f6ae 100644 --- a/tests/test_commonline_sync3n_cupy.py +++ b/tests/test_commonline_sync3n_cupy.py @@ -4,14 +4,15 @@ from aspire.abinitio.commonline_sync3n import CLSync3N from aspire.source import Simulation +# If cupy is not available, skip this entire module +pytest.importorskip("cupy") + + DTYPE = np.float64 # TODO, consider single precision. N = 64 # Number of images n_pairs = N * (N - 1) // 2 -# XXX TODO, conditionally run these only if GPU present. - - @pytest.fixture(scope="module") def src_fixture(): src = Simulation(n=N, L=32, C=1, dtype=DTYPE) From 48ba46eca5f008e715fce6678480359cde914ada Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 7 May 2024 10:39:17 -0400 Subject: [PATCH 229/433] add MATLAB comparison tests --- tests/test_commonline_sync3n_cupy.py | 107 +++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/tests/test_commonline_sync3n_cupy.py b/tests/test_commonline_sync3n_cupy.py index e13147f6ae..7165d368a7 100644 --- a/tests/test_commonline_sync3n_cupy.py +++ b/tests/test_commonline_sync3n_cupy.py @@ -112,3 +112,110 @@ def test_stvJwt_host_vs_cupy(cl3n_fixture, rijs_fixture): # Compare host to cupy calls np.testing.assert_allclose(new_vec_cp, new_vec_h) + + +@pytest.fixture +def matlab_ref_fixture(): + """ + Setup ASPIRE-Python objects using dummy data that is easily + constructed in MATLAB. + """ + DTYPE = np.float64 + n = 5 + n_pairs = n * (n - 1) // 2 + + # Dummy input vector. + Rijs = np.transpose( + np.arange(1, n_pairs * 3 * 3 + 1, dtype=DTYPE).reshape(n_pairs, 3, 3), (0, 2, 1) + ) + # Equivalent MATLAB + # n=5; np=n*(n-1)/2; rijs= reshape([1:np*3*3],[3,3,np]) + + # Create CL object for testing function calls + src = Simulation(L=8, n=n, C=1, dtype=DTYPE) + cl3n = CLSync3N(src, seed=314, S_weighting=False, J_weighting=False) + + return Rijs, cl3n + + +def test_triangles_scores(matlab_ref_fixture): + """ + Compares output of identical dummy data between this + implementation and legacy MATLAB triangles_scores_mex. + """ + Rijs, cl3n = matlab_ref_fixture + + hist = cl3n._triangle_scores_inner(Rijs) + + # Default is 100 histogram intervals, + # so the histogram reference is compressed. + ref_hist = np.zeros(cl3n.hist_intervals) + # Nonzeros, [[indices, ...], [values, ...]] + ref_compressed = np.array( + [[0, 10, 11, 12, 70, 71, 72, 76, 81, 89], [14, 2, 2, 2, 1, 1, 2, 1, 2, 3]] + ) + # Pack the reference histogram + np.put(ref_hist, *ref_compressed) + + np.testing.assert_allclose(hist, ref_hist) + + +def test_pairs_prob_mex(matlab_ref_fixture): + """ + Compares output of identical dummy data between this + implementation and legacy MATLAB pairs_probabilities_mex. + """ + Rijs, cl3n = matlab_ref_fixture + + params = np.arange(1, 7) + + ln_f_ind, ln_f_arb = cl3n._pairs_probabilities_host(Rijs, *params) + + ref_ln_f_ind = [ + -24.1817, + -5.6554, + 4.9117, + 12.7047, + -12.9374, + -5.5158, + 1.5289, + -9.0406, + -2.2067, + -7.3968, + ] + + ref_ln_f_arb = [ + -17.1264, + -6.7218, + -0.8876, + 3.3437, + -10.7251, + -6.7051, + -2.9029, + -8.5061, + -4.8288, + -7.5608, + ] + + np.testing.assert_allclose(ln_f_arb, ref_ln_f_arb, atol=5e-5) + + np.testing.assert_allclose(ln_f_ind, ref_ln_f_ind, atol=5e-5) + + +def test_signs_times_v_mex(matlab_ref_fixture): + """ + Compares output of identical dummy data between this + implementation and legacy MATLAB signs_times_v. + """ + Rijs, cl3n = matlab_ref_fixture + + # Dummy input vector + vec = np.ones(len(Rijs), dtype=DTYPE) + # Equivalent matlab + # vec=ones([1,np]); + + new_vec = cl3n._signs_times_v(Rijs, vec) + + ref_vec = [0, -2, -2, 0, -6, -4, -2, -2, -2, 0] + + np.testing.assert_allclose(new_vec, ref_vec) From f15bef587396b0f9b32f023660599e1baaa512b8 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 7 May 2024 11:45:13 -0400 Subject: [PATCH 230/433] Allow sync3n methods to run in singles via upcasting --- src/aspire/abinitio/commonline_sync3n.py | 8 ++--- tests/test_commonline_sync3n_cupy.py | 42 +++++++++++++++--------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 886557630f..36f251510f 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -611,8 +611,8 @@ def _pairs_probabilities_cupy(self, Rijs, P2, A, a, B, b, x0): ) # accumulate over thread results - ln_f_arb = ln_f_arb_dev.get() - ln_f_ind = ln_f_ind_dev.get() + ln_f_arb = ln_f_arb_dev.get().astype(self.dtype, copy=False) + ln_f_ind = ln_f_ind_dev.get().astype(self.dtype, copy=False) return ln_f_ind, ln_f_arb @@ -857,7 +857,7 @@ def _signs_times_v(self, Rijs, vec): else: new_vec = self._signs_times_v_host(Rijs, vec) - return new_vec + return new_vec.astype(vec.dtype, copy=False) def _signs_times_v_host(self, Rijs, vec): """ @@ -961,7 +961,7 @@ def _signs_times_v_cupy(self, Rijs, vec): ) # dtoh - new_vec = new_vec_dev.get() + new_vec = new_vec_dev.get().astype(vec.dtype, copy=False) return new_vec diff --git a/tests/test_commonline_sync3n_cupy.py b/tests/test_commonline_sync3n_cupy.py index 7165d368a7..9bea14c21f 100644 --- a/tests/test_commonline_sync3n_cupy.py +++ b/tests/test_commonline_sync3n_cupy.py @@ -8,14 +8,19 @@ pytest.importorskip("cupy") -DTYPE = np.float64 # TODO, consider single precision. -N = 64 # Number of images +N = 32 # Number of images n_pairs = N * (N - 1) // 2 +DTYPES = [np.float32, np.float64] + + +@pytest.fixture(scope="module", params=DTYPES, ids=lambda x: f"dtype={x}") +def dtype(request): + return request.param @pytest.fixture(scope="module") -def src_fixture(): - src = Simulation(n=N, L=32, C=1, dtype=DTYPE) +def src_fixture(dtype): + src = Simulation(n=N, L=32, C=1, dtype=dtype) src = src.cache() return src @@ -27,9 +32,8 @@ def cl3n_fixture(src_fixture): @pytest.fixture(scope="module") -def rijs_fixture(): - Rijs = np.arange(n_pairs * 3 * 3).reshape(n_pairs, 3, 3) - Rijs = Rijs.astype(dtype=DTYPE, copy=False) +def rijs_fixture(dtype): + Rijs = np.arange(n_pairs * 3 * 3, dtype=dtype).reshape(n_pairs, 3, 3) return Rijs @@ -50,15 +54,17 @@ def test_pairs_prob_host_vs_cupy(cl3n_fixture, rijs_fixture): indsh, arbh = cl3n_fixture._pairs_probabilities_host(rijs_fixture, *params) # Compare host to cupy calls - np.testing.assert_allclose(indsh, indscp) - np.testing.assert_allclose(arbh, arbcp) + rtol = 1e-07 # np testing default + if rijs_fixture.dtype != np.float64: + rtol = 2e-5 + np.testing.assert_allclose(indsh, indscp, rtol=rtol) + np.testing.assert_allclose(arbh, arbcp, rtol=rtol) def test_triangle_scores_host_vs_cupy(cl3n_fixture, rijs_fixture): """ Compares triangle_scores between host and cupy implementations. """ - # DTYPE is critical here (manually calling private method # Execute CUPY hist_cp = cl3n_fixture._triangle_scores_inner_cupy(rijs_fixture) @@ -77,7 +83,7 @@ def test_stv_host_vs_cupy(cl3n_fixture, rijs_fixture): Default J_weighting=False """ # dummy data vector - vec = np.random.random(n_pairs).astype(dtype=DTYPE, copy=False) + vec = np.ones(n_pairs, dtype=rijs_fixture.dtype) # J_weighting=False assert cl3n_fixture.J_weighting is False @@ -99,7 +105,7 @@ def test_stvJwt_host_vs_cupy(cl3n_fixture, rijs_fixture): Force J_weighting=True """ # dummy data vector - vec = np.random.random(n_pairs).astype(dtype=DTYPE, copy=False) + vec = np.ones(n_pairs, dtype=rijs_fixture.dtype) # J_weighting=True cl3n_fixture.J_weighting = True @@ -111,7 +117,13 @@ def test_stvJwt_host_vs_cupy(cl3n_fixture, rijs_fixture): new_vec_h = cl3n_fixture._signs_times_v_host(rijs_fixture, vec) # Compare host to cupy calls - np.testing.assert_allclose(new_vec_cp, new_vec_h) + rtol = 1e-7 # np testing default + if vec.dtype != np.float64: + rtol = 3e-07 + np.testing.assert_allclose(new_vec_cp, new_vec_h, rtol=rtol) + + +# The following fixture and tests compare against the legacy MATLAB implementation @pytest.fixture @@ -120,7 +132,7 @@ def matlab_ref_fixture(): Setup ASPIRE-Python objects using dummy data that is easily constructed in MATLAB. """ - DTYPE = np.float64 + DTYPE = np.float64 # MATLAB code is doubles only n = 5 n_pairs = n * (n - 1) // 2 @@ -210,7 +222,7 @@ def test_signs_times_v_mex(matlab_ref_fixture): Rijs, cl3n = matlab_ref_fixture # Dummy input vector - vec = np.ones(len(Rijs), dtype=DTYPE) + vec = np.ones(len(Rijs), dtype=Rijs.dtype) # Equivalent matlab # vec=ones([1,np]); From 277b0dcaac90539b74af917726066303a65913b0 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 3 Jul 2024 08:58:34 -0400 Subject: [PATCH 231/433] Update some docstrings --- src/aspire/abinitio/commonline_sync3n.py | 54 ++++++++++++++++++++---- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 36f251510f..32db9d23e7 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -16,6 +16,15 @@ class CLSync3N(CLOrient3D, SyncVotingMixin): """ Define a class to estimate 3D orientations using common lines Sync3N methods (2017). + + Ido Greenberg, Yoel Shkolnisky, + Common lines modeling for reference free Ab-initio reconstruction in cryo-EM, + Journal of Structural Biology, + Volume 200, Issue 2, + 2017, + Pages 106-117, + ISSN 1047-8477, + https://doi.org/10.1016/j.jsb.2017.09.007. """ # Initialize alternatives @@ -136,13 +145,17 @@ def estimate_rotations(self): # Yield rotations from S self.rotations = self._sync3n_S_to_rot(S, W) - ########################################### - # The hackberries taste like hackberries # - ########################################### + ####################### + # Main Sync3N Methods # + ####################### def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): """ Use eigen decomposition of S to estimate transforms, then project transforms to nearest rotations. + + :param S: Numpy array represeting Synchronization matrix. + :param W: Optional weights array, default `None` is equal weighting of `S`. + :param n_eigs: Optional, number of eigenvalues to compute (min 3). """ if n_eigs < 3: @@ -214,6 +227,9 @@ def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): def _construct_sync3n_matrix(self, Rij): """ Construct sync3n matrix from estimated rotations Rij. + + :param Rij: Numpy array of estimated rotations (all pairs). + :return: Synchronization matrix S, (3*N, 3*N). """ # Initialize S with diag identity blocks @@ -258,6 +274,7 @@ def _syncmatrix_weights( :param max_iterations: Maximum iterations for P estimation. :param min_p_permitted: Small value at which to stop attempting to synchronize P. + :return: Synchronization matrix weights `W`. """ logger.info("Computing synchronization matrix weights.") @@ -327,6 +344,7 @@ def _triangle_scores_inner(self, Rijs): Wrapper for cpu/gpu dispatch. :param Rijs: nchoose2 by 3 by 3 array of rotations. + :return: Histogram of triangle scores. """ # host/gpu dispatch @@ -475,7 +493,7 @@ def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0): :param B: distribution parameter :param b: distribution parameter :param x0: Initial guess - + :return: (log indicative probabilities, log arbitrary probabilities) """ # These param values are passed to C, force doubles. params = np.array([P2, A, a, B, b, x0], dtype=np.float64) @@ -629,19 +647,23 @@ def _triangle_scores( x0=0.78, ): """ - Computes `triangle_scores`, attempts to fit curve to distribution, and uses estimated distribution to compute `pairs_probabilities`. + Computes `triangle_scores`, attempts to fit curve to + distribution, and uses estimated distribution to compute + `pairs_probabilities`. Default parameters here were taken from those in the MATLAB code, with the original author noting they were found empirically. - :param a: + :param a: distribution parameter :param peak2sigma: empirical relation between the location of the peak of the histigram, and the mean error in the common lines estimations. - :param P: - :param b: + :param P: distribution parameter + :param b: distribution parameter :param x0: Initial guess + :return: Tuple of pairs probabilty Pij and related terms + (P, sigma, Pij, scores_hist) """ Pmin = Pmin or 0 @@ -731,7 +753,17 @@ def _estimate_relative_viewing_directions(self): return Rijs def _global_J_sync(self, Rijs): - """ """ + """ + Apply global J-synchronization. + + Given all pairs of estimated rotation matrices `Rijs` with + arbitrary handedness (J conjugation), attempt to detect and + conjugate entries of `Rijs` such that all rotations have same + handedness. + + :param Rijs: Array of all pairs of rotation matrices + :return: Array of all pairs of J synchronized rotation matrices + """ # Determine relative handedness of Rijs. sign_ij_J = self._J_sync_power_method(Rijs) @@ -746,6 +778,9 @@ def _global_J_sync(self, Rijs): def _estimate_all_Rijs(self, clmatrix): """ Estimate Rijs using the voting method. + + :param clmatrix: Common lines matrix + :return: Estimated rotations """ n_img = self.n_img n_theta = self.n_theta @@ -850,6 +885,7 @@ def _signs_times_v(self, Rijs, vec): :param Rijs: An n-choose-2x3x3 array of estimates of relative rotations :param vec: The current candidate eigenvector of length n-choose-2 from the power method. + :return: New candidate eigenvector. """ # host/gpu dispatch if self._gpu_module: From 2d886e382bc22184371eae675ab1ea71b2a7e059 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 3 Jul 2024 09:14:42 -0400 Subject: [PATCH 232/433] initial add cl sync3n test --- tests/test_commonline_sync3n.py | 101 ++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 tests/test_commonline_sync3n.py diff --git a/tests/test_commonline_sync3n.py b/tests/test_commonline_sync3n.py new file mode 100644 index 0000000000..f9be7a103d --- /dev/null +++ b/tests/test_commonline_sync3n.py @@ -0,0 +1,101 @@ +import os + +import numpy as np +import pytest + +from aspire.abinitio import CLSync3N +from aspire.source import Simulation +from aspire.utils import mean_aligned_angular_distance, rots_to_clmatrix +from aspire.volume import AsymmetricVolume + +DATA_DIR = os.path.join(os.path.dirname(__file__), "saved_test_data") + +RESOLUTION = [ + 40, + 41, +] + +# `None` defaults to random offsets. +OFFSETS = [ + 0, + # pytest.param(None, marks=pytest.mark.expensive), +] + +DTYPES = [ + # np.float32, + # pytest.param(np.float64, marks=pytest.mark.expensive), + np.float64, +] + + +@pytest.fixture(params=RESOLUTION, ids=lambda x: f"resolution={x}") +def resolution(request): + return request.param + + +@pytest.fixture(params=OFFSETS, ids=lambda x: f"offsets={x}") +def offsets(request): + return request.param + + +@pytest.fixture(params=DTYPES, ids=lambda x: f"dtype={x}") +def dtype(request): + return request.param + + +@pytest.fixture +def source_orientation_objs(resolution, offsets, dtype): + src = Simulation( + n=50, + L=resolution, + vols=AsymmetricVolume(L=resolution, C=1, K=100, seed=0).generate(), + offsets=offsets, + amplitudes=1, + seed=0, + ).cache() + + # # Search for common lines over less shifts for 0 offsets. + # max_shift = 1 / resolution + # shift_step = 1 + # if src.offsets.all() != 0: + # max_shift = 0.20 + # shift_step = 0.25 # Reduce shift steps for non-integer offsets of Simulation. + # orient_est = CLSync3N( + # src, max_shift=max_shift, shift_step=shift_step, mask=False + + # ) + orient_est = CLSync3N(src) + + return src, orient_est + + +def test_build_clmatrix(source_orientation_objs): + src, orient_est = source_orientation_objs + + # Build clmatrix estimate. + orient_est.build_clmatrix() + + gt_clmatrix = rots_to_clmatrix(src.rotations, orient_est.n_theta) + + angle_diffs = abs(orient_est.clmatrix - gt_clmatrix) * 360 / orient_est.n_theta + + # Count number of estimates within 5 degrees of ground truth. + within_5 = np.sum((angle_diffs - 360) % 360 < 5) + + # Check that at least 98% of estimates are within 5 degrees. + tol = 0.98 + if src.offsets.all() != 0: + # Set tolerance to 95% when using nonzero offsets. + tol = 0.95 + assert within_5 / angle_diffs.size > tol + + +def test_estimate_rotations(source_orientation_objs): + src, orient_est = source_orientation_objs + + orient_est.estimate_rotations() + + # Register estimates to ground truth rotations and compute the + # mean angular distance between them (in degrees). + # Assert that mean angular distance is less than 1 degree. + mean_aligned_angular_distance(orient_est.rotations, src.rotations, degree_tol=1) From e6fddd67f6109e9cb116985679b8acc151806062 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 3 Jul 2024 10:13:14 -0400 Subject: [PATCH 233/433] add minimal test --- src/aspire/abinitio/commonline_sync3n.py | 8 ++++++- tests/test_commonline_sync3n.py | 29 ++++++++---------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 32db9d23e7..45456f8a70 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -99,7 +99,13 @@ def __init__( self.S_weighting = S_weighting self.J_weighting = J_weighting self._D_null = 1e-13 - self.hist_intervals = hist_intervals + self.hist_intervals = int(hist_intervals) + # Warn if histogram may be too sparse for curve fitting + if self.S_weighting and (src.n < hist_intervals): + logger.warning( + f"`hist_intervals` {hist_intervals} > src.n {src.n}." + " Consider reducing if curve fitting is infeasable." + ) # Auto configure GPU self._gpu_module = None diff --git a/tests/test_commonline_sync3n.py b/tests/test_commonline_sync3n.py index f9be7a103d..119eec2ae1 100644 --- a/tests/test_commonline_sync3n.py +++ b/tests/test_commonline_sync3n.py @@ -18,53 +18,42 @@ # `None` defaults to random offsets. OFFSETS = [ 0, - # pytest.param(None, marks=pytest.mark.expensive), ] DTYPES = [ - # np.float32, + np.float32, # pytest.param(np.float64, marks=pytest.mark.expensive), np.float64, ] -@pytest.fixture(params=RESOLUTION, ids=lambda x: f"resolution={x}") +@pytest.fixture(params=RESOLUTION, ids=lambda x: f"resolution={x}", scope="module") def resolution(request): return request.param -@pytest.fixture(params=OFFSETS, ids=lambda x: f"offsets={x}") +@pytest.fixture(params=OFFSETS, ids=lambda x: f"offsets={x}", scope="module") def offsets(request): return request.param -@pytest.fixture(params=DTYPES, ids=lambda x: f"dtype={x}") +@pytest.fixture(params=DTYPES, ids=lambda x: f"dtype={x}", scope="module") def dtype(request): return request.param -@pytest.fixture +@pytest.fixture(scope="module") def source_orientation_objs(resolution, offsets, dtype): src = Simulation( - n=50, + n=100, L=resolution, - vols=AsymmetricVolume(L=resolution, C=1, K=100, seed=0).generate(), + vols=AsymmetricVolume(L=resolution, C=1, K=100, seed=123).generate(), offsets=offsets, amplitudes=1, - seed=0, + seed=456, ).cache() - # # Search for common lines over less shifts for 0 offsets. - # max_shift = 1 / resolution - # shift_step = 1 - # if src.offsets.all() != 0: - # max_shift = 0.20 - # shift_step = 0.25 # Reduce shift steps for non-integer offsets of Simulation. - # orient_est = CLSync3N( - # src, max_shift=max_shift, shift_step=shift_step, mask=False - - # ) - orient_est = CLSync3N(src) + orient_est = CLSync3N(src, S_weighting=True, seed=789) return src, orient_est From 6c21b9156c8f0505973d08233493adc5a5186bdd Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 3 Jul 2024 10:20:52 -0400 Subject: [PATCH 234/433] actually test the different dtypes --- tests/test_orient_sync_voting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_orient_sync_voting.py b/tests/test_orient_sync_voting.py index 31d6b20e94..3e875e9467 100644 --- a/tests/test_orient_sync_voting.py +++ b/tests/test_orient_sync_voting.py @@ -52,7 +52,7 @@ def source_orientation_objs(resolution, offsets, dtype): src = Simulation( n=50, L=resolution, - vols=AsymmetricVolume(L=resolution, C=1, K=100, seed=0).generate(), + vols=AsymmetricVolume(L=resolution, C=1, K=100, seed=0, dtype=dtype).generate(), offsets=offsets, amplitudes=1, seed=0, From 6b6f86fa2d2dcb2a780f99b2c44786f9b571ffe1 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 3 Jul 2024 10:24:05 -0400 Subject: [PATCH 235/433] mark float64 and odd sync3n as expensive --- tests/test_commonline_sync3n.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_commonline_sync3n.py b/tests/test_commonline_sync3n.py index 119eec2ae1..6640fa871f 100644 --- a/tests/test_commonline_sync3n.py +++ b/tests/test_commonline_sync3n.py @@ -12,18 +12,16 @@ RESOLUTION = [ 40, - 41, + pytest.param(41, marks=pytest.mark.expensive), ] -# `None` defaults to random offsets. OFFSETS = [ 0, ] DTYPES = [ np.float32, - # pytest.param(np.float64, marks=pytest.mark.expensive), - np.float64, + pytest.param(np.float64, marks=pytest.mark.expensive), ] @@ -47,7 +45,9 @@ def source_orientation_objs(resolution, offsets, dtype): src = Simulation( n=100, L=resolution, - vols=AsymmetricVolume(L=resolution, C=1, K=100, seed=123).generate(), + vols=AsymmetricVolume( + L=resolution, C=1, K=100, seed=123, dtype=dtype + ).generate(), offsets=offsets, amplitudes=1, seed=456, From 735b8fe633b220f3ef5a26134f5775c0fbe09006 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 19 Jul 2024 08:45:47 -0400 Subject: [PATCH 236/433] first pass addressing review remarks --- src/aspire/abinitio/commonline_sync3n.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 45456f8a70..4c06d882d9 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -122,7 +122,7 @@ def __init__( logger.info("GPU not found, defaulting to numpy.") except ModuleNotFoundError: - logger.info("cupy not found, defaulting numpy.") + logger.info("cupy not found, defaulting to numpy.") ########################################### # High level algorithm steps # @@ -159,7 +159,7 @@ def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): Use eigen decomposition of S to estimate transforms, then project transforms to nearest rotations. - :param S: Numpy array represeting Synchronization matrix. + :param S: Numpy array representing Synchronization matrix. :param W: Optional weights array, default `None` is equal weighting of `S`. :param n_eigs: Optional, number of eigenvalues to compute (min 3). """ @@ -177,7 +177,7 @@ def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): f" Received {W.shape}." ) # Initialize D - D = np.mean(W, axis=1) # D, check axis + D = np.mean(W, axis=1) Dhalf = D # Compute mask of trouble D values @@ -197,10 +197,10 @@ def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): logger.warning(f"Large Weights Matrix Normalization Error: {err}") # Make W of size 3Nx3N - W = np.kron(W, np.ones((3, 3))) + W = np.kron(W, np.ones((3, 3), dtype=self.dtype)) # Make Dhalf of size 3Nx3N - Dhalf = np.diag(np.kron(np.diag(Dhalf), np.ones((1, 3)))[0]) + Dhalf = np.diag(np.kron(np.diag(Dhalf), np.ones(3, dtype=self.dtype))) # Apply weights to S S = Dhalf @ (W * S) @ Dhalf @@ -333,7 +333,7 @@ def _body(prev_too_low, Pmin, Pmax, hist, p_domain_limit=p_domain_limit): i += 1 # Pack W - W = np.zeros((self.n_img, self.n_img)) + W = np.zeros((self.n_img, self.n_img), dtype=self.dtype) idx = 0 for i in range(self.n_img): for j in range(i + 1, self.n_img): @@ -375,7 +375,7 @@ def _triangle_scores_inner_host(self, Rijs): h = 1 / self.hist_intervals c = np.empty((4), dtype=Rijs.dtype) - for i in trange(self.n_img, desc="Computing triangle scores"): + for i in trange(self.n_img - 2, desc="Computing triangle scores"): for j in range( i + 1, self.n_img - 1 ): # check bound (taken from MATLAB mex) @@ -525,7 +525,7 @@ def _pairs_probabilities_host(self, Rijs, P2, A, a, B, b, x0): ln_f_arb = np.zeros(len(Rijs), dtype=Rijs.dtype) c = np.empty((4), dtype=Rijs.dtype) - for i in trange(self.n_img, desc="Computing pair probabilities"): + for i in trange(self.n_img - 2, desc="Computing pair probabilities"): for j in range(i + 1, self.n_img - 1): ij = self._pairs_to_linear[i, j] Rij = Rijs[ij] @@ -715,8 +715,7 @@ def fun(x, B, P, b, x0, A=A, a=a): # Derive P and sigma P = P ** (1 / 3) - peak = x0 # can rm later - sigma = (1 - peak) / peak2sigma + sigma = (1 - x0) / peak2sigma # Initialize probability computations # Local histograms analysis @@ -918,7 +917,7 @@ def _signs_times_v_host(self, Rijs, vec): desc = "Computing signs_times_v" if self.J_weighting: desc += " with J_weighting" - for i in trange(self.n_img, desc=desc): + for i in trange(self.n_img - 2, desc=desc): for j in range( i + 1, self.n_img - 1 ): # check bound (taken from MATLAB mex) From bd6ba2b301596c44b86885a46f78812f7e020aeb Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 19 Jul 2024 08:51:42 -0400 Subject: [PATCH 237/433] move initial rotation estimate lines into estimate_rotations --- src/aspire/abinitio/commonline_sync3n.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 4c06d882d9..77f964c523 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -134,8 +134,14 @@ def estimate_rotations(self): :return: Array of rotation matrices, size n_imgx3x3. """ + logger.info(f"Estimating relative viewing directions for {self.n_img} images.") + + # Detect a single pair of common-lines between each pair of images + self.build_clmatrix() + # Initial estimate of viewing directions - Rijs0 = self._estimate_relative_viewing_directions() + # Calculate relative rotations + Rijs0 = self._estimate_all_Rijs(self.clmatrix) # Compute and apply global handedness Rijs = self._global_J_sync(Rijs0) @@ -743,20 +749,6 @@ def fun(x, B, P, b, x0, A=A, a=a): # Primary Methods # ########################################### - def _estimate_relative_viewing_directions(self): - """ - Estimate the relative viewing directions vij = vi*vj^T, i Date: Fri, 9 Aug 2024 14:32:26 -0400 Subject: [PATCH 238/433] important progress bar --- src/aspire/abinitio/commonline_sync3n.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 77f964c523..8369d50045 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -6,7 +6,7 @@ from scipy.optimize import curve_fit from aspire.abinitio import CLOrient3D, SyncVotingMixin -from aspire.utils import J_conjugate, all_pairs, nearest_rotations, trange +from aspire.utils import J_conjugate, all_pairs, nearest_rotations, tqdm, trange from aspire.utils.matlab_compat import stable_eigsh from aspire.utils.random import randn @@ -783,7 +783,7 @@ def _estimate_all_Rijs(self, clmatrix): n_theta = self.n_theta Rijs = np.zeros((len(self._pairs), 3, 3)) - for idx, (i, j) in enumerate(self._pairs): + for idx, (i, j) in enumerate(tqdm(self._pairs, desc="Estimate Rijs")): Rijs[idx] = self._syncmatrix_ij_vote_3n( clmatrix, i, j, np.arange(n_img), n_theta ) From 7cf3eaa291b3b0435e73150d0f2702457c69531d Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 13 Aug 2024 15:37:49 -0400 Subject: [PATCH 239/433] Use trust region method for S weight least squares --- src/aspire/abinitio/commonline_sync3n.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 8369d50045..5c730e7aa2 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -716,6 +716,7 @@ def fun(x, B, P, b, x0, A=A, a=a): scores_hist.astype(np.float64, copy=False), p0=start_values, bounds=(lower_bounds, upper_bounds), + method="trf", # MATLAB used method "LAR" with algo "Trust-Region" ) B, P, b, x0 = popt From d365de661865c69c77f1a556da66a04057bc42bc Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 19 Aug 2024 09:10:18 -0400 Subject: [PATCH 240/433] use class mangled names for gpu methods --- src/aspire/abinitio/commonline_sync3n.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 5c730e7aa2..e8149a4921 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -108,7 +108,7 @@ def __init__( ) # Auto configure GPU - self._gpu_module = None + self.__gpu_module = None try: import cupy as cp @@ -117,7 +117,7 @@ def __init__( logger.info( f"cupy and GPU {gpu_id} found by cuda runtime; enabling cupy." ) - self._gpu_module = self._init_cupy_module() + self.__gpu_module = self.__init_cupy_module() else: logger.info("GPU not found, defaulting to numpy.") @@ -360,7 +360,7 @@ def _triangle_scores_inner(self, Rijs): """ # host/gpu dispatch - if self._gpu_module: + if self.__gpu_module: scores_hist = self._triangle_scores_inner_cupy(Rijs) else: scores_hist = self._triangle_scores_inner_host(Rijs) @@ -460,7 +460,7 @@ def _triangle_scores_inner_cupy(self, Rijs): import cupy as cp - triangle_scores = self._gpu_module.get_function("triangle_scores_inner") + triangle_scores = self.__gpu_module.get_function("triangle_scores_inner") Rijs_dev = cp.array(Rijs, dtype=np.float64) @@ -511,7 +511,7 @@ def _pairs_probabilities(self, Rijs, P2, A, a, B, b, x0): params = np.array([P2, A, a, B, b, x0], dtype=np.float64) # host/gpu dispatch - if self._gpu_module: + if self.__gpu_module: ln_f_ind, ln_f_arb = self._pairs_probabilities_cupy(Rijs, *params) else: ln_f_ind, ln_f_arb = self._pairs_probabilities_host(Rijs, *params) @@ -625,7 +625,7 @@ def _pairs_probabilities_cupy(self, Rijs, P2, A, a, B, b, x0): import cupy as cp - pairs_probabilities = self._gpu_module.get_function("pairs_probabilities") + pairs_probabilities = self.__gpu_module.get_function("pairs_probabilities") Rijs_dev = cp.array(Rijs, dtype=np.float64) ln_f_ind_dev = cp.zeros((self.n_img * (self.n_img - 1) // 2), dtype=np.float64) @@ -886,7 +886,7 @@ def _signs_times_v(self, Rijs, vec): :return: New candidate eigenvector. """ # host/gpu dispatch - if self._gpu_module: + if self.__gpu_module: new_vec = self._signs_times_v_cupy(Rijs, vec) else: new_vec = self._signs_times_v_host(Rijs, vec) @@ -979,7 +979,7 @@ def _signs_times_v_cupy(self, Rijs, vec): """ import cupy as cp - signs_times_v = self._gpu_module.get_function("signs_times_v") + signs_times_v = self.__gpu_module.get_function("signs_times_v") Rijs_dev = cp.array(Rijs, dtype=np.float64) vec_dev = cp.array(vec, dtype=np.float64) @@ -1000,7 +1000,7 @@ def _signs_times_v_cupy(self, Rijs, vec): return new_vec @staticmethod - def _init_cupy_module(): + def __init_cupy_module(): """ Private utility method to read in CUDA source and return as compiled CUPY module. From c0fdbf9e94efe27c3cc4dc181303284168dbdd87 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 19 Aug 2024 09:11:32 -0400 Subject: [PATCH 241/433] typo --- src/aspire/abinitio/commonline_sync3n.cu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_sync3n.cu b/src/aspire/abinitio/commonline_sync3n.cu index 99582b3f24..eeaee723b9 100644 --- a/src/aspire/abinitio/commonline_sync3n.cu +++ b/src/aspire/abinitio/commonline_sync3n.cu @@ -1,5 +1,5 @@ -/* from i,j indoces to the common index in the N-choose-2 sized array */ +/* from i,j indices to the common index in the N-choose-2 sized array */ #define PAIR_IDX(N,I,J) ((2*N-I-1)*I/2 + J-I-1) From 8d571b7a3df3c181dfd79b9ed1ca9fe9f4b7d897 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 27 Aug 2024 09:53:55 -0400 Subject: [PATCH 242/433] Add disable_gpu sync3n flag --- src/aspire/abinitio/commonline_sync3n.py | 31 ++++++++++++++---------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index e8149a4921..5e34491d42 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -57,6 +57,7 @@ def __init__( S_weighting=False, J_weighting=False, hist_intervals=100, + disable_gpu=False, ): """ Initialize object for estimating 3D orientations. @@ -77,6 +78,9 @@ def __init__( signs when computing `signs_times_v`. :param hist_intervals: Number of histogram bins used to compute triangle scores when `S_weighting` enabled. + :param disable_gpu: Disables GPU acceleration; + forces CPU only code for this module. + Defaults to automatically using GPU when available. """ super().__init__( @@ -109,20 +113,21 @@ def __init__( # Auto configure GPU self.__gpu_module = None - try: - import cupy as cp - - if cp.cuda.runtime.getDeviceCount() >= 1: - gpu_id = cp.cuda.runtime.getDevice() - logger.info( - f"cupy and GPU {gpu_id} found by cuda runtime; enabling cupy." - ) - self.__gpu_module = self.__init_cupy_module() - else: - logger.info("GPU not found, defaulting to numpy.") + if not disable_gpu: + try: + import cupy as cp + + if cp.cuda.runtime.getDeviceCount() >= 1: + gpu_id = cp.cuda.runtime.getDevice() + logger.info( + f"cupy and GPU {gpu_id} found by cuda runtime; enabling cupy." + ) + self.__gpu_module = self.__init_cupy_module() + else: + logger.info("GPU not found, defaulting to numpy.") - except ModuleNotFoundError: - logger.info("cupy not found, defaulting to numpy.") + except ModuleNotFoundError: + logger.info("cupy not found, defaulting to numpy.") ########################################### # High level algorithm steps # From 24d627619035755d35c072f1c8e5062bca49c6f7 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 27 Aug 2024 10:02:34 -0400 Subject: [PATCH 243/433] P->W typo --- src/aspire/abinitio/commonline_sync3n.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 5e34491d42..e2186a5bc6 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -277,7 +277,7 @@ def _syncmatrix_weights( ): """ Given relative rotations matrix `Rij`, - compute and return probability weights `P` for S. + compute and return probability weights `W` for S. Default parameters here were taken from those in the MATLAB code, with the original author noting they were found From 2d969596b5a7547fc7e0622dad8a708c1b8d8b3a Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 27 Aug 2024 10:06:14 -0400 Subject: [PATCH 244/433] use more specific language instead of resolution --- src/aspire/abinitio/commonline_sync3n.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index e2186a5bc6..3b02bb8d2d 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -65,8 +65,8 @@ def __init__( :param src: The source object of 2D denoised or class-averaged images with metadata :param n_rad: The number of points in the radial direction :param n_theta: The number of points in the theta direction - :param max_shift: Maximum range for shifts as a proportion of resolution. Default = 0.15. - :param shift_step: Resolution of shift estimation in pixels. Default = 1 pixel. + :param max_shift: Maximum range for shifts as a proportion of box size. Default = 0.15. + :param shift_step: Step size of shift estimation in pixels. Default = 1 pixel. :param epsilon: Tolerance for the power method. :param max_iter: Maximum iterations for the power method. :param seed: Optional seed for RNG. From 9374f0a88eda62db8ec7d3612046f59171da1363 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 27 Aug 2024 10:53:40 -0400 Subject: [PATCH 245/433] Replace histogram logic --- src/aspire/abinitio/commonline_sync3n.py | 29 +++++++----------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 3b02bb8d2d..e3b1c50edc 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -383,9 +383,9 @@ def _triangle_scores_inner_host(self, Rijs): # Initialize probability result arrays scores_hist = np.zeros(self.hist_intervals, dtype=np.uint32) - h = 1 / self.hist_intervals c = np.empty((4), dtype=Rijs.dtype) + s = np.empty((3), dtype=Rijs.dtype) for i in trange(self.n_img - 2, desc="Computing triangle scores"): for j in range( i + 1, self.n_img - 1 @@ -427,28 +427,15 @@ def _triangle_scores_inner_host(self, Rijs): alt_ij_ik = c[self._ALTS[1][best_i][2]] # Compute scores - s_ij_jk = 1 - np.sqrt(best_val / alt_ij_jk) - s_ik_jk = 1 - np.sqrt(best_val / alt_ik_jk) - s_ij_ik = 1 - np.sqrt(best_val / alt_ij_ik) + s[0] = 1 - np.sqrt(best_val / alt_ij_jk) # s_ij_jk + s[1] = 1 - np.sqrt(best_val / alt_ik_jk) # s_ik_jk + s[2] = 1 - np.sqrt(best_val / alt_ij_ik) # s_ij_ik # Update histogram - threshold = 0 - for _l1 in range(self.hist_intervals - 1): - threshold += h - if s_ij_jk < threshold: - break - - threshold = 0 - for _l2 in range(self.hist_intervals - 1): - threshold += h - if s_ik_jk < threshold: - break - - threshold = 0 - for _l3 in range(self.hist_intervals - 1): - threshold += h - if s_ij_ik < threshold: - break + # Find integer bin [0,self.hist_intervals) + _l1, _l2, _l3 = np.minimum( + (self.hist_intervals * s).astype(int), # implicit floor + self.hist_intervals-1) # clamp upper bound scores_hist[_l1] += 1 scores_hist[_l2] += 1 From 565b61c065834d85f2a413f61b7b9e520cfaa8ee Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 27 Aug 2024 11:27:51 -0400 Subject: [PATCH 246/433] factor out sync3n score body --- src/aspire/abinitio/commonline_sync3n.py | 126 ++++++++++------------- 1 file changed, 56 insertions(+), 70 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index e3b1c50edc..e0ed1514e0 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -372,6 +372,54 @@ def _triangle_scores_inner(self, Rijs): return scores_hist + def _scores_inner_body(self, Rijs, c, s, i, j, k): + """ + Private method to compute scores `s` + given rotations `Rijs` and indices `i`, `j`, `k`. + + Note arrays `Rijs`, `c`, and `s` are passed by reference from caller. + """ + + ij = self._pairs_to_linear[i, j] + ik = self._pairs_to_linear[i, k] + jk = self._pairs_to_linear[j, k] + Rij = Rijs[ij] + Rik = Rijs[ik] + Rjk = Rijs[jk] + + # Compute conjugated rots + Rij_J = J_conjugate(Rij) + Rik_J = J_conjugate(Rik) + Rjk_J = J_conjugate(Rjk) + + # Compute R muls and norms + c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) + c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) + c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) + c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) + + # Find best match + best_i = np.argmin(c) + best_val = c[best_i] + + # For each triangle side, find the best alternative + alt_ij_jk = c[self._ALTS[0][best_i][0]] + if c[self._ALTS[1][best_i][0]] < alt_ij_jk: + alt_ij_jk = c[self._ALTS[1][best_i][0]] + + alt_ik_jk = c[self._ALTS[0][best_i][1]] + if c[self._ALTS[1][best_i][1]] < alt_ik_jk: + alt_ik_jk = c[self._ALTS[1][best_i][1]] + + alt_ij_ik = c[self._ALTS[0][best_i][2]] + if c[self._ALTS[1][best_i][2]] < alt_ij_ik: + alt_ij_ik = c[self._ALTS[1][best_i][2]] + + # Compute scores + s[0] = 1 - np.sqrt(best_val / alt_ij_jk) # s_ij_jk + s[1] = 1 - np.sqrt(best_val / alt_ik_jk) # s_ik_jk + s[2] = 1 - np.sqrt(best_val / alt_ij_ik) # s_ij_ik + def _triangle_scores_inner_host(self, Rijs): """ See _triangle_scores_inner. @@ -390,52 +438,17 @@ def _triangle_scores_inner_host(self, Rijs): for j in range( i + 1, self.n_img - 1 ): # check bound (taken from MATLAB mex) - ij = self._pairs_to_linear[i, j] - Rij = Rijs[ij] for k in range(j + 1, self.n_img): - ik = self._pairs_to_linear[i, k] - jk = self._pairs_to_linear[j, k] - Rik = Rijs[ik] - Rjk = Rijs[jk] - - # Compute conjugated rotats - Rij_J = J_conjugate(Rij) - Rik_J = J_conjugate(Rik) - Rjk_J = J_conjugate(Rjk) - - # Compute R muls and norms - c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) - c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) - c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) - c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) - - # Find best match - best_i = np.argmin(c) - best_val = c[best_i] - - # For each triangle side, find the best alternative - alt_ij_jk = c[self._ALTS[0][best_i][0]] - if c[self._ALTS[1][best_i][0]] < alt_ij_jk: - alt_ij_jk = c[self._ALTS[1][best_i][0]] - - alt_ik_jk = c[self._ALTS[0][best_i][1]] - if c[self._ALTS[1][best_i][1]] < alt_ik_jk: - alt_ik_jk = c[self._ALTS[1][best_i][1]] - - alt_ij_ik = c[self._ALTS[0][best_i][2]] - if c[self._ALTS[1][best_i][2]] < alt_ij_ik: - alt_ij_ik = c[self._ALTS[1][best_i][2]] # Compute scores - s[0] = 1 - np.sqrt(best_val / alt_ij_jk) # s_ij_jk - s[1] = 1 - np.sqrt(best_val / alt_ik_jk) # s_ik_jk - s[2] = 1 - np.sqrt(best_val / alt_ij_ik) # s_ij_ik + self._scores_inner_body(Rijs, c, s, i, j, k) # Update histogram # Find integer bin [0,self.hist_intervals) _l1, _l2, _l3 = np.minimum( (self.hist_intervals * s).astype(int), # implicit floor - self.hist_intervals-1) # clamp upper bound + self.hist_intervals - 1, + ) # clamp upper bound scores_hist[_l1] += 1 scores_hist[_l2] += 1 @@ -523,46 +536,19 @@ def _pairs_probabilities_host(self, Rijs, P2, A, a, B, b, x0): ln_f_arb = np.zeros(len(Rijs), dtype=Rijs.dtype) c = np.empty((4), dtype=Rijs.dtype) + s = np.empty((3), dtype=Rijs.dtype) for i in trange(self.n_img - 2, desc="Computing pair probabilities"): for j in range(i + 1, self.n_img - 1): ij = self._pairs_to_linear[i, j] - Rij = Rijs[ij] for k in range(j + 1, self.n_img): ik = self._pairs_to_linear[i, k] jk = self._pairs_to_linear[j, k] - Rik = Rijs[ik] - Rjk = Rijs[jk] - - # Compute conjugated rotats - Rij_J = J_conjugate(Rij) - Rik_J = J_conjugate(Rik) - Rjk_J = J_conjugate(Rjk) - - # Compute R muls and norms - c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) - c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) - c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) - c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) - - # Find best match - best_i = np.argmin(c) - best_val = c[best_i] - - # For each triangle side, find the best alternative - alt_ij_jk = c[self._ALTS[0][best_i][0]] - if c[self._ALTS[1][best_i][0]] < alt_ij_jk: - alt_ij_jk = c[self._ALTS[1][best_i][0]] - alt_ik_jk = c[self._ALTS[0][best_i][1]] - if c[self._ALTS[1][best_i][1]] < alt_ik_jk: - alt_ik_jk = c[self._ALTS[1][best_i][1]] - alt_ij_ik = c[self._ALTS[0][best_i][2]] - if c[self._ALTS[1][best_i][2]] < alt_ij_ik: - alt_ij_ik = c[self._ALTS[1][best_i][2]] # Compute scores - s_ij_jk = 1 - np.sqrt(best_val / alt_ij_jk) - s_ik_jk = 1 - np.sqrt(best_val / alt_ik_jk) - s_ij_ik = 1 - np.sqrt(best_val / alt_ij_ik) + self._scores_inner_body(Rijs, c, s, i, j, k) + + # Unpack scores to local formula vars + s_ij_jk, s_ik_jk, s_ij_ik = s # Update probabilities # # Probability of pair ij having score given indicicative common line From 6570545c9d8fe5df62620421ca1bcc90ac941cff Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 28 Aug 2024 08:01:31 -0400 Subject: [PATCH 247/433] Revert "factor out sync3n score body" This reverts commit bd34d3d7dd3bdd9d1c432046437395124432e483. --- src/aspire/abinitio/commonline_sync3n.py | 126 +++++++++++++---------- 1 file changed, 70 insertions(+), 56 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index e0ed1514e0..e3b1c50edc 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -372,54 +372,6 @@ def _triangle_scores_inner(self, Rijs): return scores_hist - def _scores_inner_body(self, Rijs, c, s, i, j, k): - """ - Private method to compute scores `s` - given rotations `Rijs` and indices `i`, `j`, `k`. - - Note arrays `Rijs`, `c`, and `s` are passed by reference from caller. - """ - - ij = self._pairs_to_linear[i, j] - ik = self._pairs_to_linear[i, k] - jk = self._pairs_to_linear[j, k] - Rij = Rijs[ij] - Rik = Rijs[ik] - Rjk = Rijs[jk] - - # Compute conjugated rots - Rij_J = J_conjugate(Rij) - Rik_J = J_conjugate(Rik) - Rjk_J = J_conjugate(Rjk) - - # Compute R muls and norms - c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) - c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) - c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) - c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) - - # Find best match - best_i = np.argmin(c) - best_val = c[best_i] - - # For each triangle side, find the best alternative - alt_ij_jk = c[self._ALTS[0][best_i][0]] - if c[self._ALTS[1][best_i][0]] < alt_ij_jk: - alt_ij_jk = c[self._ALTS[1][best_i][0]] - - alt_ik_jk = c[self._ALTS[0][best_i][1]] - if c[self._ALTS[1][best_i][1]] < alt_ik_jk: - alt_ik_jk = c[self._ALTS[1][best_i][1]] - - alt_ij_ik = c[self._ALTS[0][best_i][2]] - if c[self._ALTS[1][best_i][2]] < alt_ij_ik: - alt_ij_ik = c[self._ALTS[1][best_i][2]] - - # Compute scores - s[0] = 1 - np.sqrt(best_val / alt_ij_jk) # s_ij_jk - s[1] = 1 - np.sqrt(best_val / alt_ik_jk) # s_ik_jk - s[2] = 1 - np.sqrt(best_val / alt_ij_ik) # s_ij_ik - def _triangle_scores_inner_host(self, Rijs): """ See _triangle_scores_inner. @@ -438,17 +390,52 @@ def _triangle_scores_inner_host(self, Rijs): for j in range( i + 1, self.n_img - 1 ): # check bound (taken from MATLAB mex) + ij = self._pairs_to_linear[i, j] + Rij = Rijs[ij] for k in range(j + 1, self.n_img): + ik = self._pairs_to_linear[i, k] + jk = self._pairs_to_linear[j, k] + Rik = Rijs[ik] + Rjk = Rijs[jk] + + # Compute conjugated rotats + Rij_J = J_conjugate(Rij) + Rik_J = J_conjugate(Rik) + Rjk_J = J_conjugate(Rjk) + + # Compute R muls and norms + c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) + c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) + c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) + c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) + + # Find best match + best_i = np.argmin(c) + best_val = c[best_i] + + # For each triangle side, find the best alternative + alt_ij_jk = c[self._ALTS[0][best_i][0]] + if c[self._ALTS[1][best_i][0]] < alt_ij_jk: + alt_ij_jk = c[self._ALTS[1][best_i][0]] + + alt_ik_jk = c[self._ALTS[0][best_i][1]] + if c[self._ALTS[1][best_i][1]] < alt_ik_jk: + alt_ik_jk = c[self._ALTS[1][best_i][1]] + + alt_ij_ik = c[self._ALTS[0][best_i][2]] + if c[self._ALTS[1][best_i][2]] < alt_ij_ik: + alt_ij_ik = c[self._ALTS[1][best_i][2]] # Compute scores - self._scores_inner_body(Rijs, c, s, i, j, k) + s[0] = 1 - np.sqrt(best_val / alt_ij_jk) # s_ij_jk + s[1] = 1 - np.sqrt(best_val / alt_ik_jk) # s_ik_jk + s[2] = 1 - np.sqrt(best_val / alt_ij_ik) # s_ij_ik # Update histogram # Find integer bin [0,self.hist_intervals) _l1, _l2, _l3 = np.minimum( (self.hist_intervals * s).astype(int), # implicit floor - self.hist_intervals - 1, - ) # clamp upper bound + self.hist_intervals-1) # clamp upper bound scores_hist[_l1] += 1 scores_hist[_l2] += 1 @@ -536,19 +523,46 @@ def _pairs_probabilities_host(self, Rijs, P2, A, a, B, b, x0): ln_f_arb = np.zeros(len(Rijs), dtype=Rijs.dtype) c = np.empty((4), dtype=Rijs.dtype) - s = np.empty((3), dtype=Rijs.dtype) for i in trange(self.n_img - 2, desc="Computing pair probabilities"): for j in range(i + 1, self.n_img - 1): ij = self._pairs_to_linear[i, j] + Rij = Rijs[ij] for k in range(j + 1, self.n_img): ik = self._pairs_to_linear[i, k] jk = self._pairs_to_linear[j, k] + Rik = Rijs[ik] + Rjk = Rijs[jk] - # Compute scores - self._scores_inner_body(Rijs, c, s, i, j, k) + # Compute conjugated rotats + Rij_J = J_conjugate(Rij) + Rik_J = J_conjugate(Rik) + Rjk_J = J_conjugate(Rjk) + + # Compute R muls and norms + c[0] = np.sum(((Rij @ Rjk) - Rik) ** 2) + c[1] = np.sum(((Rij_J @ Rjk) - Rik) ** 2) + c[2] = np.sum(((Rij @ Rjk_J) - Rik) ** 2) + c[3] = np.sum(((Rij @ Rjk) - Rik_J) ** 2) - # Unpack scores to local formula vars - s_ij_jk, s_ik_jk, s_ij_ik = s + # Find best match + best_i = np.argmin(c) + best_val = c[best_i] + + # For each triangle side, find the best alternative + alt_ij_jk = c[self._ALTS[0][best_i][0]] + if c[self._ALTS[1][best_i][0]] < alt_ij_jk: + alt_ij_jk = c[self._ALTS[1][best_i][0]] + alt_ik_jk = c[self._ALTS[0][best_i][1]] + if c[self._ALTS[1][best_i][1]] < alt_ik_jk: + alt_ik_jk = c[self._ALTS[1][best_i][1]] + alt_ij_ik = c[self._ALTS[0][best_i][2]] + if c[self._ALTS[1][best_i][2]] < alt_ij_ik: + alt_ij_ik = c[self._ALTS[1][best_i][2]] + + # Compute scores + s_ij_jk = 1 - np.sqrt(best_val / alt_ij_jk) + s_ik_jk = 1 - np.sqrt(best_val / alt_ik_jk) + s_ij_ik = 1 - np.sqrt(best_val / alt_ij_ik) # Update probabilities # # Probability of pair ij having score given indicicative common line From 758df6bfb1a2dea71fc53fd42a286c49b7ec1b89 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 28 Aug 2024 08:04:05 -0400 Subject: [PATCH 248/433] black style --- src/aspire/abinitio/commonline_sync3n.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index e3b1c50edc..3c40eb3ac5 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -435,7 +435,8 @@ def _triangle_scores_inner_host(self, Rijs): # Find integer bin [0,self.hist_intervals) _l1, _l2, _l3 = np.minimum( (self.hist_intervals * s).astype(int), # implicit floor - self.hist_intervals-1) # clamp upper bound + self.hist_intervals - 1, + ) # clamp upper bound scores_hist[_l1] += 1 scores_hist[_l2] += 1 From 540b5b7ae3b4e8fff00797339f7733ecbf50e003 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 3 Sep 2024 10:26:04 -0400 Subject: [PATCH 249/433] fix fuzzy mask dtypes --- src/aspire/abinitio/commonline_base.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_base.py b/src/aspire/abinitio/commonline_base.py index e3d8fa50db..70909d1a42 100644 --- a/src/aspire/abinitio/commonline_base.py +++ b/src/aspire/abinitio/commonline_base.py @@ -91,8 +91,13 @@ def _prepare_pf(self): imgs = self.src.images[:] if self.mask: - fuzz_mask = fuzzy_mask((self.n_res, self.n_res), self.dtype) + # For best results and to reproduce MATLAB: + # Always compute mask (erf) in doubles. + fuzz_mask = fuzzy_mask((self.n_res, self.n_res), np.float64) + # Apply mask in doubles (allow imgs to upcast as needed) imgs = imgs * fuzz_mask + # Cast to desired type + imgs = Image(imgs.asnumpy().astype(self.dtype, copy=False)) # Obtain coefficients of polar Fourier transform for input 2D images pft = PolarFT( From 8b69fe7a6732614d90e7df967b27517a000fd8cb Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 3 Sep 2024 10:38:02 -0400 Subject: [PATCH 250/433] fix rise time --- src/aspire/abinitio/commonline_base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_base.py b/src/aspire/abinitio/commonline_base.py index 70909d1a42..3a7d57252d 100644 --- a/src/aspire/abinitio/commonline_base.py +++ b/src/aspire/abinitio/commonline_base.py @@ -4,6 +4,7 @@ import numpy as np import scipy.sparse as sparse +from aspire.image import Image from aspire.operators import PolarFT from aspire.utils import common_line_from_rots, fuzzy_mask, tqdm from aspire.utils.random import choice @@ -92,8 +93,9 @@ def _prepare_pf(self): if self.mask: # For best results and to reproduce MATLAB: + # Set risetime=2 # Always compute mask (erf) in doubles. - fuzz_mask = fuzzy_mask((self.n_res, self.n_res), np.float64) + fuzz_mask = fuzzy_mask((self.n_res, self.n_res), np.float64, risetime=2) # Apply mask in doubles (allow imgs to upcast as needed) imgs = imgs * fuzz_mask # Cast to desired type From 9dababa011a6e4d2db97e250a59bb93ed461b4e9 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 21 Aug 2024 09:12:45 -0400 Subject: [PATCH 251/433] update finufft and cufinufft to 2.3.0 --- pyproject.toml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c9c25a9976..51fc94dd8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,9 +31,7 @@ dependencies = [ "click", "confuse >= 2.0.0", "cvxpy", - # finufft 2.2.0 doesn't seemt to run on GHA Windows CI... - "finufft==2.2.0 ; sys_platform != 'win32'", - "finufft==2.1.0 ; sys_platform == 'win32'", + "finufft==2.3.0", "gemmi >= 0.6.5", "grpcio >= 1.54.2", "joblib", @@ -61,7 +59,7 @@ dependencies = [ "Source" = "https://github.com/ComputationalCryoEM/ASPIRE-Python" [project.optional-dependencies] -gpu-12x = ["cupy-cuda12x", "cufinufft==2.2.0"] +gpu-12x = ["cupy-cuda12x", "cufinufft==2.3.0"] dev = [ "black", "bumpversion", From 625f06e4c6425bf20d3336e52e5b48c71b783b2b Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 11 Sep 2024 17:37:24 -0400 Subject: [PATCH 252/433] revert a finufft dtype workaround --- src/aspire/volume/volume.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index 5e2212e958..0ed31b8b74 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -672,15 +672,9 @@ def load(cls, filename, permissive=True, dtype=None, symmetry_group=None): :return: Volume instance. """ with mrcfile.open(filename, permissive=permissive) as mrc: - loaded_data = mrc.data + loaded_data = mrc.data.copy() # Allow mutation pixel_size = Volume._vx_array_to_size(mrc.voxel_size) - # FINUFFT work around - if loaded_data.dtype == np.float32: - loaded_data = loaded_data.astype(np.float32) - elif loaded_data.dtype == np.float64: - loaded_data = loaded_data.astype(np.float64) - if loaded_data.dtype != dtype: logger.info(f"{filename} with dtype {loaded_data.dtype} loaded as {dtype}") From 0a8aa194db53ed4490840a8d4d0de7864f87716d Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 11 Sep 2024 17:39:22 -0400 Subject: [PATCH 253/433] remove the deepcopy finufft workaround --- src/aspire/source/image.py | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/src/aspire/source/image.py b/src/aspire/source/image.py index 4d256bd414..285b7163b5 100644 --- a/src/aspire/source/image.py +++ b/src/aspire/source/image.py @@ -2,7 +2,6 @@ import functools import logging import os.path -import types from abc import ABC, abstractmethod from collections import OrderedDict from collections.abc import Iterable @@ -213,40 +212,6 @@ def __init__( logger.info(f"Creating {self.__class__.__name__} with {len(self)} images.") - def __deepcopy__(self, memo): - """ - A custom __deepcopy__ implementation to individually handle special cases. - Mostly copied over from https://stackoverflow.com/a/71125311 - """ - # Get a reference to the bound deepcopy method - deepcopy_method = self.__deepcopy__ - # Temporarily disable __deepcopy__ to avoid infinite recursion - self.__deepcopy__ = None - # Create a deepcopy cp using the normal procedure - cp = copy.deepcopy(self, memo) - - # -------------------------------------- - # Handle any special cases for cp here. - # -------------------------------------- - # This is the whole reason this method exists. If this section is empty, - # then this entire __deepcopy__ implementation can be removed. - - # The 'dtype' attribute is a numpy module level singleton obtained by np.dtype(..) call - # The 'finufft' library currently compares this to the result of a new np.dtype(..) call - # by reference, not by value (as it should). A deepcopy will make a copy of the singleton, - # and thus comparison by reference will fail. Till this bug in 'finufft' is removed, we assign - # self.dtype to dtype - cp.dtype = self.dtype - - # -------------------------------------- - - # Reattach the bound deepcopy method - self.__deepcopy__ = deepcopy_method - # Get the unbounded function corresponding to the bound deepcopy method and rebind to cp - cp.__deepcopy__ = types.MethodType(deepcopy_method.__func__, cp) - - return cp - @property def symmetry_group(self): """ From 338f5129d7c354910651af80cf04a144369d9a8d Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 11 Sep 2024 14:45:46 -0400 Subject: [PATCH 254/433] begin looking at removing pyshtools --- src/aspire/basis/basis_utils.py | 50 +++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/src/aspire/basis/basis_utils.py b/src/aspire/basis/basis_utils.py index fe599e9fdc..3813c038ba 100644 --- a/src/aspire/basis/basis_utils.py +++ b/src/aspire/basis/basis_utils.py @@ -9,8 +9,7 @@ import numpy as np from numpy import diff, exp, log, pi from numpy.polynomial.legendre import leggauss -from pyshtools.expand import spharm_lm -from scipy.special import jn, jv, sph_harm +from scipy.special import jn, jv, sph_harm, factorial from aspire.utils import grid_2d, grid_3d @@ -157,6 +156,31 @@ def norm_assoc_legendre(j, m, x): return px +def _sph_harm(m, j, theta, phi): + """ + Compute spherical harmonics. + + :param m: Order |m| <= j + :param j: Harmonic degree, j>=0 + :param theta: longitude coordinate [0, 2*pi] + :param phi: latitude coordinate [0, pi] + """ + + if m < 0: + return (-1)**(m%2)*np.conj(_sph_harm(-m, j, phi, theta)) + + from scipy.special import lpmv + y = np.sqrt( ((2*j+1)/(4*np.pi)) * factorial(j-m)/factorial(j+m)) * lpmv(m, j, np.cos(phi)) * np.exp(1j*m*theta) # OKAY + # _y = norm_assoc_legendre(j, m, np.cos(phi)) * np.exp(1j*m*theta) / np.sqrt( ((2*j+1)/(4*np.pi)) * factorial(j-m)/factorial(j+m)) # not the right factor? + + # # also not the right factor + # k=2 + # if m == 0: + # k =1 + # _y = norm_assoc_legendre(j, m, np.cos(phi)) * np.exp(1j*m*theta) / np.sqrt( k*(2*j+1) * factorial(j-m)/factorial(j+m)) + + + return y def real_sph_harmonic(j, m, theta, phi): """ @@ -174,27 +198,11 @@ def real_sph_harmonic(j, m, theta, phi): # The `scipy` sph_harm implementation is much faster, # but incorrectly returns NaN for high orders. - # For higher order use `pyshtools`. - if j < 86: - y = sph_harm(abs_m, j, phi, theta) - else: - warnings.warn( - "Computing higher order spherical harmonics is slow." - " Consider using `FFBBasis3D` or decreasing volume size.", - stacklevel=1, - ) + y = _sph_harm(abs_m, j, phi, theta) + #y = sph_harm(abs_m, j, phi, theta) # scipy - y = spharm_lm( - j, - abs_m, - theta, - phi, - kind="complex", - degrees=False, - csphase=-1, - normalization="ortho", - ) + if m < 0: y = np.sqrt(2) * np.imag(y) elif m > 0: From 01ae621719b9ba0974df1743017589e153defb5e Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 11 Sep 2024 14:46:59 -0400 Subject: [PATCH 255/433] purge shtools --- .github/workflows/workflow.yml | 1 - environment-accelerate.yml | 1 - pyproject.toml | 1 - 3 files changed, 3 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index c41b221ec4..b2263a460b 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -244,7 +244,6 @@ jobs: run: | conda info conda list - conda install pyshtools # debug depends issues pip install -e ".[dev]" # install aspire pip freeze - name: Test diff --git a/environment-accelerate.yml b/environment-accelerate.yml index 38dd49813d..cfe9631f3c 100644 --- a/environment-accelerate.yml +++ b/environment-accelerate.yml @@ -7,7 +7,6 @@ channels: dependencies: - pip - python=3.8 - - pyshtools - numpy=1.24.1 - scipy=1.10.1 - scikit-learn diff --git a/pyproject.toml b/pyproject.toml index 51fc94dd8f..7dff9dddaf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,6 @@ dependencies = [ "pillow", "psutil", "pymanopt", - "pyshtools<=4.10.4", # 4.11.7 might have a packaging bug "PyWavelets", "ray >= 2.9.2", "scipy >= 1.10.0", From 650241eb4a86ac04b66ab53c805b6525bf84d975 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 11 Sep 2024 20:45:51 -0400 Subject: [PATCH 256/433] tox --- src/aspire/basis/basis_utils.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/aspire/basis/basis_utils.py b/src/aspire/basis/basis_utils.py index 3813c038ba..02297ab814 100644 --- a/src/aspire/basis/basis_utils.py +++ b/src/aspire/basis/basis_utils.py @@ -4,12 +4,11 @@ """ import logging -import warnings import numpy as np from numpy import diff, exp, log, pi from numpy.polynomial.legendre import leggauss -from scipy.special import jn, jv, sph_harm, factorial +from scipy.special import factorial, jn, jv from aspire.utils import grid_2d, grid_3d @@ -156,6 +155,7 @@ def norm_assoc_legendre(j, m, x): return px + def _sph_harm(m, j, theta, phi): """ Compute spherical harmonics. @@ -167,10 +167,15 @@ def _sph_harm(m, j, theta, phi): """ if m < 0: - return (-1)**(m%2)*np.conj(_sph_harm(-m, j, phi, theta)) + return (-1) ** (m % 2) * np.conj(_sph_harm(-m, j, phi, theta)) + + from scipy.special import lpmv - from scipy.special import lpmv - y = np.sqrt( ((2*j+1)/(4*np.pi)) * factorial(j-m)/factorial(j+m)) * lpmv(m, j, np.cos(phi)) * np.exp(1j*m*theta) # OKAY + y = ( + np.sqrt(((2 * j + 1) / (4 * np.pi)) * factorial(j - m) / factorial(j + m)) + * lpmv(m, j, np.cos(phi)) + * np.exp(1j * m * theta) + ) # OKAY # _y = norm_assoc_legendre(j, m, np.cos(phi)) * np.exp(1j*m*theta) / np.sqrt( ((2*j+1)/(4*np.pi)) * factorial(j-m)/factorial(j+m)) # not the right factor? # # also not the right factor @@ -179,9 +184,9 @@ def _sph_harm(m, j, theta, phi): # k =1 # _y = norm_assoc_legendre(j, m, np.cos(phi)) * np.exp(1j*m*theta) / np.sqrt( k*(2*j+1) * factorial(j-m)/factorial(j+m)) - return y + def real_sph_harmonic(j, m, theta, phi): """ Evaluate a real spherical harmonic @@ -199,10 +204,9 @@ def real_sph_harmonic(j, m, theta, phi): # The `scipy` sph_harm implementation is much faster, # but incorrectly returns NaN for high orders. y = _sph_harm(abs_m, j, phi, theta) - #y = sph_harm(abs_m, j, phi, theta) # scipy - + # from scipy.special import sph_harm + # y = sph_harm(abs_m, j, phi, theta) # scipy - if m < 0: y = np.sqrt(2) * np.imag(y) elif m > 0: From bfc3b4319cdb53b54d9ff76f6248ed665965a6b7 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 12 Sep 2024 09:01:44 -0400 Subject: [PATCH 257/433] implement sph_harm using recurance form of norm assoc legendre --- src/aspire/basis/basis_utils.py | 43 +++++++++++++----------------- tests/test_basis_utils.py | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 25 deletions(-) diff --git a/src/aspire/basis/basis_utils.py b/src/aspire/basis/basis_utils.py index 02297ab814..e629d4d456 100644 --- a/src/aspire/basis/basis_utils.py +++ b/src/aspire/basis/basis_utils.py @@ -8,7 +8,7 @@ import numpy as np from numpy import diff, exp, log, pi from numpy.polynomial.legendre import leggauss -from scipy.special import factorial, jn, jv +from scipy.special import jn, jv from aspire.utils import grid_2d, grid_3d @@ -156,33 +156,29 @@ def norm_assoc_legendre(j, m, x): return px -def _sph_harm(m, j, theta, phi): +def sph_harm(j, m, theta, phi): """ Compute spherical harmonics. + Note call signature convention may be different from other packages. + :param m: Order |m| <= j :param j: Harmonic degree, j>=0 - :param theta: longitude coordinate [0, 2*pi] - :param phi: latitude coordinate [0, pi] + :param theta: latitude coordinate [0, pi] + :param phi: longitude coordinate [0, 2*pi] + :return: Complex array of evaluated spherical harmonics. """ - if m < 0: - return (-1) ** (m % 2) * np.conj(_sph_harm(-m, j, phi, theta)) - - from scipy.special import lpmv - + # Compute sph_harm for positive `abs(m)` y = ( - np.sqrt(((2 * j + 1) / (4 * np.pi)) * factorial(j - m) / factorial(j + m)) - * lpmv(m, j, np.cos(phi)) - * np.exp(1j * m * theta) - ) # OKAY - # _y = norm_assoc_legendre(j, m, np.cos(phi)) * np.exp(1j*m*theta) / np.sqrt( ((2*j+1)/(4*np.pi)) * factorial(j-m)/factorial(j+m)) # not the right factor? - - # # also not the right factor - # k=2 - # if m == 0: - # k =1 - # _y = norm_assoc_legendre(j, m, np.cos(phi)) * np.exp(1j*m*theta) / np.sqrt( k*(2*j+1) * factorial(j-m)/factorial(j+m)) + norm_assoc_legendre(j, abs(m), np.cos(theta)) + * np.exp(1j * abs(m) * phi) + * np.sqrt(0.5 / np.pi) + ) + + # Use identity for negative `m` + if m < 0: + (-1) ** (m % 2) * np.conj(y) return y @@ -201,11 +197,8 @@ def real_sph_harmonic(j, m, theta, phi): """ abs_m = abs(m) - # The `scipy` sph_harm implementation is much faster, - # but incorrectly returns NaN for high orders. - y = _sph_harm(abs_m, j, phi, theta) - # from scipy.special import sph_harm - # y = sph_harm(abs_m, j, phi, theta) # scipy + # Note the calling convention here may not match other `sph_harm` packages + y = sph_harm(j, abs_m, theta, phi) if m < 0: y = np.sqrt(2) * np.imag(y) diff --git a/tests/test_basis_utils.py b/tests/test_basis_utils.py index 2d6a3efdb2..6f475f89fe 100644 --- a/tests/test_basis_utils.py +++ b/tests/test_basis_utils.py @@ -1,6 +1,7 @@ from unittest import TestCase import numpy as np +from scipy.special import sph_harm as sp_sph_harm from aspire.basis.basis_utils import ( all_besselj_zeros, @@ -9,10 +10,55 @@ norm_assoc_legendre, real_sph_harmonic, sph_bessel, + sph_harm, unique_coords_nd, ) +def test_sph_harm_low_order(): + """ + Test the `sph_harm` implementation matches `scipy` at lower orders. + """ + m = 3 + j = 5 + x = np.linspace(0, np.pi, 42) + y = np.linspace(0, 2 * np.pi, 42) + + ref = sp_sph_harm(m, j, y, x) # Note calling convention is different + np.testing.assert_allclose(sph_harm(j, m, x, y), ref) + + +def test_sph_harm_high_order(): + """ + Test we remain finite at higher orders where `scipy.special.sph_harm` overflows. + """ + m = 87 + j = 87 + x = 0.12345 + y = 0.56789 + + # If scipy fixed their implementation for higher orders in the future, + # this check will we may wish to take it. + ref = sp_sph_harm(m, j, y, x) # Note calling convention is different + assert not np.isfinite(ref) + + # Can manually check against pyshtools, + # but we are avoiding that package dependency. + # y = spharm_lm( + # j, + # abs_m, + # theta, + # phi, + # kind="complex", + # degrees=False, + # csphase=-1, + # normalization="ortho", + # ) + + # Check we are finite. + assert np.isfinite(sph_harm(j, m, x, y)) + + class BesselTestCase(TestCase): def setUp(self): pass From f03ed8be39ba07717943b8690ef20d3a51aacac3 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 12 Sep 2024 09:41:36 -0400 Subject: [PATCH 258/433] self review cleanup --- tests/test_basis_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_basis_utils.py b/tests/test_basis_utils.py index 6f475f89fe..e0693fce7a 100644 --- a/tests/test_basis_utils.py +++ b/tests/test_basis_utils.py @@ -38,12 +38,13 @@ def test_sph_harm_high_order(): y = 0.56789 # If scipy fixed their implementation for higher orders in the future, - # this check will we may wish to take it. + # this check should fail and we can reconsider that package. ref = sp_sph_harm(m, j, y, x) # Note calling convention is different assert not np.isfinite(ref) # Can manually check against pyshtools, # but we are avoiding that package dependency. + # Leaving this here intentionally for future developers. # y = spharm_lm( # j, # abs_m, From 46363581add8454ed607ede8f9013eab1d445546 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 12 Sep 2024 10:27:39 -0400 Subject: [PATCH 259/433] Fixup -m sph_harm case and add test. --- src/aspire/basis/basis_utils.py | 2 +- tests/test_basis_utils.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/aspire/basis/basis_utils.py b/src/aspire/basis/basis_utils.py index e629d4d456..c32e73fbf3 100644 --- a/src/aspire/basis/basis_utils.py +++ b/src/aspire/basis/basis_utils.py @@ -178,7 +178,7 @@ def sph_harm(j, m, theta, phi): # Use identity for negative `m` if m < 0: - (-1) ** (m % 2) * np.conj(y) + y = (-1) ** (m % 2) * np.conj(y) return y diff --git a/tests/test_basis_utils.py b/tests/test_basis_utils.py index e0693fce7a..2e416a5dee 100644 --- a/tests/test_basis_utils.py +++ b/tests/test_basis_utils.py @@ -27,6 +27,11 @@ def test_sph_harm_low_order(): ref = sp_sph_harm(m, j, y, x) # Note calling convention is different np.testing.assert_allclose(sph_harm(j, m, x, y), ref) + # negative m + m *= -1 + ref = sp_sph_harm(m, j, y, x) # Note calling convention is different + np.testing.assert_allclose(sph_harm(j, m, x, y), ref) + def test_sph_harm_high_order(): """ From 33268507bf12776ad7dc1bdd92c659d9ef401ff8 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 29 Aug 2024 11:01:44 -0400 Subject: [PATCH 260/433] remove scikit radon warning by adjusting radial mask for test image to r < .99 --- tests/test_sinogram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index bbf448db97..7a1f32a0e0 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -113,7 +113,7 @@ def test_project_multidim(num_ang): # Generate a mask g = grid_2d(L, normalized=True, shifted=True) - mask = g["r"] < 1 + mask = g["r"] < .99 # Generate images imgs = Image(np.random.random((m, n, L, L))) * mask From 82431eef0e52fbc4359bbf10ea6ae7eb15ecefef Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 29 Aug 2024 11:36:22 -0400 Subject: [PATCH 261/433] tox --- tests/test_sinogram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_sinogram.py b/tests/test_sinogram.py index 7a1f32a0e0..dc173449b9 100644 --- a/tests/test_sinogram.py +++ b/tests/test_sinogram.py @@ -113,7 +113,7 @@ def test_project_multidim(num_ang): # Generate a mask g = grid_2d(L, normalized=True, shifted=True) - mask = g["r"] < .99 + mask = g["r"] < 0.99 # Generate images imgs = Image(np.random.random((m, n, L, L))) * mask From e9e7ca3e2d14f438032f9de5d89c977542671918 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 29 Aug 2024 15:11:46 -0400 Subject: [PATCH 262/433] resolve scipy cg warning by adjusting version in wrapper to 1.12.0 --- src/aspire/numeric/scipy.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/aspire/numeric/scipy.py b/src/aspire/numeric/scipy.py index 8f2e7d86d8..c913e917a3 100644 --- a/src/aspire/numeric/scipy.py +++ b/src/aspire/numeric/scipy.py @@ -8,10 +8,11 @@ def cg(*args, **kwargs): """ - Supports scipy cg before and after 1.14.0. + Supports scipy cg before and after 1.12.0. """ - # older scipy cg interface uses `tol` instead of `rtol` - if Version(scipy.__version__) < Version("1.14.0"): + # older (<1.12.0) scipy cg interface uses `tol` instead of `rtol`. + # `tol` will be removed in scipy 1.14.0. + if Version(scipy.__version__) < Version("1.12.0"): kwargs["tol"] = kwargs.pop("rtol", None) return scipy.sparse.linalg.cg(*args, **kwargs) From 4b37a23f590cb3f7360bc5f4cdffaa35e6014c09 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 29 Aug 2024 15:23:30 -0400 Subject: [PATCH 263/433] Resolve Matplotlib warning by explicilty closing plots in testing. --- tests/test_simulation.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_simulation.py b/tests/test_simulation.py index 92a29e225e..c90caa5bdd 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -3,6 +3,7 @@ import tempfile from unittest import TestCase +import matplotlib.pyplot as plt import numpy as np from pytest import raises @@ -38,14 +39,23 @@ def testPixelSize(self): def testImageShow(self): self.sim.images[:].show() + # Explicitly close all figures before making backend changes. + plt.close("all") + @matplotlib_dry_run def testCleanImagesShow(self): self.sim.clean_images[:].show() + # Explicitly close all figures before making backend changes. + plt.close("all") + @matplotlib_dry_run def testProjectionsShow(self): self.sim.projections[:].show() + # Explicitly close all figures before making backend changes. + plt.close("all") + class SimVolTestCase(TestCase): """Test Simulation with Volume provided.""" From 2f8b61026cbda1b68085553d9275a9b03d8c62c4 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 3 Sep 2024 10:11:49 -0400 Subject: [PATCH 264/433] explicitly close figures in matplotlib test wrapper. --- tests/test_utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index ffad5bc9f6..c7617d28a8 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -399,6 +399,9 @@ def matplotlib_no_gui(): yield + # Explicitly close all figures before making backend changes. + matplotlib.pyplot.close("all") + # Restore backend matplotlib.use(backend) From cbe52321272b913943364b56b61b214c7d0b84a1 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 3 Sep 2024 11:10:12 -0400 Subject: [PATCH 265/433] Resolve FRC legend warning by adding default label for single correlation. --- src/aspire/utils/resolution_estimation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/utils/resolution_estimation.py b/src/aspire/utils/resolution_estimation.py index 14c142bdc5..2baefe4491 100644 --- a/src/aspire/utils/resolution_estimation.py +++ b/src/aspire/utils/resolution_estimation.py @@ -354,7 +354,7 @@ def plot(self, cutoff=None, save_to_file=False, labels=None): plt.ylabel("Correlation") plt.ylim([0, 1.1]) for i, line in enumerate(self.correlations): - _label = None + _label = "correlation" if len(self.correlations) > 1: _label = f"{i}" if labels is not None: From 326ada02916f6b2dd7c4395643e43e81796641c2 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 3 Sep 2024 11:16:35 -0400 Subject: [PATCH 266/433] resolve numpy.product warning --- src/aspire/sinogram/sinogram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/sinogram/sinogram.py b/src/aspire/sinogram/sinogram.py index 34451a396d..7c7bb43662 100644 --- a/src/aspire/sinogram/sinogram.py +++ b/src/aspire/sinogram/sinogram.py @@ -42,7 +42,7 @@ def __init__(self, data, dtype=None): self.shape = self._data.shape self.stack_shape = self._data.shape[:-2] self.stack_n_dim = self._data.ndim - 2 - self.n = np.product(self.stack_shape) + self.n = np.prod(self.stack_shape) self.n_angles = self._data.shape[-2] self.n_radial_points = self._data.shape[-1] From 007fcefe5bb5512c416f02316a69442876de8a0d Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 3 Sep 2024 14:19:03 -0400 Subject: [PATCH 267/433] resolve Conversion of an array wit h ndim > 0 to a scalar is deprecated, by returning scalar for single value returns --- src/aspire/abinitio/commonline_c3_c4.py | 8 +++++++- src/aspire/utils/rotation.py | 4 ++++ tests/test_rotation.py | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_c3_c4.py b/src/aspire/abinitio/commonline_c3_c4.py index 68469618dd..0e0ca76565 100644 --- a/src/aspire/abinitio/commonline_c3_c4.py +++ b/src/aspire/abinitio/commonline_c3_c4.py @@ -850,7 +850,13 @@ def cl_angles_to_ind(cl_angles, n_theta): thetas = np.mod(thetas, 2 * np.pi) # linear scale from [0,2*pi) to [0,n_theta). - return np.mod(np.round(thetas / (2 * np.pi) * n_theta), n_theta).astype(int) + ind = np.mod(np.round(thetas / (2 * np.pi) * n_theta), n_theta).astype(int) + + # Return scalar for single value. + if ind.size == 1: + ind = ind.flat[0] + + return ind @staticmethod def g_sync(rots, order, rots_gt): diff --git a/src/aspire/utils/rotation.py b/src/aspire/utils/rotation.py index 08bec4ca3d..dc713a74ad 100644 --- a/src/aspire/utils/rotation.py +++ b/src/aspire/utils/rotation.py @@ -408,6 +408,10 @@ def angle_dist(r1, r2, dtype=None): theta = (tr_r[non_zero_dist_ind] - 1) / 2 theta = np.maximum(np.minimum(theta, 1), -1) # Clamp theta in [-1,1] dist[non_zero_dist_ind] = np.arccos(theta, dtype=dtype) + + # If we only have one value, return as a scalar. + if dist.size == 1: + dist = dist.flat[0] return dist @staticmethod diff --git a/tests/test_rotation.py b/tests/test_rotation.py index 9e0dba4ec6..e02e650bd5 100644 --- a/tests/test_rotation.py +++ b/tests/test_rotation.py @@ -173,6 +173,9 @@ def test_angle_dist(dtype): with pytest.raises(ValueError, match=r"r1 and r2 are not broadcastable*"): _ = Rotation.angle_dist(rots[:3], rots[:5]) + # Test that single value returns as 0-dim. + assert Rotation.angle_dist(rots[0], rots[1], dtype).ndim == 0 + def test_mean_angular_distance(dtype): rots_z = Rotation.about_axis("z", [0, np.pi / 4, np.pi / 2], dtype=dtype).matrices From 102f2872d1656025ba6a5eebb5dadd91bdb359d9 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 3 Sep 2024 16:07:00 -0400 Subject: [PATCH 268/433] Resolve expected BlkDiagMatrix truncation warning. --- tests/test_covar2d_denoiser.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/test_covar2d_denoiser.py b/tests/test_covar2d_denoiser.py index 7b4da5511e..c9b749335b 100644 --- a/tests/test_covar2d_denoiser.py +++ b/tests/test_covar2d_denoiser.py @@ -22,8 +22,21 @@ pytest.param(FBBasis2D, marks=pytest.mark.expensive), FFBBasis2D, FLEBasis2D, - pytest.param(PSWFBasis2D, marks=pytest.mark.expensive), - FPSWFBasis2D, + pytest.param( + PSWFBasis2D, + marks=[ + pytest.mark.expensive, + pytest.mark.filterwarnings( + "ignore:BlkDiagMatrix.from_dense truncating values*" + ), + ], + ), + pytest.param( + FPSWFBasis2D, + marks=pytest.mark.filterwarnings( + "ignore:BlkDiagMatrix.from_dense truncating values*" + ), + ), ] From d209161c80ee51e1719270f55822ab3b4976d50c Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 4 Sep 2024 10:04:26 -0400 Subject: [PATCH 269/433] Resolve test_micrograph_source warnings by using zeros instead of empty for test images. --- tests/test_micrograph_source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_micrograph_source.py b/tests/test_micrograph_source.py index 06c5874a07..d4793cf61f 100644 --- a/tests/test_micrograph_source.py +++ b/tests/test_micrograph_source.py @@ -285,7 +285,7 @@ def test_rectangular_micrograph_source_files(): """ # Test inconsistent mrc files - imgs = [np.empty((7, 7)), np.empty((8, 8))] + imgs = [np.zeros((7, 7)), np.zeros((8, 8))] with tempfile.TemporaryDirectory() as tmp_output_dir: # Save the files for i, img in enumerate(imgs): From 00158f4484b33ad7950977995e004ef504b6449a Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 9 Sep 2024 11:04:28 -0400 Subject: [PATCH 270/433] Resolve test_image.py warning. Remove Ray xfail and use context to check caplog. --- tests/test_image.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_image.py b/tests/test_image.py index 887e726c0d..ec7bb42e0e 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -353,14 +353,11 @@ def test_asnumpy_readonly(): vw[0, 0, 0] = 123 -@pytest.mark.xfail(reason="Ray logging issue ray#37711", strict=False) def test_corrupt_mrc_load(caplog): """ Test that corrupt mrc files are logged as expected. """ - caplog.set_level(logging.WARNING) - # Create a tmp dir for this test output with tempfile.TemporaryDirectory() as tmpdir_name: # tmp filename @@ -374,13 +371,16 @@ def test_corrupt_mrc_load(caplog): fh.header.map = -1 # Check that we get a WARNING - _ = Image.load(mrc_path) + with caplog.at_level(logging.WARNING): + _ = Image.load(mrc_path) + + # Check the message prefix + assert f"Image.load of {mrc_path} reporting 1 corruptions" in caplog.text - # Check the message prefix - assert f"Image.load of {mrc_path} reporting 1 corruptions" in caplog.text + # Check the message contains the file path + assert mrc_path in caplog.text - # Check the message contains the file path - assert mrc_path in caplog.text + caplog.clear() def test_load_bad_ext(): From f7b8c88c0ebd65b47f76e74c3ce0aca1c06b2941 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 9 Sep 2024 11:42:17 -0400 Subject: [PATCH 271/433] resolve test_FLEbasis2D.py warnings. --- tests/test_FLEbasis2D.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_FLEbasis2D.py b/tests/test_FLEbasis2D.py index ffb1f8f7d1..e60346f84b 100644 --- a/tests/test_FLEbasis2D.py +++ b/tests/test_FLEbasis2D.py @@ -232,7 +232,7 @@ def testRadialConvolution(): # (e.g. CTF) function via FLE coefficients L = 32 - basis = FLEBasis2D(L, match_fb=False) + basis = FLEBasis2D(L, match_fb=False, dtype=np.float64) # load test radial function x = np.load(os.path.join(DATA_DIR, "fle_radial_fn_32x32.npy")).reshape(1, 32, 32) x = x / np.max(np.abs(x.flatten())) @@ -245,7 +245,7 @@ def testRadialConvolution(): imgs_convolved_fle = basis.evaluate(coefs_convolved).asnumpy() # convolve using FFT - x = basis.evaluate(basis.evaluate_t(x)).asnumpy() + x = basis.evaluate(basis.evaluate_t(Image(x))).asnumpy() ims = basis.evaluate(coefs).asnumpy() imgs_convolved_slow = np.zeros((10, L, L)) From a3fc7a0577f13e9e5e4993d015aedcbc9e6c3dfb Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 9 Sep 2024 12:09:49 -0400 Subject: [PATCH 272/433] resolve numpy multiply overflow warning by using ones for test image instead of np.empty. --- tests/test_image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_image.py b/tests/test_image.py index ec7bb42e0e..89fbde4a84 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -364,7 +364,7 @@ def test_corrupt_mrc_load(caplog): mrc_path = os.path.join(tmpdir_name, "bad.mrc") # Create and save image - Image(np.empty((1, 8, 8), dtype=np.float32)).save(mrc_path) + Image(np.ones((1, 8, 8), dtype=np.float32)).save(mrc_path) # Open mrc file and soft corrupt it with mrcfile.open(mrc_path, "r+") as fh: From 1500e96d22352f42227581d772a9e21e858df544 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 9 Sep 2024 15:09:38 -0400 Subject: [PATCH 273/433] resolve test_diag_matrix.py invalid cast value warning, by replacing empty's with ones. --- tests/test_diag_matrix.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/test_diag_matrix.py b/tests/test_diag_matrix.py index ecce899105..05805912c9 100644 --- a/tests/test_diag_matrix.py +++ b/tests/test_diag_matrix.py @@ -77,7 +77,7 @@ def test_repr(): Test accessing the `repr` does not crash. """ - d = DiagMatrix(np.empty((10, 8))) + d = DiagMatrix(np.ones((10, 8))) assert repr(d).startswith("DiagMatrix(") @@ -86,7 +86,7 @@ def test_str(): Test accessing the `str` does not crash. """ - d = DiagMatrix(np.empty((10, 8))) + d = DiagMatrix(np.ones((10, 8))) assert str(d).startswith("DiagMatrix(") @@ -104,13 +104,13 @@ def test_len(): """ Test the `len`. """ - d = DiagMatrix(np.empty((10, 8))) + d = DiagMatrix(np.ones((10, 8))) assert d.size == 10 assert d.count == 8 assert len(d) == 10 - d = DiagMatrix(np.empty((2, 5, 8))) + d = DiagMatrix(np.ones((2, 5, 8))) assert d.size == 10 assert d.count == 8 @@ -121,8 +121,8 @@ def test_size_mismatch(): """ Test we raise operating on `DiagMatrix` having different counts. """ - d1 = DiagMatrix(np.empty((10, 8))) - d2 = DiagMatrix(np.empty((10, 7))) + d1 = DiagMatrix(np.ones((10, 8))) + d2 = DiagMatrix(np.ones((10, 7))) with pytest.raises(RuntimeError, match=r".*not same dimension.*"): _ = d1 + d2 @@ -132,8 +132,8 @@ def test_dtype_mismatch(): """ Test we raise operating on `DiagMatrix` having different dtypes. """ - d1 = DiagMatrix(np.empty((10, 8)), dtype=np.float32) - d2 = DiagMatrix(np.empty((10, 8)), dtype=np.float64) + d1 = DiagMatrix(np.ones((10, 8)), dtype=np.float32) + d2 = DiagMatrix(np.ones((10, 8)), dtype=np.float64) with pytest.raises(RuntimeError, match=r".*received different types.*"): _ = d1 + d2 @@ -144,7 +144,7 @@ def test_dtype_passthrough(): Test that the datatype is inferred correctly. """ for dtype in (int, np.float32, np.float64, np.complex64, np.complex128): - d_np = np.empty(42, dtype=dtype) + d_np = np.ones(42, dtype=dtype) d = DiagMatrix(d_np) assert d.dtype == dtype @@ -154,7 +154,7 @@ def test_dtype_cast(): Test that a datatype is cast when overridden. """ for dtype in (int, np.float32, np.float64, np.complex64, np.complex128): - d_np = np.empty(42, dtype=np.float16) + d_np = np.ones(42, dtype=np.float16) d = DiagMatrix(d_np, dtype) assert d.dtype == dtype @@ -444,7 +444,7 @@ def test_diag_badtype_matmul(): """ Test matrix multiply of `DiagMatrix` with incompatible type raises. """ - d1 = DiagMatrix(np.empty(8)) + d1 = DiagMatrix(np.ones(8)) # matmul with pytest.raises(RuntimeError, match=r".*not implemented for.*"): @@ -576,7 +576,7 @@ def test_bad_as_blk_diag(matrix_size, blk_diag): """ with pytest.raises(RuntimeError, match=r".*only implemented for singletons.*"): # Construct via Numpy. - d_np = np.empty((2, matrix_size), dtype=blk_diag.dtype) + d_np = np.ones((2, matrix_size), dtype=blk_diag.dtype) # Create DiagMatrix then convert to BlkDiagMatrix d = DiagMatrix(d_np) @@ -654,7 +654,7 @@ def test_diag_blk_mul(): """ Test mixing `BlkDiagMatrix` with `DiagMatrix` element-wise multiplication raises. """ - d = DiagMatrix(np.empty(8)) + d = DiagMatrix(np.ones(8)) partition = [(4, 4), (4, 4)] b = BlkDiagMatrix.ones(partition, dtype=d.dtype) @@ -672,7 +672,7 @@ def test_non_square_as_blk_diag(): """ Test non square partition blocks raise an error in as_blk_diag. """ - d = DiagMatrix(np.empty(8)) + d = DiagMatrix(np.ones(8)) partition = [(4, 5), (4, 3)] with pytest.raises(RuntimeError, match=r".*not square.*"): @@ -683,8 +683,8 @@ def test_bad_broadcast(): """ Test incompatible stack shapes raise appropriate error. """ - d1 = DiagMatrix(np.empty((2, 3, 8))) - d2 = DiagMatrix(np.empty((2, 2, 8))) + d1 = DiagMatrix(np.ones((2, 3, 8))) + d2 = DiagMatrix(np.ones((2, 2, 8))) with pytest.raises(ValueError, match=r".*incompatible shapes.*"): _ = d1 + d2 From 0719bec256c8960256324d0c278e1311d7b98aa1 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 10 Sep 2024 09:21:06 -0400 Subject: [PATCH 274/433] catch np.exp overflow warnings --- src/aspire/abinitio/commonline_sync3n.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 3c40eb3ac5..6efb429818 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -1,5 +1,6 @@ import logging import os.path +import warnings import numpy as np from numpy.linalg import norm @@ -727,7 +728,13 @@ def fun(x, B, P, b, x0, A=A, a=a): # Calculate probabilities ln_f_ind, ln_f_arb = self._pairs_probabilities(Rijs, P**2, A, a, B, b, x0) - Pij = 1 / (1 + (1 - P) / P * np.exp(ln_f_arb - ln_f_ind)) + + with warnings.catch_warnings(): + # For large values of (ln_f_arb - ln_f_ind), numpy exponential will overflow. We still + # get the intended result of Pij = 0, so we capture and ignore the overflow warning. + warnings.filterwarnings("ignore", r".*overflow encountered in exp.*") + + Pij = 1 / (1 + (1 - P) / P * np.exp(ln_f_arb - ln_f_ind)) # Fix singular output num_nan = np.sum(np.isnan(Pij)) From 0fe37cecd4b563249088b62d01513327353ce8c4 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 10 Sep 2024 10:21:43 -0400 Subject: [PATCH 275/433] Add comments explaining changes. --- src/aspire/utils/resolution_estimation.py | 1 + src/aspire/utils/rotation.py | 2 +- tests/test_FLEbasis2D.py | 5 +++-- tests/test_covar2d_denoiser.py | 3 +++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/aspire/utils/resolution_estimation.py b/src/aspire/utils/resolution_estimation.py index 2baefe4491..af5a46f8a9 100644 --- a/src/aspire/utils/resolution_estimation.py +++ b/src/aspire/utils/resolution_estimation.py @@ -354,6 +354,7 @@ def plot(self, cutoff=None, save_to_file=False, labels=None): plt.ylabel("Correlation") plt.ylim([0, 1.1]) for i, line in enumerate(self.correlations): + # Set default label for single correlation (required by plt.legend() below). _label = "correlation" if len(self.correlations) > 1: _label = f"{i}" diff --git a/src/aspire/utils/rotation.py b/src/aspire/utils/rotation.py index dc713a74ad..07a31df9df 100644 --- a/src/aspire/utils/rotation.py +++ b/src/aspire/utils/rotation.py @@ -409,7 +409,7 @@ def angle_dist(r1, r2, dtype=None): theta = np.maximum(np.minimum(theta, 1), -1) # Clamp theta in [-1,1] dist[non_zero_dist_ind] = np.arccos(theta, dtype=dtype) - # If we only have one value, return as a scalar. + # Return scalar for single value. if dist.size == 1: dist = dist.flat[0] return dist diff --git a/tests/test_FLEbasis2D.py b/tests/test_FLEbasis2D.py index e60346f84b..0873d61bab 100644 --- a/tests/test_FLEbasis2D.py +++ b/tests/test_FLEbasis2D.py @@ -230,16 +230,17 @@ def testLowPass(): def testRadialConvolution(): # test ability to accurately convolve with a radial # (e.g. CTF) function via FLE coefficients - L = 32 - basis = FLEBasis2D(L, match_fb=False, dtype=np.float64) + # load test radial function x = np.load(os.path.join(DATA_DIR, "fle_radial_fn_32x32.npy")).reshape(1, 32, 32) x = x / np.max(np.abs(x.flatten())) # get sample images ims = create_images(L, 10) + # convolve using coefficients + basis = FLEBasis2D(L, match_fb=False, dtype=ims.dtype) coefs = basis.evaluate_t(ims) coefs_convolved = basis.radial_convolve(coefs, x) imgs_convolved_fle = basis.evaluate(coefs_convolved).asnumpy() diff --git a/tests/test_covar2d_denoiser.py b/tests/test_covar2d_denoiser.py index c9b749335b..ea5410fb34 100644 --- a/tests/test_covar2d_denoiser.py +++ b/tests/test_covar2d_denoiser.py @@ -18,6 +18,9 @@ RadialCTFFilter(5, 200, defocus=d, Cs=2.0, alpha=0.1) for d in np.linspace(1.5e4, 2.5e4, 7) ] + +# For (F)PSWFBasis2D we get off-block entries which are truncated +# when converting to block-diagonal. We filter these warnings. BASIS = [ pytest.param(FBBasis2D, marks=pytest.mark.expensive), FFBBasis2D, From 0df540a17b66d8d321aa21c0906eefff8b63656b Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 10 Sep 2024 13:55:48 -0400 Subject: [PATCH 276/433] Add pytest --strict-warnings to CI workflows. --- .github/workflows/long_workflow.yml | 2 +- .github/workflows/workflow.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/long_workflow.yml b/.github/workflows/long_workflow.yml index ec5714a29e..d483ac5912 100644 --- a/.github/workflows/long_workflow.yml +++ b/.github/workflows/long_workflow.yml @@ -36,6 +36,6 @@ jobs: export OMP_NUM_THREADS=1 ASPIREDIR=${{ env.WORK_DIR }} python -c \ "import aspire; print(aspire.config['ray']['temp_dir'])" - ASPIREDIR=${{ env.WORK_DIR }} python -m pytest -n8 -m "expensive" --durations=0 + ASPIREDIR=${{ env.WORK_DIR }} python -m pytest -n8 -m "expensive" --durations=0 --strict-warnings - name: Cleanup run: rm -rf ${{ env.WORK_DIR }} diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index b2263a460b..ead21b923f 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -99,7 +99,7 @@ jobs: run: | export OMP_NUM_THREADS=2 # -n runs test in parallel using pytest-xdist - pytest -n2 --durations=50 -s + pytest -n2 --durations=50 -s --strict-warnings # Build and Deploy production (main) docs. docs_deploy: @@ -157,7 +157,7 @@ jobs: run: | ASPIREDIR=${{ env.WORK_DIR }} python -c \ "import aspire; print(aspire.config['ray']['temp_dir'])" - ASPIREDIR=${{ env.WORK_DIR }} python -m pytest --durations=50 + ASPIREDIR=${{ env.WORK_DIR }} python -m pytest --durations=50 --strict-warnings - name: Cache Data run: | ASPIREDIR=${{ env.WORK_DIR }} python -c \ @@ -247,4 +247,4 @@ jobs: pip install -e ".[dev]" # install aspire pip freeze - name: Test - run: python -m pytest -n3 --durations=50 + run: python -m pytest -n3 --durations=50 --strict-warnings From 8ae3daf29312aa35b6d2b942e757a2d9061b08d1 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 10 Sep 2024 14:15:10 -0400 Subject: [PATCH 277/433] Use PYTHONWARNINGS=error when python runs pytest. --- .github/workflows/long_workflow.yml | 2 +- .github/workflows/workflow.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/long_workflow.yml b/.github/workflows/long_workflow.yml index d483ac5912..a2f2938c8f 100644 --- a/.github/workflows/long_workflow.yml +++ b/.github/workflows/long_workflow.yml @@ -36,6 +36,6 @@ jobs: export OMP_NUM_THREADS=1 ASPIREDIR=${{ env.WORK_DIR }} python -c \ "import aspire; print(aspire.config['ray']['temp_dir'])" - ASPIREDIR=${{ env.WORK_DIR }} python -m pytest -n8 -m "expensive" --durations=0 --strict-warnings + ASPIREDIR=${{ env.WORK_DIR }} PYTHONWARNINGS=error python -m pytest -n8 -m "expensive" --durations=0 - name: Cleanup run: rm -rf ${{ env.WORK_DIR }} diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index ead21b923f..253876f83c 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -157,7 +157,7 @@ jobs: run: | ASPIREDIR=${{ env.WORK_DIR }} python -c \ "import aspire; print(aspire.config['ray']['temp_dir'])" - ASPIREDIR=${{ env.WORK_DIR }} python -m pytest --durations=50 --strict-warnings + ASPIREDIR=${{ env.WORK_DIR }} PYTHONWARNINGS=error python -m pytest --durations=50 - name: Cache Data run: | ASPIREDIR=${{ env.WORK_DIR }} python -c \ @@ -247,4 +247,4 @@ jobs: pip install -e ".[dev]" # install aspire pip freeze - name: Test - run: python -m pytest -n3 --durations=50 --strict-warnings + run: PYTHONWARNINGS=error python -m pytest -n3 --durations=50 From 5b75caf6664cc592289e96f00bb16eceb5e58293 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 10 Sep 2024 15:24:35 -0400 Subject: [PATCH 278/433] enforce C order on signal for cufinufft transform. --- src/aspire/nufft/cufinufft.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/aspire/nufft/cufinufft.py b/src/aspire/nufft/cufinufft.py index 218fbd5fb7..fd869aacfd 100644 --- a/src/aspire/nufft/cufinufft.py +++ b/src/aspire/nufft/cufinufft.py @@ -107,7 +107,8 @@ def transform(self, signal): " In the future this will be an error." ) - signal = cp.asarray(signal, dtype=self.complex_dtype) + # Note, if not C order, cuFINUFFT will copy-cast anyway. + signal = cp.asarray(signal, order="C", dtype=self.complex_dtype) sig_shape = signal.shape res_shape = self.num_pts From ed347600e94f1f8a88db2d203c2de7ae5c23cf0d Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 11 Sep 2024 08:27:53 -0400 Subject: [PATCH 279/433] Skip jobs on CI that will error on cached warnings. ampere, osx, long_running. --- tests/test_volume.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_volume.py b/tests/test_volume.py index ac86c4096b..b6e4f74a89 100644 --- a/tests/test_volume.py +++ b/tests/test_volume.py @@ -813,6 +813,12 @@ def test_transformation_symmetry_warnings(symmetric_vols): assert str(vol_c3.symmetry_group) == "C3" +@pytest.mark.skipif( + (os.getenv("GITHUB_JOB") == "ampere_gpu") + or (os.getenv("GITHUB_JOB") == "osx_arm") + or (os.getenv("GITHUB_JOB") == "expensive_tests"), + reason="Cached warnings will error for these jobs.", +) def test_aglebraic_ops_symmetry_warnings(symmetric_vols): """ A warning should be emitted for add, sub, mult, and div. From 4d7bc493e06d82e4ae15cd32cb98c185c59dff36 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 11 Sep 2024 10:28:05 -0400 Subject: [PATCH 280/433] Only check warnings on ampere_gpu job. --- .github/workflows/long_workflow.yml | 2 +- .github/workflows/workflow.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/long_workflow.yml b/.github/workflows/long_workflow.yml index a2f2938c8f..ec5714a29e 100644 --- a/.github/workflows/long_workflow.yml +++ b/.github/workflows/long_workflow.yml @@ -36,6 +36,6 @@ jobs: export OMP_NUM_THREADS=1 ASPIREDIR=${{ env.WORK_DIR }} python -c \ "import aspire; print(aspire.config['ray']['temp_dir'])" - ASPIREDIR=${{ env.WORK_DIR }} PYTHONWARNINGS=error python -m pytest -n8 -m "expensive" --durations=0 + ASPIREDIR=${{ env.WORK_DIR }} python -m pytest -n8 -m "expensive" --durations=0 - name: Cleanup run: rm -rf ${{ env.WORK_DIR }} diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 253876f83c..69156dc0e0 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -99,7 +99,7 @@ jobs: run: | export OMP_NUM_THREADS=2 # -n runs test in parallel using pytest-xdist - pytest -n2 --durations=50 -s --strict-warnings + pytest -n2 --durations=50 -s # Build and Deploy production (main) docs. docs_deploy: @@ -247,4 +247,4 @@ jobs: pip install -e ".[dev]" # install aspire pip freeze - name: Test - run: PYTHONWARNINGS=error python -m pytest -n3 --durations=50 + run: python -m pytest -n3 --durations=50 From 3e1f021443655e2ba18f612fc328c85d11ad7b97 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 11 Sep 2024 10:31:53 -0400 Subject: [PATCH 281/433] remove symmetry warning pytest skips. --- tests/test_volume.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/test_volume.py b/tests/test_volume.py index b6e4f74a89..162904a63c 100644 --- a/tests/test_volume.py +++ b/tests/test_volume.py @@ -814,10 +814,8 @@ def test_transformation_symmetry_warnings(symmetric_vols): @pytest.mark.skipif( - (os.getenv("GITHUB_JOB") == "ampere_gpu") - or (os.getenv("GITHUB_JOB") == "osx_arm") - or (os.getenv("GITHUB_JOB") == "expensive_tests"), - reason="Cached warnings will error for these jobs.", + (os.getenv("GITHUB_JOB") == "ampere_gpu"), + reason="Cached warnings will error for this job.", ) def test_aglebraic_ops_symmetry_warnings(symmetric_vols): """ From d5622fb544ed10bdddafe6db03f800e945f31c05 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 11 Sep 2024 14:28:03 -0400 Subject: [PATCH 282/433] remove unnecesary plt.close() --- tests/test_simulation.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/test_simulation.py b/tests/test_simulation.py index c90caa5bdd..7892a4e8de 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -39,23 +39,14 @@ def testPixelSize(self): def testImageShow(self): self.sim.images[:].show() - # Explicitly close all figures before making backend changes. - plt.close("all") - @matplotlib_dry_run def testCleanImagesShow(self): self.sim.clean_images[:].show() - # Explicitly close all figures before making backend changes. - plt.close("all") - @matplotlib_dry_run def testProjectionsShow(self): self.sim.projections[:].show() - # Explicitly close all figures before making backend changes. - plt.close("all") - class SimVolTestCase(TestCase): """Test Simulation with Volume provided.""" From d9c7f6e191ac0a97e83a0b3ab03c8e8bcdadbabf Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 11 Sep 2024 14:29:58 -0400 Subject: [PATCH 283/433] unused import --- tests/test_simulation.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_simulation.py b/tests/test_simulation.py index 7892a4e8de..92a29e225e 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -3,7 +3,6 @@ import tempfile from unittest import TestCase -import matplotlib.pyplot as plt import numpy as np from pytest import raises From c8ca38eb1c67ad8f45d2e382d23b64be3a9b8c55 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 11 Sep 2024 14:35:56 -0400 Subject: [PATCH 284/433] Remove useless test case. --- tests/test_volume.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/test_volume.py b/tests/test_volume.py index 162904a63c..1f55645e10 100644 --- a/tests/test_volume.py +++ b/tests/test_volume.py @@ -813,10 +813,6 @@ def test_transformation_symmetry_warnings(symmetric_vols): assert str(vol_c3.symmetry_group) == "C3" -@pytest.mark.skipif( - (os.getenv("GITHUB_JOB") == "ampere_gpu"), - reason="Cached warnings will error for this job.", -) def test_aglebraic_ops_symmetry_warnings(symmetric_vols): """ A warning should be emitted for add, sub, mult, and div. @@ -850,12 +846,6 @@ def test_aglebraic_ops_symmetry_warnings(symmetric_vols): # Should have 4 warnings on record. assert len(record) == 4 - # Check that warning occurs only once per line. - with warnings.catch_warnings(record=True) as record: - for _ in range(5): - vol_c3 + vol_c4 - assert len(record) == 1 - def test_volume_load_with_symmetry(): # Check we can load a Volume with symmetry_group. From 377991a5f1a4460b92096ca26646c582d666bd15 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 13 Sep 2024 07:10:47 -0400 Subject: [PATCH 285/433] migrate osx_arm CI job to run native python/pip --- .github/workflows/workflow.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 69156dc0e0..1c8327793a 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -231,19 +231,9 @@ jobs: if: ${{ github.event_name == 'push' || github.event.pull_request.draft == false }} steps: - uses: actions/checkout@v4 - - name: Set up Conda - uses: conda-incubator/setup-miniconda@v2.3.0 - with: - miniconda-version: "latest" - auto-update-conda: true - python-version: '3.8' - activate-environment: aspire - environment-file: environment-accelerate.yml - auto-activate-base: false - - name: Complete Install and Log Environment ${{ matrix.os }} Python ${{ matrix.python-version }} + - name: Complete Install and Log Environment run: | - conda info - conda list + python --version pip install -e ".[dev]" # install aspire pip freeze - name: Test From d1b9feb2c87e9f16fe6cdbb929e8baf4908d53f4 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 13 Sep 2024 07:13:03 -0400 Subject: [PATCH 286/433] Remove x86_64 doc updates --- README.md | 6 +----- docs/source/installation.rst | 6 ------ 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/README.md b/README.md index d3fe484579..ecb217a741 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,7 @@ install `aspire` safely in that environment. If you are unfamiliar with `conda`, the [Miniconda](https://docs.conda.io/en/latest/miniconda.html) -distribution for `x86_64` is recommended. For Apple silicon to use -the osx-arm platform, patching and building some dependencies from -source is currently required. The Intel `osx-64` install is still -preferred even for Apple silicon users, otherwise [notes are -provided.](https://github.com/ComputationalCryoEM/ASPIRE-Python/discussions/969) +distribution for `x86_64` is recommended. Assuming you have `conda` and a compatible system, the following steps will checkout current code release, create an environment, and install diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 5fa608ecdf..1fca5a35dd 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -34,12 +34,6 @@ to view Conda's installation instructions. .. note:: If you're not sure which distribution is right for you, go with `Miniconda `__ -.. note:: For Apple silicon to use the osx-arm platform, patching and - building some dependencies from source is currently required. The - Intel ``osx-64`` install is still preferred even for Apple silicon - users, otherwise `notes are - provided. `_ - Getting Started - Installation ************************************ From fe82488c1e12b5abb7febce359bd27508858b952 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 13 Sep 2024 07:24:22 -0400 Subject: [PATCH 287/433] Use 3.11 on osx_arm, default was 3.12 --- .github/workflows/workflow.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 1c8327793a..e4fab44f98 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -231,6 +231,9 @@ jobs: if: ${{ github.event_name == 'push' || github.event.pull_request.draft == false }} steps: - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.11' - name: Complete Install and Log Environment run: | python --version From c90d2a5a2082d9f4ce4dc30ea8b1a00718dc19f3 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 13 Sep 2024 07:30:17 -0400 Subject: [PATCH 288/433] use default osx shell --- .github/workflows/workflow.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index e4fab44f98..dd75b0d6c6 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -222,9 +222,6 @@ jobs: retention-days: 7 osx_arm: - defaults: - run: - shell: bash -l {0} needs: check runs-on: macos-14 # Run on every code push, but only on review ready PRs From efa5cc52b7c3c72ec03c940954fa87f3c9c864cc Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 13 Sep 2024 08:05:41 -0400 Subject: [PATCH 289/433] adjust a few tests for osx arm --- tests/test_FLEbasis2D.py | 7 +++++-- tests/test_indexed_source.py | 8 ++++++-- tests/test_simulation.py | 16 +++++++++++----- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/tests/test_FLEbasis2D.py b/tests/test_FLEbasis2D.py index 0873d61bab..3d27eb7449 100644 --- a/tests/test_FLEbasis2D.py +++ b/tests/test_FLEbasis2D.py @@ -1,4 +1,5 @@ import os +import platform import sys import numpy as np @@ -70,8 +71,10 @@ def relerr(base, approx): @pytest.mark.parametrize("basis", test_bases, ids=show_fle_params) class TestFLEBasis2D(UniversalBasisMixin): - # Loosen the tolerance for `cufinufft` to be within 15% - test_eps = 1.15 if backend_available("cufinufft") else 1.0 + # Loosen the tolerance for `cufinufft` and `osx_arm` to be within 15% + test_eps = 1.0 + if backend_available("cufinufft") or platform.system() == "Darwin": + test_eps = 1.16 # check closeness guarantees for fast vs dense matrix method def testFastVDense_T(self, basis): diff --git a/tests/test_indexed_source.py b/tests/test_indexed_source.py index 9ce35c7052..3092ed16f4 100644 --- a/tests/test_indexed_source.py +++ b/tests/test_indexed_source.py @@ -22,11 +22,15 @@ def test_remapping(sim_fixture): sim, sim2 = sim_fixture # Check images are served correctly, using internal index. - assert np.allclose(sim.images[sim2.index_map].asnumpy(), sim2.images[:].asnumpy()) + np.testing.assert_allclose( + sim.images[sim2.index_map].asnumpy(), sim2.images[:].asnumpy(), atol=1e-6 + ) # Check images are served correctly, using known index (evens). index = list(range(0, sim.n, 2)) - assert np.allclose(sim.images[index].asnumpy(), sim2.images[:].asnumpy()) + np.testing.assert_allclose( + sim.images[index].asnumpy(), sim2.images[:].asnumpy(), atol=1e-6 + ) # Check meta is served correctly. assert np.all(sim.get_metadata(indices=sim2.index_map) == sim2.get_metadata()) diff --git a/tests/test_simulation.py b/tests/test_simulation.py index 92a29e225e..02e7d7a7fe 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -604,7 +604,9 @@ def testSimulationSaveFile(self): relion_src = RelionSource(star_filepath, tmpdir, max_rows=1024) imgs_sav = relion_src.images[:1024] # Compare original images with saved images - self.assertTrue(np.allclose(imgs_org.asnumpy(), imgs_sav.asnumpy())) + np.testing.assert_allclose( + imgs_org.asnumpy(), imgs_sav.asnumpy(), atol=1e-6 + ) # Save images into multiple MRCS files based on batch size batch_size = 512 info = self.sim.save(star_filepath, batch_size=batch_size, overwrite=False) @@ -623,7 +625,9 @@ def testSimulationSaveFile(self): relion_src = RelionSource(star_filepath, tmpdir, max_rows=1024) imgs_sav = relion_src.images[:1024] # Compare original images with saved images - self.assertTrue(np.allclose(imgs_org.asnumpy(), imgs_sav.asnumpy())) + np.testing.assert_allclose( + imgs_org.asnumpy(), imgs_sav.asnumpy(), atol=1e-6 + ) def test_default_symmetry_group(): @@ -666,9 +670,11 @@ def test_cached_image_accessors(): cached_src = src.cache() # Compare the cached vs dynamic image sets. - np.testing.assert_allclose(cached_src.projections[:], src.projections[:]) - np.testing.assert_allclose(cached_src.images[:], src.images[:]) - np.testing.assert_allclose(cached_src.clean_images[:], src.clean_images[:]) + np.testing.assert_allclose(cached_src.projections[:], src.projections[:], atol=1e-6) + np.testing.assert_allclose(cached_src.images[:], src.images[:], atol=1e-6) + np.testing.assert_allclose( + cached_src.clean_images[:], src.clean_images[:], atol=1e-6 + ) def test_mismatched_pixel_size(): From 6b9a2df58a16a715351aaf1bd2700469827a29c9 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 13 Sep 2024 08:30:15 -0400 Subject: [PATCH 290/433] convert simulation tests to np.testing.assert_allclose --- tests/test_simulation.py | 498 +++++++++++++++++++-------------------- 1 file changed, 243 insertions(+), 255 deletions(-) diff --git a/tests/test_simulation.py b/tests/test_simulation.py index 02e7d7a7fe..6780595856 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -141,32 +141,28 @@ def tearDown(self): def testGaussianBlob(self): blobs = self.sim.vols.asnumpy() ref = np.load(os.path.join(DATA_DIR, "sim_blobs.npy")) - self.assertTrue(np.allclose(blobs, ref)) + np.testing.assert_allclose(blobs, ref, rtol=1e-05, atol=1e-08) def testSimulationRots(self): - self.assertTrue( - np.allclose( - self.sim.rots_zyx_to_legacy_aspire(self.sim.rotations[0, :, :]), - np.array( - [ - [0.91675498, 0.2587233, 0.30433956], - [0.39941773, -0.58404652, -0.70665065], - [-0.00507853, 0.76938412, -0.63876622], - ] - ), - atol=utest_tolerance(self.dtype), - ) + np.testing.assert_allclose( + self.sim.rots_zyx_to_legacy_aspire(self.sim.rotations[0, :, :]), + np.array( + [ + [0.91675498, 0.2587233, 0.30433956], + [0.39941773, -0.58404652, -0.70665065], + [-0.00507853, 0.76938412, -0.63876622], + ] + ), + atol=utest_tolerance(self.dtype), ) def testSimulationImages(self): images = self.sim.clean_images[:512].asnumpy() - self.assertTrue( - np.allclose( - images, - np.load(os.path.join(DATA_DIR, "sim_clean_images.npy")), - rtol=1e-2, - atol=utest_tolerance(self.sim.dtype), - ) + np.testing.assert_allclose( + images, + np.load(os.path.join(DATA_DIR, "sim_clean_images.npy")), + rtol=1e-2, + atol=utest_tolerance(self.sim.dtype), ) def testSimulationCached(self): @@ -184,32 +180,28 @@ def testSimulationCached(self): dtype=self.dtype, ) sim_cached = sim_cached.cache() - self.assertTrue( - np.array_equal(sim_cached.images[:].asnumpy(), self.sim.images[:].asnumpy()) + np.testing.assert_allclose( + sim_cached.images[:].asnumpy(), self.sim.images[:].asnumpy(), atol=1e-6 ) def testSimulationImagesNoisy(self): images = self.sim.images[:512].asnumpy() - self.assertTrue( - np.allclose( - images, - np.load(os.path.join(DATA_DIR, "sim_images_with_noise.npy")), - rtol=1e-2, - atol=utest_tolerance(self.sim.dtype), - ) + np.testing.assert_allclose( + images, + np.load(os.path.join(DATA_DIR, "sim_images_with_noise.npy")), + rtol=1e-2, + atol=utest_tolerance(self.sim.dtype), ) def testSimulationImagesDownsample(self): # The simulation already generates images of size 8 x 8; Downsampling to resolution 8 should thus have no effect self.sim = self.sim.downsample(8) images = self.sim.clean_images[:512].asnumpy() - self.assertTrue( - np.allclose( - images, - np.load(os.path.join(DATA_DIR, "sim_clean_images.npy")), - rtol=1e-2, - atol=utest_tolerance(self.sim.dtype), - ) + np.testing.assert_allclose( + images, + np.load(os.path.join(DATA_DIR, "sim_clean_images.npy")), + rtol=1e-2, + atol=utest_tolerance(self.sim.dtype), ) def testSimulationImagesShape(self): @@ -225,192 +217,192 @@ def testSimulationImagesDownsampleShape(self): def testSimulationEigen(self): eigs_true, lambdas_true = self.sim.eigs() - self.assertTrue( - np.allclose( - eigs_true.asnumpy()[0, :, :, 2], - np.array( - [ - [ - -1.67666201e-07, - -7.95741380e-06, - -1.49160041e-04, - -1.10151654e-03, - -3.11287888e-03, - -3.09157884e-03, - -9.91418026e-04, - -1.31673165e-04, - ], - [ - -1.15402077e-06, - -2.49849709e-05, - -3.51658906e-04, - -2.21575261e-03, - -7.83315487e-03, - -9.44795180e-03, - -4.07636259e-03, - -9.02186439e-04, - ], - [ - -1.88737249e-05, - -1.91418396e-04, - -1.09021540e-03, - -1.02020288e-03, - 1.39411855e-02, - 8.58035963e-03, - -5.54619730e-03, - -3.86377703e-03, - ], - [ - -1.21280536e-04, - -9.51461843e-04, - -3.22565017e-03, - -1.05731178e-03, - 2.61375736e-02, - 3.11595201e-02, - 6.40814053e-03, - -2.31698658e-02, - ], - [ - -2.44067283e-04, - -1.40560151e-03, - -6.73082832e-05, - 1.44160679e-02, - 2.99893934e-02, - 5.92632964e-02, - 7.75623545e-02, - 3.06570008e-02, - ], - [ - -1.53507499e-04, - -7.21709803e-04, - 8.54929152e-04, - -1.27235036e-02, - -5.34382043e-03, - 2.18879692e-02, - 6.22706190e-02, - 4.51998860e-02, - ], - [ - -3.00595184e-05, - -1.43038429e-04, - -2.15870258e-03, - -9.99002904e-02, - -7.79077187e-02, - -1.53395887e-02, - 1.88777559e-02, - 1.68759506e-02, - ], - [ - 3.22692649e-05, - 4.07977635e-03, - 1.63959339e-02, - -8.68835449e-02, - -7.86240026e-02, - -1.75694861e-02, - 3.24984640e-03, - 1.95389288e-03, - ], - ] - ), - ) - ) - - def testSimulationMean(self): - mean_vol = self.sim.mean_true() - self.assertTrue( - np.allclose( + np.testing.assert_allclose( + eigs_true.asnumpy()[0, :, :, 2], + np.array( [ [ - 0.00000930, - 0.00033866, - 0.00490734, - 0.01998369, - 0.03874487, - 0.04617764, - 0.02970645, - 0.00967604, + -1.67666201e-07, + -7.95741380e-06, + -1.49160041e-04, + -1.10151654e-03, + -3.11287888e-03, + -3.09157884e-03, + -9.91418026e-04, + -1.31673165e-04, ], [ - 0.00003904, - 0.00247391, - 0.03818476, - 0.12325402, - 0.22278425, - 0.25246665, - 0.14093882, - 0.03683474, + -1.15402077e-06, + -2.49849709e-05, + -3.51658906e-04, + -2.21575261e-03, + -7.83315487e-03, + -9.44795180e-03, + -4.07636259e-03, + -9.02186439e-04, ], [ - 0.00014177, - 0.01191146, - 0.14421064, - 0.38428235, - 0.78645319, - 0.86522675, - 0.44862473, - 0.16382280, + -1.88737249e-05, + -1.91418396e-04, + -1.09021540e-03, + -1.02020288e-03, + 1.39411855e-02, + 8.58035963e-03, + -5.54619730e-03, + -3.86377703e-03, ], [ - 0.00066036, - 0.03137806, - 0.29226971, - 0.97105378, - 2.39410496, - 2.17099857, - 1.23595858, - 0.49233940, + -1.21280536e-04, + -9.51461843e-04, + -3.22565017e-03, + -1.05731178e-03, + 2.61375736e-02, + 3.11595201e-02, + 6.40814053e-03, + -2.31698658e-02, ], [ - 0.00271748, - 0.05491289, - 0.49955708, - 2.05356097, - 3.70941424, - 3.01578689, - 1.51441932, - 0.52054572, + -2.44067283e-04, + -1.40560151e-03, + -6.73082832e-05, + 1.44160679e-02, + 2.99893934e-02, + 5.92632964e-02, + 7.75623545e-02, + 3.06570008e-02, ], [ - 0.00584845, - 0.06962635, - 0.50568032, - 1.99643707, - 3.77415895, - 2.76039767, - 1.04602003, - 0.20633197, + -1.53507499e-04, + -7.21709803e-04, + 8.54929152e-04, + -1.27235036e-02, + -5.34382043e-03, + 2.18879692e-02, + 6.22706190e-02, + 4.51998860e-02, ], [ - 0.00539583, - 0.06068972, - 0.47008955, - 1.17128026, - 1.82821035, - 1.18743944, - 0.30667788, - 0.04851476, + -3.00595184e-05, + -1.43038429e-04, + -2.15870258e-03, + -9.99002904e-02, + -7.79077187e-02, + -1.53395887e-02, + 1.88777559e-02, + 1.68759506e-02, ], [ - 0.00246362, - 0.04867788, - 0.65284950, - 0.65238875, - 0.65745538, - 0.37955678, - 0.08053055, - 0.01210055, + 3.22692649e-05, + 4.07977635e-03, + 1.63959339e-02, + -8.68835449e-02, + -7.86240026e-02, + -1.75694861e-02, + 3.24984640e-03, + 1.95389288e-03, ], + ] + ), + rtol=1e-05, + atol=1e-08, + ) + + def testSimulationMean(self): + mean_vol = self.sim.mean_true() + np.testing.assert_allclose( + [ + [ + 0.00000930, + 0.00033866, + 0.00490734, + 0.01998369, + 0.03874487, + 0.04617764, + 0.02970645, + 0.00967604, ], - mean_vol.asnumpy()[0, :, :, 4], - ) + [ + 0.00003904, + 0.00247391, + 0.03818476, + 0.12325402, + 0.22278425, + 0.25246665, + 0.14093882, + 0.03683474, + ], + [ + 0.00014177, + 0.01191146, + 0.14421064, + 0.38428235, + 0.78645319, + 0.86522675, + 0.44862473, + 0.16382280, + ], + [ + 0.00066036, + 0.03137806, + 0.29226971, + 0.97105378, + 2.39410496, + 2.17099857, + 1.23595858, + 0.49233940, + ], + [ + 0.00271748, + 0.05491289, + 0.49955708, + 2.05356097, + 3.70941424, + 3.01578689, + 1.51441932, + 0.52054572, + ], + [ + 0.00584845, + 0.06962635, + 0.50568032, + 1.99643707, + 3.77415895, + 2.76039767, + 1.04602003, + 0.20633197, + ], + [ + 0.00539583, + 0.06068972, + 0.47008955, + 1.17128026, + 1.82821035, + 1.18743944, + 0.30667788, + 0.04851476, + ], + [ + 0.00246362, + 0.04867788, + 0.65284950, + 0.65238875, + 0.65745538, + 0.37955678, + 0.08053055, + 0.01210055, + ], + ], + mean_vol.asnumpy()[0, :, :, 4], + rtol=1e-05, + atol=1e-08, ) def testSimulationVolCoords(self): coords, norms, inners = self.sim.vol_coords() - self.assertTrue(np.allclose([4.72837704, -4.72837709], coords, atol=1e-4)) - self.assertTrue(np.allclose([8.20515764e-07, 1.17550184e-06], norms, atol=1e-4)) - self.assertTrue( - np.allclose([3.78030562e-06, -4.20475816e-06], inners, atol=1e-4) + np.testing.assert_allclose([4.72837704, -4.72837709], coords, atol=1e-4) + np.testing.assert_allclose([8.20515764e-07, 1.17550184e-06], norms, atol=1e-4) + np.testing.assert_allclose( + [[3.78030562e-06, -4.20475816e-06]], inners, atol=1e-4 ) def testSimulationCovar(self): @@ -498,23 +490,23 @@ def testSimulationCovar(self): ], ] - self.assertTrue(np.allclose(result, covar[:, :, 4, 4, 4, 4], atol=1e-4)) + np.testing.assert_allclose(result, covar[:, :, 4, 4, 4, 4], atol=1e-4) def testSimulationEvalMean(self): mean_est = Volume(np.load(os.path.join(DATA_DIR, "mean_8_8_8.npy"))) result = self.sim.eval_mean(mean_est) - self.assertTrue(np.allclose(result["err"], 2.664116055950763, atol=1e-4)) - self.assertTrue(np.allclose(result["rel_err"], 0.1765943704851626, atol=1e-4)) - self.assertTrue(np.allclose(result["corr"], 0.9849211540734224, atol=1e-4)) + np.testing.assert_allclose(result["err"], 2.664116055950763, atol=1e-4) + np.testing.assert_allclose(result["rel_err"], 0.1765943704851626, atol=1e-4) + np.testing.assert_allclose(result["corr"], 0.9849211540734224, atol=1e-4) def testSimulationEvalCovar(self): covar_est = np.load(os.path.join(DATA_DIR, "covar_8_8_8_8_8_8.npy")) result = self.sim.eval_covar(covar_est) - self.assertTrue(np.allclose(result["err"], 13.322721549011165, atol=1e-4)) - self.assertTrue(np.allclose(result["rel_err"], 0.5958936073938558, atol=1e-4)) - self.assertTrue(np.allclose(result["corr"], 0.8405347287741631, atol=1e-4)) + np.testing.assert_allclose(result["err"], 13.322721549011165, atol=1e-4) + np.testing.assert_allclose(result["rel_err"], 0.5958936073938558, atol=1e-4) + np.testing.assert_allclose(result["corr"], 0.8405347287741631, atol=1e-4) def testSimulationEvalCoords(self): mean_est = Volume(np.load(os.path.join(DATA_DIR, "mean_8_8_8.npy"))) @@ -528,58 +520,54 @@ def testSimulationEvalCoords(self): result = self.sim.eval_coords(mean_est, eigs_est, clustered_coords_est) - self.assertTrue( - np.allclose( - result["err"][0, :10], - [ - 1.58382394, - 1.58382394, - 3.72076112, - 1.58382394, - 1.58382394, - 3.72076112, - 3.72076112, - 1.58382394, - 1.58382394, - 1.58382394, - ], - ) + np.testing.assert_allclose( + result["err"][0, :10], + [ + 1.58382394, + 1.58382394, + 3.72076112, + 1.58382394, + 1.58382394, + 3.72076112, + 3.72076112, + 1.58382394, + 1.58382394, + 1.58382394, + ], ) - self.assertTrue( - np.allclose( - result["rel_err"][0, :10], - [ - 0.11048937, - 0.11048937, - 0.21684697, - 0.11048937, - 0.11048937, - 0.21684697, - 0.21684697, - 0.11048937, - 0.11048937, - 0.11048937, - ], - ) + np.testing.assert_allclose( + result["rel_err"][0, :10], + [ + 0.11048937, + 0.11048937, + 0.21684697, + 0.11048937, + 0.11048937, + 0.21684697, + 0.21684697, + 0.11048937, + 0.11048937, + 0.11048937, + ], ) - self.assertTrue( - np.allclose( - result["corr"][0, :10], - [ - 0.99390133, - 0.99390133, - 0.97658719, - 0.99390133, - 0.99390133, - 0.97658719, - 0.97658719, - 0.99390133, - 0.99390133, - 0.99390133, - ], - ) + np.testing.assert_allclose( + result["corr"][0, :10], + [ + 0.99390133, + 0.99390133, + 0.97658719, + 0.99390133, + 0.99390133, + 0.97658719, + 0.97658719, + 0.99390133, + 0.99390133, + 0.99390133, + ], + rtol=1e-05, + atol=1e-08, ) def testSimulationSaveFile(self): From 00f0a4176fda20e2ebe5575e23064aa489e859e1 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 13 Sep 2024 08:33:59 -0400 Subject: [PATCH 291/433] Another test file tweak for arm64 --- tests/test_preprocess_pipeline.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_preprocess_pipeline.py b/tests/test_preprocess_pipeline.py index d7416095b0..0f67ae1b67 100644 --- a/tests/test_preprocess_pipeline.py +++ b/tests/test_preprocess_pipeline.py @@ -168,7 +168,7 @@ def testInvertContrast(L, dtype): # all images should be the same after inverting contrast np.testing.assert_allclose( - imgs1_rc.asnumpy(), imgs2_rc.asnumpy(), rtol=1e-05, atol=1e-08 + imgs1_rc.asnumpy(), imgs2_rc.asnumpy(), rtol=1e-05, atol=1e-06 ) # dtype of returned images should be the same assert dtype == imgs1_rc.dtype From 372545d03eee8aba0dbe1214fe78243e82638d23 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 13 Sep 2024 09:43:40 -0400 Subject: [PATCH 292/433] loosen FLE for arm a little more --- tests/test_FLEbasis2D.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_FLEbasis2D.py b/tests/test_FLEbasis2D.py index 3d27eb7449..3e20b756c6 100644 --- a/tests/test_FLEbasis2D.py +++ b/tests/test_FLEbasis2D.py @@ -73,8 +73,10 @@ def relerr(base, approx): class TestFLEBasis2D(UniversalBasisMixin): # Loosen the tolerance for `cufinufft` and `osx_arm` to be within 15% test_eps = 1.0 - if backend_available("cufinufft") or platform.system() == "Darwin": - test_eps = 1.16 + if backend_available("cufinufft"): + test_eps = 1.15 + elif platform.system() == "Darwin": + test_eps = 1.20 # check closeness guarantees for fast vs dense matrix method def testFastVDense_T(self, basis): From c094e56504f753c3cfb259b2e7f11c296ad7f871 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 13 Sep 2024 09:44:38 -0400 Subject: [PATCH 293/433] adjust comment --- tests/test_FLEbasis2D.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_FLEbasis2D.py b/tests/test_FLEbasis2D.py index 3e20b756c6..160f95e1b7 100644 --- a/tests/test_FLEbasis2D.py +++ b/tests/test_FLEbasis2D.py @@ -71,7 +71,7 @@ def relerr(base, approx): @pytest.mark.parametrize("basis", test_bases, ids=show_fle_params) class TestFLEBasis2D(UniversalBasisMixin): - # Loosen the tolerance for `cufinufft` and `osx_arm` to be within 15% + # Loosen the tolerance for `cufinufft` and `osx_arm` test_eps = 1.0 if backend_available("cufinufft"): test_eps = 1.15 From 19e861614ba1d1e6ae434cb8771de54eb8a71b43 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 6 Sep 2024 08:55:12 -0400 Subject: [PATCH 294/433] mean alpha angles --- src/aspire/abinitio/commonline_sync3n.py | 32 +++++++++++++++++------- src/aspire/abinitio/sync_voting.py | 11 +------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 6efb429818..bfb804e109 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -7,7 +7,14 @@ from scipy.optimize import curve_fit from aspire.abinitio import CLOrient3D, SyncVotingMixin -from aspire.utils import J_conjugate, all_pairs, nearest_rotations, tqdm, trange +from aspire.utils import ( + J_conjugate, + Rotation, + all_pairs, + nearest_rotations, + tqdm, + trange, +) from aspire.utils.matlab_compat import stable_eigsh from aspire.utils.random import randn @@ -783,12 +790,15 @@ def _estimate_all_Rijs(self, clmatrix): n_img = self.n_img n_theta = self.n_theta Rijs = np.zeros((len(self._pairs), 3, 3)) + dbg_angles = np.zeros((len(self._pairs), 3)) for idx, (i, j) in enumerate(tqdm(self._pairs, desc="Estimate Rijs")): - Rijs[idx] = self._syncmatrix_ij_vote_3n( + Rijs[idx], dbg_angles[idx] = self._syncmatrix_ij_vote_3n( clmatrix, i, j, np.arange(n_img), n_theta ) + np.save("Rijs.npy", Rijs) + np.save("dbg_angles.npy", dbg_angles) return Rijs def _syncmatrix_ij_vote_3n(self, clmatrix, i, j, k_list, n_theta): @@ -807,18 +817,22 @@ def _syncmatrix_ij_vote_3n(self, clmatrix, i, j, k_list, n_theta): """ good_k = self._vote_ij(clmatrix, n_theta, i, j, k_list) - rots = self._rotratio_eulerangle_vec(clmatrix, i, j, good_k, n_theta) - - if rots is not None: - rot_mean = np.mean(rots, 0) - + angle = self._rotratio_eulerangle_vec(clmatrix, i, j, good_k, n_theta) + angles = np.zeros(3) + + if angle is not None: + # Convert the Euler angles with ZYZ conversion to rotation matrices + angles[0] = clmatrix[i, j] * 2 * np.pi / n_theta + np.pi / 2 + angles[1] = angle + angles[2] = -np.pi / 2 - clmatrix[j, i] * 2 * np.pi / n_theta + rot = Rotation.from_euler(angles).matrices else: # This is for the case that images i and j correspond to the same # viewing direction and differ only by in-plane rotation. # We set to zero as in the Matlab code. - rot_mean = np.zeros((3, 3)) + rot = np.zeros((3, 3)) - return rot_mean + return rot, angles ####################################### # Secondary Methods for Global J Sync # diff --git a/src/aspire/abinitio/sync_voting.py b/src/aspire/abinitio/sync_voting.py index abc11ef6e1..3eec09160b 100644 --- a/src/aspire/abinitio/sync_voting.py +++ b/src/aspire/abinitio/sync_voting.py @@ -2,8 +2,6 @@ import numpy as np -from aspire.utils import Rotation - logger = logging.getLogger(__name__) @@ -46,14 +44,7 @@ def _rotratio_eulerangle_vec(self, clmatrix, i, j, good_k, n_theta): return None alpha = np.arccos(c_alpha) - # Convert the Euler angles with ZYZ conversion to rotation matrices - angles = np.zeros((alpha.shape[0], 3)) - angles[:, 0] = clmatrix[i, j] * 2 * np.pi / n_theta + np.pi / 2 - angles[:, 1] = alpha - angles[:, 2] = -np.pi / 2 - clmatrix[j, i] * 2 * np.pi / n_theta - r = Rotation.from_euler(angles).matrices - - return r[good_idx, :, :] + return np.mean(alpha) def _vote_ij(self, clmatrix, n_theta, i, j, k_list): """ From f9819d3dd6df25ea9a2b20e8c58f400ca6e777fa Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 6 Sep 2024 10:00:19 -0400 Subject: [PATCH 295/433] restore old euler to rotation code --- src/aspire/abinitio/commonline_sync3n.py | 27 ++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index bfb804e109..77efcc86d8 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -5,16 +5,10 @@ import numpy as np from numpy.linalg import norm from scipy.optimize import curve_fit +from scipy.spatial.transform import Rotation as sprot from aspire.abinitio import CLOrient3D, SyncVotingMixin -from aspire.utils import ( - J_conjugate, - Rotation, - all_pairs, - nearest_rotations, - tqdm, - trange, -) +from aspire.utils import J_conjugate, all_pairs, nearest_rotations, tqdm, trange from aspire.utils.matlab_compat import stable_eigsh from aspire.utils.random import randn @@ -819,13 +813,20 @@ def _syncmatrix_ij_vote_3n(self, clmatrix, i, j, k_list, n_theta): angle = self._rotratio_eulerangle_vec(clmatrix, i, j, good_k, n_theta) angles = np.zeros(3) - + if angle is not None: - # Convert the Euler angles with ZYZ conversion to rotation matrices - angles[0] = clmatrix[i, j] * 2 * np.pi / n_theta + np.pi / 2 + # # # BAD + # # Convert the Euler angles with ZYZ conversion to rotation matrices + # angles[0] = clmatrix[i, j] * 2 * np.pi / n_theta + np.pi / 2 + # angles[1] = angle + # angles[2] = -np.pi / 2 - clmatrix[j, i] * 2 * np.pi / n_theta + # rot = Rotation.from_euler(angles).matrices + + angles[0] = clmatrix[i, j] * 2 * np.pi / n_theta - np.pi angles[1] = angle - angles[2] = -np.pi / 2 - clmatrix[j, i] * 2 * np.pi / n_theta - rot = Rotation.from_euler(angles).matrices + angles[2] = np.pi - clmatrix[j, i] * 2 * np.pi / n_theta + rot = sprot.from_euler("ZXZ", angles).as_matrix() + else: # This is for the case that images i and j correspond to the same # viewing direction and differ only by in-plane rotation. From badce6d3e69a53ee60f535dfb8ed1c80657e2b90 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 6 Sep 2024 22:43:57 -0400 Subject: [PATCH 296/433] incorrect tic width --- src/aspire/abinitio/commonline_base.py | 3 +++ src/aspire/abinitio/sync_voting.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_base.py b/src/aspire/abinitio/commonline_base.py index 3a7d57252d..3bed626d87 100644 --- a/src/aspire/abinitio/commonline_base.py +++ b/src/aspire/abinitio/commonline_base.py @@ -23,6 +23,7 @@ def __init__( n_rad=None, n_theta=360, n_check=None, + tic_width=1, max_shift=0.15, shift_step=1, mask=True, @@ -42,6 +43,7 @@ def __init__( of the resolution. Default is 0.15. :param shift_step: Resolution of shift estimation in pixels. Default is 1 pixel. + :param tic_width: Bin width in smoothing histogram (a tic is approx a degree). :param mask: Option to mask `src.images` with a fuzzy mask (boolean). Default, `True`, applies a mask. """ @@ -53,6 +55,7 @@ def __init__( self.n_rad = n_rad self.n_theta = n_theta self.n_check = n_check + self.tic_width = tic_width self.clmatrix = None self.max_shift = math.ceil(max_shift * self.n_res) self.shift_step = shift_step diff --git a/src/aspire/abinitio/sync_voting.py b/src/aspire/abinitio/sync_voting.py index 3eec09160b..aba9ae8d38 100644 --- a/src/aspire/abinitio/sync_voting.py +++ b/src/aspire/abinitio/sync_voting.py @@ -93,8 +93,11 @@ def _vote_ij(self, clmatrix, n_theta, i, j, k_list): # cl_diff2 is for the angle on C2 created by its intersection with C1 and C3. # cl_diff3 is for the angle on C3 created by its intersection with C2 and C1. cl_diff1 = cl_idx13 - cl_idx12 + # bad or just a trig identity? cl_diff2 = cl_idx21 - cl_idx23 + # cl_diff2 = cl_idx23 - cl_idx21 # theta2 = (clmatrix(j,K)-clmatrix(j,i)) * 2*pi/L; cl_diff3 = cl_idx32 - cl_idx31 + # Calculate the cos values of rotation angles between i an j images for good k images cos_phi2, good_idx = self._get_cos_phis(cl_diff1, cl_diff2, cl_diff3, n_theta) @@ -115,7 +118,7 @@ def _vote_ij(self, clmatrix, n_theta, i, j, k_list): return [] # Parameters used to compute the smoothed angle histogram. - ntics = 60 + ntics = int(180 / self.tic_width) angles_grid = np.linspace(0, 180, ntics, True) # Get angles between images i and j for computing the histogram angles = np.arccos(phis[:]) * 180 / np.pi @@ -218,4 +221,5 @@ def _get_cos_phis(self, cl_diff1, cl_diff2, cl_diff3, n_theta): cos_phi2 = (c3[good_idx] - c1[good_idx] * c2[good_idx]) / ( np.sin(theta1[good_idx]) * np.sin(theta2[good_idx]) ) + return cos_phi2, good_idx From 9bfd757b9cae4c331adab088373dccaa353350c5 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Sun, 8 Sep 2024 07:50:41 -0400 Subject: [PATCH 297/433] hist width and peak spread patches --- src/aspire/abinitio/commonline_base.py | 11 +++++++--- src/aspire/abinitio/commonline_sync.py | 16 +++++++++++++- src/aspire/abinitio/commonline_sync3n.py | 8 +++++++ src/aspire/abinitio/sync_voting.py | 27 ++++++++++++++++++++++-- 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/src/aspire/abinitio/commonline_base.py b/src/aspire/abinitio/commonline_base.py index 3bed626d87..33f2a600e9 100644 --- a/src/aspire/abinitio/commonline_base.py +++ b/src/aspire/abinitio/commonline_base.py @@ -23,7 +23,8 @@ def __init__( n_rad=None, n_theta=360, n_check=None, - tic_width=1, + hist_bin_width=3, + full_width=6, max_shift=0.15, shift_step=1, mask=True, @@ -43,7 +44,10 @@ def __init__( of the resolution. Default is 0.15. :param shift_step: Resolution of shift estimation in pixels. Default is 1 pixel. - :param tic_width: Bin width in smoothing histogram (a tic is approx a degree). + :param hist_bin_width: Bin width in smoothing histogram (degrees). + :param full_width: Selection width around smoothed histogram peak (degrees). + `adaptive` will attempt to automatically find the smallest number of + `hist_bin_width`s required to find at least one valid image index. :param mask: Option to mask `src.images` with a fuzzy mask (boolean). Default, `True`, applies a mask. """ @@ -55,7 +59,8 @@ def __init__( self.n_rad = n_rad self.n_theta = n_theta self.n_check = n_check - self.tic_width = tic_width + self.hist_bin_width = hist_bin_width + self.full_width = full_width self.clmatrix = None self.max_shift = math.ceil(max_shift * self.n_res) self.shift_step = shift_step diff --git a/src/aspire/abinitio/commonline_sync.py b/src/aspire/abinitio/commonline_sync.py index 5e07181f4a..f8986351bb 100644 --- a/src/aspire/abinitio/commonline_sync.py +++ b/src/aspire/abinitio/commonline_sync.py @@ -24,7 +24,15 @@ class CLSyncVoting(CLOrient3D, SyncVotingMixin): """ def __init__( - self, src, n_rad=None, n_theta=360, max_shift=0.15, shift_step=1, mask=True + self, + src, + n_rad=None, + n_theta=360, + max_shift=0.15, + shift_step=1, + hist_bin_width=3, + full_width=6, + mask=True, ): """ Initialize an object for estimating 3D orientations using synchronization matrix @@ -36,6 +44,10 @@ def __init__( :param max_shift: Determines maximum range for shifts as a proportion of the resolution. Default is 0.15. :param shift_step: Resolution for shift estimation in pixels. Default is 1 pixel. + :param hist_bin_width: Bin width in smoothing histogram (degrees). + :param full_width: Selection width around smoothed histogram peak (degrees). + `adaptive` will attempt to automatically find the smallest number of + `hist_bin_width`s required to find at least one valid image index. :param mask: Option to mask `src.images` with a fuzzy mask (boolean). Default, `True`, applies a mask. """ @@ -45,6 +57,8 @@ def __init__( n_theta=n_theta, max_shift=max_shift, shift_step=shift_step, + hist_bin_width=hist_bin_width, + full_width=full_width, mask=mask, ) self.syncmatrix = None diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 77efcc86d8..7bf8a25502 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -52,6 +52,8 @@ def __init__( n_theta=360, max_shift=0.15, shift_step=1, + hist_bin_width=1, + full_width="adaptive", epsilon=1e-2, max_iters=1000, seed=None, @@ -69,6 +71,10 @@ def __init__( :param n_theta: The number of points in the theta direction :param max_shift: Maximum range for shifts as a proportion of box size. Default = 0.15. :param shift_step: Step size of shift estimation in pixels. Default = 1 pixel. + :param hist_bin_width: Bin width in smoothing histogram (degrees). + :param full_width: Selection width around smoothed histogram peak (degrees). + `adaptive` will attempt to automatically find the smallest number of + `hist_bin_width`s required to find at least one valid image index. :param epsilon: Tolerance for the power method. :param max_iter: Maximum iterations for the power method. :param seed: Optional seed for RNG. @@ -91,6 +97,8 @@ def __init__( n_theta=n_theta, max_shift=max_shift, shift_step=shift_step, + hist_bin_width=hist_bin_width, + full_width=full_width, mask=mask, ) diff --git a/src/aspire/abinitio/sync_voting.py b/src/aspire/abinitio/sync_voting.py index aba9ae8d38..25ca2d4dd4 100644 --- a/src/aspire/abinitio/sync_voting.py +++ b/src/aspire/abinitio/sync_voting.py @@ -118,7 +118,7 @@ def _vote_ij(self, clmatrix, n_theta, i, j, k_list): return [] # Parameters used to compute the smoothed angle histogram. - ntics = int(180 / self.tic_width) + ntics = int(180 / self.hist_bin_width) angles_grid = np.linspace(0, 180, ntics, True) # Get angles between images i and j for computing the histogram angles = np.arccos(phis[:]) * 180 / np.pi @@ -145,8 +145,31 @@ def _vote_ij(self, clmatrix, n_theta, i, j, k_list): # tics, since the peak might move a little bit due to wrong k images # that accidentally fall near the peak. peak_idx = angles_hist.argmax() - idx = np.abs(angles - angles_grid[peak_idx]) < 360 / ntics + + if str(self.full_width).lower() == "adaptive": + # Adaptive width (MATLAB) + # % look for the estimations in the peak of the histogram + # w_theta_needed = 0; + # idx = []; + # while numel(idx) == 0 + # w_theta_needed = w_theta_needed + w_theta; % widen peak as needed + # idx = find( abs(angles-angle_tics(peakidx)) < w_theta_needed ); + # end + w_theta_needed = 0 + idx = [] + while sum(idx) == 0: + w_theta_needed += self.hist_bin_width # widen peak as needed + idx = np.abs(angles - angles_grid[peak_idx]) < w_theta_needed + if w_theta_needed > self.hist_bin_width: + logger.info( + f"adaptive ({i},{j}) w_theta_needed={w_theta_needed} sum(idx)={sum(idx)}" + ) + else: + # Fixed width + idx = np.abs(angles - angles_grid[peak_idx]) < self.full_width + good_k = inds[idx] + return good_k.astype("int") def _get_cos_phis(self, cl_diff1, cl_diff2, cl_diff3, n_theta): From ddb7fede30927052271ac9a85a6bade76d3aef42 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 10 Sep 2024 14:20:35 -0400 Subject: [PATCH 298/433] common line bug fixes and cleanup repros matlab alpha angles [skip ci] --- src/aspire/abinitio/commonline_c3_c4.py | 2 +- src/aspire/abinitio/commonline_sync.py | 2 +- src/aspire/abinitio/commonline_sync3n.py | 22 ++--- src/aspire/abinitio/sync_voting.py | 100 +++++++++++++++-------- 4 files changed, 76 insertions(+), 50 deletions(-) diff --git a/src/aspire/abinitio/commonline_c3_c4.py b/src/aspire/abinitio/commonline_c3_c4.py index 0e0ca76565..670d314d36 100644 --- a/src/aspire/abinitio/commonline_c3_c4.py +++ b/src/aspire/abinitio/commonline_c3_c4.py @@ -561,7 +561,7 @@ def _syncmatrix_ij_vote_3n(self, clmatrix, i, j, k_list, n_theta): :param n_theta: The number of points in the theta direction (common lines) :return: The (i,j) rotation block of the synchronization matrix """ - good_k = self._vote_ij(clmatrix, n_theta, i, j, k_list) + _, good_k = self._vote_ij(clmatrix, n_theta, i, j, k_list) rots = self._rotratio_eulerangle_vec(clmatrix, i, j, good_k, n_theta) diff --git a/src/aspire/abinitio/commonline_sync.py b/src/aspire/abinitio/commonline_sync.py index f8986351bb..aae9e4b3e0 100644 --- a/src/aspire/abinitio/commonline_sync.py +++ b/src/aspire/abinitio/commonline_sync.py @@ -203,7 +203,7 @@ def _syncmatrix_ij_vote(self, clmatrix, i, j, k_list, n_theta): :return: The (i,j) rotation block of the synchronization matrix """ - good_k = self._vote_ij(clmatrix, n_theta, i, j, k_list) + _, good_k = self._vote_ij(clmatrix, n_theta, i, j, k_list) rots = self._rotratio_eulerangle_vec(clmatrix, i, j, good_k, n_theta) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 7bf8a25502..2bee427453 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -792,15 +792,12 @@ def _estimate_all_Rijs(self, clmatrix): n_img = self.n_img n_theta = self.n_theta Rijs = np.zeros((len(self._pairs), 3, 3)) - dbg_angles = np.zeros((len(self._pairs), 3)) for idx, (i, j) in enumerate(tqdm(self._pairs, desc="Estimate Rijs")): - Rijs[idx], dbg_angles[idx] = self._syncmatrix_ij_vote_3n( + Rijs[idx] = self._syncmatrix_ij_vote_3n( clmatrix, i, j, np.arange(n_img), n_theta ) - np.save("Rijs.npy", Rijs) - np.save("dbg_angles.npy", dbg_angles) return Rijs def _syncmatrix_ij_vote_3n(self, clmatrix, i, j, k_list, n_theta): @@ -817,21 +814,14 @@ def _syncmatrix_ij_vote_3n(self, clmatrix, i, j, k_list, n_theta): :param n_theta: The number of points in the theta direction (common lines) :return: The (i,j) rotation block of the synchronization matrix """ - good_k = self._vote_ij(clmatrix, n_theta, i, j, k_list) + alphas, good_k = self._vote_ij(clmatrix, n_theta, i, j, k_list, sync=True) - angle = self._rotratio_eulerangle_vec(clmatrix, i, j, good_k, n_theta) angles = np.zeros(3) - if angle is not None: - # # # BAD - # # Convert the Euler angles with ZYZ conversion to rotation matrices - # angles[0] = clmatrix[i, j] * 2 * np.pi / n_theta + np.pi / 2 - # angles[1] = angle - # angles[2] = -np.pi / 2 - clmatrix[j, i] * 2 * np.pi / n_theta - # rot = Rotation.from_euler(angles).matrices - + if alphas is not None: + # TODO, fixup to ZYZ? or? angles[0] = clmatrix[i, j] * 2 * np.pi / n_theta - np.pi - angles[1] = angle + angles[1] = np.mean(alphas) angles[2] = np.pi - clmatrix[j, i] * 2 * np.pi / n_theta rot = sprot.from_euler("ZXZ", angles).as_matrix() @@ -841,7 +831,7 @@ def _syncmatrix_ij_vote_3n(self, clmatrix, i, j, k_list, n_theta): # We set to zero as in the Matlab code. rot = np.zeros((3, 3)) - return rot, angles + return rot ####################################### # Secondary Methods for Global J Sync # diff --git a/src/aspire/abinitio/sync_voting.py b/src/aspire/abinitio/sync_voting.py index 25ca2d4dd4..3f56e85f33 100644 --- a/src/aspire/abinitio/sync_voting.py +++ b/src/aspire/abinitio/sync_voting.py @@ -2,6 +2,8 @@ import numpy as np +from aspire.utils import Rotation + logger = logging.getLogger(__name__) @@ -35,18 +37,29 @@ def _rotratio_eulerangle_vec(self, clmatrix, i, j, good_k, n_theta): # cl_diff2 is for the angle on C2 created by its intersection with C1 and C3. # cl_diff3 is for the angle on C3 created by its intersection with C2 and C1. cl_diff1 = clmatrix[i, good_k] - clmatrix[i, j] # for theta1 - cl_diff2 = clmatrix[j, good_k] - clmatrix[j, i] # for - theta2 + cl_diff2 = clmatrix[j, good_k] - clmatrix[j, i] # for theta2 cl_diff3 = clmatrix[good_k, j] - clmatrix[good_k, i] # for theta3 # Calculate the cos values of rotation angles between i an j images for good k images - c_alpha, good_idx = self._get_cos_phis(cl_diff1, cl_diff2, cl_diff3, n_theta) + c_alpha, good_idx = self._get_cos_phis( + cl_diff1, cl_diff2, cl_diff3, n_theta, sync=False + ) + if len(c_alpha) == 0: return None alpha = np.arccos(c_alpha) - return np.mean(alpha) + # # TODO?? + # Convert the Euler angles with ZYZ conversion to rotation matrices + angles = np.zeros((alpha.shape[0], 3)) + angles[:, 0] = clmatrix[i, j] * 2 * np.pi / n_theta + np.pi / 2 + angles[:, 1] = alpha + angles[:, 2] = -np.pi / 2 - clmatrix[j, i] * 2 * np.pi / n_theta + r = Rotation.from_euler(angles).matrices - def _vote_ij(self, clmatrix, n_theta, i, j, k_list): + return r[good_idx, :, :] + + def _vote_ij(self, clmatrix, n_theta, i, j, k_list, sync=False): """ Apply the voting algorithm for images i and j. @@ -59,12 +72,13 @@ def _vote_ij(self, clmatrix, n_theta, i, j, k_list): :param i: The i image :param j: The j image :param k_list: The list of images for the third image for voting algorithm + :param sync: :return: good_k, the list of all third images in the peak of the histogram corresponding to the pair of images (i,j) """ if i == j or clmatrix[i, j] == -1: - return [] + return None, [] # Some of the entries in clmatrix may be zero if we cleared # them due to small correlation, or if for each image @@ -93,13 +107,13 @@ def _vote_ij(self, clmatrix, n_theta, i, j, k_list): # cl_diff2 is for the angle on C2 created by its intersection with C1 and C3. # cl_diff3 is for the angle on C3 created by its intersection with C2 and C1. cl_diff1 = cl_idx13 - cl_idx12 - # bad or just a trig identity? - cl_diff2 = cl_idx21 - cl_idx23 - # cl_diff2 = cl_idx23 - cl_idx21 # theta2 = (clmatrix(j,K)-clmatrix(j,i)) * 2*pi/L; + cl_diff2 = cl_idx23 - cl_idx21 cl_diff3 = cl_idx32 - cl_idx31 # Calculate the cos values of rotation angles between i an j images for good k images - cos_phi2, good_idx = self._get_cos_phis(cl_diff1, cl_diff2, cl_diff3, n_theta) + cos_phi2, good_idx = self._get_cos_phis( + cl_diff1, cl_diff2, cl_diff3, n_theta, sync=sync + ) if np.any(np.abs(cos_phi2) - 1 > 1e-12): logger.warning( @@ -115,13 +129,15 @@ def _vote_ij(self, clmatrix, n_theta, i, j, k_list): inds = k_list[good_idx] if phis.shape[0] == 0: - return [] + return None, [] # Parameters used to compute the smoothed angle histogram. ntics = int(180 / self.hist_bin_width) - angles_grid = np.linspace(0, 180, ntics, True) + angles_grid = np.linspace(0, 180, ntics + 1, True) + # Get angles between images i and j for computing the histogram angles = np.arccos(phis[:]) * 180 / np.pi + # Angles that are up to 10 degrees apart are considered # similar. This sigma ensures that the width of the density # estimation kernel is roughly 10 degrees. For 15 degrees, the @@ -129,14 +145,8 @@ def _vote_ij(self, clmatrix, n_theta, i, j, k_list): sigma = 3.0 # Compute the histogram of the angles between images i and j - squared_values = np.add.outer(np.square(angles), np.square(angles_grid)) - angles_hist = np.sum( - np.exp( - (2 * np.multiply.outer(angles, angles_grid) - squared_values) - / (2 * sigma**2) - ), - 0, - ) + angles_distances = angles_grid[None, :] - angles[:, None] + angles_hist = np.sum(np.exp(-(angles_distances**2) / (2 * sigma**2)), axis=0) # We assume that at the location of the peak we get the true angle # between images i and j. Find all third images k, that induce an @@ -148,13 +158,7 @@ def _vote_ij(self, clmatrix, n_theta, i, j, k_list): if str(self.full_width).lower() == "adaptive": # Adaptive width (MATLAB) - # % look for the estimations in the peak of the histogram - # w_theta_needed = 0; - # idx = []; - # while numel(idx) == 0 - # w_theta_needed = w_theta_needed + w_theta; % widen peak as needed - # idx = find( abs(angles-angle_tics(peakidx)) < w_theta_needed ); - # end + # Look for the estimations in the peak of the histogram w_theta_needed = 0 idx = [] while sum(idx) == 0: @@ -162,17 +166,18 @@ def _vote_ij(self, clmatrix, n_theta, i, j, k_list): idx = np.abs(angles - angles_grid[peak_idx]) < w_theta_needed if w_theta_needed > self.hist_bin_width: logger.info( - f"adaptive ({i},{j}) w_theta_needed={w_theta_needed} sum(idx)={sum(idx)}" + f"Adaptive width {w_theta_needed} required for ({i},{j}), found {sum(idx)} indices." ) else: # Fixed width idx = np.abs(angles - angles_grid[peak_idx]) < self.full_width good_k = inds[idx] + alpha = np.arccos(phis[idx]) - return good_k.astype("int") + return alpha, good_k.astype("int") - def _get_cos_phis(self, cl_diff1, cl_diff2, cl_diff3, n_theta): + def _get_cos_phis(self, cl_diff1, cl_diff2, cl_diff3, n_theta, sync=False): """ Calculate cos values of rotation angles between i and j images @@ -196,6 +201,7 @@ def _get_cos_phis(self, cl_diff1, cl_diff2, cl_diff3, n_theta): :param cl_diff3: Difference of common line indices on C3 created by its intersection with C2 and C1 :param n_theta: The number of points in the theta direction (common lines) + :param sync: :return: cos values of rotation angles between i and j images and indices for good k """ @@ -241,8 +247,38 @@ def _get_cos_phis(self, cl_diff1, cl_diff2, cl_diff3, n_theta): good_idx = np.nonzero(cond > 1e-5)[0] # Calculated cos values of angle between i and j images - cos_phi2 = (c3[good_idx] - c1[good_idx] * c2[good_idx]) / ( - np.sin(theta1[good_idx]) * np.sin(theta2[good_idx]) - ) + if sync: + # MATLAB + cos_phi2 = (c3[good_idx] - c1[good_idx] * c2[good_idx]) / ( + np.sqrt(1 - c1[good_idx] ** 2) * np.sqrt(1 - c2[good_idx] ** 2) + ) + + # Some synchronization must be applied when common line is + # out by 180 degrees. + # Here fix the angles between c_ij(c_ji) and c_ik(c_jk) to be smaller than pi/2, + # otherwise there will be an ambiguity between alpha and pi-alpha. + TOL_idx = 1e-12 + + # Select only good_idx + theta1 = theta1[good_idx] + theta2 = theta2[good_idx] + theta3 = theta3[good_idx] + + # Check sync conditions + ind1 = (theta1 > (np.pi + TOL_idx)) | ( + (theta1 < -TOL_idx) & (theta1 > -np.pi) + ) + ind2 = (theta2 > (np.pi + TOL_idx)) | ( + (theta2 < -TOL_idx) & (theta2 > -np.pi) + ) + align180 = (ind1 & ~ind2) | (~ind1 & ind2) + + # Apply sync + cos_phi2[align180] = -cos_phi2[align180] + else: + # Python + cos_phi2 = (c3[good_idx] - c1[good_idx] * c2[good_idx]) / ( + np.sin(theta1[good_idx]) * np.sin(theta2[good_idx]) + ) return cos_phi2, good_idx From 1d8c4d7e3e762a3bbc8424e10a1c73cbdfe41f84 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 11 Sep 2024 10:52:19 -0400 Subject: [PATCH 299/433] after compat changes, restore zyz convention --- src/aspire/abinitio/commonline_sync3n.py | 17 +++++++++++------ src/aspire/abinitio/sync_voting.py | 1 - 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 2bee427453..74f1d3bf21 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -5,10 +5,16 @@ import numpy as np from numpy.linalg import norm from scipy.optimize import curve_fit -from scipy.spatial.transform import Rotation as sprot from aspire.abinitio import CLOrient3D, SyncVotingMixin -from aspire.utils import J_conjugate, all_pairs, nearest_rotations, tqdm, trange +from aspire.utils import ( + J_conjugate, + Rotation, + all_pairs, + nearest_rotations, + tqdm, + trange, +) from aspire.utils.matlab_compat import stable_eigsh from aspire.utils.random import randn @@ -819,11 +825,10 @@ def _syncmatrix_ij_vote_3n(self, clmatrix, i, j, k_list, n_theta): angles = np.zeros(3) if alphas is not None: - # TODO, fixup to ZYZ? or? - angles[0] = clmatrix[i, j] * 2 * np.pi / n_theta - np.pi + angles[0] = clmatrix[i, j] * 2 * np.pi / n_theta + np.pi / 2 angles[1] = np.mean(alphas) - angles[2] = np.pi - clmatrix[j, i] * 2 * np.pi / n_theta - rot = sprot.from_euler("ZXZ", angles).as_matrix() + angles[2] = -np.pi / 2 - clmatrix[j, i] * 2 * np.pi / n_theta + rot = Rotation.from_euler(angles).matrices else: # This is for the case that images i and j correspond to the same diff --git a/src/aspire/abinitio/sync_voting.py b/src/aspire/abinitio/sync_voting.py index 3f56e85f33..ec94ae11b9 100644 --- a/src/aspire/abinitio/sync_voting.py +++ b/src/aspire/abinitio/sync_voting.py @@ -49,7 +49,6 @@ def _rotratio_eulerangle_vec(self, clmatrix, i, j, good_k, n_theta): return None alpha = np.arccos(c_alpha) - # # TODO?? # Convert the Euler angles with ZYZ conversion to rotation matrices angles = np.zeros((alpha.shape[0], 3)) angles[:, 0] = clmatrix[i, j] * 2 * np.pi / n_theta + np.pi / 2 From b96265ff91b54de3f3bc14dc3932e114c1f07068 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 11 Sep 2024 13:27:01 -0400 Subject: [PATCH 300/433] add sync param docstring --- src/aspire/abinitio/sync_voting.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/aspire/abinitio/sync_voting.py b/src/aspire/abinitio/sync_voting.py index ec94ae11b9..fb626a8a91 100644 --- a/src/aspire/abinitio/sync_voting.py +++ b/src/aspire/abinitio/sync_voting.py @@ -71,9 +71,10 @@ def _vote_ij(self, clmatrix, n_theta, i, j, k_list, sync=False): :param i: The i image :param j: The j image :param k_list: The list of images for the third image for voting algorithm - :param sync: - :return: good_k, the list of all third images in the peak of the histogram - corresponding to the pair of images (i,j) + :param sync: Perform 180 degree ambiguity synchronization. + :return: (alpha, good_k), angles and list of all third images + in the peak of the histogram corresponding to the pair of + images (i,j) """ if i == j or clmatrix[i, j] == -1: @@ -200,7 +201,7 @@ def _get_cos_phis(self, cl_diff1, cl_diff2, cl_diff3, n_theta, sync=False): :param cl_diff3: Difference of common line indices on C3 created by its intersection with C2 and C1 :param n_theta: The number of points in the theta direction (common lines) - :param sync: + :param sync: Perform 180 degree ambiguity synchronization. :return: cos values of rotation angles between i and j images and indices for good k """ From 89ff29317b3e7baf92305f32f32e1f54bfacc8dc Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 13 Sep 2024 07:19:42 -0400 Subject: [PATCH 301/433] stash debugging work S and Rots, match up to CL mat --- src/aspire/abinitio/commonline_sync3n.py | 38 ++++++++++++++++++------ src/aspire/utils/coor_trans.py | 1 + tests/test_commonline_sync3n.py | 12 ++++---- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 74f1d3bf21..abe603f27b 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -16,7 +16,7 @@ trange, ) from aspire.utils.matlab_compat import stable_eigsh -from aspire.utils.random import randn +from aspire.utils.random import rand logger = logging.getLogger(__name__) @@ -191,6 +191,9 @@ def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): :param n_eigs: Optional, number of eigenvalues to compute (min 3). """ + # Critical this occurs in double precision + S = S.astype(np.float64, copy=False) + if n_eigs < 3: raise ValueError( f"n_eigs must be greater than 3, default is 4. Invoked with {n_eigs}" @@ -204,6 +207,8 @@ def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): f" Received {W.shape}." ) # Initialize D + # Critical this occurs in double precision + W = W.astype(np.float64, copy=False) D = np.mean(W, axis=1) Dhalf = D @@ -227,13 +232,14 @@ def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): W = np.kron(W, np.ones((3, 3), dtype=self.dtype)) # Make Dhalf of size 3Nx3N - Dhalf = np.diag(np.kron(np.diag(Dhalf), np.ones(3, dtype=self.dtype))) + Dhalf = np.diag(np.kron(np.diag(Dhalf), np.ones(3, dtype=np.float64))) # Apply weights to S S = Dhalf @ (W * S) @ Dhalf # Extract three eigenvectors corresponding to non-zero eigenvalues. - d, v = stable_eigsh(S, n_eigs) + d, v = stable_eigsh(S, n_eigs, which="LM") + sort_idx = np.argsort(-d) logger.info( f"Top {n_eigs} eigenvalues from synchronization voting matrix: {d[sort_idx]}" @@ -249,13 +255,21 @@ def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): # to multiply: v = Dhalf @ v - # Yield estimated rotations from the eigen-vectors - rotations = v.reshape(self.n_img, 3, 3).transpose(0, 2, 1) + # # quick hack the matlab code in here + H = v.T.reshape(3, self.n_img, 3) + rotations = np.zeros((self.n_img, 3, 3), dtype=np.float64) + for i in range(self.n_img): + U, _, V = np.linalg.svd(H[:, i, :]) + # breakpoint() + rotations[i] = U @ V + + # # Yield estimated rotations from the eigen-vectors + # rotations = v.reshape(self.n_img, 3, 3).transpose(0, 2, 1) - # Enforce we are returning actual rotations - rotations = nearest_rotations(rotations) + # # Enforce we are returning actual rotations + # rotations = nearest_rotations(rotations) - return rotations + return rotations.astype(self.dtype) def _construct_sync3n_matrix(self, Rij): """ @@ -829,6 +843,11 @@ def _syncmatrix_ij_vote_3n(self, clmatrix, i, j, k_list, n_theta): angles[1] = np.mean(alphas) angles[2] = -np.pi / 2 - clmatrix[j, i] * 2 * np.pi / n_theta rot = Rotation.from_euler(angles).matrices + # from scipy.spatial.transform import Rotation as sprot + # angles[0] = clmatrix[i, j] * 2 * np.pi / n_theta - np.pi + # angles[1] = np.mean(alphas) + # angles[2] = np.pi - clmatrix[j, i] * 2 * np.pi / n_theta + # rot = sprot.from_euler("ZXZ", angles).as_matrix() else: # This is for the case that images i and j correspond to the same @@ -866,7 +885,7 @@ def _J_sync_power_method(self, Rijs): # Initialize candidate eigenvectors n_Rijs = Rijs.shape[0] - vec = randn(n_Rijs, seed=self.seed) + vec = rand(n_Rijs, seed=self.seed) vec = vec / norm(vec) residual = 1 itr = 0 @@ -890,6 +909,7 @@ def _J_sync_power_method(self, Rijs): # We need only the signs of the eigenvector J_sync = np.sign(vec) + J_sync = -1 * np.sign(J_sync[0]) * J_sync # Stabilize J_sync return J_sync diff --git a/src/aspire/utils/coor_trans.py b/src/aspire/utils/coor_trans.py index cad8fb0295..9745484485 100644 --- a/src/aspire/utils/coor_trans.py +++ b/src/aspire/utils/coor_trans.py @@ -299,6 +299,7 @@ def mean_aligned_angular_distance(rots_est, rots_gt, degree_tol=None): and the ground truth (in degrees). """ Q_mat, flag = register_rotations(rots_est, rots_gt) + print("Q_mat", Q_mat, "\nflag", flag) regrot = get_aligned_rotations(rots_est, Q_mat, flag) mean_ang_dist = Rotation.mean_angular_distance(regrot, rots_gt) * 180 / np.pi diff --git a/tests/test_commonline_sync3n.py b/tests/test_commonline_sync3n.py index 6640fa871f..6472e31eb0 100644 --- a/tests/test_commonline_sync3n.py +++ b/tests/test_commonline_sync3n.py @@ -53,7 +53,7 @@ def source_orientation_objs(resolution, offsets, dtype): seed=456, ).cache() - orient_est = CLSync3N(src, S_weighting=True, seed=789) + orient_est = CLSync3N(src, n_theta=72, S_weighting=True, seed=789) return src, orient_est @@ -68,15 +68,15 @@ def test_build_clmatrix(source_orientation_objs): angle_diffs = abs(orient_est.clmatrix - gt_clmatrix) * 360 / orient_est.n_theta - # Count number of estimates within 5 degrees of ground truth. - within_5 = np.sum((angle_diffs - 360) % 360 < 5) + # Count number of estimates near ground truth. + within = np.sum((angle_diffs - 360) % 360 < 10) - # Check that at least 98% of estimates are within 5 degrees. - tol = 0.98 + # Check that at least 95% of estimates are within degree range. + tol = 0.96 if src.offsets.all() != 0: # Set tolerance to 95% when using nonzero offsets. tol = 0.95 - assert within_5 / angle_diffs.size > tol + assert within / angle_diffs.size > tol def test_estimate_rotations(source_orientation_objs): From 97bc6300d634b7fe0f546ab961c761751ded8400 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 16 Sep 2024 13:46:09 -0400 Subject: [PATCH 302/433] cleanup rotation comparison debug, adds logger --- src/aspire/abinitio/commonline_sync3n.py | 16 ++++------------ src/aspire/utils/coor_trans.py | 5 ++++- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index abe603f27b..d1ea5ab289 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -255,19 +255,11 @@ def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): # to multiply: v = Dhalf @ v - # # quick hack the matlab code in here - H = v.T.reshape(3, self.n_img, 3) - rotations = np.zeros((self.n_img, 3, 3), dtype=np.float64) - for i in range(self.n_img): - U, _, V = np.linalg.svd(H[:, i, :]) - # breakpoint() - rotations[i] = U @ V - - # # Yield estimated rotations from the eigen-vectors - # rotations = v.reshape(self.n_img, 3, 3).transpose(0, 2, 1) + # Yield estimated rotations from the eigen-vectors + rotations = v.reshape(self.n_img, 3, 3).transpose(0, 2, 1) - # # Enforce we are returning actual rotations - # rotations = nearest_rotations(rotations) + # Enforce we are returning actual rotations + rotations = nearest_rotations(rotations) return rotations.astype(self.dtype) diff --git a/src/aspire/utils/coor_trans.py b/src/aspire/utils/coor_trans.py index 9745484485..f17c23a0f0 100644 --- a/src/aspire/utils/coor_trans.py +++ b/src/aspire/utils/coor_trans.py @@ -2,6 +2,7 @@ General purpose math functions, mostly geometric in nature. """ +import logging import math import numpy as np @@ -12,6 +13,8 @@ from aspire.utils.random import Random from aspire.utils.rotation import Rotation +logger = logging.getLogger(__name__) + def cart2pol(x, y): """ @@ -299,7 +302,7 @@ def mean_aligned_angular_distance(rots_est, rots_gt, degree_tol=None): and the ground truth (in degrees). """ Q_mat, flag = register_rotations(rots_est, rots_gt) - print("Q_mat", Q_mat, "\nflag", flag) + logger.debug(f"Registration Q_mat: {Q_mat}\nflag: {flag}") regrot = get_aligned_rotations(rots_est, Q_mat, flag) mean_ang_dist = Rotation.mean_angular_distance(regrot, rots_gt) * 180 / np.pi From 363832594f41b09951b8e4028c8cc2e5881c9190 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 16 Sep 2024 14:15:55 -0400 Subject: [PATCH 303/433] Fix reflection bug in nearest_rotation --- src/aspire/abinitio/commonline_sync3n.py | 2 +- src/aspire/utils/matrix.py | 17 +++++++++++------ tests/test_commonline_sync3n.py | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index d1ea5ab289..c96ec60bc9 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -259,7 +259,7 @@ def _sync3n_S_to_rot(self, S, W=None, n_eigs=4): rotations = v.reshape(self.n_img, 3, 3).transpose(0, 2, 1) # Enforce we are returning actual rotations - rotations = nearest_rotations(rotations) + rotations = nearest_rotations(rotations, allow_reflection=True) return rotations.astype(self.dtype) diff --git a/src/aspire/utils/matrix.py b/src/aspire/utils/matrix.py index 5e56d2e65e..782891f122 100644 --- a/src/aspire/utils/matrix.py +++ b/src/aspire/utils/matrix.py @@ -434,11 +434,12 @@ def best_rank1_approximation(A): return (U @ S_rank1 @ V).reshape(og_shape) -def nearest_rotations(A): +def nearest_rotations(A, allow_reflection=False): """ Uses the SVD method to compute the set of nearest rotations to the set A of noisy rotations. :param A: A 2D array or a 3D array where the first axis is the stack axis. + :param allow_reflection: Optionally correct reflections. :return: ndarray of rotations of equal size to A. """ og_shape = A.shape @@ -451,12 +452,16 @@ def nearest_rotations(A): f"Array must be of shape (3, 3) or (n, 3, 3). Found shape {A.shape}." ) - # For the singular value decomposition A = U @ S @ V, we compute the nearest rotation - # matrices R = U @ V. If det(U)*det(V) = -1, we negate the third singular value to ensure - # we have a rotation. + # For the singular value decomposition A = U @ S @ V, + # we compute the nearest rotation matrices R = U @ V. U, _, V = np.linalg.svd(A) - neg_det_idx = np.linalg.det(U) * np.linalg.det(V) < 0 - U[neg_det_idx] = U[neg_det_idx] @ np.diag((1, 1, -1)).astype(dtype, copy=False) + + if not allow_reflection: + # If det(U)*det(V) = -1, we negate the third singular value to + # ensure we have a rotation. + neg_det_idx = np.linalg.det(U) * np.linalg.det(V) < 0 + U[neg_det_idx] = U[neg_det_idx] @ np.diag((1, 1, -1)).astype(dtype, copy=False) + rots = U @ V return rots.reshape(og_shape) diff --git a/tests/test_commonline_sync3n.py b/tests/test_commonline_sync3n.py index 6472e31eb0..c69116a326 100644 --- a/tests/test_commonline_sync3n.py +++ b/tests/test_commonline_sync3n.py @@ -71,7 +71,7 @@ def test_build_clmatrix(source_orientation_objs): # Count number of estimates near ground truth. within = np.sum((angle_diffs - 360) % 360 < 10) - # Check that at least 95% of estimates are within degree range. + # Check estimates are within degree range. tol = 0.96 if src.offsets.all() != 0: # Set tolerance to 95% when using nonzero offsets. From 661f12123361cbc8ea89576eb8ada4dbdc396c53 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 16 Sep 2024 14:37:47 -0400 Subject: [PATCH 304/433] revert sync3n test --- tests/test_commonline_sync3n.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_commonline_sync3n.py b/tests/test_commonline_sync3n.py index c69116a326..6640fa871f 100644 --- a/tests/test_commonline_sync3n.py +++ b/tests/test_commonline_sync3n.py @@ -53,7 +53,7 @@ def source_orientation_objs(resolution, offsets, dtype): seed=456, ).cache() - orient_est = CLSync3N(src, n_theta=72, S_weighting=True, seed=789) + orient_est = CLSync3N(src, S_weighting=True, seed=789) return src, orient_est @@ -68,15 +68,15 @@ def test_build_clmatrix(source_orientation_objs): angle_diffs = abs(orient_est.clmatrix - gt_clmatrix) * 360 / orient_est.n_theta - # Count number of estimates near ground truth. - within = np.sum((angle_diffs - 360) % 360 < 10) + # Count number of estimates within 5 degrees of ground truth. + within_5 = np.sum((angle_diffs - 360) % 360 < 5) - # Check estimates are within degree range. - tol = 0.96 + # Check that at least 98% of estimates are within 5 degrees. + tol = 0.98 if src.offsets.all() != 0: # Set tolerance to 95% when using nonzero offsets. tol = 0.95 - assert within / angle_diffs.size > tol + assert within_5 / angle_diffs.size > tol def test_estimate_rotations(source_orientation_objs): From 1559eaa316b8d19966ab0d66346fba114bcd2ef1 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 16 Sep 2024 15:23:42 -0400 Subject: [PATCH 305/433] more cleanup --- src/aspire/abinitio/commonline_sync3n.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index c96ec60bc9..6ec3b51e4a 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -835,11 +835,6 @@ def _syncmatrix_ij_vote_3n(self, clmatrix, i, j, k_list, n_theta): angles[1] = np.mean(alphas) angles[2] = -np.pi / 2 - clmatrix[j, i] * 2 * np.pi / n_theta rot = Rotation.from_euler(angles).matrices - # from scipy.spatial.transform import Rotation as sprot - # angles[0] = clmatrix[i, j] * 2 * np.pi / n_theta - np.pi - # angles[1] = np.mean(alphas) - # angles[2] = np.pi - clmatrix[j, i] * 2 * np.pi / n_theta - # rot = sprot.from_euler("ZXZ", angles).as_matrix() else: # This is for the case that images i and j correspond to the same @@ -901,7 +896,7 @@ def _J_sync_power_method(self, Rijs): # We need only the signs of the eigenvector J_sync = np.sign(vec) - J_sync = -1 * np.sign(J_sync[0]) * J_sync # Stabilize J_sync + J_sync = np.sign(J_sync[0]) * J_sync # Stabilize J_sync return J_sync From a7b7f92c0e1b30e86c694bacb74a2ed390cb20b1 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 17 Sep 2024 16:12:16 -0400 Subject: [PATCH 306/433] clarify nearest_rotation docstring --- src/aspire/utils/matrix.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aspire/utils/matrix.py b/src/aspire/utils/matrix.py index 782891f122..71c709608b 100644 --- a/src/aspire/utils/matrix.py +++ b/src/aspire/utils/matrix.py @@ -438,8 +438,10 @@ def nearest_rotations(A, allow_reflection=False): """ Uses the SVD method to compute the set of nearest rotations to the set A of noisy rotations. + Note when `allow_reflection` is `True`, results may contain reflections. + :param A: A 2D array or a 3D array where the first axis is the stack axis. - :param allow_reflection: Optionally correct reflections. + :param allow_reflection: Optionally allow reflections (disables correction). :return: ndarray of rotations of equal size to A. """ og_shape = A.shape From ab409a3c098d7673e3ee637cf4f74cfbb29dc29f Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 14 Sep 2023 12:27:53 -0400 Subject: [PATCH 307/433] Add init --- src/aspire/abinitio/commonline_d2.py | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/aspire/abinitio/commonline_d2.py diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py new file mode 100644 index 0000000000..9a72ef8ce4 --- /dev/null +++ b/src/aspire/abinitio/commonline_d2.py @@ -0,0 +1,61 @@ +import logging + +import numpy as np + +from aspire.abinitio import CLOrient3D + +logger = logging.getLogger(__name__) + + +class CLSymmetryD2(CLOrient3D): + """ + Define a class to estimate 3D orientations using common lines methods for + molecules with D2 (dihedral) symmetry. + + The related publications are: + E. Rosen and Y. Shkolnisky, + Common lines ab-initio reconstruction of D2-symmetric molecules, + """ + + def __init__( + self, + src, + n_rad=None, + n_theta=None, + max_shift=0.15, + shift_step=1, + grid_res=1200, + inplane_res=5, + eq_min_dist=7, + seed=None, + ): + """ + Initialize object for estimating 3D orientations for molecules with C3 and C4 symmetry. + + :param src: The source object of 2D denoised or class-averaged images with metadata + :param n_rad: The number of points in the radial direction + :param n_theta: The number of points in the theta direction + :param max_shift: Maximum range for shifts as a proportion of resolution. Default = 0.15. + :param shift_step: Resolution of shift estimation in pixels. Default = 1 pixel. + :param grid_res: Number of sampling points on sphere for projetion directions. + These are generated using the Saaf - Kuijlaars algoithm. Default value is 1200. + :param inplane_res: The sampling resolution of in-plane rotations for each + projetion direction. Default value is 5. + :param eq_min_dist: Width of strip around equator projection directions from + which we DO NOT sample directions. Default value is 7. + :param seed: Optional seed for RNG. + """ + + super().__init__( + src, + n_rad=n_rad, + n_theta=n_theta, + max_shift=max_shift, + shift_step=shift_step, + ) + + self.grid_res = grid_res + self.inplane_res = inplane_res + self.eq_min_dist = eq_min_dist + self.seed = seed + From e28d1105f09786b5f94ceefa6910c0bf90d33d71 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 15 Sep 2023 10:53:13 -0400 Subject: [PATCH 308/433] saff_kuijlaars shpere points. --- src/aspire/abinitio/commonline_d2.py | 66 +++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 11 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 9a72ef8ce4..48cd717c22 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -15,19 +15,20 @@ class CLSymmetryD2(CLOrient3D): The related publications are: E. Rosen and Y. Shkolnisky, Common lines ab-initio reconstruction of D2-symmetric molecules, + SIAM Journal on Imaging Sciences, volume 13-4, p. 1898-1994, 2020 """ def __init__( - self, - src, - n_rad=None, - n_theta=None, - max_shift=0.15, - shift_step=1, - grid_res=1200, - inplane_res=5, - eq_min_dist=7, - seed=None, + self, + src, + n_rad=None, + n_theta=None, + max_shift=0.15, + shift_step=1, + grid_res=1200, + inplane_res=5, + eq_min_dist=7, + seed=None, ): """ Initialize object for estimating 3D orientations for molecules with C3 and C4 symmetry. @@ -58,4 +59,47 @@ def __init__( self.inplane_res = inplane_res self.eq_min_dist = eq_min_dist self.seed = seed - + + def estimate_rotations(self): + """ + Estimate rotation matrices for molecules with C3 or C4 symmetry. + + :return: Array of rotation matrices, size n_imgx3x3. + """ + pass + + def generate_lookup_data(self): + """ + Generate candidate relative rotations and corresponding common line indices. + """ + pass + + def saff_kuijlaars(self, N): + """ + Generates N vertices on the unit sphere that are approximately evenly distributed. + + This implements the recommended algorithm in spherical coordinates + (theta, phi) according to "Distributing many points on a sphere" + by E.B. Saff and A.B.J. Kuijlaars, Mathematical Intelligencer 19.1 + (1997) 5--11. + + :param N: Number of vertices to generate. + + :return: Nx3 array of vertices in cartesian coordinates. + """ + k = np.arange(1, N + 1) + h = -1 + 2 * (k - 1) / (N - 1) + theta = np.arccos(h) + phi = np.zeros(N) + + for i in range(1, N - 1): + phi[i] = (phi[i - 1] + 3.6 / (np.sqrt(N * (1 - h[i] ** 2)))) % (2 * np.pi) + + # Spherical coordinates + x = np.sin(theta) * np.cos(phi) + y = np.sin(theta) * np.sin(phi) + z = np.cos(theta) + + mesh = np.column_stack((x, y, z)) + + return mesh From 4ef2577be8bbb8e91770a856eed6983d3cf1a69d Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 19 Sep 2023 12:01:19 -0400 Subject: [PATCH 309/433] saff_kuijlaars and mark_equators partial. --- src/aspire/abinitio/commonline_d2.py | 72 ++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 4 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 48cd717c22..5ccbbb266c 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -39,7 +39,7 @@ def __init__( :param max_shift: Maximum range for shifts as a proportion of resolution. Default = 0.15. :param shift_step: Resolution of shift estimation in pixels. Default = 1 pixel. :param grid_res: Number of sampling points on sphere for projetion directions. - These are generated using the Saaf - Kuijlaars algoithm. Default value is 1200. + These are generated using the Saaf - Kuijlaars algorithm. Default value is 1200. :param inplane_res: The sampling resolution of in-plane rotations for each projetion direction. Default value is 5. :param eq_min_dist: Width of strip around equator projection directions from @@ -72,9 +72,28 @@ def generate_lookup_data(self): """ Generate candidate relative rotations and corresponding common line indices. """ - pass - - def saff_kuijlaars(self, N): + # Generate uniform grid on sphere with Saff-Kuijlaars and take one quarter + # of sphere because of D2 symmetry redundancy. + sphere_grid = self.saff_kuijlaars(self.grid_res) + octant1_mask = np.all(sphere_grid > 0, axis=1) + octant2_mask = ( + (sphere_grid[:, 0] > 0) & (sphere_grid[:, 1] > 0) & (sphere_grid[:, 2] < 0) + ) + sphere_grid1 = sphere_grid[octant1_mask] + sphere_grid2 = sphere_grid[octant2_mask] + + # Mark Equator Directions. + # Common lines between projection directions which are perpendicular to + # symmetry axes (equator images) have common line degeneracies. Two images + # taken from directions on the same great circle which is perpendicular to + # some symmetry axis only have 2 common lines instead of 4, and must be + # treated separately. + # We detect such directions by taking a strip of radius + # eq_filter_angle about the 3 great circles perpendicular to the symmetry + # axes of D2 (i.e to X,Y and Z axes). + + @staticmethod + def saff_kuijlaars(N): """ Generates N vertices on the unit sphere that are approximately evenly distributed. @@ -103,3 +122,48 @@ def saff_kuijlaars(self, N): mesh = np.column_stack((x, y, z)) return mesh + + @staticmethod + def mark_equators(sphere_grid, eq_filter_angle): + """ + :param sphere_grid: Nx3 array of vertices in cartesian coordinates. + :param eq_filter_angle: Angular distance from equator to be marked as + an equator point. + + :return: Indices of points on sphere whose distance from one of + the equators is < eq_filter angle. + """ + # Project each vector onto xy, xz, yz planes and measure angular distance + # from each plane. + n_rots = len(sphere_grid) + angular_dists = np.zeros(3, n_rots, dtype=sphere_grid.dtype) + + proj_xy = sphere_grid.copy() + proj_xy[:, 2] = 0 + proj_xy /= np.linalg.norm(proj_xy, axis=1)[:, None] + angular_dists[0] = np.sum(sphere_grid * proj_xy, axis=-1) + + proj_xz = sphere_grid.copy() + proj_xz[:, 1] = 0 + proj_xz /= np.linalg.norm(proj_xz, axis=1)[:, None] + angular_dists[1] = np.sum(sphere_grid * proj_xz, axis=-1) + + proj_yz = sphere_grid.copy() + proj_yz[:, 0] = 0 + proj_yz /= np.linalg.norm(proj_yz, axis=1)[:, None] + angular_dists[2] = np.sum(sphere_grid * proj_yz, axis=-1) + + # Mark points close to equator (within eq_filter_angle). + eq_min_dist = np.cos(eq_filter_angle * np.pi / 180) + n_eqs_close = np.sum(angular_dists > eq_min_dist, axis=0) + eq_mask = n_eqs_close > 0 + + # Classify equators. + # 1 -> z equator + # 2 -> y equator + # 3 -> x equator + # 4 -> z top view, ie. both x and y equator + # 5 -> y top view, ie. both x and z equator + # 6 -> x top view, ie. both y and z equator + eq_class = np.zeros(n_rots) + top_view_mask = n_eqs_close > 1 From 436e1538df5280fd72a60e264896430d888bc831 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 22 Sep 2023 15:03:38 -0400 Subject: [PATCH 310/433] Mark top views and equators. Generate inplane rotations. --- src/aspire/abinitio/commonline_d2.py | 110 ++++++++++++++++++++++----- 1 file changed, 91 insertions(+), 19 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 5ccbbb266c..cb0de5958c 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -3,6 +3,7 @@ import numpy as np from aspire.abinitio import CLOrient3D +from aspire.utils import Rotation logger = logging.getLogger(__name__) @@ -91,6 +92,30 @@ def generate_lookup_data(self): # We detect such directions by taking a strip of radius # eq_filter_angle about the 3 great circles perpendicular to the symmetry # axes of D2 (i.e to X,Y and Z axes). + eq_mask1, top_view_mask1 = self.mark_equators(sphere_grid1, self.eq_min_dist) + eq_mask2, top_view_mask2 = self.mark_equators(sphere_grid2, self.eq_min_dist) + + # Mark Top View Directions. + # A Top view projection image is taken from the direction of one of the + # symmetry axes. Since all symmetry axes of D2 molecules are perpendicular + # this means that such an image is an equator with repect to both symmetry + # axes which are perpendicular to the direction of the symmetry axis from + # which the image was made, e.g. if the image was formed by projecting in + # the direction of the X (symmetry) axis, then it is an equator with + # respect to both Y and Z symmetry axes (it's direction is the + # interesection of 2 great circles perpendicular to Y and Z axes). + # Such images have severe degeneracies. A pair of Top View images (taken + # from different directions or a Top View and equator image only have a + # single common line. A top view and a regular non-equator image only have + # two common lines. + + # Remove top views from sphere grids and update equator masks. + sphere_grid1 = sphere_grid1[~top_view_mask1] + sphere_grid2 = sphere_grid2[~top_view_mask2] + eq_mask1 = eq_mask1[~top_view_mask1] + eq_mask2 = eq_mask2[~top_view_mask2] + + # Generate in-plane rotations for each grid point on the sphere. @staticmethod def saff_kuijlaars(N): @@ -135,35 +160,82 @@ def mark_equators(sphere_grid, eq_filter_angle): """ # Project each vector onto xy, xz, yz planes and measure angular distance # from each plane. - n_rots = len(sphere_grid) - angular_dists = np.zeros(3, n_rots, dtype=sphere_grid.dtype) + eq_min_dist = np.cos(eq_filter_angle * np.pi / 180) + # Mask for z-axis equator views. proj_xy = sphere_grid.copy() proj_xy[:, 2] = 0 proj_xy /= np.linalg.norm(proj_xy, axis=1)[:, None] - angular_dists[0] = np.sum(sphere_grid * proj_xy, axis=-1) + ang_dists_xy = np.sum(sphere_grid * proj_xy, axis=-1) + z_eq_mask = ang_dists_xy > eq_min_dist + # Mask for y-axis equator views. proj_xz = sphere_grid.copy() proj_xz[:, 1] = 0 proj_xz /= np.linalg.norm(proj_xz, axis=1)[:, None] - angular_dists[1] = np.sum(sphere_grid * proj_xz, axis=-1) + ang_dists_xz = np.sum(sphere_grid * proj_xz, axis=-1) + y_eq_mask = ang_dists_xz > eq_min_dist + # Mask for x-axis equator views. proj_yz = sphere_grid.copy() proj_yz[:, 0] = 0 proj_yz /= np.linalg.norm(proj_yz, axis=1)[:, None] - angular_dists[2] = np.sum(sphere_grid * proj_yz, axis=-1) + ang_dists_yz = np.sum(sphere_grid * proj_yz, axis=-1) + x_eq_mask = ang_dists_yz > eq_min_dist - # Mark points close to equator (within eq_filter_angle). - eq_min_dist = np.cos(eq_filter_angle * np.pi / 180) - n_eqs_close = np.sum(angular_dists > eq_min_dist, axis=0) - eq_mask = n_eqs_close > 0 - - # Classify equators. - # 1 -> z equator - # 2 -> y equator - # 3 -> x equator - # 4 -> z top view, ie. both x and y equator - # 5 -> y top view, ie. both x and z equator - # 6 -> x top view, ie. both y and z equator - eq_class = np.zeros(n_rots) - top_view_mask = n_eqs_close > 1 + # Mask for all views close to an equator. + eq_mask = z_eq_mask | y_eq_mask | x_eq_mask + + # Top view masks. + # A top view is a view along an axis of symmetry (ie. x, y, or z). + # A top view is also at the intersection of the two equator views + # perpendicular to the axis of symmetry. + z_top_view_mask = y_eq_mask & x_eq_mask + y_top_view_mask = z_eq_mask & x_eq_mask + x_top_view_mask = z_eq_mask & y_eq_mask + top_view_mask = z_top_view_mask | y_top_view_mask | x_top_view_mask + + return eq_mask, top_view_mask + + @staticmethod + def generate_inplane_rots(sphere_grid, d_theta): + """ + This function takes projection directions (points on the 2-sphere) and + generates rotation matrices in SO(3). The projection direction + is the 3rd column and columns 1 and 2 span the perpendicular plane. + To properly discretize SO(3), for each projection direction we generate + [2*pi/dtheta] "in-plane" rotations, of the plane + perpendicular to this direction. This is done by generating one rotation + for each direction and then multiplying on the right by a rotation about + the Z-axis by k*dtheta degrees, k=0...2*pi/dtheta-1. + + :param sphere_grid: A set of points on the 2-sphere. + :param d_theta: Resolution for in-plane rotations (in degrees) + :returns: 4D array of rotations of size len(sphere_grid) x n_inplane_rots x 3 x 3. + """ + dtype = sphere_grid.dtype + # Generate one rotation for each point on the sphere. + n_rots = len(sphere_grid) + Ri2 = np.column_stack((-sphere_grid[:, 2], sphere_grid[:, 1], np.zeros(n_rots))) + Ri2 /= np.linalg.norm(Ri2, axis=1)[:, None] + Ri1 = np.cross(Ri2, sphere_grid) + Ri1 /= np.linalg.norm(Ri1, axis=1)[:, None] + + rots_grid = np.zeros((n_rots, 3, 3), dtype=dtype) + rots_grid[:, :, 0] = Ri1 + rots_grid[:, :, 1] = Ri2 + rots_grid[:, :, 2] = sphere_grid + + # Generate in-plane rotations. + d_theta *= np.pi / 180 + inplane_rots = Rotation.about_axis( + "z", np.arange(0, 2 * np.pi, d_theta), dtype=dtype + ).matrices + n_inplane_rots = len(inplane_rots) + + # Generate in-plane rotations of rots_grid. + inplane_rotated_grid = np.zeros((n_rots, n_inplane_rots, 3, 3), dtype=dtype) + for i in range(n_rots): + inplane_rotated_grid[i] = rots_grid[i] @ inplane_rots + + return inplane_rotated_grid From b649a9faa35a8689e0a0ec14abb7e1db7a85205d Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 1 Dec 2023 15:48:19 -0500 Subject: [PATCH 311/433] match matlab MarkEquators --- src/aspire/abinitio/__init__.py | 1 + src/aspire/abinitio/commonline_d2.py | 136 +++++++++++++++++++++++++-- 2 files changed, 128 insertions(+), 9 deletions(-) diff --git a/src/aspire/abinitio/__init__.py b/src/aspire/abinitio/__init__.py index 9d4b0f483c..e8115ea185 100644 --- a/src/aspire/abinitio/__init__.py +++ b/src/aspire/abinitio/__init__.py @@ -8,5 +8,6 @@ from .commonline_c3_c4 import CLSymmetryC3C4 from .commonline_cn import CLSymmetryCn from .commonline_c2 import CLSymmetryC2 +from .commonline_d2 import CLSymmetryD2 # isort: on diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index cb0de5958c..234adc1e2c 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -92,8 +92,8 @@ def generate_lookup_data(self): # We detect such directions by taking a strip of radius # eq_filter_angle about the 3 great circles perpendicular to the symmetry # axes of D2 (i.e to X,Y and Z axes). - eq_mask1, top_view_mask1 = self.mark_equators(sphere_grid1, self.eq_min_dist) - eq_mask2, top_view_mask2 = self.mark_equators(sphere_grid2, self.eq_min_dist) + eq_idx1, eq_class1 = self.mark_equators(sphere_grid1, self.eq_min_dist) + eq_idx2, eq_class2 = self.mark_equators(sphere_grid2, self.eq_min_dist) # Mark Top View Directions. # A Top view projection image is taken from the direction of one of the @@ -109,13 +109,31 @@ def generate_lookup_data(self): # single common line. A top view and a regular non-equator image only have # two common lines. - # Remove top views from sphere grids and update equator masks. - sphere_grid1 = sphere_grid1[~top_view_mask1] - sphere_grid2 = sphere_grid2[~top_view_mask2] - eq_mask1 = eq_mask1[~top_view_mask1] - eq_mask2 = eq_mask2[~top_view_mask2] + # Remove top views from sphere grids and update equator indices and classes. + sphere_grid1 = sphere_grid1[eq_class1 < 4] + sphere_grid2 = sphere_grid2[eq_class2 < 4] + eq_idx1 = eq_idx1[eq_class1 < 4] + eq_idx2 = eq_idx2[eq_class2 < 4] + eq_class1 = eq_class1[eq_class1 < 4] + eq_class2 = eq_class2[eq_class2 < 4] # Generate in-plane rotations for each grid point on the sphere. + inplane_rotated_grid1 = self.generate_inplane_rots( + sphere_grid1, self.inplane_res + ) + inplane_rotated_grid2 = self.generate_inplane_rots( + sphere_grid2, self.inplane_res + ) + + # Generate all relative rotation candidates for maximum-likelihood method. + rots = self.generate_relative_rotations( + inplane_rotated_grid1, + inplane_rotated_grid1, + eq_idx1, + eq_idx1, + eq_class1, + eq_class1, + ) @staticmethod def saff_kuijlaars(N): @@ -149,7 +167,7 @@ def saff_kuijlaars(N): return mesh @staticmethod - def mark_equators(sphere_grid, eq_filter_angle): + def mark_equators1(sphere_grid, eq_filter_angle): """ :param sphere_grid: Nx3 array of vertices in cartesian coordinates. :param eq_filter_angle: Angular distance from equator to be marked as @@ -195,7 +213,72 @@ def mark_equators(sphere_grid, eq_filter_angle): x_top_view_mask = z_eq_mask & y_eq_mask top_view_mask = z_top_view_mask | y_top_view_mask | x_top_view_mask - return eq_mask, top_view_mask + masks = { + "eq": eq_mask, + "top": top_view_mask, + "x_eq": x_eq_mask, + "y_eq": y_eq_mask, + "z_eq": z_eq_mask, + } + + return masks + + @staticmethod + def mark_equators(sphere_grid, eq_filter_angle): + """ + :param sphere_grid: Nx3 array of vertices in cartesian coordinates. + :param eq_filter_angle: Angular distance from equator to be marked as + an equator point. + + :returns: + - eq_idx, a boolean mask for equator indices. + - eq_class, n_rots length array of values indicating equator class. + """ + # Project each vector onto xy, xz, yz planes and measure angular distance + # from each plane. + n_rots = len(sphere_grid) + angular_dists = np.zeros((n_rots, 3), dtype=sphere_grid.dtype) + + # Distance from z-axis equator. + proj_xy = sphere_grid.copy() + proj_xy[:, 2] = 0 + proj_xy /= np.linalg.norm(proj_xy, axis=1)[:, None] + angular_dists[:, 0] = np.sum(sphere_grid * proj_xy, axis=-1) + + # Distance from y-axis equator. + proj_xz = sphere_grid.copy() + proj_xz[:, 1] = 0 + proj_xz /= np.linalg.norm(proj_xz, axis=1)[:, None] + angular_dists[:, 1] = np.sum(sphere_grid * proj_xz, axis=-1) + + # Distance from x-axis equator. + proj_yz = sphere_grid.copy() + proj_yz[:, 0] = 0 + proj_yz /= np.linalg.norm(proj_yz, axis=1)[:, None] + angular_dists[:, 2] = np.sum(sphere_grid * proj_yz, axis=-1) + + # Mark all views close to an equator. + eq_min_dist = np.cos(eq_filter_angle * np.pi / 180) + n_eqs = np.sum(angular_dists > eq_min_dist, axis=1) + eq_idx = n_eqs > 0 + + # Classify equators. + # 0 -> non-equator view + # 1 -> z equator + # 2 -> y equator + # 3 -> x equator + # 4 -> z top view + # 5 -> y top view + # 6 -> x top view + eq_class = np.zeros(n_rots) + top_view_idx = n_eqs > 1 + top_view_class = np.argmin(angular_dists[top_view_idx] > eq_min_dist) + eq_class[top_view_idx] = top_view_class + 4 + eq_view_idx = n_eqs == 1 + eq_view_class = np.argmax(angular_dists[eq_view_idx] > eq_min_dist, axis=1) + eq_class[eq_view_idx] = eq_view_class + 1 + + return eq_idx, eq_class @staticmethod def generate_inplane_rots(sphere_grid, d_theta): @@ -239,3 +322,38 @@ def generate_inplane_rots(sphere_grid, d_theta): inplane_rotated_grid[i] = rots_grid[i] @ inplane_rots return inplane_rotated_grid + + @staticmethod + def generate_relative_rotations( + Ris, Rjs, Ri_eq_idx, Rj_eq_idx, Ri_eq_class, Rj_eq_class + ): + """ + :param Ris: First set of candidate rotations. + :param Rjs: Second set of candidate rotation. + :param Ri_eq_idx: + """ + n_rots_i = len(Ris) + n_rots_j = len(Rjs) + n_theta = Ris.shape[1] # Same for Rjs + + # Generate upper triangular table of indicators of all pairs which are not + # equators with respect to the same symmetry axis (named unique_pairs). + eq_table = np.outer(Ri_eq_idx, Rj_eq_idx) + in_same_class = (Ri_eq_class[:, None] - Rj_eq_class.T[None]) == 0 + eq2eq_Rij_table = np.triu(~(eq_table * in_same_class)) + + n_pairs = np.sum(eq2eq_Rij_table) + idx = 0 + cls = np.zeros((2 * n_pairs, n_theta, n_theta // 2, 2, 4)) + + for i in range(n_rots_i): + unique_pairs_i = np.where(eq2eq_Rij_table[i])[0] + if len(unique_pairs_i) == 0: + continue + Ri = Ris[i] + for j in unique_pairs_i: + # Compute relative rotations candidates + Rj = Rjs[j, : n_theta // 2] + import pdb + + pdb.set_trace() From 24341b1dab5d7d7d3d8ff90fa724b7e8e2b89064 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 4 Dec 2023 13:59:21 -0500 Subject: [PATCH 312/433] relative rotations. --- src/aspire/abinitio/commonline_d2.py | 141 ++++++++++++++------------- 1 file changed, 75 insertions(+), 66 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 234adc1e2c..e5a95337ca 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -125,8 +125,8 @@ def generate_lookup_data(self): sphere_grid2, self.inplane_res ) - # Generate all relative rotation candidates for maximum-likelihood method. - rots = self.generate_relative_rotations( + # Generate commmon line angles induced by all relative rotation candidates. + cl_angles_1 = self.generate_relative_rotations( inplane_rotated_grid1, inplane_rotated_grid1, eq_idx1, @@ -134,6 +134,16 @@ def generate_lookup_data(self): eq_class1, eq_class1, ) + cl_angles_2 = self.generate_relative_rotations( + inplane_rotated_grid1, + inplane_rotated_grid2, + eq_idx1, + eq_idx2, + eq_class1, + eq_class2, + ) + + return cl_angles_1, cl_angles_2 @staticmethod def saff_kuijlaars(N): @@ -166,63 +176,6 @@ def saff_kuijlaars(N): return mesh - @staticmethod - def mark_equators1(sphere_grid, eq_filter_angle): - """ - :param sphere_grid: Nx3 array of vertices in cartesian coordinates. - :param eq_filter_angle: Angular distance from equator to be marked as - an equator point. - - :return: Indices of points on sphere whose distance from one of - the equators is < eq_filter angle. - """ - # Project each vector onto xy, xz, yz planes and measure angular distance - # from each plane. - eq_min_dist = np.cos(eq_filter_angle * np.pi / 180) - - # Mask for z-axis equator views. - proj_xy = sphere_grid.copy() - proj_xy[:, 2] = 0 - proj_xy /= np.linalg.norm(proj_xy, axis=1)[:, None] - ang_dists_xy = np.sum(sphere_grid * proj_xy, axis=-1) - z_eq_mask = ang_dists_xy > eq_min_dist - - # Mask for y-axis equator views. - proj_xz = sphere_grid.copy() - proj_xz[:, 1] = 0 - proj_xz /= np.linalg.norm(proj_xz, axis=1)[:, None] - ang_dists_xz = np.sum(sphere_grid * proj_xz, axis=-1) - y_eq_mask = ang_dists_xz > eq_min_dist - - # Mask for x-axis equator views. - proj_yz = sphere_grid.copy() - proj_yz[:, 0] = 0 - proj_yz /= np.linalg.norm(proj_yz, axis=1)[:, None] - ang_dists_yz = np.sum(sphere_grid * proj_yz, axis=-1) - x_eq_mask = ang_dists_yz > eq_min_dist - - # Mask for all views close to an equator. - eq_mask = z_eq_mask | y_eq_mask | x_eq_mask - - # Top view masks. - # A top view is a view along an axis of symmetry (ie. x, y, or z). - # A top view is also at the intersection of the two equator views - # perpendicular to the axis of symmetry. - z_top_view_mask = y_eq_mask & x_eq_mask - y_top_view_mask = z_eq_mask & x_eq_mask - x_top_view_mask = z_eq_mask & y_eq_mask - top_view_mask = z_top_view_mask | y_top_view_mask | x_top_view_mask - - masks = { - "eq": eq_mask, - "top": top_view_mask, - "x_eq": x_eq_mask, - "y_eq": y_eq_mask, - "z_eq": z_eq_mask, - } - - return masks - @staticmethod def mark_equators(sphere_grid, eq_filter_angle): """ @@ -333,7 +286,6 @@ def generate_relative_rotations( :param Ri_eq_idx: """ n_rots_i = len(Ris) - n_rots_j = len(Rjs) n_theta = Ris.shape[1] # Same for Rjs # Generate upper triangular table of indicators of all pairs which are not @@ -344,7 +296,7 @@ def generate_relative_rotations( n_pairs = np.sum(eq2eq_Rij_table) idx = 0 - cls = np.zeros((2 * n_pairs, n_theta, n_theta // 2, 2, 4)) + cls = np.zeros((2 * n_pairs, n_theta, n_theta // 2, 4, 2)) for i in range(n_rots_i): unique_pairs_i = np.where(eq2eq_Rij_table[i])[0] @@ -352,8 +304,65 @@ def generate_relative_rotations( continue Ri = Ris[i] for j in unique_pairs_i: - # Compute relative rotations candidates - Rj = Rjs[j, : n_theta // 2] - import pdb - - pdb.set_trace() + # Compute relative rotations candidates Rij = Ri.T @ Rj + Rj = Rjs[j, : (n_theta // 2)] + Rijs = np.transpose(Rj, axes=(0, 2, 1)) @ Ri[:, None] + + # Common line indices induced by Rijs + cls[idx, :, :, 0, 0] = np.arctan2(Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1]) + cls[idx, :, :, 0, 1] = np.arctan2(-Rijs[:, :, 0, 2], Rijs[:, :, 1, 2]) + cls[idx + n_pairs, :, :, 0, 0] = np.arctan2( + Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] + ) + cls[idx + n_pairs, :, :, 0, 1] = np.arctan2( + -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] + ) + + # Compute relative rotations candidates Rij = Ri.T @ g1 @ Rj, + # where g1 = diag(1, -1, -1). + g1_Rj = Rj.copy() + g1_Rj[:, 1:3] = -g1_Rj[:, 1:3] + Rijs = np.transpose(g1_Rj, axes=(0, 2, 1)) @ Ri[:, None] + + cls[idx, :, :, 1, 0] = np.arctan2(Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1]) + cls[idx, :, :, 1, 1] = np.arctan2(-Rijs[:, :, 0, 2], Rijs[:, :, 1, 2]) + cls[idx + n_pairs, :, :, 1, 0] = np.arctan2( + Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] + ) + cls[idx + n_pairs, :, :, 1, 1] = np.arctan2( + -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] + ) + + # Compute relative rotations candidates Rij = Ri.T @ g2 @ Rj, + # where g2 = diag(-1, 1, -1). + g2_Rj = Rj.copy() + g2_Rj[:, [0, 2]] = -g2_Rj[:, [0, 2]] + Rijs = np.transpose(g2_Rj, axes=(0, 2, 1)) @ Ri[:, None] + + cls[idx, :, :, 2, 0] = np.arctan2(Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1]) + cls[idx, :, :, 2, 1] = np.arctan2(-Rijs[:, :, 0, 2], Rijs[:, :, 1, 2]) + cls[idx + n_pairs, :, :, 2, 0] = np.arctan2( + Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] + ) + cls[idx + n_pairs, :, :, 2, 1] = np.arctan2( + -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] + ) + + # Compute relative rotations candidates Rij = Ri.T @ g3 @ Rj, + # where g3 = diag(-1, -1, 1). + g3_Rj = Rj.copy() + g3_Rj[:, 0:2] = -g3_Rj[:, 0:2] + Rijs = np.transpose(g3_Rj, axes=(0, 2, 1)) @ Ri[:, None] + + cls[idx, :, :, 3, 0] = np.arctan2(Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1]) + cls[idx, :, :, 3, 1] = np.arctan2(-Rijs[:, :, 0, 2], Rijs[:, :, 1, 2]) + cls[idx + n_pairs, :, :, 3, 0] = np.arctan2( + Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] + ) + cls[idx + n_pairs, :, :, 3, 1] = np.arctan2( + -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] + ) + + idx += 1 + + return cls From d147304276f0c1212d8db80ba083469cd011b58c Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 6 Dec 2023 10:01:34 -0500 Subject: [PATCH 313/433] generate_commonline_indices --- src/aspire/abinitio/commonline_d2.py | 99 +++++++++++++++++++++------- 1 file changed, 75 insertions(+), 24 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index e5a95337ca..5eb6fafce1 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -63,7 +63,7 @@ def __init__( def estimate_rotations(self): """ - Estimate rotation matrices for molecules with C3 or C4 symmetry. + Estimate rotation matrices for molecules with D2 symmetry. :return: Array of rotation matrices, size n_imgx3x3. """ @@ -126,7 +126,7 @@ def generate_lookup_data(self): ) # Generate commmon line angles induced by all relative rotation candidates. - cl_angles_1 = self.generate_relative_rotations( + cl_angles1 = self.generate_commonline_angles( inplane_rotated_grid1, inplane_rotated_grid1, eq_idx1, @@ -134,7 +134,7 @@ def generate_lookup_data(self): eq_class1, eq_class1, ) - cl_angles_2 = self.generate_relative_rotations( + cl_angles2 = self.generate_commonline_angles( inplane_rotated_grid1, inplane_rotated_grid2, eq_idx1, @@ -143,7 +143,10 @@ def generate_lookup_data(self): eq_class2, ) - return cl_angles_1, cl_angles_2 + cl_ind_1 = self.generate_commonline_indices(cl_angles1) + cl_ind_2 = self.generate_commonline_indices(cl_angles2) + + return cl_angles1, cl_angles2 @staticmethod def saff_kuijlaars(N): @@ -277,13 +280,22 @@ def generate_inplane_rots(sphere_grid, d_theta): return inplane_rotated_grid @staticmethod - def generate_relative_rotations( + def generate_commonline_angles( Ris, Rjs, Ri_eq_idx, Rj_eq_idx, Ri_eq_class, Rj_eq_class ): """ + Compute commonline angles induced by the 4 sets of relative rotations + Rij = Ri.T @ g_m @ Rj, m = 0,1,2,3, where g_m is the identity and rotations + about the three axes of symmetry of a D2 symmetric molecule. + :param Ris: First set of candidate rotations. :param Rjs: Second set of candidate rotation. - :param Ri_eq_idx: + :param Ri_eq_idx: Equator index mask. + :param Rj_eq_idx: Equator index mask. + :param Ri_eq_class: Equator classification for Ris. + :param Rj_eq_class: Equator classification for Rjs. + + :return: Commonline angles induced by relative rotation candidates. """ n_rots_i = len(Ris) n_theta = Ris.shape[1] # Same for Rjs @@ -296,7 +308,7 @@ def generate_relative_rotations( n_pairs = np.sum(eq2eq_Rij_table) idx = 0 - cls = np.zeros((2 * n_pairs, n_theta, n_theta // 2, 4, 2)) + cl_angles = np.zeros((2 * n_pairs, n_theta, n_theta // 2, 4, 2)) for i in range(n_rots_i): unique_pairs_i = np.where(eq2eq_Rij_table[i])[0] @@ -309,12 +321,16 @@ def generate_relative_rotations( Rijs = np.transpose(Rj, axes=(0, 2, 1)) @ Ri[:, None] # Common line indices induced by Rijs - cls[idx, :, :, 0, 0] = np.arctan2(Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1]) - cls[idx, :, :, 0, 1] = np.arctan2(-Rijs[:, :, 0, 2], Rijs[:, :, 1, 2]) - cls[idx + n_pairs, :, :, 0, 0] = np.arctan2( + cl_angles[idx, :, :, 0, 0] = np.arctan2( + Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1] + ) + cl_angles[idx, :, :, 0, 1] = np.arctan2( + -Rijs[:, :, 0, 2], Rijs[:, :, 1, 2] + ) + cl_angles[idx + n_pairs, :, :, 0, 0] = np.arctan2( Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] ) - cls[idx + n_pairs, :, :, 0, 1] = np.arctan2( + cl_angles[idx + n_pairs, :, :, 0, 1] = np.arctan2( -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] ) @@ -324,12 +340,16 @@ def generate_relative_rotations( g1_Rj[:, 1:3] = -g1_Rj[:, 1:3] Rijs = np.transpose(g1_Rj, axes=(0, 2, 1)) @ Ri[:, None] - cls[idx, :, :, 1, 0] = np.arctan2(Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1]) - cls[idx, :, :, 1, 1] = np.arctan2(-Rijs[:, :, 0, 2], Rijs[:, :, 1, 2]) - cls[idx + n_pairs, :, :, 1, 0] = np.arctan2( + cl_angles[idx, :, :, 1, 0] = np.arctan2( + Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1] + ) + cl_angles[idx, :, :, 1, 1] = np.arctan2( + -Rijs[:, :, 0, 2], Rijs[:, :, 1, 2] + ) + cl_angles[idx + n_pairs, :, :, 1, 0] = np.arctan2( Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] ) - cls[idx + n_pairs, :, :, 1, 1] = np.arctan2( + cl_angles[idx + n_pairs, :, :, 1, 1] = np.arctan2( -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] ) @@ -339,12 +359,16 @@ def generate_relative_rotations( g2_Rj[:, [0, 2]] = -g2_Rj[:, [0, 2]] Rijs = np.transpose(g2_Rj, axes=(0, 2, 1)) @ Ri[:, None] - cls[idx, :, :, 2, 0] = np.arctan2(Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1]) - cls[idx, :, :, 2, 1] = np.arctan2(-Rijs[:, :, 0, 2], Rijs[:, :, 1, 2]) - cls[idx + n_pairs, :, :, 2, 0] = np.arctan2( + cl_angles[idx, :, :, 2, 0] = np.arctan2( + Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1] + ) + cl_angles[idx, :, :, 2, 1] = np.arctan2( + -Rijs[:, :, 0, 2], Rijs[:, :, 1, 2] + ) + cl_angles[idx + n_pairs, :, :, 2, 0] = np.arctan2( Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] ) - cls[idx + n_pairs, :, :, 2, 1] = np.arctan2( + cl_angles[idx + n_pairs, :, :, 2, 1] = np.arctan2( -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] ) @@ -354,15 +378,42 @@ def generate_relative_rotations( g3_Rj[:, 0:2] = -g3_Rj[:, 0:2] Rijs = np.transpose(g3_Rj, axes=(0, 2, 1)) @ Ri[:, None] - cls[idx, :, :, 3, 0] = np.arctan2(Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1]) - cls[idx, :, :, 3, 1] = np.arctan2(-Rijs[:, :, 0, 2], Rijs[:, :, 1, 2]) - cls[idx + n_pairs, :, :, 3, 0] = np.arctan2( + cl_angles[idx, :, :, 3, 0] = np.arctan2( + Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1] + ) + cl_angles[idx, :, :, 3, 1] = np.arctan2( + -Rijs[:, :, 0, 2], Rijs[:, :, 1, 2] + ) + cl_angles[idx + n_pairs, :, :, 3, 0] = np.arctan2( Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] ) - cls[idx + n_pairs, :, :, 3, 1] = np.arctan2( + cl_angles[idx + n_pairs, :, :, 3, 1] = np.arctan2( -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] ) idx += 1 - return cls + return cl_angles + + @staticmethod + def generate_commonline_indices(cl_angles): + # Make all angles non-negative and convert to degrees. + cl_angles = (cl_angles + 2 * np.pi) % (2 * np.pi) + cl_angles = cl_angles * 180 / np.pi + + # Flatten the stack + og_shape = cl_angles.shape + cl_angles = np.reshape(cl_angles, (np.prod(og_shape[:-1]), 2)) + + # Fourier ray index + cl_ind_j = np.round(cl_angles[:, 0]).astype("int") % 360 + cl_ind_i = np.round(cl_angles[:, 1]).astype("int") % 360 + + # Restrict Rj in-plane coordinates to <180 degrees. + is_geq_than_pi = cl_ind_j >= 180 + cl_ind_j[is_geq_than_pi] = cl_ind_j[is_geq_than_pi] - 180 + cl_ind_i[is_geq_than_pi] = (cl_ind_i[is_geq_than_pi] + 180) % 360 + + # Convert to linear indices in 360*180 correlation matrix + cl_ind = np.ravel_multi_index((cl_ind_i, cl_ind_j), dims=(360, 180)) + return cl_ind From 1ab71bcd48bd896f681de3485455f3ed1f43d27b Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 11 Dec 2023 15:24:00 -0500 Subject: [PATCH 314/433] generate_gs. Partial self-commonline lookup. --- src/aspire/abinitio/commonline_d2.py | 98 +++++++++++++++++++--------- 1 file changed, 68 insertions(+), 30 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 5eb6fafce1..2c3597c694 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -32,7 +32,7 @@ def __init__( seed=None, ): """ - Initialize object for estimating 3D orientations for molecules with C3 and C4 symmetry. + Initialize object for estimating 3D orientations for molecules with D2 symmetry. :param src: The source object of 2D denoised or class-averaged images with metadata :param n_rad: The number of points in the radial direction @@ -60,6 +60,7 @@ def __init__( self.inplane_res = inplane_res self.eq_min_dist = eq_min_dist self.seed = seed + self._generate_gs() def estimate_rotations(self): """ @@ -67,7 +68,12 @@ def estimate_rotations(self): :return: Array of rotation matrices, size n_imgx3x3. """ - pass + self.generate_lookup_data() + self.generate_scl_lookup_data( + self.inplane_rotated_grid1, + self.eq_idx1, + self.eq_class1, + ) def generate_lookup_data(self): """ @@ -110,43 +116,62 @@ def generate_lookup_data(self): # two common lines. # Remove top views from sphere grids and update equator indices and classes. - sphere_grid1 = sphere_grid1[eq_class1 < 4] - sphere_grid2 = sphere_grid2[eq_class2 < 4] - eq_idx1 = eq_idx1[eq_class1 < 4] - eq_idx2 = eq_idx2[eq_class2 < 4] - eq_class1 = eq_class1[eq_class1 < 4] - eq_class2 = eq_class2[eq_class2 < 4] + self.sphere_grid1 = sphere_grid1[eq_class1 < 4] + self.sphere_grid2 = sphere_grid2[eq_class2 < 4] + self.eq_idx1 = eq_idx1[eq_class1 < 4] + self.eq_idx2 = eq_idx2[eq_class2 < 4] + self.eq_class1 = eq_class1[eq_class1 < 4] + self.eq_class2 = eq_class2[eq_class2 < 4] # Generate in-plane rotations for each grid point on the sphere. - inplane_rotated_grid1 = self.generate_inplane_rots( - sphere_grid1, self.inplane_res + self.inplane_rotated_grid1 = self.generate_inplane_rots( + self.sphere_grid1, self.inplane_res ) - inplane_rotated_grid2 = self.generate_inplane_rots( - sphere_grid2, self.inplane_res + self.inplane_rotated_grid2 = self.generate_inplane_rots( + self.sphere_grid2, self.inplane_res ) - # Generate commmon line angles induced by all relative rotation candidates. - cl_angles1 = self.generate_commonline_angles( - inplane_rotated_grid1, - inplane_rotated_grid1, - eq_idx1, - eq_idx1, - eq_class1, - eq_class1, + # Generate commmonline angles induced by all relative rotation candidates. + self.cl_angles1 = self.generate_commonline_angles( + self.inplane_rotated_grid1, + self.inplane_rotated_grid1, + self.eq_idx1, + self.eq_idx1, + self.eq_class1, + self.eq_class1, ) - cl_angles2 = self.generate_commonline_angles( - inplane_rotated_grid1, - inplane_rotated_grid2, - eq_idx1, - eq_idx2, - eq_class1, - eq_class2, + self.cl_angles2 = self.generate_commonline_angles( + self.inplane_rotated_grid1, + self.inplane_rotated_grid2, + self.eq_idx1, + self.eq_idx2, + self.eq_class1, + self.eq_class2, ) - cl_ind_1 = self.generate_commonline_indices(cl_angles1) - cl_ind_2 = self.generate_commonline_indices(cl_angles2) + # Generate commonline indices. + self.cl_ind_1 = self.generate_commonline_indices(self.cl_angles1) + self.cl_ind_2 = self.generate_commonline_indices(self.cl_angles2) + + def generate_scl_lookup_data(self, Ris, eq_idx, eq_class): + """ + Generate lookup data for self-commonlines. - return cl_angles1, cl_angles2 + :param Ris: Candidate rotation matrices, (n_sphere_grid, n_inplane_rots, 3, 3). + :param eq_idx: Equator index mask for Ris. + :param eq_class: Equator classification for Ris. + """ + # For each candidate rotation Ri we generate the set of 3 self-commonlines. + scl_angles = np.zeros((*Ris.shape[:2], 3, 2), dtype=Ris.dtype) + n_rots = len(Ris) + for i in range(n_rots): + Ri = Ris[i] + for j, g in enumerate(self.gs[1:]): + g_Ri = g * Ri + Riis = np.transpose(Ri, axes=(0, 2, 1)) @ g_Ri + + scl_angles[i, :, j, 0] = np.arctan2(Riis[:, 2, 0], -Riis[:, 2, 1]) + scl_angles[i, :, j, 1] = np.arctan2(-Riis[:, 0, 2], Riis[:, 1, 2]) @staticmethod def saff_kuijlaars(N): @@ -417,3 +442,16 @@ def generate_commonline_indices(cl_angles): # Convert to linear indices in 360*180 correlation matrix cl_ind = np.ravel_multi_index((cl_ind_i, cl_ind_j), dims=(360, 180)) return cl_ind + + def _generate_gs(self): + """ + Generate analogue to D2 rotation matrices, such that element-wise + multiplication, `*`, by gs is equivalent to matrix multiplication, + `@`, by a correspopnding rotation matrix. + """ + gs = np.ones((4, 3, 3), dtype=self.dtype) + gs[1, 1:3] = -gs[1, 1:3] + gs[2, [0, 2]] = -gs[2, [0, 2]] + gs[3, 0:2] = -gs[3, 0:2] + + self.gs = gs From c7b5e66a9cdcd2f64c254275649d203e56d5739d Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 15 Dec 2023 09:11:29 -0500 Subject: [PATCH 315/433] More self-commonline stuff. --- src/aspire/abinitio/commonline_d2.py | 153 +++++++++++++-------------- 1 file changed, 75 insertions(+), 78 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 2c3597c694..006022ea7c 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -166,12 +166,65 @@ def generate_scl_lookup_data(self, Ris, eq_idx, eq_class): n_rots = len(Ris) for i in range(n_rots): Ri = Ris[i] - for j, g in enumerate(self.gs[1:]): + for k, g in enumerate(self.gs[1:]): g_Ri = g * Ri Riis = np.transpose(Ri, axes=(0, 2, 1)) @ g_Ri - scl_angles[i, :, j, 0] = np.arctan2(Riis[:, 2, 0], -Riis[:, 2, 1]) - scl_angles[i, :, j, 1] = np.arctan2(-Riis[:, 0, 2], Riis[:, 1, 2]) + scl_angles[i, :, k, 0] = np.arctan2(Riis[:, 2, 0], -Riis[:, 2, 1]) + scl_angles[i, :, k, 1] = np.arctan2(-Riis[:, 0, 2], Riis[:, 1, 2]) + + # Prepare self commonline coordinates. + scl_angles = scl_angles % (2 * np.pi) + + # Deal with non top view equators + # A non-TV equator has only one self common line. However, we clasify an + # equator as an image whose projection direction is at radial distance < + # eq_filter_angle from the great circle perpendicual to a symmetry axis, + # and not strcitly zero distance. Thus in most cases we get 2 common lines + # differing by a small difference in degrees. Actually the calculation above + # gives us two NEARLY antipodal lines, so we first flip one of them by + # adding 180 degrees to it. Then we aggregate all the rays within the range + # between these two resulting lines to compute the score of this self common + # line for this candidate. The scoring part is done in the ML function itself. + # Furthermore, the line perpendicular to the self common line, though not + # really a self common line, has the property that all its values are real + # and both halves of the line (rays differing by pi, emanating from the + # origin) have the same values, and so it 'beahves like' a self common + # line which we also register here and exploit in the ML function. + # We put the 'real' self common line at 2 first coordinates, the + # candidate for perpendicular line is in 3rd coordinate. + + # If this is a self common line with respect to x-equator then the actual self + # common line(s) is given by the self relative rotations given by the y and z + # rotation (by 180 degrees) group members, i.e. Ri^TgyRj and Ri^TgzRj + scl_angles[eq_class == 1] = scl_angles[eq_class == 1][:, :, [1, 2, 0]] + scl_angles[eq_class == 1, :, 0] = scl_angles[eq_class == 1][:, :, 0, [1, 0]] + + # If this is a self common line with respect to y-equator then the actual self + # common line(s) is given by the self relative rotations given by the x and z + # rotation (by 180 degrees) group members, i.e. Ri^TgxRj and Ri^TgzRj + scl_angles[eq_class == 2] = scl_angles[eq_class == 2][:, :, [0, 2, 1]] + scl_angles[eq_class == 2, :, 0] = scl_angles[eq_class == 2][:, :, 0, [1, 0]] + + # If this is a self common line with respect to z-equator then the actual self + # common line(s) is given by the self relative rotations given by the x and y + # rotation (by 180 degrees) group members, i.e. Ri^TgxRj and Ri^TgyRj + # No need to rearrange entries, the "real" common lines are already in + # indices 1 and 2, but flip one common line to antipodal. + scl_angles[eq_class == 3, :, 0] = scl_angles[eq_class == 3][:, :, 0, [1, 0]] + + # TODO: This section is silly! Clean up! + # Make sure angle range is <= 180 degrees. + p1 = scl_angles[eq_class > 0, :, 0] > scl_angles[eq_class > 0, :, 1] + p1 = p1[:, :, 0] & p1[:, :, 1] + p2 = scl_angles[eq_class > 0, :, 0] - scl_angles[eq_class > 0, :, 1] < -np.pi + p2 = p2[:, :, 0] | p2[:, :, 1] + p = p1 | p2 + + scl_angles[eq_class > 0] = ( + scl_angles[eq_class > 0][:, :, [1, 0, 2]] * p[:, :, None, None] + + scl_angles[eq_class > 0] * ~p[:, :, None, None] + ) @staticmethod def saff_kuijlaars(N): @@ -304,9 +357,8 @@ def generate_inplane_rots(sphere_grid, d_theta): return inplane_rotated_grid - @staticmethod def generate_commonline_angles( - Ris, Rjs, Ri_eq_idx, Rj_eq_idx, Ri_eq_class, Rj_eq_class + self, Ris, Rjs, Ri_eq_idx, Rj_eq_idx, Ri_eq_class, Rj_eq_class ): """ Compute commonline angles induced by the 4 sets of relative rotations @@ -341,80 +393,25 @@ def generate_commonline_angles( continue Ri = Ris[i] for j in unique_pairs_i: - # Compute relative rotations candidates Rij = Ri.T @ Rj Rj = Rjs[j, : (n_theta // 2)] - Rijs = np.transpose(Rj, axes=(0, 2, 1)) @ Ri[:, None] - - # Common line indices induced by Rijs - cl_angles[idx, :, :, 0, 0] = np.arctan2( - Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1] - ) - cl_angles[idx, :, :, 0, 1] = np.arctan2( - -Rijs[:, :, 0, 2], Rijs[:, :, 1, 2] - ) - cl_angles[idx + n_pairs, :, :, 0, 0] = np.arctan2( - Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] - ) - cl_angles[idx + n_pairs, :, :, 0, 1] = np.arctan2( - -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] - ) - - # Compute relative rotations candidates Rij = Ri.T @ g1 @ Rj, - # where g1 = diag(1, -1, -1). - g1_Rj = Rj.copy() - g1_Rj[:, 1:3] = -g1_Rj[:, 1:3] - Rijs = np.transpose(g1_Rj, axes=(0, 2, 1)) @ Ri[:, None] - - cl_angles[idx, :, :, 1, 0] = np.arctan2( - Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1] - ) - cl_angles[idx, :, :, 1, 1] = np.arctan2( - -Rijs[:, :, 0, 2], Rijs[:, :, 1, 2] - ) - cl_angles[idx + n_pairs, :, :, 1, 0] = np.arctan2( - Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] - ) - cl_angles[idx + n_pairs, :, :, 1, 1] = np.arctan2( - -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] - ) - - # Compute relative rotations candidates Rij = Ri.T @ g2 @ Rj, - # where g2 = diag(-1, 1, -1). - g2_Rj = Rj.copy() - g2_Rj[:, [0, 2]] = -g2_Rj[:, [0, 2]] - Rijs = np.transpose(g2_Rj, axes=(0, 2, 1)) @ Ri[:, None] - - cl_angles[idx, :, :, 2, 0] = np.arctan2( - Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1] - ) - cl_angles[idx, :, :, 2, 1] = np.arctan2( - -Rijs[:, :, 0, 2], Rijs[:, :, 1, 2] - ) - cl_angles[idx + n_pairs, :, :, 2, 0] = np.arctan2( - Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] - ) - cl_angles[idx + n_pairs, :, :, 2, 1] = np.arctan2( - -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] - ) - - # Compute relative rotations candidates Rij = Ri.T @ g3 @ Rj, - # where g3 = diag(-1, -1, 1). - g3_Rj = Rj.copy() - g3_Rj[:, 0:2] = -g3_Rj[:, 0:2] - Rijs = np.transpose(g3_Rj, axes=(0, 2, 1)) @ Ri[:, None] - - cl_angles[idx, :, :, 3, 0] = np.arctan2( - Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1] - ) - cl_angles[idx, :, :, 3, 1] = np.arctan2( - -Rijs[:, :, 0, 2], Rijs[:, :, 1, 2] - ) - cl_angles[idx + n_pairs, :, :, 3, 0] = np.arctan2( - Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] - ) - cl_angles[idx + n_pairs, :, :, 3, 1] = np.arctan2( - -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] - ) + for k, g in enumerate(self.gs): + # Compute relative rotations candidates Rij = Ri.T @ gs @ Rj + g_Rj = g * Rj + Rijs = np.transpose(g_Rj, axes=(0, 2, 1)) @ Ri[:, None] + + # Common line indices induced by Rijs + cl_angles[idx, :, :, k, 0] = np.arctan2( + Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1] + ) + cl_angles[idx, :, :, k, 1] = np.arctan2( + -Rijs[:, :, 0, 2], Rijs[:, :, 1, 2] + ) + cl_angles[idx + n_pairs, :, :, k, 0] = np.arctan2( + Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] + ) + cl_angles[idx + n_pairs, :, :, k, 1] = np.arctan2( + -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] + ) idx += 1 From 1176d5a9f73ef7632980f84625051211aa8ffb14 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 26 Feb 2024 15:16:29 -0500 Subject: [PATCH 316/433] circ_seq. more scl_lookup_data. --- src/aspire/abinitio/commonline_d2.py | 120 ++++++++++++++++++++++----- 1 file changed, 98 insertions(+), 22 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 006022ea7c..b728c5bd89 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -35,8 +35,8 @@ def __init__( Initialize object for estimating 3D orientations for molecules with D2 symmetry. :param src: The source object of 2D denoised or class-averaged images with metadata - :param n_rad: The number of points in the radial direction - :param n_theta: The number of points in the theta direction + :param n_rad: The number of points in the radial direction of Fourier image. + :param n_theta: The number of points in the theta direction of Fourier image. :param max_shift: Maximum range for shifts as a proportion of resolution. Default = 0.15. :param shift_step: Resolution of shift estimation in pixels. Default = 1 pixel. :param grid_res: Number of sampling points on sphere for projetion directions. @@ -132,7 +132,7 @@ def generate_lookup_data(self): ) # Generate commmonline angles induced by all relative rotation candidates. - self.cl_angles1 = self.generate_commonline_angles( + cl_angles1 = self.generate_commonline_angles( self.inplane_rotated_grid1, self.inplane_rotated_grid1, self.eq_idx1, @@ -140,7 +140,7 @@ def generate_lookup_data(self): self.eq_class1, self.eq_class1, ) - self.cl_angles2 = self.generate_commonline_angles( + cl_angles2 = self.generate_commonline_angles( self.inplane_rotated_grid1, self.inplane_rotated_grid2, self.eq_idx1, @@ -150,8 +150,12 @@ def generate_lookup_data(self): ) # Generate commonline indices. - self.cl_ind_1 = self.generate_commonline_indices(self.cl_angles1) - self.cl_ind_2 = self.generate_commonline_indices(self.cl_angles2) + self.cl_ind_1, self.cl_angles1 = self.generate_commonline_indices(cl_angles1) + self.cl_ind_2, self.cl_angles2 = self.generate_commonline_indices(cl_angles2) + + self.generate_scl_lookup_data( + self.inplane_rotated_grid1, self.eq_idx1, self.eq_class1 + ) def generate_scl_lookup_data(self, Ris, eq_idx, eq_class): """ @@ -161,6 +165,8 @@ def generate_scl_lookup_data(self, Ris, eq_idx, eq_class): :param eq_idx: Equator index mask for Ris. :param eq_class: Equator classification for Ris. """ + L = 360 # TODO: Maybe this should be self.n_theta + # For each candidate rotation Ri we generate the set of 3 self-commonlines. scl_angles = np.zeros((*Ris.shape[:2], 3, 2), dtype=Ris.dtype) n_rots = len(Ris) @@ -179,8 +185,8 @@ def generate_scl_lookup_data(self, Ris, eq_idx, eq_class): # Deal with non top view equators # A non-TV equator has only one self common line. However, we clasify an # equator as an image whose projection direction is at radial distance < - # eq_filter_angle from the great circle perpendicual to a symmetry axis, - # and not strcitly zero distance. Thus in most cases we get 2 common lines + # eq_filter_angle from the great circle perpendicural to a symmetry axis, + # and not strictly zero distance. Thus in most cases we get 2 common lines # differing by a small difference in degrees. Actually the calculation above # gives us two NEARLY antipodal lines, so we first flip one of them by # adding 180 degrees to it. Then we aggregate all the rays within the range @@ -189,7 +195,7 @@ def generate_scl_lookup_data(self, Ris, eq_idx, eq_class): # Furthermore, the line perpendicular to the self common line, though not # really a self common line, has the property that all its values are real # and both halves of the line (rays differing by pi, emanating from the - # origin) have the same values, and so it 'beahves like' a self common + # origin) have the same values, and so it 'behaves like' a self common # line which we also register here and exploit in the ML function. # We put the 'real' self common line at 2 first coordinates, the # candidate for perpendicular line is in 3rd coordinate. @@ -213,19 +219,81 @@ def generate_scl_lookup_data(self, Ris, eq_idx, eq_class): # indices 1 and 2, but flip one common line to antipodal. scl_angles[eq_class == 3, :, 0] = scl_angles[eq_class == 3][:, :, 0, [1, 0]] - # TODO: This section is silly! Clean up! + # TODO: Maybe a cleaner way to do this. # Make sure angle range is <= 180 degrees. + # p1 marks "equator" self-commonlines where both entries of the first + # scl are greater than both entries of the second scl. p1 = scl_angles[eq_class > 0, :, 0] > scl_angles[eq_class > 0, :, 1] p1 = p1[:, :, 0] & p1[:, :, 1] + # p2 marks "equator" self-commonlines where the angle range between the + # first and second sets of self-commonlines is greater than 180. p2 = scl_angles[eq_class > 0, :, 0] - scl_angles[eq_class > 0, :, 1] < -np.pi p2 = p2[:, :, 0] | p2[:, :, 1] p = p1 | p2 + # Swap entries satisfying either of the above conditions. scl_angles[eq_class > 0] = ( scl_angles[eq_class > 0][:, :, [1, 0, 2]] * p[:, :, None, None] + scl_angles[eq_class > 0] * ~p[:, :, None, None] ) + # Convert angles from radians to degrees. + scl_angles = np.round(scl_angles * 180 / np.pi) % L + import pdb + + pdb.set_trace() + # Create candidate common line linear indices lists for equators. + # As indicated above for equator candidate, for each self common line we + # don't get a single coordinate but a range of them. Here we register a + # list of coordinates for each such self common line candidate. + non_top_view_eq_idx = np.where(eq_class > 0)[0] + n_eq = len(non_top_view_eq_idx) + n_inplane_rots = Ris.shape[1] + count_eq = 0 + + # eq_lin_idx_lists[i,j,1] registers a list of linear indices of the j'th + # in-plane rotation of the range for the (only) self common line of the i'th + # candidate. eq_lin_idx_lists[i,j,2] registers the actual (integer) angle + # of the self common line in the 2D Fourier space. Note that we need only + # one number since each self common line has radial coordinates of the form + # (theta, theta+180). + eq_lin_idx_lists = [] + for i in list(non_top_view_eq_idx): + i_list = [] + for j in range(n_inplane_rots): + idx1 = self.circ_seq(scl_angles[i, j, 0, 0], scl_angles[i, j, 1, 0], L) + idx2 = self.circ_seq(scl_angles[i, j, 0, 1], scl_angles[i, j, 1, 1], L) + + # Adjust so idx2 is in [0, 180) range. + idx2[idx2 >= 180] = (idx2[idx2 >= 180] - L // 2) % (L // 2) + idx1[idx2 >= 180] = (idx1[idx2 >= 180] + L // 2) % L + print(i, j, idx1, idx2) + # register indices in list. + i_list.append(np.ravel_multi_index((idx1, idx2), (L, L // 2))) + i_list.append(idx2) + + eq_lin_idx_lists.append(i_list) + + @staticmethod + def circ_seq(n1, n2, L): + """ + Make a circular sequence of integers between n1 and n2 modulo L. + + :param n1: First integer in sequence. + :param n2: Last integer in sequence. + :param L: Modulus of values in sequence. + :return: Circular sequence modulo L. + """ + if n2 < n1: + n2 += L + if n1 == n2: + return np.array(n1).astype(int) + + seq = np.arange(n1, n2) % L + seq[abs(seq) < 1e-8] = L + + return seq.astype(int) + @staticmethod def saff_kuijlaars(N): """ @@ -333,7 +401,7 @@ def generate_inplane_rots(sphere_grid, d_theta): dtype = sphere_grid.dtype # Generate one rotation for each point on the sphere. n_rots = len(sphere_grid) - Ri2 = np.column_stack((-sphere_grid[:, 2], sphere_grid[:, 1], np.zeros(n_rots))) + Ri2 = np.column_stack((-sphere_grid[:, 1], sphere_grid[:, 0], np.zeros(n_rots))) Ri2 /= np.linalg.norm(Ri2, axis=1)[:, None] Ri1 = np.cross(Ri2, sphere_grid) Ri1 /= np.linalg.norm(Ri1, axis=1)[:, None] @@ -345,8 +413,9 @@ def generate_inplane_rots(sphere_grid, d_theta): # Generate in-plane rotations. d_theta *= np.pi / 180 + # TODO: Negative signs to match matlab. inplane_rots = Rotation.about_axis( - "z", np.arange(0, 2 * np.pi, d_theta), dtype=dtype + "z", np.arange(0, -2 * np.pi, -d_theta), dtype=dtype ).matrices n_inplane_rots = len(inplane_rots) @@ -375,13 +444,13 @@ def generate_commonline_angles( :return: Commonline angles induced by relative rotation candidates. """ n_rots_i = len(Ris) - n_theta = Ris.shape[1] # Same for Rjs + n_theta = Ris.shape[1] # Same for Rjs, TODO: Don't call this n_theta # Generate upper triangular table of indicators of all pairs which are not # equators with respect to the same symmetry axis (named unique_pairs). eq_table = np.outer(Ri_eq_idx, Rj_eq_idx) in_same_class = (Ri_eq_class[:, None] - Rj_eq_class.T[None]) == 0 - eq2eq_Rij_table = np.triu(~(eq_table * in_same_class)) + eq2eq_Rij_table = np.triu(~(eq_table * in_same_class), 1) n_pairs = np.sum(eq2eq_Rij_table) idx = 0 @@ -419,6 +488,8 @@ def generate_commonline_angles( @staticmethod def generate_commonline_indices(cl_angles): + # TODO: This is not accounting for n_theta other than 360! + # Make all angles non-negative and convert to degrees. cl_angles = (cl_angles + 2 * np.pi) % (2 * np.pi) cl_angles = cl_angles * 180 / np.pi @@ -428,17 +499,22 @@ def generate_commonline_indices(cl_angles): cl_angles = np.reshape(cl_angles, (np.prod(og_shape[:-1]), 2)) # Fourier ray index - cl_ind_j = np.round(cl_angles[:, 0]).astype("int") % 360 - cl_ind_i = np.round(cl_angles[:, 1]).astype("int") % 360 + row_sub = np.round(cl_angles[:, 0]).astype("int") % 360 + col_sub = np.round(cl_angles[:, 1]).astype("int") % 360 # Restrict Rj in-plane coordinates to <180 degrees. - is_geq_than_pi = cl_ind_j >= 180 - cl_ind_j[is_geq_than_pi] = cl_ind_j[is_geq_than_pi] - 180 - cl_ind_i[is_geq_than_pi] = (cl_ind_i[is_geq_than_pi] + 180) % 360 + is_geq_than_pi = col_sub >= 180 + col_sub[is_geq_than_pi] = col_sub[is_geq_than_pi] - 180 + row_sub[is_geq_than_pi] = (row_sub[is_geq_than_pi] + 180) % 360 + + # Convert to linear indices in 360*180 correlation matrix (same as cls_lookup in matlab) + cl_ind = np.ravel_multi_index((row_sub, col_sub), dims=(360, 180)) + + # Reshape cl_angles (to match matlab `cls`) + cl_angles = cl_angles.reshape(og_shape) - # Convert to linear indices in 360*180 correlation matrix - cl_ind = np.ravel_multi_index((cl_ind_i, cl_ind_j), dims=(360, 180)) - return cl_ind + # Return as integer indices. + return cl_ind, np.rint(cl_angles).astype(int) def _generate_gs(self): """ From 229992112536a3b669a51335e50bbcb928eb692b Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 29 Feb 2024 15:58:19 -0500 Subject: [PATCH 317/433] Finish scl_lookup --- src/aspire/abinitio/commonline_d2.py | 78 +++++++++++++++++----------- 1 file changed, 47 insertions(+), 31 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index b728c5bd89..a702902928 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -69,11 +69,7 @@ def estimate_rotations(self): :return: Array of rotation matrices, size n_imgx3x3. """ self.generate_lookup_data() - self.generate_scl_lookup_data( - self.inplane_rotated_grid1, - self.eq_idx1, - self.eq_class1, - ) + self.generate_scl_lookup_data() def generate_lookup_data(self): """ @@ -153,13 +149,26 @@ def generate_lookup_data(self): self.cl_ind_1, self.cl_angles1 = self.generate_commonline_indices(cl_angles1) self.cl_ind_2, self.cl_angles2 = self.generate_commonline_indices(cl_angles2) - self.generate_scl_lookup_data( - self.inplane_rotated_grid1, self.eq_idx1, self.eq_class1 + def generate_scl_lookup_data(self): + """ + Generate lookup data for self-commonlines. + + :param Ris: Candidate rotation matrices, (n_sphere_grid, n_inplane_rots, 3, 3). + :param eq_idx: Equator index mask for Ris. + :param eq_class: Equator classification for Ris. + """ + self.scl_angles1 = self.generate_scl_angles( + self.inplane_rotated_grid1, + self.eq_idx1, + self.eq_class1, + ) + self.scl_ind_1, self.scl_eq_lin_idx_lists_1 = self.generate_scl_indices( + self.scl_angles1, self.eq_class1 ) - def generate_scl_lookup_data(self, Ris, eq_idx, eq_class): + def generate_scl_angles(self, Ris, eq_idx, eq_class): """ - Generate lookup data for self-commonlines. + Generate self-commonline angles. :param Ris: Candidate rotation matrices, (n_sphere_grid, n_inplane_rots, 3, 3). :param eq_idx: Equator index mask for Ris. @@ -172,7 +181,8 @@ def generate_scl_lookup_data(self, Ris, eq_idx, eq_class): n_rots = len(Ris) for i in range(n_rots): Ri = Ris[i] - for k, g in enumerate(self.gs[1:]): + # TODO: Reversing self.gs here to match matlab. Should use as is. + for k, g in enumerate(self.gs[::-1][:3]): g_Ri = g * Ri Riis = np.transpose(Ri, axes=(0, 2, 1)) @ g_Ri @@ -237,42 +247,49 @@ def generate_scl_lookup_data(self, Ris, eq_idx, eq_class): + scl_angles[eq_class > 0] * ~p[:, :, None, None] ) - # Convert angles from radians to degrees. + # Convert angles from radians to degrees (indices). scl_angles = np.round(scl_angles * 180 / np.pi) % L - import pdb - pdb.set_trace() + return scl_angles + + def generate_scl_indices(self, scl_angles, eq_class): + L = 360 + # Create candidate common line linear indices lists for equators. # As indicated above for equator candidate, for each self common line we # don't get a single coordinate but a range of them. Here we register a # list of coordinates for each such self common line candidate. non_top_view_eq_idx = np.where(eq_class > 0)[0] n_eq = len(non_top_view_eq_idx) - n_inplane_rots = Ris.shape[1] + n_inplane_rots = scl_angles.shape[1] count_eq = 0 - # eq_lin_idx_lists[i,j,1] registers a list of linear indices of the j'th + # eq_lin_idx_lists[1,i,j] registers a list of linear indices of the j'th # in-plane rotation of the range for the (only) self common line of the i'th - # candidate. eq_lin_idx_lists[i,j,2] registers the actual (integer) angle + # candidate. eq_lin_idx_lists[2,i,j] registers the actual (integer) angle # of the self common line in the 2D Fourier space. Note that we need only # one number since each self common line has radial coordinates of the form # (theta, theta+180). - eq_lin_idx_lists = [] - for i in list(non_top_view_eq_idx): - i_list = [] + eq_lin_idx_lists = np.empty((2, n_eq, n_inplane_rots), dtype=object) + for i in non_top_view_eq_idx.tolist(): for j in range(n_inplane_rots): idx1 = self.circ_seq(scl_angles[i, j, 0, 0], scl_angles[i, j, 1, 0], L) idx2 = self.circ_seq(scl_angles[i, j, 0, 1], scl_angles[i, j, 1, 1], L) # Adjust so idx2 is in [0, 180) range. - idx2[idx2 >= 180] = (idx2[idx2 >= 180] - L // 2) % (L // 2) idx1[idx2 >= 180] = (idx1[idx2 >= 180] + L // 2) % L - print(i, j, idx1, idx2) + idx2[idx2 >= 180] = (idx2[idx2 >= 180] - L // 2) % (L // 2) + # register indices in list. - i_list.append(np.ravel_multi_index((idx1, idx2), (L, L // 2))) - i_list.append(idx2) + eq_lin_idx_lists[0, count_eq, j] = np.ravel_multi_index( + (idx1, idx2), (L, L // 2) + ) + eq_lin_idx_lists[1, count_eq, j] = idx2 + count_eq += 1 - eq_lin_idx_lists.append(i_list) + scl_indices, _ = self.generate_commonline_indices(scl_angles) + + return scl_indices, eq_lin_idx_lists @staticmethod def circ_seq(n1, n2, L): @@ -289,10 +306,9 @@ def circ_seq(n1, n2, L): if n1 == n2: return np.array(n1).astype(int) - seq = np.arange(n1, n2) % L - seq[abs(seq) < 1e-8] = L + seq = np.arange(n1, n2 + 1).astype(int) % L - return seq.astype(int) + return seq @staticmethod def saff_kuijlaars(N): @@ -484,16 +500,16 @@ def generate_commonline_angles( idx += 1 + # Make all angles non-negative and convert to degrees. + cl_angles = (cl_angles + 2 * np.pi) % (2 * np.pi) + cl_angles = cl_angles * 180 / np.pi + return cl_angles @staticmethod def generate_commonline_indices(cl_angles): # TODO: This is not accounting for n_theta other than 360! - # Make all angles non-negative and convert to degrees. - cl_angles = (cl_angles + 2 * np.pi) % (2 * np.pi) - cl_angles = cl_angles * 180 / np.pi - # Flatten the stack og_shape = cl_angles.shape cl_angles = np.reshape(cl_angles, (np.prod(og_shape[:-1]), 2)) From 44c21c997c58a50418b4beb3764d894aa7edc9a7 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 8 Mar 2024 16:02:51 -0500 Subject: [PATCH 318/433] all_eq_measures and partial compute_scl_scores --- src/aspire/abinitio/commonline_d2.py | 121 ++++++++++++++++++++++++++- 1 file changed, 120 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index a702902928..dff513e923 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1,9 +1,11 @@ import logging import numpy as np +from numpy.linalg import norm from aspire.abinitio import CLOrient3D -from aspire.utils import Rotation +from aspire.operators import PolarFT +from aspire.utils import Rotation, trange logger = logging.getLogger(__name__) @@ -70,6 +72,114 @@ def estimate_rotations(self): """ self.generate_lookup_data() self.generate_scl_lookup_data() + self.compute_scl_scores() + + def compute_scl_scores(self): + pf = self.pf + n_img = self.n_img + L = self.src.L + n_theta = self.n_theta + max_shift_1d = self.max_shift + shift_step = self.shift_step + + # Compute the correlation over all shifts. + # Generate Shifts. + r_max = pf.shape[-1] + shifts, shift_phases, _ = self._generate_shift_phase_and_filter( + r_max, max_shift_1d, shift_step + ) + n_shifts = len(shifts) + + # Reconstruct the full polar Fourier for use in correlation. self.pf only consists of + # rays in the range [180, 360), with shape (n_img, n_theta//2, n_rad-1). + pf_full = PolarFT.half_to_full(pf) + + for i in trange(n_img): + pf_i = pf[i] + pf_full_i = pf_full[i] + + # Generate shifted versions of images. + pf_i_shifted = np.array( + [pf_i * shift_phase for shift_phase in shift_phases] + ) + pf_i_shifted = np.reshape(pf_i_shifted, (n_shifts * n_theta // 2, r_max)) + + # # Normalize each ray. + pf_full_i /= norm(pf_full_i, axis=1)[..., np.newaxis] + pf_i_shifted /= norm(pf_i_shifted, axis=1)[..., np.newaxis] + + # Compute max correlation over all shifts. + corrs = np.real(pf_i_shifted @ pf_full_i.T) + corrs = np.reshape(corrs, (n_shifts, n_theta // 2, n_theta)) + corrs = np.max(corrs, axis=0) + + # Map correlations to probabilities (in the spirit of Maximum Likelihood). + corrs = 0.5 * (corrs + 1) + + # Compute equator measures. + eq_measures = self.all_eq_measures(corrs) + + def all_eq_measures(self, corrs): + """ + Compute a measure of how much an image from data is close to be an equator. + """ + # First compute the eq measure (corrs(scl-k,scl+k) for k=1:90) + # An eqautor image of a D2 molecule has the following property: If t_i is + # the angle of one of the rays of the self common line then all the pairs of + # rays of the form (t_i-k,t_i+k) for k=1:90 are identical. For each t_i we + # average over correlations between the lines (t_i-k,t_i+k) for k=1:90 + # to measure the likelihood that the image is an equator and the ray (line) + # with angle t_i is a self common line. + # (This first loop can be done once outside this function and then pass + # idx as an argument). + idx = np.zeros((180, 90, 2)) + idx_1 = np.mod(np.vstack((-np.arange(1, 91), np.arange(1, 91))), 360) + idx[0, :, :] = idx_1.T + for k in range(1, 180): + idx[k, :, :] = np.mod(idx_1.T + k, 360) + idx = np.mod(idx, 360) + + idx_1 = idx[:, :, 0].flatten() + idx_2 = idx[:, :, 1].flatten() + + # Make all Ri coordinates < 180 and compute linear indices for corrrelations + bigger_than_180 = idx_1 >= 180 + idx_1[bigger_than_180] = idx_1[bigger_than_180] - 180 + idx_2[bigger_than_180] = (idx_2[bigger_than_180] + 180) % 360 + + # Compute correlations. + eq_corrs = corrs[idx_1.astype(int), idx_2.astype(int)] + eq_corrs = eq_corrs.reshape(180, 90) + corrs_mean = np.mean(eq_corrs, axis=1) + + # Now compute correlations for normals to scls. + # An eqautor image of a D2 molecule has the additional following property: + # The normal line to a self common line in 2D Fourier plane is real valued + # and both of its rays have identical values. We use the correlation + # between one Fourier ray of the normal to a self common line candidate t_i + # with its anti-podal as an additional way to measure if the image is an + # equator and t_i+0.5*pi is the normal to its self common line. + r = 2 + + normal_2_scl_idx = np.zeros((180, 2 * r + 1)) + normal_2_scl_idx_1 = np.mod(180 - np.arange(90 - r, 90 + r + 1), 360) + normal_2_scl_idx[0, :] = normal_2_scl_idx_1 + for k in range(1, 180): + normal_2_scl_idx[k, :] = np.mod(normal_2_scl_idx_1 + k, 360) + + # Make all Ri coordinates <=180 and compute linear indices for corrrelations + bigger_than_180 = normal_2_scl_idx >= 180 + normal_2_scl_idx[bigger_than_180] = normal_2_scl_idx[bigger_than_180] - 180 + + # Compute correlations for normals. + normal_2_scl_idx = normal_2_scl_idx.flatten() + normal_corrs = corrs[ + normal_2_scl_idx.astype(int), normal_2_scl_idx.astype(int) + 180 + ] + normal_corrs = normal_corrs.reshape(180, 2 * r + 1) + normal_corrs_max = np.max(normal_corrs, axis=1) + + return corrs_mean * normal_corrs_max def generate_lookup_data(self): """ @@ -162,9 +272,18 @@ def generate_scl_lookup_data(self): self.eq_idx1, self.eq_class1, ) + self.scl_angles2 = self.generate_scl_angles( + self.inplane_rotated_grid2, + self.eq_idx2, + self.eq_class2, + ) + self.scl_ind_1, self.scl_eq_lin_idx_lists_1 = self.generate_scl_indices( self.scl_angles1, self.eq_class1 ) + self.scl_ind_2, self.scl_eq_lin_idx_lists_2 = self.generate_scl_indices( + self.scl_angles2, self.eq_class2 + ) def generate_scl_angles(self, Ris, eq_idx, eq_class): """ From 8ed50112905ce99f6964e1e3514540239717095f Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 14 Mar 2024 09:19:57 -0400 Subject: [PATCH 319/433] compute_scl_scores. Enforce aspire-python cl correlation convention, ie. (180, 360) shape. --- src/aspire/abinitio/commonline_d2.py | 125 ++++++++++++++++++++++----- 1 file changed, 102 insertions(+), 23 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index dff513e923..2dfcfe0918 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -60,6 +60,7 @@ def __init__( self.grid_res = grid_res self.inplane_res = inplane_res + self.n_inplane_rots = int(360 / self.inplane_res) self.eq_min_dist = eq_min_dist self.seed = seed self._generate_gs() @@ -75,12 +76,16 @@ def estimate_rotations(self): self.compute_scl_scores() def compute_scl_scores(self): + """ + Compute correlations for self-commonline candidates. + """ pf = self.pf n_img = self.n_img - L = self.src.L n_theta = self.n_theta max_shift_1d = self.max_shift shift_step = self.shift_step + n_eq = len(self.non_tv_eq_idx) + n_inplane = self.n_inplane_rots # Compute the correlation over all shifts. # Generate Shifts. @@ -94,6 +99,19 @@ def compute_scl_scores(self): # rays in the range [180, 360), with shape (n_img, n_theta//2, n_rad-1). pf_full = PolarFT.half_to_full(pf) + # Run ML in parallel + scl_matrix = np.concatenate((self.scl_idx_1, self.scl_idx_2)) + M = len(scl_matrix) // 3 + corrs_out = np.zeros((n_img, M), dtype=self.dtype) + scl_idx = scl_matrix.reshape(M, 3) + + # Get non-equator indices to use with corrs matrix. + non_eq_lin_idx = self.non_eq_idx.flatten() + n_non_eq = len(non_eq_lin_idx) + non_eq_idx = np.unravel_index( + scl_idx[non_eq_lin_idx].flatten(), (n_theta // 2, n_theta) + ) + for i in trange(n_img): pf_i = pf[i] pf_full_i = pf_full[i] @@ -109,9 +127,9 @@ def compute_scl_scores(self): pf_i_shifted /= norm(pf_i_shifted, axis=1)[..., np.newaxis] # Compute max correlation over all shifts. - corrs = np.real(pf_i_shifted @ pf_full_i.T) - corrs = np.reshape(corrs, (n_shifts, n_theta // 2, n_theta)) - corrs = np.max(corrs, axis=0) + corrs = np.real(pf_i_shifted @ np.conj(pf_full_i).T) + corrs = np.reshape(corrs, (n_theta // 2, n_shifts, n_theta)) + corrs = np.max(corrs, axis=1) # Map correlations to probabilities (in the spirit of Maximum Likelihood). corrs = 0.5 * (corrs + 1) @@ -119,6 +137,31 @@ def compute_scl_scores(self): # Compute equator measures. eq_measures = self.all_eq_measures(corrs) + # Handle the cases: Non-equator, Non-top-view equator, and Top view images. + # 1. Non-equators: just take product of probabilities. + prod_corrs = np.prod(corrs[non_eq_idx].reshape(n_non_eq, 3), axis=1) + corrs_out[i, non_eq_lin_idx] = prod_corrs + + # 2. Non-topview equators: adjust scores by eq_measures + for eq_idx in range(n_eq): + for j in range(n_inplane): + # Take the correlations for the self common line candidate of the + # "equator rotation" `eq_idx` with respect to image i, and + # multiply by all scores from the function eq_measures (see + # documentation inside the function ). Then take maximum over + # all the scores. + scl_idx_list = np.unravel_index( + self.scl_idx_lists[0, eq_idx, j], (n_theta // 2, n_theta) + ) + true_scls_corrs = corrs[scl_idx_list] + scls_cand_idx = self.scl_idx_lists[1, eq_idx, j] + eq_measures_j = eq_measures[scls_cand_idx] + measures_agg = true_scls_corrs * eq_measures_j + k = self.non_tv_eq_idx[eq_idx] + corrs_out[i, k * n_inplane + j] = np.max(measures_agg) + + self.scls_scores = corrs_out + def all_eq_measures(self, corrs): """ Compute a measure of how much an image from data is close to be an equator. @@ -226,6 +269,7 @@ def generate_lookup_data(self): self.sphere_grid2 = sphere_grid2[eq_class2 < 4] self.eq_idx1 = eq_idx1[eq_class1 < 4] self.eq_idx2 = eq_idx2[eq_class2 < 4] + self.eq_idx = np.concatenate((self.eq_idx1, self.eq_idx2)) self.eq_class1 = eq_class1[eq_class1 < 4] self.eq_class2 = eq_class2[eq_class2 < 4] @@ -256,17 +300,14 @@ def generate_lookup_data(self): ) # Generate commonline indices. - self.cl_ind_1, self.cl_angles1 = self.generate_commonline_indices(cl_angles1) - self.cl_ind_2, self.cl_angles2 = self.generate_commonline_indices(cl_angles2) + self.cl_idx_1, self.cl_angles1 = self.generate_commonline_indices(cl_angles1) + self.cl_idx_2, self.cl_angles2 = self.generate_commonline_indices(cl_angles2) def generate_scl_lookup_data(self): """ Generate lookup data for self-commonlines. - - :param Ris: Candidate rotation matrices, (n_sphere_grid, n_inplane_rots, 3, 3). - :param eq_idx: Equator index mask for Ris. - :param eq_class: Equator classification for Ris. """ + # Get self-commonline angles. self.scl_angles1 = self.generate_scl_angles( self.inplane_rotated_grid1, self.eq_idx1, @@ -278,12 +319,50 @@ def generate_scl_lookup_data(self): self.eq_class2, ) - self.scl_ind_1, self.scl_eq_lin_idx_lists_1 = self.generate_scl_indices( + # Get self-commonline indices. + self.scl_idx_1, self.scl_eq_lin_idx_lists_1 = self.generate_scl_indices( self.scl_angles1, self.eq_class1 ) - self.scl_ind_2, self.scl_eq_lin_idx_lists_2 = self.generate_scl_indices( + self.scl_idx_2, self.scl_eq_lin_idx_lists_2 = self.generate_scl_indices( self.scl_angles2, self.eq_class2 ) + self.scl_idx_lists = np.concatenate( + (self.scl_eq_lin_idx_lists_1, self.scl_eq_lin_idx_lists_2), axis=1 + ) + + # Compute non-equator indices. + # Register non equator indices. Denote by C_ij the j'th in-plane rotation of + # the i'th ML candidate, and arrange all candidates in a list with their in-plane + # rotations in the order: C_11,...,C_1r,...,C_m1,...,C_mr where m is the + # number of candidates and r is the number of in plane rotations. Here we + # create a sub-list of only non equator candidates, i.e., if i_1,...,i_p are + # non equators then we have the sub list is + # C_(i_1)1,...,C(i_1)r,...C_(i_p)1,...,C_(i_p)r. + n_non_eq = np.sum(self.eq_class1 == 0) + np.sum(self.eq_class2 == 0) + non_eq_idx = np.zeros((n_non_eq, int(self.n_inplane_rots))) + non_eq_idx[:, 0] = ( + np.hstack( + ( + np.where(self.eq_class1 == 0)[0], + len(self.eq_class1) + np.where(self.eq_class2 == 0)[0], + ) + ) + * self.n_inplane_rots + ) + for i in range(1, self.n_inplane_rots): + non_eq_idx[:, i] = non_eq_idx[:, 0] + i + + self.non_eq_idx = non_eq_idx.astype(int) + + # Non-topview equator indices. + non_tv_eq_idx = np.concatenate( + ( + np.where(self.eq_class1 > 0)[0], + len(self.eq_class1) + np.where(self.eq_class2 > 0)[0], + ) + ) + + self.non_tv_eq_idx = non_tv_eq_idx.astype(int) def generate_scl_angles(self, Ris, eq_idx, eq_class): """ @@ -395,15 +474,15 @@ def generate_scl_indices(self, scl_angles, eq_class): idx1 = self.circ_seq(scl_angles[i, j, 0, 0], scl_angles[i, j, 1, 0], L) idx2 = self.circ_seq(scl_angles[i, j, 0, 1], scl_angles[i, j, 1, 1], L) - # Adjust so idx2 is in [0, 180) range. - idx1[idx2 >= 180] = (idx1[idx2 >= 180] + L // 2) % L - idx2[idx2 >= 180] = (idx2[idx2 >= 180] - L // 2) % (L // 2) + # Adjust so idx1 is in [0, 180) range. + idx1[idx1 >= 180] = (idx1[idx1 >= 180] - L // 2) % (L // 2) + idx2[idx1 >= 180] = (idx2[idx1 >= 180] + L // 2) % L # register indices in list. eq_lin_idx_lists[0, count_eq, j] = np.ravel_multi_index( - (idx1, idx2), (L, L // 2) + (idx1, idx2), (L // 2, L) ) - eq_lin_idx_lists[1, count_eq, j] = idx2 + eq_lin_idx_lists[1, count_eq, j] = idx1 count_eq += 1 scl_indices, _ = self.generate_commonline_indices(scl_angles) @@ -637,19 +716,19 @@ def generate_commonline_indices(cl_angles): row_sub = np.round(cl_angles[:, 0]).astype("int") % 360 col_sub = np.round(cl_angles[:, 1]).astype("int") % 360 - # Restrict Rj in-plane coordinates to <180 degrees. - is_geq_than_pi = col_sub >= 180 - col_sub[is_geq_than_pi] = col_sub[is_geq_than_pi] - 180 - row_sub[is_geq_than_pi] = (row_sub[is_geq_than_pi] + 180) % 360 + # Restrict Ri in-plane coordinates to <180 degrees. + is_geq_than_pi = row_sub >= 180 + row_sub[is_geq_than_pi] = row_sub[is_geq_than_pi] - 180 + col_sub[is_geq_than_pi] = (col_sub[is_geq_than_pi] + 180) % 360 # Convert to linear indices in 360*180 correlation matrix (same as cls_lookup in matlab) - cl_ind = np.ravel_multi_index((row_sub, col_sub), dims=(360, 180)) + cl_idx = np.ravel_multi_index((row_sub, col_sub), dims=(180, 360)) # Reshape cl_angles (to match matlab `cls`) cl_angles = cl_angles.reshape(og_shape) # Return as integer indices. - return cl_ind, np.rint(cl_angles).astype(int) + return cl_idx, np.rint(cl_angles).astype(int) def _generate_gs(self): """ From 8c8dffecb10db05e420a2bb04a935a8f6815eda9 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 14 Mar 2024 14:23:26 -0400 Subject: [PATCH 320/433] precompute shifted polar fourier. Confirm corrs reshape. --- src/aspire/abinitio/commonline_d2.py | 58 +++++++++++++++------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 2dfcfe0918..117e43b7ee 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -71,15 +71,41 @@ def estimate_rotations(self): :return: Array of rotation matrices, size n_imgx3x3. """ + self.compute_shifted_pf() self.generate_lookup_data() self.generate_scl_lookup_data() self.compute_scl_scores() + def compute_shifted_pf(self): + pf = self.pf + + # Generate shift phases. + r_max = pf.shape[-1] + shifts, shift_phases, _ = self._generate_shift_phase_and_filter( + r_max, self.max_shift, self.shift_step + ) + self.n_shifts = len(shifts) + + # Reconstruct full polar Fourier for use in correlation. + pf /= norm(pf, axis=2)[..., np.newaxis] # Normalize each ray. + self.pf_full = PolarFT.half_to_full(pf) + + # Pre-compute shifted pf's. + pf_shifted = (pf * shift_phases[:, None, None]).swapaxes(0, 1) + self.pf_shifted = pf_shifted.reshape( + (self.n_img, self.n_shifts * (self.n_theta // 2), r_max) + ) + + def compute_cl_scores(self): + """ + Run common lines Maximum likelihood procedure for a D2 molecule, to find + the set of rotations Ri^TgkRj, k=1,2,3,4 for each pair of images i and j. + """ + def compute_scl_scores(self): """ Compute correlations for self-commonline candidates. """ - pf = self.pf n_img = self.n_img n_theta = self.n_theta max_shift_1d = self.max_shift @@ -87,18 +113,6 @@ def compute_scl_scores(self): n_eq = len(self.non_tv_eq_idx) n_inplane = self.n_inplane_rots - # Compute the correlation over all shifts. - # Generate Shifts. - r_max = pf.shape[-1] - shifts, shift_phases, _ = self._generate_shift_phase_and_filter( - r_max, max_shift_1d, shift_step - ) - n_shifts = len(shifts) - - # Reconstruct the full polar Fourier for use in correlation. self.pf only consists of - # rays in the range [180, 360), with shape (n_img, n_theta//2, n_rad-1). - pf_full = PolarFT.half_to_full(pf) - # Run ML in parallel scl_matrix = np.concatenate((self.scl_idx_1, self.scl_idx_2)) M = len(scl_matrix) // 3 @@ -113,23 +127,13 @@ def compute_scl_scores(self): ) for i in trange(n_img): - pf_i = pf[i] - pf_full_i = pf_full[i] - - # Generate shifted versions of images. - pf_i_shifted = np.array( - [pf_i * shift_phase for shift_phase in shift_phases] - ) - pf_i_shifted = np.reshape(pf_i_shifted, (n_shifts * n_theta // 2, r_max)) - - # # Normalize each ray. - pf_full_i /= norm(pf_full_i, axis=1)[..., np.newaxis] - pf_i_shifted /= norm(pf_i_shifted, axis=1)[..., np.newaxis] + pf_full_i = self.pf_full[i] + pf_i_shifted = self.pf_shifted[i] # Compute max correlation over all shifts. corrs = np.real(pf_i_shifted @ np.conj(pf_full_i).T) - corrs = np.reshape(corrs, (n_theta // 2, n_shifts, n_theta)) - corrs = np.max(corrs, axis=1) + corrs = np.reshape(corrs, (self.n_shifts, n_theta // 2, n_theta)) + corrs = np.max(corrs, axis=0) # Map correlations to probabilities (in the spirit of Maximum Likelihood). corrs = 0.5 * (corrs + 1) From d62ed4076ad035113bdc0096e9d9f3774d3b0f31 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 15 Mar 2024 13:44:17 -0400 Subject: [PATCH 321/433] add generate_scl_scores_idx_map method. --- src/aspire/abinitio/commonline_d2.py | 66 ++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 117e43b7ee..5337a5fa8e 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -286,7 +286,7 @@ def generate_lookup_data(self): ) # Generate commmonline angles induced by all relative rotation candidates. - cl_angles1 = self.generate_commonline_angles( + cl_angles1, self.eq2eq_Rij_table_11 = self.generate_commonline_angles( self.inplane_rotated_grid1, self.inplane_rotated_grid1, self.eq_idx1, @@ -294,7 +294,7 @@ def generate_lookup_data(self): self.eq_class1, self.eq_class1, ) - cl_angles2 = self.generate_commonline_angles( + cl_angles2, self.eq2eq_Rij_table_12 = self.generate_commonline_angles( self.inplane_rotated_grid1, self.inplane_rotated_grid2, self.eq_idx1, @@ -368,6 +368,8 @@ def generate_scl_lookup_data(self): self.non_tv_eq_idx = non_tv_eq_idx.astype(int) + self.generate_scl_scores_idx_map() + def generate_scl_angles(self, Ris, eq_idx, eq_class): """ Generate self-commonline angles. @@ -493,6 +495,64 @@ def generate_scl_indices(self, scl_angles, eq_class): return scl_indices, eq_lin_idx_lists + def generate_scl_scores_idx_map(self): + n_rot_1 = len(self.scl_idx_1) // (3 * self.n_inplane_rots) + n_rot_2 = len(self.scl_idx_2) // (3 * self.n_inplane_rots) + + # First the map for i 0] + if len(unique_pairs_i) == 0: + continue + i_idx_plus_offset = i_idx + (i * self.n_inplane_rots) + + for j in unique_pairs_i: + j_idx_plus_offset = j_idx + (j * self.n_inplane_rots) + oct1_ij_map[idx] = np.vstack((i_idx_plus_offset, j_idx_plus_offset)) + idx += 1 + + # First the map for i 0] + if len(unique_pairs_i) == 0: + continue + i_idx_plus_offset = i_idx + (i * self.n_inplane_rots) + + for j in unique_pairs_i: + j_idx_plus_offset = j_idx + (j * self.n_inplane_rots) + oct2_ij_map[idx] = np.vstack((i_idx_plus_offset, j_idx_plus_offset)) + idx += 1 + + tmp1 = oct1_ij_map[:, 0, :] + tmp2 = oct1_ij_map[:, 1, :] + self.oct1_ij_map = np.column_stack((tmp1.flatten(), tmp2.flatten())) + + tmp1 = oct2_ij_map[:, 0, :] + tmp2 = oct2_ij_map[:, 1, :] + self.oct2_ij_map = np.column_stack((tmp1.flatten(), tmp2.flatten())) + @staticmethod def circ_seq(n1, n2, L): """ @@ -706,7 +766,7 @@ def generate_commonline_angles( cl_angles = (cl_angles + 2 * np.pi) % (2 * np.pi) cl_angles = cl_angles * 180 / np.pi - return cl_angles + return cl_angles, eq2eq_Rij_table @staticmethod def generate_commonline_indices(cl_angles): From 3d649b5f346fd62af91c470a04dc49b70e5d1615 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 15 Mar 2024 13:47:06 -0400 Subject: [PATCH 322/433] remove unused variables. --- src/aspire/abinitio/commonline_d2.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 5337a5fa8e..08a984768a 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -108,8 +108,6 @@ def compute_scl_scores(self): """ n_img = self.n_img n_theta = self.n_theta - max_shift_1d = self.max_shift - shift_step = self.shift_step n_eq = len(self.non_tv_eq_idx) n_inplane = self.n_inplane_rots From e01a7d839a912221c785df76b2870d48327a89d4 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 29 Mar 2024 16:07:28 -0400 Subject: [PATCH 323/433] completed compute_cl_scores --- src/aspire/abinitio/commonline_d2.py | 196 ++++++++++++++++++++++++--- 1 file changed, 174 insertions(+), 22 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 08a984768a..223824187f 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -5,7 +5,7 @@ from aspire.abinitio import CLOrient3D from aspire.operators import PolarFT -from aspire.utils import Rotation, trange +from aspire.utils import Rotation, tqdm, trange logger = logging.getLogger(__name__) @@ -75,8 +75,12 @@ def estimate_rotations(self): self.generate_lookup_data() self.generate_scl_lookup_data() self.compute_scl_scores() + self.compute_cl_scores() def compute_shifted_pf(self): + """ + Pre-compute shifted and full polar Fourier transforms. + """ pf = self.pf # Generate shift phases. @@ -101,6 +105,137 @@ def compute_cl_scores(self): Run common lines Maximum likelihood procedure for a D2 molecule, to find the set of rotations Ri^TgkRj, k=1,2,3,4 for each pair of images i and j. """ + # Map the self common line scores of each 2 candidate rotations R_i,R_j to + # the respective relative rotation candidate R_i^TR_j. + n_lookup_1 = len(self.scl_idx_1) // 3 + oct1_ij_map = np.vstack((self.oct1_ij_map, self.oct1_ij_map[:, [1, 0]])) + oct2_ij_map = self.oct2_ij_map + oct2_ij_map[:, 1] += n_lookup_1 + oct2_ij_map = np.vstack((oct2_ij_map, oct2_ij_map[:, [1, 0]])) + ij_map = np.vstack((oct1_ij_map, oct2_ij_map)) + + # Allocate output variables. + n_pairs = self.n_img * (self.n_img - 1) // 2 + corrs_idx = np.zeros(n_pairs, dtype=np.int64) + corrs_out = np.zeros(n_pairs, dtype=self.dtype) + ij_idx = 0 + + # Search for common lines between pairs of projections. + pbar = tqdm( + desc="Searching for commonlines between pairs of images", total=n_pairs + ) + for i in range(self.n_img): + pf_i = self.pf_shifted[i] + scores_i = self.scls_scores[i] + + for j in range(i + 1, self.n_img): + pf_j = self.pf_full[j] + + # Compute maximum correlation over all shifts. + corrs = np.real(pf_i @ np.conj(pf_j).T) + corrs = np.reshape( + corrs, (self.n_shifts, self.n_theta // 2, self.n_theta) + ) + corrs = np.max(corrs, axis=0) + + # Take the product over symmetrically induced candidates. Eq. 4.5 in paper. + cl_idx = np.unravel_index( + self.cl_idx, (self.n_theta // 2, self.n_theta) + ) + prod_corrs = corrs[cl_idx] + prod_corrs = prod_corrs.reshape(len(prod_corrs) // 4, 4) + prod_corrs = np.prod(prod_corrs, axis=1) + + # Incorporate scores of individual rotations from self-commonlines. + scores_j = self.scls_scores[j] + scores_ij = scores_i[ij_map[:, 0]] * scores_j[ij_map[:, 1]] + + # Find maximum correlations. + prod_corrs = prod_corrs * scores_ij + max_idx = np.argmax(prod_corrs) + corrs_idx[ij_idx] = max_idx + corrs_out[ij_idx] = prod_corrs[max_idx] + ij_idx += 1 + + pbar.update() + pbar.close() + + # Get estimated relative viewing directions. + self.Rijs_est = self.get_Rijs_from_lin_idx(corrs_idx) + + def get_Rijs_from_lin_idx(self, lin_idx): + """ + Restore map results from maximum-likelihood over commonlines to corresponding + relative rotations. + """ + Rijs_est = np.zeros((len(lin_idx), 4, 3, 3), dtype=self.dtype) + n_cand_per_oct = len(self.cl_idx_1) // 4 + oct1_idx = lin_idx < n_cand_per_oct + n_est_in_oct1 = np.sum(oct1_idx, dtype=int) + if n_est_in_oct1 > 0: + Rijs_est[oct1_idx] = self.get_Rijs_from_oct(lin_idx[oct1_idx], octant=1) + if n_est_in_oct1 <= len(lin_idx): + Rijs_est[~oct1_idx] = self.get_Rijs_from_oct( + lin_idx[~oct1_idx] - n_cand_per_oct, octant=2 + ) + + def get_Rijs_from_oct(self, lin_idx, octant=1): + if octant not in [1, 2]: + raise ValueError("`octant` must be 1 or 2.") + + # Get pairs lookup table. + if octant == 1: + unique_pairs = self.eq2eq_Rij_table_11 + else: + unique_pairs = self.eq2eq_Rij_table_12 + n_theta = self.n_inplane_rots + n_lookup_pairs = np.sum(unique_pairs, dtype=np.int64) + n_rots = len(self.sphere_grid1) + if octant == 1: + n_rots2 = n_rots + else: + n_rots2 = len(self.sphere_grid2) + n_pairs = len(lin_idx) + + # Map linear indices of chosen pairs of rotation candidates from ML to regular indices. + p_idx, inplane_i, inplane_j = np.unravel_index( + lin_idx, (2 * n_lookup_pairs, n_theta, n_theta // 2) + ) + transpose_idx = p_idx >= n_lookup_pairs + p_idx[transpose_idx] -= n_lookup_pairs + s = self.inplane_rotated_grid1.shape + inplane_rotated_grid = np.reshape( + self.inplane_rotated_grid1, (np.prod(s[0:2]), 3, 3) + ) + if octant == 1: + s2 = s + inplane_rotated_grid2 = inplane_rotated_grid + else: + s2 = self.inplane_rotated_grid2.shape + inplane_rotated_grid2 = np.reshape( + self.inplane_rotated_grid2, (np.prod(s2[0:2]), 3, 3) + ) + + Rijs_est = np.zeros((n_pairs, 4, 3, 3), dtype=self.dtype) + + # Convert linear indices of unique table to linear indices of index pairs table. + idx_vec = np.arange(np.prod(unique_pairs.shape)) + unique_lin_idx = idx_vec[unique_pairs.flatten()] + I, J = np.unravel_index(unique_lin_idx, (n_rots, n_rots2)) + est_idx = np.vstack((I[p_idx], J[p_idx])) + + # Assemble relative rotations Ri^TgRj using linear indices, where g is a group member of D2. + Ris_lin_idx = np.ravel_multi_index((est_idx[0], inplane_i), s[:2]) + Rjs_lin_idx = np.ravel_multi_index((est_idx[1], inplane_j), s2[:2]) + Ris = np.transpose(inplane_rotated_grid[Ris_lin_idx], (0, 2, 1)) + Rjs = np.transpose(inplane_rotated_grid2[Rjs_lin_idx], (0, 2, 1)) + + for k, g in enumerate(self.gs): + Rijs_est[:, k] = np.transpose(Ris, (0, 2, 1)) @ (g * Rjs) + + Rijs_est[transpose_idx] = np.transpose(Rijs_est[transpose_idx], (0, 1, 3, 2)) + + return Rijs_est def compute_scl_scores(self): """ @@ -299,11 +434,13 @@ def generate_lookup_data(self): self.eq_idx2, self.eq_class1, self.eq_class2, + triu=False, ) # Generate commonline indices. self.cl_idx_1, self.cl_angles1 = self.generate_commonline_indices(cl_angles1) self.cl_idx_2, self.cl_angles2 = self.generate_commonline_indices(cl_angles2) + self.cl_idx = np.hstack((self.cl_idx_1, self.cl_idx_2)) def generate_scl_lookup_data(self): """ @@ -366,6 +503,7 @@ def generate_scl_lookup_data(self): self.non_tv_eq_idx = non_tv_eq_idx.astype(int) + # Generate maps from scl indices to relative rotations. self.generate_scl_scores_idx_map() def generate_scl_angles(self, Ris, eq_idx, eq_class): @@ -499,36 +637,32 @@ def generate_scl_scores_idx_map(self): # First the map for i 0] + unique_pairs_i = idx_vec[self.eq2eq_Rij_table_11[i]] if len(unique_pairs_i) == 0: continue i_idx_plus_offset = i_idx + (i * self.n_inplane_rots) for j in unique_pairs_i: j_idx_plus_offset = j_idx + (j * self.n_inplane_rots) - oct1_ij_map[idx] = np.vstack((i_idx_plus_offset, j_idx_plus_offset)) + oct1_ij_map[:, :, idx] = np.column_stack( + (i_idx_plus_offset, j_idx_plus_offset) + ) idx += 1 # First the map for i Date: Thu, 11 Apr 2024 15:15:01 -0400 Subject: [PATCH 324/433] global J sync complete --- src/aspire/abinitio/commonline_d2.py | 209 ++++++++++++++++++++++++++- 1 file changed, 208 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 223824187f..0c8a402889 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -5,7 +5,8 @@ from aspire.abinitio import CLOrient3D from aspire.operators import PolarFT -from aspire.utils import Rotation, tqdm, trange +from aspire.utils import J_conjugate, Rotation, all_pairs, all_triplets, tqdm, trange +from aspire.utils.random import randn logger = logging.getLogger(__name__) @@ -31,6 +32,7 @@ def __init__( grid_res=1200, inplane_res=5, eq_min_dist=7, + epsilon=0.01, seed=None, ): """ @@ -63,6 +65,7 @@ def __init__( self.n_inplane_rots = int(360 / self.inplane_res) self.eq_min_dist = eq_min_dist self.seed = seed + self.epsilon = epsilon self._generate_gs() def estimate_rotations(self): @@ -77,6 +80,14 @@ def estimate_rotations(self): self.compute_scl_scores() self.compute_cl_scores() + # Handedness Synchronization + self.Rijs_sync = self._global_J_sync(self.Rijs_est) + np.save("Rijs_sync.npy", self.Rijs_sync) + np.save("Rijs_est.npy", self.Rijs_est) + import pdb + + pdb.set_trace() + def compute_shifted_pf(self): """ Pre-compute shifted and full polar Fourier transforms. @@ -179,6 +190,8 @@ def get_Rijs_from_lin_idx(self, lin_idx): lin_idx[~oct1_idx] - n_cand_per_oct, octant=2 ) + return Rijs_est + def get_Rijs_from_oct(self, lin_idx, octant=1): if octant not in [1, 2]: raise ValueError("`octant` must be 1 or 2.") @@ -691,6 +704,200 @@ def generate_scl_scores_idx_map(self): (tmp1.flatten(order="F"), tmp2.flatten(order="F")) ) + ############################# + # Methods for Global J Sync # + ############################# + + def _global_J_sync(self, Rijs): + """ + Global J-synchronization of all third row outer products. Given 3x3 matrices Rijs and viis, each + of which might contain a spurious J (ie. vij = J*vi*vj^T*J instead of vij = vi*vj^T), + we return Rijs and viis that all have either a spurious J or not. + + :param Rijs: An (n-choose-2)x3x3 array where each 3x3 slice holds an estimate for the corresponding + outer-product vi*vj^T between the third rows of the rotation matrices Ri and Rj. Each estimate + might have a spurious J independently of other estimates. + + :return: Rijs, all of which have a spurious J or not. + """ + n_img = self.n_img + + # Find best J_configuration. + J_list = self._J_configuration(Rijs) + + # Determine relative handedness of Rijs. + sign_ij_J = self._J_sync_power_method(J_list) + + # Synchronize Rijs + logger.info("Applying global handedness synchronization.") + mask = sign_ij_J == 1 + Rijs[mask] = J_conjugate(Rijs[mask]) + + return Rijs + + def _J_configuration(self, Rijs): + """ + For each triplet of indices (i, j, k), consider the relative rotations + tuples {Ri^TgmRj}, {Ri^TglRk} and {Rj^TgrRk}. Compute norms of the form + ||Ri^TgmRj*Rj^TglRk-Ri^TglRk||, ||J*Ri^TgmRj*J*Rj^TglRk-Ri^TglRk||, + ||Ri^TgmRj*J*Rj^TglRk*J-Ri^TglRk| and ||Ri^TgmRj*Rj^TglRk-J*Ri^TglRk*J|| + where gm,gl,gr are the varipus gorup members of Dn and J=diag([1,1-1]). + The correct "J-configuration" is given for the smallest of these 4 norms. + + :param Rijs: (n-choose-2)x3x3 array of relative rotations. + :return: List of n-choose-3 indices in {0,1,2,3} indicating + which J-configuration for each triplet of Rijs, inmik", Rik, Rjk_t) + + arr = np.zeros((8, 8, 3, 3), dtype=self.dtype) + arr[0:4, 0:4] = prod_arr - Rij[0] + arr[0:4, 4:8] = prod_arr - Rij[1] + arr[4:8, 0:4] = prod_arr - Rij[2] + arr[4:8, 4:8] = prod_arr - Rij[3] + + arr = arr.reshape((64, 9)) + arr = np.sum(arr**2, axis=1) + m = np.sort(arr.flatten()) + vote = np.sum(m[:16]) + + return vote + + def _J_sync_power_method(self, J_list): + """ + Calculate the leading eigenvector of the J-synchronization matrix + using the power method. + + As the J-synchronization matrix is of size (n-choose-2)x(n-choose-2), we + use the power method to compute the eigenvalues and eigenvectors, + while constructing the matrix on-the-fly. + + :param Rijs: (n-choose-2)x3x3 array of estimates of relative orientation matrices. + + :return: An array of length n-choose-2 consisting of 1 or -1, where the sign of the + i'th entry indicates whether the i'th relative orientation matrix will be J-conjugated. + """ + + # Set power method tolerance and maximum iterations. + epsilon = self.epsilon + max_iters = 100 + + # Initialize candidate eigenvectors + n_Rijs = len(self.pairs) + vec = randn(n_Rijs, seed=self.seed) + vec = vec / norm(vec) + residual = 1 + itr = 0 + + # Power method iterations + logger.info( + "Initiating power method to estimate J-synchronization matrix eigenvector." + ) + while itr < max_iters and residual > epsilon: + itr += 1 + vec_new = self._signs_times_v2(J_list, vec) + vec_new = vec_new / norm(vec_new) + residual = norm(vec_new - vec) + vec = vec_new + logger.info( + f"Iteration {itr}, residual {round(residual, 5)} (target {epsilon})" + ) + + # We need only the signs of the eigenvector + J_sync = np.sign(vec) + + return J_sync + + def _signs_times_v2(self, J_list, vec): + """ + Multiplication of the J-synchronization matrix by a candidate eigenvector. + + The J-synchronization matrix is a matrix representation of the handedness graph, Gamma, whose set of + nodes consists of the estimates Rijs and whose set of edges consists of the undirected edges between + all triplets of estimates vij, vjk, and vik, where i Date: Fri, 12 Apr 2024 16:00:11 -0400 Subject: [PATCH 325/433] beginning of color sync --- src/aspire/abinitio/commonline_d2.py | 111 +++++++++++++++++++++++++-- 1 file changed, 105 insertions(+), 6 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 0c8a402889..8f6db5f855 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -67,6 +67,8 @@ def __init__( self.seed = seed self.epsilon = epsilon self._generate_gs() + self.triplets = all_triplets(self.n_img) + self.pairs, self.pairs_to_linear = all_pairs(self.n_img, return_map=True) def estimate_rotations(self): """ @@ -74,19 +76,23 @@ def estimate_rotations(self): :return: Array of rotation matrices, size n_imgx3x3. """ + # Pre-compute phase-shifted polar Fourier. self.compute_shifted_pf() + + # Generate lookup data self.generate_lookup_data() self.generate_scl_lookup_data() + + # Compute common-line scores. self.compute_scl_scores() + + # Compute common-lines and estimate relative rotations Rijs. self.compute_cl_scores() - # Handedness Synchronization + # Perform handedness synchronization. self.Rijs_sync = self._global_J_sync(self.Rijs_est) - np.save("Rijs_sync.npy", self.Rijs_sync) - np.save("Rijs_est.npy", self.Rijs_est) - import pdb - pdb.set_trace() + # Synchronize colors. def compute_shifted_pf(self): """ @@ -714,7 +720,7 @@ def _global_J_sync(self, Rijs): of which might contain a spurious J (ie. vij = J*vi*vj^T*J instead of vij = vi*vj^T), we return Rijs and viis that all have either a spurious J or not. - :param Rijs: An (n-choose-2)x3x3 array where each 3x3 slice holds an estimate for the corresponding + :param Rijs: An (n-choose-2)x4 x3x3 array where each 3x3 slice holds an estimate for the corresponding outer-product vi*vj^T between the third rows of the rotation matrices Ri and Rj. Each estimate might have a spurious J independently of other estimates. @@ -898,6 +904,99 @@ def _signs_times_v2(self, J_list, vec): return new_vec + ###################### + # Synchronize Colors # + ###################### + + def _sync_colors(self, Rijs): + + # Generate array of one rank matrices from which we can extract rows. + # Matrices are of the form 0.5(Ri^TRj+Ri^TgkRj). Each such matrix can be + # written in the form Qi^T*Ik*Qj where Ik is a 3x3 matrix with all zero + # entries except for the entry a_kk, k in {1,2,3}. + n_pairs = len(Rijs) + Rijs_rows = np.zeros((n_pairs, 3, 3, 3), dtype=self.dtype) + for layer in range(3): + Rijs_rows[:, layer] = 0.5 * (Rijs[:, 0] + Rijs[:, layer + 1]) + + # Partition the set of matrices Rijs_rows into 3 sets of matrices, where + # each set there are only matrices Qi^T*Ik*Qj for a unique value of k in + # {1,2,3}. + # First determine for each pair of tuples of the form {Qi^T*Ik*Qj} and + # {Qr^T*Il*Qj} where {i,j}\cap{r,l}==1, whether l==r. + color_perms = self._match_colors(Rijs_rows) + return color_perms + + def _match_colors(self, Rijs_rows): + Rijs_rows_t = np.transpose(Rijs_rows, (0, 1, 3, 2)) + trip_perms = [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]] + inverse_perms = [ + [1, 2, 3], + [1, 3, 2], + [2, 1, 3], + [3, 1, 2], + [2, 3, 1], + [3, 2, 1], + ] + + m = np.zeros(6) + colors_i = np.zeros((len(self.triplets), 3), dtype=self.dtype) # int? + n_trip = len(self.triplets) + votes = np.zeros((n_trip)) + + # Compute relative color permutations. See Section 7.2 of paper. + for i, j, k in self.triplets: + ij = self.pairs_to_linear[i, j] + jk = self.pairs_to_linear[j, k] + ik = self.pairs_to_linear[i, k] + + # For r=1:3 compute 3*3 products v_{ji}(r)v_{ik}v_{kj} + prod_arr = np.einsum("nij,mjk->mnik", Rijs_rows[ik], Rijs_rows_t[jk]) + prod_arr_tmp = prod_arr.copy() + prod_arr = np.einsum( + "nij,mjk->nmik", Rijs_rows_t[ij], prod_arr.reshape((9, 3, 3)) + ) + prod_arr = np.transpose( + prod_arr.reshape((3, 3, 3, 9), order="F"), (2, 1, 0, 3) + ) + + # Compare to v_{jj}(r)=v_{ji}v_{ij}. + self_prods = Rijs_rows_t[ij] @ Rijs_rows[ij] + self_prods = self_prods.reshape(3, 9) + + prod_arr1 = prod_arr.copy() + prod_arr1[:, :, 0, :] = prod_arr1[:, :, 0, :] - self_prods[0] + prod_arr1[:, :, 1, :] = prod_arr1[:, :, 1, :] - self_prods[1] + prod_arr1[:, :, 2, :] = prod_arr1[:, :, 2, :] - self_prods[2] + norms1 = np.sum(prod_arr1**2, axis=3) + + prod_arr2 = prod_arr.copy() + prod_arr2[:, :, 0, :] = prod_arr2[:, :, 0, :] + self_prods[0] + prod_arr2[:, :, 1, :] = prod_arr2[:, :, 1, :] + self_prods[1] + prod_arr2[:, :, 2, :] = prod_arr2[:, :, 2, :] + self_prods[2] + norms2 = np.sum(prod_arr2**2, axis=3) + + # Compare to v_{jj}(r)=v_{jk}v_{kj}. + self_prods = Rijs_rows[jk] @ Rijs_rows_t[jk] + self_prods = self_prods.reshape(3, 9) + + prod_arr1 = prod_arr.copy() + prod_arr1[0] = prod_arr1[0] - self_prods[0] + prod_arr1[1] = prod_arr1[1] - self_prods[1] + prod_arr1[2] = prod_arr1[2] - self_prods[2] + norms1 = norms1 + np.sum(prod_arr1**2, axis=3) + + prod_arr2 = prod_arr.copy() + prod_arr2[0] = prod_arr2[0] + self_prods[0] + prod_arr2[1] = prod_arr2[1] + self_prods[1] + prod_arr2[2] = prod_arr2[2] + self_prods[2] + norms2 = norms2 + np.sum(prod_arr2**2, axis=3) + # Verfied up to this point! + + #################### + # Helper Functions # + #################### + @staticmethod def circ_seq(n1, n2, L): """ From 06163b973245d82f8773fc3d194753ae9ce63bbd Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 17 Apr 2024 13:08:35 -0400 Subject: [PATCH 326/433] _match_colors function. --- src/aspire/abinitio/commonline_d2.py | 91 ++++++++++++++++++++++++---- 1 file changed, 79 insertions(+), 12 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 8f6db5f855..382b3eeb7e 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -929,20 +929,27 @@ def _sync_colors(self, Rijs): def _match_colors(self, Rijs_rows): Rijs_rows_t = np.transpose(Rijs_rows, (0, 1, 3, 2)) - trip_perms = [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]] - inverse_perms = [ - [1, 2, 3], - [1, 3, 2], - [2, 1, 3], - [3, 1, 2], - [2, 3, 1], - [3, 2, 1], - ] + trip_perms = np.array( + [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]], + dtype="int", + ) + inverse_perms = np.array( + [ + [0, 1, 2], + [0, 2, 1], + [1, 0, 2], + [2, 0, 1], + [1, 2, 0], + [2, 1, 0], + ], + dtype="int", + ) - m = np.zeros(6) - colors_i = np.zeros((len(self.triplets), 3), dtype=self.dtype) # int? + m = np.zeros((6, 6), dtype=self.dtype) + colors_i = np.zeros((len(self.triplets), 3), dtype=self.dtype) # ints? n_trip = len(self.triplets) votes = np.zeros((n_trip)) + trip_idx = 0 # Compute relative color permutations. See Section 7.2 of paper. for i, j, k in self.triplets: @@ -991,7 +998,67 @@ def _match_colors(self, Rijs_rows): prod_arr2[1] = prod_arr2[1] + self_prods[1] prod_arr2[2] = prod_arr2[2] + self_prods[2] norms2 = norms2 + np.sum(prod_arr2**2, axis=3) - # Verfied up to this point! + + # For r=1:3 compute 3*3 products v_{ij}(r)v_{jk}v_{ki} and compare to + # Compare to v_{ii}(r)=v_{ij}v_{ji} + prod_arr = np.transpose(prod_arr_tmp, (0, 1, 3, 2)) + prod_arr = np.einsum( + "nij,mjk->mnik", Rijs_rows[ij], prod_arr.reshape(9, 3, 3) + ) + prod_arr = np.transpose( + prod_arr.reshape((3, 3, 3, 9), order="F"), (1, 0, 2, 3) + ) + # Commented out calculations in matlab here. + + # Compare to v_{ii}(r)=v_{ik}v_{ki}. + self_prods = Rijs_rows[ik] @ Rijs_rows_t[ik] + self_prods = self_prods.reshape(3, 9) + + prod_arr1 = prod_arr.copy() + prod_arr1[:, 0] = prod_arr1[:, 0] - self_prods[0] + prod_arr1[:, 1] = prod_arr1[:, 1] - self_prods[1] + prod_arr1[:, 2] = prod_arr1[:, 2] - self_prods[2] + norms1 = norms1 + np.sum(prod_arr1**2, axis=3) + + prod_arr2 = prod_arr.copy() + prod_arr2[:, 0] = prod_arr2[:, 0] + self_prods[0] + prod_arr2[:, 1] = prod_arr2[:, 1] + self_prods[1] + prod_arr2[:, 2] = prod_arr2[:, 2] + self_prods[2] + norms2 = norms2 + np.sum(prod_arr2**2, axis=3) + + norms = np.minimum(norms1, norms2) + + for l in range(6): + p1 = trip_perms[l] + for r in range(6): + p2 = trip_perms[r] + m[l, r] = ( + norms[p2[0], p1[0], 0] + + norms[p2[1], p1[1], 1] + + norms[p2[2], p1[2], 2] + ) + + min_idx = np.unravel_index(np.argmin(m), m.shape) + votes[trip_idx] = m[min_idx] + colors_i[trip_idx, :2] = [ + 100 * (min_idx[0] + 1), + 10 * (min_idx[1] + 1), + ] # What's up with 100 and 10?? + # might need to use 1-based indexing for colors_i, ie min_idx[i] + 1 + + # Calculate the relative permutation of Rik to Rij given + # by (sigma_ik)\circ(sigma_ij)^-1 + inv_jk_perm = inverse_perms[min_idx[1]] + rel_perm = trip_perms[min_idx[0]] + rel_perm = rel_perm[inv_jk_perm] + colors_i[trip_idx, 2] = (2 * (rel_perm[0] + 1) - 1) + ( + rel_perm[1] > rel_perm[2] + ) + trip_idx += 1 + + colors_i = np.sum(colors_i, axis=1) + + return colors_i #################### # Helper Functions # From 0447ade1b3e6c7c393da69da4bed7c9923fa4d6d Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 17 Apr 2024 15:50:00 -0400 Subject: [PATCH 327/433] mult_cmat_by_vec function --- src/aspire/abinitio/commonline_d2.py | 95 +++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 2 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 382b3eeb7e..eaab08b9cf 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1,6 +1,7 @@ import logging import numpy as np +import scipy.sparse.linalg as la from numpy.linalg import norm from aspire.abinitio import CLOrient3D @@ -925,6 +926,21 @@ def _sync_colors(self, Rijs): # First determine for each pair of tuples of the form {Qi^T*Ik*Qj} and # {Qr^T*Il*Qj} where {i,j}\cap{r,l}==1, whether l==r. color_perms = self._match_colors(Rijs_rows) + + # Compute eigenvectors of color matrix. This is just a matrix of dimensions + # 3(N choose 2)x3(N choose 2) where each entry corresponds to a pair of + # matrices {Qi^T*Ir*Qj} and {Qr^T*Il*Qj} and eqauls \delta_rl. + # The 2 leading eigenvectors span a linear subspace which contains a + # vector which encodes the partition. All the entries of the vector are + # either 1,0 or -1, where the number encodes which the index r in Ir. + # This vector is a linear combination of the two leading eigen vectors, + # and so we 'unmix' these vectors to retrieve it. + cmat = lambda v: self.mult_cmat_by_vec(color_perms, v) + omega = la.LinearOperator((3 * n_pairs,) * 2, cmat) + vals, colors = la.eigs(omega, k=3, which="LR") + import pdb + + pdb.set_trace() return color_perms def _match_colors(self, Rijs_rows): @@ -1040,11 +1056,12 @@ def _match_colors(self, Rijs_rows): min_idx = np.unravel_index(np.argmin(m), m.shape) votes[trip_idx] = m[min_idx] + + # Store permutation indices as digits in of base 10 number. colors_i[trip_idx, :2] = [ 100 * (min_idx[0] + 1), 10 * (min_idx[1] + 1), - ] # What's up with 100 and 10?? - # might need to use 1-based indexing for colors_i, ie min_idx[i] + 1 + ] # Calculate the relative permutation of Rik to Rij given # by (sigma_ik)\circ(sigma_ij)^-1 @@ -1060,6 +1077,80 @@ def _match_colors(self, Rijs_rows): return colors_i + def mult_cmat_by_vec(self, c_perms, v): + """ + Multiply color matrix by vector v "on the fly". + + :param c_perms: An (N over 3) vector. Each corresponds to a triplet of + indices i Date: Thu, 18 Apr 2024 12:47:50 -0400 Subject: [PATCH 328/433] fix loop indices and lambda function. --- src/aspire/abinitio/commonline_d2.py | 30 +++++++++++++--------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index eaab08b9cf..9cddddd466 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -727,8 +727,6 @@ def _global_J_sync(self, Rijs): :return: Rijs, all of which have a spurious J or not. """ - n_img = self.n_img - # Find best J_configuration. J_list = self._J_configuration(Rijs) @@ -935,12 +933,11 @@ def _sync_colors(self, Rijs): # either 1,0 or -1, where the number encodes which the index r in Ir. # This vector is a linear combination of the two leading eigen vectors, # and so we 'unmix' these vectors to retrieve it. - cmat = lambda v: self.mult_cmat_by_vec(color_perms, v) - omega = la.LinearOperator((3 * n_pairs,) * 2, cmat) - vals, colors = la.eigs(omega, k=3, which="LR") - import pdb + color_mat = la.LinearOperator( + (3 * n_pairs,) * 2, lambda v: self.mult_cmat_by_vec(color_perms, v) + ) + vals, colors = la.eigs(color_mat, k=3, which="LR") - pdb.set_trace() return color_perms def _match_colors(self, Rijs_rows): @@ -1044,11 +1041,11 @@ def _match_colors(self, Rijs_rows): norms = np.minimum(norms1, norms2) - for l in range(6): - p1 = trip_perms[l] - for r in range(6): - p2 = trip_perms[r] - m[l, r] = ( + for r in range(6): + p1 = trip_perms[r] + for s in range(6): + p2 = trip_perms[s] + m[r, s] = ( norms[p2[0], p1[0], 0] + norms[p2[1], p1[1], 1] + norms[p2[2], p1[2], 2] @@ -1100,18 +1097,19 @@ def mult_cmat_by_vec(self, c_perms, v): trip_idx = 0 for i in trange(self.n_img, desc="Computing cmat_times_v."): for j in range(i + 1, self.n_img - 1): - ij = 3 * self.pairs_to_linear[i, j] - 2 + ij = 3 * self.pairs_to_linear[i, j] for k in range(j + 1, self.n_img): - ik = 3 * self.pairs_to_linear[i, k] - 2 - jk = 3 * self.pairs_to_linear[j, k] - 2 + ik = 3 * self.pairs_to_linear[i, k] + jk = 3 * self.pairs_to_linear[j, k] # Extract permutation indices from c_perms n = c_perms[trip_idx] + trip_idx += 1 p_n1 = n // 100 p_n3 = n % 10 p_n2 = (n - p_n1 * 100 - p_n3) // 10 - # Adjust for 0-based indexing. (Take this out) + # Adjust for 0-based indexing. (Take this out by computing c_perms with 0-base) p_n1 = (p_n1 - 1).astype("int") p_n2 = (p_n2 - 1).astype("int") p_n3 = (p_n3 - 1).astype("int") From ecb29354a6058e36b89b4da1c80447e475b3efff Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 19 Apr 2024 11:59:41 -0400 Subject: [PATCH 329/433] Add _unmix_colors function. --- src/aspire/abinitio/commonline_d2.py | 87 +++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 3 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 9cddddd466..09c0ecb8da 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -908,7 +908,9 @@ def _signs_times_v2(self, J_list, vec): ###################### def _sync_colors(self, Rijs): - + """ + Add documention! + """ # Generate array of one rank matrices from which we can extract rows. # Matrices are of the form 0.5(Ri^TRj+Ri^TgkRj). Each such matrix can be # written in the form Qi^T*Ik*Qj where Ik is a 3x3 matrix with all zero @@ -937,8 +939,12 @@ def _sync_colors(self, Rijs): (3 * n_pairs,) * 2, lambda v: self.mult_cmat_by_vec(color_perms, v) ) vals, colors = la.eigs(color_mat, k=3, which="LR") + vals = np.real(vals) + colors = np.real(colors) + + cp, _ = self._unmix_colors(colors[:, :2]) - return color_perms + return cp def _match_colors(self, Rijs_rows): Rijs_rows_t = np.transpose(Rijs_rows, (0, 1, 3, 2)) @@ -1095,7 +1101,7 @@ def mult_cmat_by_vec(self, c_perms, v): ) out = np.zeros_like(v) trip_idx = 0 - for i in trange(self.n_img, desc="Computing cmat_times_v."): + for i in range(self.n_img): for j in range(i + 1, self.n_img - 1): ij = 3 * self.pairs_to_linear[i, j] for k in range(j + 1, self.n_img): @@ -1149,6 +1155,81 @@ def mult_cmat_by_vec(self, c_perms, v): out[jk + 2] = out[jk + 2] - v[p[0]] - v[p[1]] + v[p[2]] return out + def _unmix_colors(self, color_vecs): + """ + The 'color vector' which partitions the rank 1 3x3 matrices into 3 sets + is one of 2 leading orthogonal eigenvectors of the color matrix. + SVD retrieves two orthogonal linear combinations of these vectors which + can be 'unmixed' to retrieve the color vector by finding a suitable + 2D rotation of these vectors (see Section 7.3 of D2 paper for details). + """ + n_p = color_vecs.shape[0] // 3 + d_theta = 360 // self.n_theta + max_t = 360 // d_theta + 1 + + def R_theta(theta): + R = np.array( + [[np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)]], + dtype=self.dtype, + ) + return R + + s = float("inf") + scores = np.zeros(max_t, dtype=self.dtype) + idx = 0 + for t in np.arange(0, max_t, 0.5): + unmix_ev = color_vecs @ R_theta(np.pi * t / 180) + s1 = unmix_ev[:, 0].reshape(n_p, 3) + p11 = (-s1).argsort(axis=1) # descending argsort + s1 = np.take_along_axis(s1, p11, axis=1) + score11 = np.sum((s1[:, 0] + s1[:, 2]) ** 2 + s1[:, 1] ** 2) + + s2 = abs(unmix_ev[:, 1].reshape(n_p, 3)) + p12 = (-s2).argsort(axis=1) # descending argsort + s2 = np.take_along_axis(s2, p12, axis=1) + score12 = np.sum( + (s2[:, 0] - 2 * s2[:, 1]) ** 2 + + (s2[:, 0] - 2 * s2[:, 2]) ** 2 + + (s2[:, 1] - s2[:, 2]) ** 2 + ) # Matlab comment: Is this an error??? + instead of - in the first 2 members + + s1 = abs(unmix_ev[:, 0].reshape(n_p, 3)) + p12 = (-s1).argsort(axis=1) # descending argsort + s1 = np.take_along_axis(s1, p11, axis=1) + score22 = np.sum( + (s1[:, 0] - 2 * s1[:, 1]) ** 2 + + (s1[:, 0] - 2 * s1[:, 2]) ** 2 + + (s1[:, 1] - s1[:, 2]) ** 2 + ) + + s2 = unmix_ev[:, 1].reshape(n_p, 3) + p22 = (-s2).argsort(axis=1) # descending argsort + s2 = np.take_along_axis(s2, p12, axis=1) + score21 = np.sum((s2[:, 0] + s2[:, 2]) ** 2 + s2[:, 1] ** 2) + + score_vecs = [score11 + score12, score21 + score22] + which_vec = np.argmin([score11 + score12, score21 + score22]) + scores[idx] = score_vecs[which_vec] + if scores[idx] < s: + s = scores[idx] + if which_vec == 0: + p = p11 + else: + p = p22 + best_unmix = unmix_ev[:, which_vec] + + # Assign integers between 1:3 to permutations + colors = np.zeros((n_p, 3), dtype=int) + for i in range(n_p): + p_i = p[i] + p_i_sqr = p_i[p_i] + if np.sum((p_i_sqr - [0, 1, 2]) ** 2) == 0: # non-cyclic permutation + colors[i] = p_i + else: + colors[i] = p_i_sqr + + return colors.flatten(), best_unmix + #################### # Helper Functions # #################### From 47adce3ecc61d534dce10ab455a0e2316ed9d6a0 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 19 Apr 2024 15:56:29 -0400 Subject: [PATCH 330/433] Add partial sync_signs. --- src/aspire/abinitio/commonline_d2.py | 86 +++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 09c0ecb8da..f831817e41 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -94,6 +94,10 @@ def estimate_rotations(self): self.Rijs_sync = self._global_J_sync(self.Rijs_est) # Synchronize colors. + self.colors, self.Rijs_rows = self._sync_colors(self.Rijs_sync) + + # Synchronize signs. + Ris = self._sync_signs(self.Rijs_rows, self.colors) def compute_shifted_pf(self): """ @@ -944,7 +948,7 @@ def _sync_colors(self, Rijs): cp, _ = self._unmix_colors(colors[:, :2]) - return cp + return cp, Rijs_rows def _match_colors(self, Rijs_rows): Rijs_rows_t = np.transpose(Rijs_rows, (0, 1, 3, 2)) @@ -1230,6 +1234,86 @@ def R_theta(theta): return colors.flatten(), best_unmix + ##################### + # Synchronize Signs # + ##################### + + def _sync_signs(self, rr, c_vec): + """ + This function executes the final stage of the algorithm, Signs + synchroniztion. At the end all rows of the rotations Ri are exctracted + and the matrices Ri are assembled. + """ + # Partition the union of tuples {0.5*(Ri^TRj+Ri^TgkRj), k=1:3} according + # to the color partition established in color synchroniztion procedure. + # The partition is stored in two different arrays each with the purpose + # of a computational speed up for two different computations performed + # later (space considerations are of little concern since arrays are ~ + # o(N^2) which doesn't pose a constraint for inputs on the scale of 10^3-10^4. + n_pairs = len(self.pairs) + c_mat_5d = np.zeros((self.n_img, self.n_img, 3, 3, 3), dtype=self.dtype) + c_mat_4d = np.zeros((n_pairs, 3, 3, 3), dtype=self.dtype) + for i in trange(self.n_img - 1): + for j in range(i + 1, self.n_img): + ij = self.pairs_to_linear[i, j] + c_mat_5d[i, j, c_vec[3 * ij]] = rr[ij, 0] + c_mat_5d[i, j, c_vec[3 * ij + 1]] = rr[ij, 1] + c_mat_5d[i, j, c_vec[3 * ij + 2]] = rr[ij, 2] + c_mat_5d[j, i, c_vec[3 * ij]] = rr[ij, 0].T + c_mat_5d[j, i, c_vec[3 * ij + 1]] = rr[ij, 1].T + c_mat_5d[j, i, c_vec[3 * ij + 2]] = rr[ij, 2].T + + c_mat_4d[ij, c_vec[3 * ij]] = rr[ij, 0] + c_mat_4d[ij, c_vec[3 * ij + 1]] = rr[ij, 1] + c_mat_4d[ij, c_vec[3 * ij + 2]] = rr[ij, 2] + + # Compute estimates for the tuples {0.5*(Ri^TRi+Ri^TgkRi), k=1:3} for + # i=1:N. For 1<=i,j<=N and c=1,2,3 write Qij^c=0.5*(Ri^TRj+Ri^TgmRj). + # For each i in {1:N} and each k in {1,2,3} the estimator is the + # average over all j~=i of Qij^c*(Qij^c)^T. + # Since in practice the result of the average is not really rank 1, we + # compute the best rank approximation to this average. + for i in range(self.n_img): + for c in range(3): + Rijs = c_mat_5d[i, :, c] + Rijs = np.delete(Rijs, i, axis=0) + Rii_est = Rijs @ np.transpose(Rijs, (0, 2, 1)) + Rii = np.mean(Rii_est, axis=0) + U, _, _ = np.linalg.svd(Rii) + c_mat_5d[i, i, c] = np.outer(U[:, 0], U[:, 0]) + + # Construct the 3Nx3N row synchroniztion matrices (as done for C_2), one + # for all first rows of the matrices Ri, one for all second rows and one + # for all third rows. The ij'th block of the k'th matrix is Qij^c. + # In C_2 one such matrix is constructed for the 3rd rows + # and is rank 1 by construction. In practice, thus far, for each c and + # (i,j) we either have Qij^c or -Qij^c independently. + c_mat = np.zeros((3, 3 * self.n_img, 3 * self.n_img), dtype=self.dtype) + rot = np.zeros((self.n_img, 3, 3), dtype=self.dtype) + for i in range(self.n_img - 1): + for j in range(i + 1, self.n_img): + ij = self.pairs_to_linear[i, j] + c_mat[c_vec[3 * ij], 3 * i : 3 * i + 2, 3 * j : 3 * j + 2] = rr[ij, 0] + c_mat[c_vec[3 * ij + 1], 3 * i : 3 * i + 2, 3 * j : 3 * j + 2] = rr[ + ij, 1 + ] + c_mat[c_vec[3 * ij + 2], 3 * i : 3 * i + 2, 3 * j : 3 * j + 2] = rr[ + ij, 2 + ] + + c_mat[0] = c_mat[0] + c_mat[0].T + c_mat[1] = c_mat[1] + c_mat[1].T + c_mat[2] = c_mat[2] + c_mat[2].T + + for c in range(3): + for i in range(self.n_img): + c_mat[c, 3 * i : 3 * i + 2, 3 * i : 3 * i + 2] = c_mat_5d[i, i, c] + + # To decompose cMat as a rank 1 matrix we need to adjust the signs of the + # Qij^c so that sign(Qij^c*Qjk^c) = sign(Qik^c) for all c=1,2,3 and (i,j). + # In practice we compare the sign of the sum of the entries of Qij^c*Qjk^c + # to the sum of entries of Qik^c. + #################### # Helper Functions # #################### From 50f355ab08d8b2725f344112742c36692cdea15e Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 25 Apr 2024 15:26:28 -0400 Subject: [PATCH 331/433] syncSigns method. --- src/aspire/abinitio/commonline_d2.py | 225 ++++++++++++++++++++++++++- 1 file changed, 220 insertions(+), 5 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index f831817e41..e8d3bde421 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -99,6 +99,8 @@ def estimate_rotations(self): # Synchronize signs. Ris = self._sync_signs(self.Rijs_rows, self.colors) + self.rotations = Ris + def compute_shifted_pf(self): """ Pre-compute shifted and full polar Fourier transforms. @@ -945,7 +947,7 @@ def _sync_colors(self, Rijs): vals, colors = la.eigs(color_mat, k=3, which="LR") vals = np.real(vals) colors = np.real(colors) - + colors[:, 1] = -colors[:, 1] # TODO: Take this out. Only here for debugging. cp, _ = self._unmix_colors(colors[:, :2]) return cp, Rijs_rows @@ -1293,11 +1295,11 @@ def _sync_signs(self, rr, c_vec): for i in range(self.n_img - 1): for j in range(i + 1, self.n_img): ij = self.pairs_to_linear[i, j] - c_mat[c_vec[3 * ij], 3 * i : 3 * i + 2, 3 * j : 3 * j + 2] = rr[ij, 0] - c_mat[c_vec[3 * ij + 1], 3 * i : 3 * i + 2, 3 * j : 3 * j + 2] = rr[ + c_mat[c_vec[3 * ij], 3 * i : 3 * i + 3, 3 * j : 3 * j + 3] = rr[ij, 0] + c_mat[c_vec[3 * ij + 1], 3 * i : 3 * i + 3, 3 * j : 3 * j + 3] = rr[ ij, 1 ] - c_mat[c_vec[3 * ij + 2], 3 * i : 3 * i + 2, 3 * j : 3 * j + 2] = rr[ + c_mat[c_vec[3 * ij + 2], 3 * i : 3 * i + 3, 3 * j : 3 * j + 3] = rr[ ij, 2 ] @@ -1307,13 +1309,226 @@ def _sync_signs(self, rr, c_vec): for c in range(3): for i in range(self.n_img): - c_mat[c, 3 * i : 3 * i + 2, 3 * i : 3 * i + 2] = c_mat_5d[i, i, c] + c_mat[c, 3 * i : 3 * i + 3, 3 * i : 3 * i + 3] = c_mat_5d[i, i, c] # To decompose cMat as a rank 1 matrix we need to adjust the signs of the # Qij^c so that sign(Qij^c*Qjk^c) = sign(Qik^c) for all c=1,2,3 and (i,j). # In practice we compare the sign of the sum of the entries of Qij^c*Qjk^c # to the sum of entries of Qik^c. + # For computational comfort the signs for each c=1,2,3 are stored in a + # Nx(N over 2) array, where the ij'th column corresponds to the signs of + # Qij^c * Qjk^c for k~=i,j. The entries in the k=i,j rows of the ij'th + # column are zero, the value zero is arbitrary, since these entries are + # not used by the algorithm, and only exist for comfort (of storage and + # access). + signs = np.zeros((3, n_pairs, self.n_img), dtype=self.dtype) + for c in range(3): + for p in range(n_pairs): + i, j = self.pairs[p] + idx_mask = np.full(self.n_img, True) + idx_mask[[i, j]] = False + signs[c, p, idx_mask] = self.calc_Rij_prods(c_mat_5d, i, j, c) + + # Now compute the signs of Qij^c. + est_signs = np.sign(np.sum(c_mat_4d, axis=(-2, -1))) + signs = np.transpose(signs, (0, 2, 1)) + for c in range(3): + signs[c] = est_signs[:, c] * signs[c] + + # Qik^c can be compared with Qir^c*Qrk^c for each r~=i,k, that is, + # N-2 options. Another way to look at this, is that the r'th image + # participates in all comparisons of the form sign(Qir^c*Qrk^c)~sign(Qik) + # for r~=i,k for each c=1,2,3 (see Section 8 in D2 paper). + # For each image r construct a 3Nx3N matrix. If + # sign(Qir^c*Qrk^c)~sign(Qik)=1, its ik'th 3x3 block is set to Qik, + # otherwise, it is set to -Qik. + sync_signs2 = np.arange(self.n_img).reshape((1, 1, self.n_img, 1)) + sync_signs2 = np.tile(sync_signs2, (3, self.n_img, 1, self.n_img)) + for c in range(3): + for r in range(self.n_img): + # Fill signs for synchroniztion for the r'th image. + # Go over all i,j~=r. + i_idx = np.concatenate( + (np.arange(0, r), np.arange(r + 1, self.n_img)) + ) # i~=r + for i in i_idx: + if i <= r: + j_idx = np.concatenate( + (np.arange(i + 1, r), np.arange(r + 1, self.n_img)) + ) + else: + j_idx = np.arange(i + 1, self.n_img) + for j in j_idx: + ij = self.pairs_to_linear[i, j] + sync_signs2[c, r, j, i] = ( + j + 0.5 * (1 - signs[c, r, ij]) * self.n_img + ) + sync_signs2[c, r, i, j] = ( + i + 0.5 * (1 - signs[c, r, ij]) * self.n_img + ) + # The function (1-x)/2 maps 1->0 and -1->1 + + c_mat_5d_mp = np.concatenate((c_mat_5d, -c_mat_5d), axis=1) + rows_arr = np.zeros((3, self.n_img, 3 * self.n_img), dtype=self.dtype) + svals = np.zeros((3, 2, self.n_img), dtype=self.dtype) + + logger.info("Constructing and decomposing N sign synchronization matrices...") + for c in range(3): + for r in range(self.n_img): + # Image r used for signs. + c_mat_eff = self.fill_sign_sync_matrix_c(c_mat_5d_mp, sync_signs2, c, r) + + # Construct (3*N)x(3*N) rank 1 matrices from Qik + c_mat_for_svd = np.zeros( + (3 * self.n_img, 3 * self.n_img), dtype=self.dtype + ) + for i in range(self.n_img): + row_3Nx3 = c_mat_eff[i] + row_3Nx3 = row_3Nx3.reshape(3 * self.n_img, 3) + c_mat_for_svd[:, 3 * i : 3 * i + 3] = row_3Nx3 + + c_mat_for_svd = c_mat_for_svd + c_mat_for_svd.T + + # Extract leading eigenvector of rank 1 matrix. For each r and c + # this gives an estimate for the c'th row of the rotation Rr, up + # to sign +/-. + for i in range(self.n_img): + c_mat_for_svd[3 * i : 3 * i + 3, 3 * i : 3 * i + 3] = c_mat_eff[ + i, i + ] + U, S, _ = np.linalg.svd(c_mat_for_svd) + svals[c, :, r] = S[:2] + rows_arr[c, r] = U[:, 0] + + # Sync signs according to results for each image. Dot products between + # signed row estimates are used to construct an (N over 2)x(N over 2) + # sign synchronization matrix S. If (v_i)k and (v_j)k are the i'th and + # j'th estimates for the c'th row of Rk, then the entry (i,k),(k,j) entry + # of S is <(v_i)k,(v_j)k>, where the rows and columns of S are indexed by + # double indexes (i,j), 1<=i 0: + ij_signs[zeros_idx] = 1 + + return np.sign(ij_signs) + + def mult_smat_by_vec(self, v, sign_mat, pairs_map): + """ + Multiplies the signs sync matrix by a vector. + """ + v_out = np.zeros_like(v) + for i in range(self.n_img): + for j in range(i + 1, self.n_img): + ij = self.pairs_to_linear[i, j] + v_out[ij] = sign_mat[ij] @ v[pairs_map[ij]] + return v_out + #################### # Helper Functions # #################### From 7ff6b5171f540366a6f99018e59a185d91b63267 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 1 May 2024 15:37:44 -0400 Subject: [PATCH 332/433] max_shift_1d, mask parameter. --- src/aspire/abinitio/commonline_d2.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index e8d3bde421..5c2bc6f4ba 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -35,6 +35,7 @@ def __init__( eq_min_dist=7, epsilon=0.01, seed=None, + mask=True, ): """ Initialize object for estimating 3D orientations for molecules with D2 symmetry. @@ -59,6 +60,7 @@ def __init__( n_theta=n_theta, max_shift=max_shift, shift_step=shift_step, + mask=mask, ) self.grid_res = grid_res @@ -109,8 +111,9 @@ def compute_shifted_pf(self): # Generate shift phases. r_max = pf.shape[-1] + max_shift_1d = np.ceil(2 * np.sqrt(2) * self.max_shift) shifts, shift_phases, _ = self._generate_shift_phase_and_filter( - r_max, self.max_shift, self.shift_step + r_max, max_shift_1d, self.shift_step ) self.n_shifts = len(shifts) From ca2e4643d1cd95064da2c79a42c89cdd59f8a696 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 8 May 2024 15:29:52 -0400 Subject: [PATCH 333/433] Fix bugs. Output rotations matching matlab sometimes. Need to stabilize all eigs and svds. --- src/aspire/abinitio/commonline_d2.py | 39 ++++++++++++++++++---------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 5c2bc6f4ba..7f9d53d097 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -118,7 +118,12 @@ def compute_shifted_pf(self): self.n_shifts = len(shifts) # Reconstruct full polar Fourier for use in correlation. + pf[:, :, 0] = 0 # Matching matlab convention to zero out the lowest frequency. pf /= norm(pf, axis=2)[..., np.newaxis] # Normalize each ray. + pf *= ( + np.sqrt(2) / 2 + ) # Magic number to match matlab pf. (root2 over 2) Remove after debug. + pf = pf[:, :, ::-1] # also to match matlab self.pf_full = PolarFT.half_to_full(pf) # Pre-compute shifted pf's. @@ -159,7 +164,7 @@ def compute_cl_scores(self): pf_j = self.pf_full[j] # Compute maximum correlation over all shifts. - corrs = np.real(pf_i @ np.conj(pf_j).T) + corrs = 2 * np.real(pf_i @ np.conj(pf_j).T) corrs = np.reshape( corrs, (self.n_shifts, self.n_theta // 2, self.n_theta) ) @@ -169,6 +174,7 @@ def compute_cl_scores(self): cl_idx = np.unravel_index( self.cl_idx, (self.n_theta // 2, self.n_theta) ) + prod_corrs = corrs[cl_idx] prod_corrs = prod_corrs.reshape(len(prod_corrs) // 4, 4) prod_corrs = np.prod(prod_corrs, axis=1) @@ -217,6 +223,7 @@ def get_Rijs_from_oct(self, lin_idx, octant=1): unique_pairs = self.eq2eq_Rij_table_11 else: unique_pairs = self.eq2eq_Rij_table_12 + n_theta = self.n_inplane_rots n_lookup_pairs = np.sum(unique_pairs, dtype=np.int64) n_rots = len(self.sphere_grid1) @@ -256,11 +263,11 @@ def get_Rijs_from_oct(self, lin_idx, octant=1): # Assemble relative rotations Ri^TgRj using linear indices, where g is a group member of D2. Ris_lin_idx = np.ravel_multi_index((est_idx[0], inplane_i), s[:2]) Rjs_lin_idx = np.ravel_multi_index((est_idx[1], inplane_j), s2[:2]) - Ris = np.transpose(inplane_rotated_grid[Ris_lin_idx], (0, 2, 1)) - Rjs = np.transpose(inplane_rotated_grid2[Rjs_lin_idx], (0, 2, 1)) + Ris_t = np.transpose(inplane_rotated_grid[Ris_lin_idx], (0, 2, 1)) + Rjs = inplane_rotated_grid2[Rjs_lin_idx] for k, g in enumerate(self.gs): - Rijs_est[:, k] = np.transpose(Ris, (0, 2, 1)) @ (g * Rjs) + Rijs_est[:, k] = Ris_t @ (g * Rjs) Rijs_est[transpose_idx] = np.transpose(Rijs_est[transpose_idx], (0, 1, 3, 2)) @@ -293,7 +300,7 @@ def compute_scl_scores(self): pf_i_shifted = self.pf_shifted[i] # Compute max correlation over all shifts. - corrs = np.real(pf_i_shifted @ np.conj(pf_full_i).T) + corrs = 2 * np.real(pf_i_shifted @ np.conj(pf_full_i).T) corrs = np.reshape(corrs, (self.n_shifts, n_theta // 2, n_theta)) corrs = np.max(corrs, axis=0) @@ -322,7 +329,7 @@ def compute_scl_scores(self): true_scls_corrs = corrs[scl_idx_list] scls_cand_idx = self.scl_idx_lists[1, eq_idx, j] eq_measures_j = eq_measures[scls_cand_idx] - measures_agg = true_scls_corrs * eq_measures_j + measures_agg = np.outer(true_scls_corrs, eq_measures_j) k = self.non_tv_eq_idx[eq_idx] corrs_out[i, k * n_inplane + j] = np.max(measures_agg) @@ -646,8 +653,9 @@ def generate_scl_indices(self, scl_angles, eq_class): idx2 = self.circ_seq(scl_angles[i, j, 0, 1], scl_angles[i, j, 1, 1], L) # Adjust so idx1 is in [0, 180) range. - idx1[idx1 >= 180] = (idx1[idx1 >= 180] - L // 2) % (L // 2) - idx2[idx1 >= 180] = (idx2[idx1 >= 180] + L // 2) % L + geq_180 = idx1 >= 180 + idx1[geq_180] = (idx1[geq_180] - L // 2) % (L // 2) + idx2[geq_180] = (idx2[geq_180] + L // 2) % L # register indices in list. eq_lin_idx_lists[0, count_eq, j] = np.ravel_multi_index( @@ -950,7 +958,7 @@ def _sync_colors(self, Rijs): vals, colors = la.eigs(color_mat, k=3, which="LR") vals = np.real(vals) colors = np.real(colors) - colors[:, 1] = -colors[:, 1] # TODO: Take this out. Only here for debugging. + colors = np.sign(colors[0]) * colors # Stable eigs cp, _ = self._unmix_colors(colors[:, :2]) return cp, Rijs_rows @@ -1066,10 +1074,12 @@ def _match_colors(self, Rijs_rows): + norms[p2[2], p1[2], 2] ) - min_idx = np.unravel_index(np.argmin(m), m.shape) + # In the event of duplicate min values min_idx is the first occurence + # by column order to match matlab outputs. + min_idx = np.unravel_index(np.argmin(m.T), m.shape)[::-1] votes[trip_idx] = m[min_idx] - # Store permutation indices as digits in of base 10 number. + # Store permutation indices as digits of a base 10 number. colors_i[trip_idx, :2] = [ 100 * (min_idx[0] + 1), 10 * (min_idx[1] + 1), @@ -1236,8 +1246,9 @@ def R_theta(theta): colors[i] = p_i else: colors[i] = p_i_sqr - - return colors.flatten(), best_unmix + colors = colors.flatten() + colors = 2 - colors # For debug. remove + return colors, best_unmix ##################### # Synchronize Signs # @@ -1258,7 +1269,7 @@ def _sync_signs(self, rr, c_vec): n_pairs = len(self.pairs) c_mat_5d = np.zeros((self.n_img, self.n_img, 3, 3, 3), dtype=self.dtype) c_mat_4d = np.zeros((n_pairs, 3, 3, 3), dtype=self.dtype) - for i in trange(self.n_img - 1): + for i in range(self.n_img - 1): for j in range(i + 1, self.n_img): ij = self.pairs_to_linear[i, j] c_mat_5d[i, j, c_vec[3 * ij]] = rr[ij, 0] From 6548f50ad2ca3a0586b1d21edfce7ad754e590e3 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 9 May 2024 14:37:21 -0400 Subject: [PATCH 334/433] Stable J_sync and SVDs. --- src/aspire/abinitio/commonline_d2.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 7f9d53d097..daf7f31994 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -865,6 +865,7 @@ def _J_sync_power_method(self, J_list): # We need only the signs of the eigenvector J_sync = np.sign(vec) + J_sync = np.sign(J_sync[0]) * J_sync # Stabilize J_sync return J_sync @@ -1466,6 +1467,7 @@ def _sync_signs(self, rr, c_vec): rmatvec=lambda v, s=sign_mat: self.mult_smat_by_vec(v, s, pairs_map), ) U, S, _ = la.svds(smat, k=3, which="LM") + U = np.sign(U[0]) * U # Stable svds signs[c] = U[:, -1] # Returns in ascending order s_out[c] = S[::-1] @@ -1495,6 +1497,11 @@ def _sync_signs(self, rr, c_vec): svals2[1] = S2[::-1] svals2[2] = S3[::-1] + # Stable eigenvectors. + U1 = np.sign(U1[0]) * U1 + U2 = np.sign(U2[0]) * U2 + U3 = np.sign(U3[0]) * U3 + # The c'th row of the rotation Rj is Uc(3*j-2:3*j,1)/norm(Uc(3*j-2:3*j,1)), # (Rows must be normalized to length 1). logger.info("Assembeling rows to rotations matrices...") From 430b324e0fe3448497820e9753dd8dc79fdcfb09 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 10 May 2024 11:18:49 -0400 Subject: [PATCH 335/433] Add initial testing. --- tests/test_orient_d2.py | 180 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 tests/test_orient_d2.py diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py new file mode 100644 index 0000000000..0e7d5b19a5 --- /dev/null +++ b/tests/test_orient_d2.py @@ -0,0 +1,180 @@ +import numpy as np +import pytest + +from aspire.abinitio import CLSymmetryD2 +from aspire.source import Simulation +from aspire.utils import ( + J_conjugate, + Rotation, + all_pairs, + cyclic_rotations, + mean_aligned_angular_distance, + randn, + utest_tolerance, +) +from aspire.volume import DnSymmetricVolume, DnSymmetryGroup + +############## +# Parameters # +############## + +DTYPE = [np.float64, np.float32] +RESOLUTION = [48, 49] +N_IMG = [10] +OFFSETS = [0] +SEED = 42 + + +@pytest.fixture(params=DTYPE, ids=lambda x: f"dtype={x}") +def dtype(request): + return request.param + + +@pytest.fixture(params=RESOLUTION, ids=lambda x: f"resolution={x}") +def resolution(request): + return request.param + + +@pytest.fixture(params=N_IMG, ids=lambda x: f"n images={x}") +def n_img(request): + return request.param + + +@pytest.fixture(params=OFFSETS, ids=lambda x: f"offsets={x}") +def offsets(request): + return request.param + + +############ +# Fixtures # +############ + + +@pytest.fixture +def source(n_img, resolution, dtype, offsets): + vol = DnSymmetricVolume( + L=resolution, order=2, C=1, K=100, dtype=dtype, seed=SEED + ).generate() + + src = Simulation( + n=n_img, + L=resolution, + vols=vol, + offsets=offsets, + amplitudes=1, + seed=SEED, + ) + + return src + + +@pytest.fixture +def orient_est(source): + orient_est = CLSymmetryD2( + source, + max_shift=0, + shift_step=1, + n_theta=360, + n_rad=source.L, + grid_res=350, # Tuned for speed + inplane_res=15, # Tuned for speed + eq_min_dist=10, # Tuned for speed + epsilon=0.01, + seed=SEED, + ) + + return orient_est + + +######### +# Tests # +######### + + +def test_estimate_rotations(orient_est): + # Estimate rotations. + orient_est.estimate_rotations() + rots_est = orient_est.rotations + + # Ground truth rotations. + rots_gt = orient_est.src.rotations + + # g-sync ground truth rotations. + rots_gt_sync = g_sync_d2(rots_est, rots_gt) + + # Register estimates to ground truth rotations and check that the + # mean angular distance between them is less than 5 degrees. + mean_aligned_angular_distance(rots_est, rots_gt_sync, degree_tol=5) + + +#################### +# Helper Functions # +#################### + + +def g_sync_d2(rots, rots_gt): + """ + Every estimated rotation might be a version of the ground truth rotation + rotated by g^{s_i}, where s_i = 0, 1, ..., order. This method synchronizes the + ground truth rotations so that only a single global rotation need be applied + to all estimates for error analysis. + + :param rots: Estimated rotation matrices + :param rots_gt: Ground truth rotation matrices. + + :return: g-synchronized ground truth rotations. + """ + assert len(rots) == len( + rots_gt + ), "Number of estimates not equal to number of references." + n_img = len(rots) + dtype = rots.dtype + + rots_symm = DnSymmetryGroup(2, dtype).matrices + order = len(rots_symm) + + A_g = np.zeros((n_img, n_img), dtype=complex) + + pairs = all_pairs(n_img) + + for i, j in pairs: + Ri = rots[i] + Rj = rots[j] + Rij = Ri.T @ Rj + + Ri_gt = rots_gt[i] + Rj_gt = rots_gt[j] + + diffs = np.zeros(order) + for s, g_s in enumerate(rots_symm): + Rij_gt = Ri_gt.T @ g_s @ Rj_gt + diffs[s] = min( + [ + np.linalg.norm(Rij - Rij_gt), + np.linalg.norm(Rij - J_conjugate(Rij_gt)), + ] + ) + + idx = np.argmin(diffs) + + A_g[i, j] = np.exp(-1j * 2 * np.pi / order * idx) + + # A_g(k,l) is exp(-j(-theta_k+theta_l)) + # Diagonal elements correspond to exp(-i*0) so put 1. + # This is important only for verification purposes that spectrum is (K,0,0,0...,0). + A_g += np.conj(A_g).T + np.eye(n_img) + + _, eig_vecs = np.linalg.eigh(A_g) + leading_eig_vec = eig_vecs[:, -1] + + angles = np.exp(1j * 2 * np.pi / order * np.arange(order)) + rots_gt_sync = np.zeros((n_img, 3, 3), dtype=dtype) + + for i, rot_gt in enumerate(rots_gt): + # Since the closest ccw or cw rotation are just as good, + # we take the absolute value of the angle differences. + angle_dists = np.abs(np.angle(leading_eig_vec[i] / angles)) + power_g_Ri = np.argmin(angle_dists) + rots_gt_sync[i] = rots_symm[power_g_Ri] @ rot_gt + + return rots_gt_sync From 1c32b2f75bf6e2064a8ad77f98970f02c9ad7374 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 10 May 2024 11:24:43 -0400 Subject: [PATCH 336/433] unused imports --- tests/test_orient_d2.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index 0e7d5b19a5..729afed79a 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -3,15 +3,7 @@ from aspire.abinitio import CLSymmetryD2 from aspire.source import Simulation -from aspire.utils import ( - J_conjugate, - Rotation, - all_pairs, - cyclic_rotations, - mean_aligned_angular_distance, - randn, - utest_tolerance, -) +from aspire.utils import J_conjugate, all_pairs, mean_aligned_angular_distance from aspire.volume import DnSymmetricVolume, DnSymmetryGroup ############## From ca316f81a46f0c0ce4ca1c12c7a145bb9bff22f1 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 10 May 2024 13:51:26 -0400 Subject: [PATCH 337/433] Add offsets to test. --- tests/test_orient_d2.py | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index 729afed79a..dc6394aca1 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -10,11 +10,16 @@ # Parameters # ############## -DTYPE = [np.float64, np.float32] +DTYPE = [np.float64, pytest.param(np.float32, marks=pytest.mark.expensive)] RESOLUTION = [48, 49] N_IMG = [10] -OFFSETS = [0] -SEED = 42 +OFFSETS = [0, pytest.param(None, marks=pytest.mark.expensive)] + +# Since these tests are optimized for runtime, detuned parameters cause +# the algorithm to be fickle, especially for small problem sizes. +# This seed is chosen so the tests pass CI on github's envs as well +# as our self-hosted runner. +SEED = 3 @pytest.fixture(params=DTYPE, ids=lambda x: f"dtype={x}") @@ -62,10 +67,17 @@ def source(n_img, resolution, dtype, offsets): @pytest.fixture def orient_est(source): + # Search for common lines over less shifts for 0 offsets. + max_shift = 0 + shift_step = 1 + if source.offsets.all() != 0: + max_shift = 0.2 + shift_step = 0.1 # Reduce shift steps for non-integer offsets of Simulation. + orient_est = CLSymmetryD2( source, - max_shift=0, - shift_step=1, + max_shift=max_shift, + shift_step=shift_step, n_theta=360, n_rad=source.L, grid_res=350, # Tuned for speed @@ -94,9 +106,12 @@ def test_estimate_rotations(orient_est): # g-sync ground truth rotations. rots_gt_sync = g_sync_d2(rots_est, rots_gt) - # Register estimates to ground truth rotations and check that the - # mean angular distance between them is less than 5 degrees. - mean_aligned_angular_distance(rots_est, rots_gt_sync, degree_tol=5) + # Register estimates to ground truth rotations and check that the mean angular + # distance between them is less than 5 degrees (7 when testing with offsets). + deg_tol = 5 + if orient_est.src.offsets.all() != 0: + deg_tol = 7 + mean_aligned_angular_distance(rots_est, rots_gt_sync, degree_tol=deg_tol) #################### From e91e2662f0a3194dc8431e6a88755f2728302189 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 13 May 2024 11:25:25 -0400 Subject: [PATCH 338/433] Make non-user functions private. --- src/aspire/abinitio/commonline_d2.py | 107 ++++++++++++++------------- 1 file changed, 55 insertions(+), 52 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index daf7f31994..3da513e117 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -80,17 +80,17 @@ def estimate_rotations(self): :return: Array of rotation matrices, size n_imgx3x3. """ # Pre-compute phase-shifted polar Fourier. - self.compute_shifted_pf() + self._compute_shifted_pf() # Generate lookup data - self.generate_lookup_data() - self.generate_scl_lookup_data() + self._generate_lookup_data() + self._generate_scl_lookup_data() # Compute common-line scores. - self.compute_scl_scores() + self._compute_scl_scores() # Compute common-lines and estimate relative rotations Rijs. - self.compute_cl_scores() + self._compute_cl_scores() # Perform handedness synchronization. self.Rijs_sync = self._global_J_sync(self.Rijs_est) @@ -101,9 +101,10 @@ def estimate_rotations(self): # Synchronize signs. Ris = self._sync_signs(self.Rijs_rows, self.colors) + # Assign rotations. self.rotations = Ris - def compute_shifted_pf(self): + def _compute_shifted_pf(self): """ Pre-compute shifted and full polar Fourier transforms. """ @@ -132,7 +133,7 @@ def compute_shifted_pf(self): (self.n_img, self.n_shifts * (self.n_theta // 2), r_max) ) - def compute_cl_scores(self): + def _compute_cl_scores(self): """ Run common lines Maximum likelihood procedure for a D2 molecule, to find the set of rotations Ri^TgkRj, k=1,2,3,4 for each pair of images i and j. @@ -194,9 +195,9 @@ def compute_cl_scores(self): pbar.close() # Get estimated relative viewing directions. - self.Rijs_est = self.get_Rijs_from_lin_idx(corrs_idx) + self.Rijs_est = self._get_Rijs_from_lin_idx(corrs_idx) - def get_Rijs_from_lin_idx(self, lin_idx): + def _get_Rijs_from_lin_idx(self, lin_idx): """ Restore map results from maximum-likelihood over commonlines to corresponding relative rotations. @@ -206,15 +207,15 @@ def get_Rijs_from_lin_idx(self, lin_idx): oct1_idx = lin_idx < n_cand_per_oct n_est_in_oct1 = np.sum(oct1_idx, dtype=int) if n_est_in_oct1 > 0: - Rijs_est[oct1_idx] = self.get_Rijs_from_oct(lin_idx[oct1_idx], octant=1) + Rijs_est[oct1_idx] = self._get_Rijs_from_oct(lin_idx[oct1_idx], octant=1) if n_est_in_oct1 <= len(lin_idx): - Rijs_est[~oct1_idx] = self.get_Rijs_from_oct( + Rijs_est[~oct1_idx] = self._get_Rijs_from_oct( lin_idx[~oct1_idx] - n_cand_per_oct, octant=2 ) return Rijs_est - def get_Rijs_from_oct(self, lin_idx, octant=1): + def _get_Rijs_from_oct(self, lin_idx, octant=1): if octant not in [1, 2]: raise ValueError("`octant` must be 1 or 2.") @@ -273,7 +274,7 @@ def get_Rijs_from_oct(self, lin_idx, octant=1): return Rijs_est - def compute_scl_scores(self): + def _compute_scl_scores(self): """ Compute correlations for self-commonline candidates. """ @@ -308,7 +309,7 @@ def compute_scl_scores(self): corrs = 0.5 * (corrs + 1) # Compute equator measures. - eq_measures = self.all_eq_measures(corrs) + eq_measures = self._all_eq_measures(corrs) # Handle the cases: Non-equator, Non-top-view equator, and Top view images. # 1. Non-equators: just take product of probabilities. @@ -335,7 +336,7 @@ def compute_scl_scores(self): self.scls_scores = corrs_out - def all_eq_measures(self, corrs): + def _all_eq_measures(self, corrs): """ Compute a measure of how much an image from data is close to be an equator. """ @@ -397,13 +398,13 @@ def all_eq_measures(self, corrs): return corrs_mean * normal_corrs_max - def generate_lookup_data(self): + def _generate_lookup_data(self): """ Generate candidate relative rotations and corresponding common line indices. """ # Generate uniform grid on sphere with Saff-Kuijlaars and take one quarter # of sphere because of D2 symmetry redundancy. - sphere_grid = self.saff_kuijlaars(self.grid_res) + sphere_grid = self._saff_kuijlaars(self.grid_res) octant1_mask = np.all(sphere_grid > 0, axis=1) octant2_mask = ( (sphere_grid[:, 0] > 0) & (sphere_grid[:, 1] > 0) & (sphere_grid[:, 2] < 0) @@ -420,8 +421,8 @@ def generate_lookup_data(self): # We detect such directions by taking a strip of radius # eq_filter_angle about the 3 great circles perpendicular to the symmetry # axes of D2 (i.e to X,Y and Z axes). - eq_idx1, eq_class1 = self.mark_equators(sphere_grid1, self.eq_min_dist) - eq_idx2, eq_class2 = self.mark_equators(sphere_grid2, self.eq_min_dist) + eq_idx1, eq_class1 = self._mark_equators(sphere_grid1, self.eq_min_dist) + eq_idx2, eq_class2 = self._mark_equators(sphere_grid2, self.eq_min_dist) # Mark Top View Directions. # A Top view projection image is taken from the direction of one of the @@ -447,15 +448,15 @@ def generate_lookup_data(self): self.eq_class2 = eq_class2[eq_class2 < 4] # Generate in-plane rotations for each grid point on the sphere. - self.inplane_rotated_grid1 = self.generate_inplane_rots( + self.inplane_rotated_grid1 = self._generate_inplane_rots( self.sphere_grid1, self.inplane_res ) - self.inplane_rotated_grid2 = self.generate_inplane_rots( + self.inplane_rotated_grid2 = self._generate_inplane_rots( self.sphere_grid2, self.inplane_res ) # Generate commmonline angles induced by all relative rotation candidates. - cl_angles1, self.eq2eq_Rij_table_11 = self.generate_commonline_angles( + cl_angles1, self.eq2eq_Rij_table_11 = self._generate_commonline_angles( self.inplane_rotated_grid1, self.inplane_rotated_grid1, self.eq_idx1, @@ -463,7 +464,7 @@ def generate_lookup_data(self): self.eq_class1, self.eq_class1, ) - cl_angles2, self.eq2eq_Rij_table_12 = self.generate_commonline_angles( + cl_angles2, self.eq2eq_Rij_table_12 = self._generate_commonline_angles( self.inplane_rotated_grid1, self.inplane_rotated_grid2, self.eq_idx1, @@ -474,31 +475,31 @@ def generate_lookup_data(self): ) # Generate commonline indices. - self.cl_idx_1, self.cl_angles1 = self.generate_commonline_indices(cl_angles1) - self.cl_idx_2, self.cl_angles2 = self.generate_commonline_indices(cl_angles2) + self.cl_idx_1, self.cl_angles1 = self._generate_commonline_indices(cl_angles1) + self.cl_idx_2, self.cl_angles2 = self._generate_commonline_indices(cl_angles2) self.cl_idx = np.hstack((self.cl_idx_1, self.cl_idx_2)) - def generate_scl_lookup_data(self): + def _generate_scl_lookup_data(self): """ Generate lookup data for self-commonlines. """ # Get self-commonline angles. - self.scl_angles1 = self.generate_scl_angles( + self.scl_angles1 = self._generate_scl_angles( self.inplane_rotated_grid1, self.eq_idx1, self.eq_class1, ) - self.scl_angles2 = self.generate_scl_angles( + self.scl_angles2 = self._generate_scl_angles( self.inplane_rotated_grid2, self.eq_idx2, self.eq_class2, ) # Get self-commonline indices. - self.scl_idx_1, self.scl_eq_lin_idx_lists_1 = self.generate_scl_indices( + self.scl_idx_1, self.scl_eq_lin_idx_lists_1 = self._generate_scl_indices( self.scl_angles1, self.eq_class1 ) - self.scl_idx_2, self.scl_eq_lin_idx_lists_2 = self.generate_scl_indices( + self.scl_idx_2, self.scl_eq_lin_idx_lists_2 = self._generate_scl_indices( self.scl_angles2, self.eq_class2 ) self.scl_idx_lists = np.concatenate( @@ -540,9 +541,9 @@ def generate_scl_lookup_data(self): self.non_tv_eq_idx = non_tv_eq_idx.astype(int) # Generate maps from scl indices to relative rotations. - self.generate_scl_scores_idx_map() + self._generate_scl_scores_idx_map() - def generate_scl_angles(self, Ris, eq_idx, eq_class): + def _generate_scl_angles(self, Ris, eq_idx, eq_class): """ Generate self-commonline angles. @@ -628,7 +629,7 @@ def generate_scl_angles(self, Ris, eq_idx, eq_class): return scl_angles - def generate_scl_indices(self, scl_angles, eq_class): + def _generate_scl_indices(self, scl_angles, eq_class): L = 360 # Create candidate common line linear indices lists for equators. @@ -649,8 +650,8 @@ def generate_scl_indices(self, scl_angles, eq_class): eq_lin_idx_lists = np.empty((2, n_eq, n_inplane_rots), dtype=object) for i in non_top_view_eq_idx.tolist(): for j in range(n_inplane_rots): - idx1 = self.circ_seq(scl_angles[i, j, 0, 0], scl_angles[i, j, 1, 0], L) - idx2 = self.circ_seq(scl_angles[i, j, 0, 1], scl_angles[i, j, 1, 1], L) + idx1 = self._circ_seq(scl_angles[i, j, 0, 0], scl_angles[i, j, 1, 0], L) + idx2 = self._circ_seq(scl_angles[i, j, 0, 1], scl_angles[i, j, 1, 1], L) # Adjust so idx1 is in [0, 180) range. geq_180 = idx1 >= 180 @@ -664,11 +665,11 @@ def generate_scl_indices(self, scl_angles, eq_class): eq_lin_idx_lists[1, count_eq, j] = idx1 count_eq += 1 - scl_indices, _ = self.generate_commonline_indices(scl_angles) + scl_indices, _ = self._generate_commonline_indices(scl_angles) return scl_indices, eq_lin_idx_lists - def generate_scl_scores_idx_map(self): + def _generate_scl_scores_idx_map(self): n_rot_1 = len(self.scl_idx_1) // (3 * self.n_inplane_rots) n_rot_2 = len(self.scl_idx_2) // (3 * self.n_inplane_rots) @@ -954,7 +955,7 @@ def _sync_colors(self, Rijs): # This vector is a linear combination of the two leading eigen vectors, # and so we 'unmix' these vectors to retrieve it. color_mat = la.LinearOperator( - (3 * n_pairs,) * 2, lambda v: self.mult_cmat_by_vec(color_perms, v) + (3 * n_pairs,) * 2, lambda v: self._mult_cmat_by_vec(color_perms, v) ) vals, colors = la.eigs(color_mat, k=3, which="LR") vals = np.real(vals) @@ -1100,7 +1101,7 @@ def _match_colors(self, Rijs_rows): return colors_i - def mult_cmat_by_vec(self, c_perms, v): + def _mult_cmat_by_vec(self, c_perms, v): """ Multiply color matrix by vector v "on the fly". @@ -1343,7 +1344,7 @@ def _sync_signs(self, rr, c_vec): i, j = self.pairs[p] idx_mask = np.full(self.n_img, True) idx_mask[[i, j]] = False - signs[c, p, idx_mask] = self.calc_Rij_prods(c_mat_5d, i, j, c) + signs[c, p, idx_mask] = self._calc_Rij_prods(c_mat_5d, i, j, c) # Now compute the signs of Qij^c. est_signs = np.sign(np.sum(c_mat_4d, axis=(-2, -1))) @@ -1392,7 +1393,9 @@ def _sync_signs(self, rr, c_vec): for c in range(3): for r in range(self.n_img): # Image r used for signs. - c_mat_eff = self.fill_sign_sync_matrix_c(c_mat_5d_mp, sync_signs2, c, r) + c_mat_eff = self._fill_sign_sync_matrix_c( + c_mat_5d_mp, sync_signs2, c, r + ) # Construct (3*N)x(3*N) rank 1 matrices from Qik c_mat_for_svd = np.zeros( @@ -1463,8 +1466,8 @@ def _sync_signs(self, rr, c_vec): smat = la.LinearOperator( shape=(n_pairs, n_pairs), - matvec=lambda v, s=sign_mat: self.mult_smat_by_vec(v, s, pairs_map), - rmatvec=lambda v, s=sign_mat: self.mult_smat_by_vec(v, s, pairs_map), + matvec=lambda v, s=sign_mat: self._mult_smat_by_vec(v, s, pairs_map), + rmatvec=lambda v, s=sign_mat: self._mult_smat_by_vec(v, s, pairs_map), ) U, S, _ = la.svds(smat, k=3, which="LM") U = np.sign(U[0]) * U # Stable svds @@ -1520,13 +1523,13 @@ def _sync_signs(self, rr, c_vec): return rot - def fill_sign_sync_matrix_c(self, c_mat_5d_mp, sync_signs2, c, img): + def _fill_sign_sync_matrix_c(self, c_mat_5d_mp, sync_signs2, c, img): c_mat_eff = np.zeros((self.n_img, self.n_img, 3, 3), dtype=self.dtype) for r in range(self.n_img): c_mat_eff[:, r] = c_mat_5d_mp[r, sync_signs2[c, img, :, r], c] return c_mat_eff - def calc_Rij_prods(self, c_mat_5d, i, j, c): + def _calc_Rij_prods(self, c_mat_5d, i, j, c): Rik = np.delete(c_mat_5d[i, :, c], [i, j], axis=0) Rkj = np.delete(c_mat_5d[:, j, c], [i, j], axis=0) Rij = Rik @ Rkj @@ -1539,7 +1542,7 @@ def calc_Rij_prods(self, c_mat_5d, i, j, c): return np.sign(ij_signs) - def mult_smat_by_vec(self, v, sign_mat, pairs_map): + def _mult_smat_by_vec(self, v, sign_mat, pairs_map): """ Multiplies the signs sync matrix by a vector. """ @@ -1555,7 +1558,7 @@ def mult_smat_by_vec(self, v, sign_mat, pairs_map): #################### @staticmethod - def circ_seq(n1, n2, L): + def _circ_seq(n1, n2, L): """ Make a circular sequence of integers between n1 and n2 modulo L. @@ -1574,7 +1577,7 @@ def circ_seq(n1, n2, L): return seq @staticmethod - def saff_kuijlaars(N): + def _saff_kuijlaars(N): """ Generates N vertices on the unit sphere that are approximately evenly distributed. @@ -1605,7 +1608,7 @@ def saff_kuijlaars(N): return mesh @staticmethod - def mark_equators(sphere_grid, eq_filter_angle): + def _mark_equators(sphere_grid, eq_filter_angle): """ :param sphere_grid: Nx3 array of vertices in cartesian coordinates. :param eq_filter_angle: Angular distance from equator to be marked as @@ -1662,7 +1665,7 @@ def mark_equators(sphere_grid, eq_filter_angle): return eq_idx, eq_class @staticmethod - def generate_inplane_rots(sphere_grid, d_theta): + def _generate_inplane_rots(sphere_grid, d_theta): """ This function takes projection directions (points on the 2-sphere) and generates rotation matrices in SO(3). The projection direction @@ -1705,7 +1708,7 @@ def generate_inplane_rots(sphere_grid, d_theta): return inplane_rotated_grid - def generate_commonline_angles( + def _generate_commonline_angles( self, Ris, Rjs, @@ -1782,7 +1785,7 @@ def generate_commonline_angles( return cl_angles, eq2eq_Rij_table @staticmethod - def generate_commonline_indices(cl_angles): + def _generate_commonline_indices(cl_angles): # TODO: This is not accounting for n_theta other than 360! # Flatten the stack From b0dc70f37b95b4f0cd755d93690b77f8597dc5f2 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 13 May 2024 11:41:22 -0400 Subject: [PATCH 339/433] Reorganize Algo Sections. --- src/aspire/abinitio/commonline_d2.py | 886 ++++++++++++++------------- 1 file changed, 453 insertions(+), 433 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 3da513e117..4b860b86d7 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -104,6 +104,10 @@ def estimate_rotations(self): # Assign rotations. self.rotations = Ris + ######################### + # Prepare Polar Fourier # + ######################### + def _compute_shifted_pf(self): """ Pre-compute shifted and full polar Fourier transforms. @@ -133,158 +137,360 @@ def _compute_shifted_pf(self): (self.n_img, self.n_shifts * (self.n_theta // 2), r_max) ) - def _compute_cl_scores(self): + ################################### + # Generate Commonline Lookup Data # + ################################### + + def _generate_lookup_data(self): """ - Run common lines Maximum likelihood procedure for a D2 molecule, to find - the set of rotations Ri^TgkRj, k=1,2,3,4 for each pair of images i and j. + Generate candidate relative rotations and corresponding common line indices. """ - # Map the self common line scores of each 2 candidate rotations R_i,R_j to - # the respective relative rotation candidate R_i^TR_j. - n_lookup_1 = len(self.scl_idx_1) // 3 - oct1_ij_map = np.vstack((self.oct1_ij_map, self.oct1_ij_map[:, [1, 0]])) - oct2_ij_map = self.oct2_ij_map - oct2_ij_map[:, 1] += n_lookup_1 - oct2_ij_map = np.vstack((oct2_ij_map, oct2_ij_map[:, [1, 0]])) - ij_map = np.vstack((oct1_ij_map, oct2_ij_map)) - - # Allocate output variables. - n_pairs = self.n_img * (self.n_img - 1) // 2 - corrs_idx = np.zeros(n_pairs, dtype=np.int64) - corrs_out = np.zeros(n_pairs, dtype=self.dtype) - ij_idx = 0 - - # Search for common lines between pairs of projections. - pbar = tqdm( - desc="Searching for commonlines between pairs of images", total=n_pairs + # Generate uniform grid on sphere with Saff-Kuijlaars and take one quarter + # of sphere because of D2 symmetry redundancy. + sphere_grid = self._saff_kuijlaars(self.grid_res) + octant1_mask = np.all(sphere_grid > 0, axis=1) + octant2_mask = ( + (sphere_grid[:, 0] > 0) & (sphere_grid[:, 1] > 0) & (sphere_grid[:, 2] < 0) ) - for i in range(self.n_img): - pf_i = self.pf_shifted[i] - scores_i = self.scls_scores[i] - - for j in range(i + 1, self.n_img): - pf_j = self.pf_full[j] + sphere_grid1 = sphere_grid[octant1_mask] + sphere_grid2 = sphere_grid[octant2_mask] - # Compute maximum correlation over all shifts. - corrs = 2 * np.real(pf_i @ np.conj(pf_j).T) - corrs = np.reshape( - corrs, (self.n_shifts, self.n_theta // 2, self.n_theta) - ) - corrs = np.max(corrs, axis=0) + # Mark Equator Directions. + # Common lines between projection directions which are perpendicular to + # symmetry axes (equator images) have common line degeneracies. Two images + # taken from directions on the same great circle which is perpendicular to + # some symmetry axis only have 2 common lines instead of 4, and must be + # treated separately. + # We detect such directions by taking a strip of radius + # eq_filter_angle about the 3 great circles perpendicular to the symmetry + # axes of D2 (i.e to X,Y and Z axes). + eq_idx1, eq_class1 = self._mark_equators(sphere_grid1, self.eq_min_dist) + eq_idx2, eq_class2 = self._mark_equators(sphere_grid2, self.eq_min_dist) - # Take the product over symmetrically induced candidates. Eq. 4.5 in paper. - cl_idx = np.unravel_index( - self.cl_idx, (self.n_theta // 2, self.n_theta) - ) + # Mark Top View Directions. + # A Top view projection image is taken from the direction of one of the + # symmetry axes. Since all symmetry axes of D2 molecules are perpendicular + # this means that such an image is an equator with repect to both symmetry + # axes which are perpendicular to the direction of the symmetry axis from + # which the image was made, e.g. if the image was formed by projecting in + # the direction of the X (symmetry) axis, then it is an equator with + # respect to both Y and Z symmetry axes (it's direction is the + # interesection of 2 great circles perpendicular to Y and Z axes). + # Such images have severe degeneracies. A pair of Top View images (taken + # from different directions or a Top View and equator image only have a + # single common line. A top view and a regular non-equator image only have + # two common lines. - prod_corrs = corrs[cl_idx] - prod_corrs = prod_corrs.reshape(len(prod_corrs) // 4, 4) - prod_corrs = np.prod(prod_corrs, axis=1) + # Remove top views from sphere grids and update equator indices and classes. + self.sphere_grid1 = sphere_grid1[eq_class1 < 4] + self.sphere_grid2 = sphere_grid2[eq_class2 < 4] + self.eq_idx1 = eq_idx1[eq_class1 < 4] + self.eq_idx2 = eq_idx2[eq_class2 < 4] + self.eq_idx = np.concatenate((self.eq_idx1, self.eq_idx2)) + self.eq_class1 = eq_class1[eq_class1 < 4] + self.eq_class2 = eq_class2[eq_class2 < 4] - # Incorporate scores of individual rotations from self-commonlines. - scores_j = self.scls_scores[j] - scores_ij = scores_i[ij_map[:, 0]] * scores_j[ij_map[:, 1]] + # Generate in-plane rotations for each grid point on the sphere. + self.inplane_rotated_grid1 = self._generate_inplane_rots( + self.sphere_grid1, self.inplane_res + ) + self.inplane_rotated_grid2 = self._generate_inplane_rots( + self.sphere_grid2, self.inplane_res + ) - # Find maximum correlations. - prod_corrs = prod_corrs * scores_ij - max_idx = np.argmax(prod_corrs) - corrs_idx[ij_idx] = max_idx - corrs_out[ij_idx] = prod_corrs[max_idx] - ij_idx += 1 + # Generate commmonline angles induced by all relative rotation candidates. + cl_angles1, self.eq2eq_Rij_table_11 = self._generate_commonline_angles( + self.inplane_rotated_grid1, + self.inplane_rotated_grid1, + self.eq_idx1, + self.eq_idx1, + self.eq_class1, + self.eq_class1, + ) + cl_angles2, self.eq2eq_Rij_table_12 = self._generate_commonline_angles( + self.inplane_rotated_grid1, + self.inplane_rotated_grid2, + self.eq_idx1, + self.eq_idx2, + self.eq_class1, + self.eq_class2, + triu=False, + ) - pbar.update() - pbar.close() + # Generate commonline indices. + self.cl_idx_1, self.cl_angles1 = self._generate_commonline_indices(cl_angles1) + self.cl_idx_2, self.cl_angles2 = self._generate_commonline_indices(cl_angles2) + self.cl_idx = np.hstack((self.cl_idx_1, self.cl_idx_2)) - # Get estimated relative viewing directions. - self.Rijs_est = self._get_Rijs_from_lin_idx(corrs_idx) + ######################################## + # Generate Self-Commonline Lookup Data # + ######################################## - def _get_Rijs_from_lin_idx(self, lin_idx): + def _generate_scl_lookup_data(self): """ - Restore map results from maximum-likelihood over commonlines to corresponding - relative rotations. + Generate lookup data for self-commonlines. """ - Rijs_est = np.zeros((len(lin_idx), 4, 3, 3), dtype=self.dtype) - n_cand_per_oct = len(self.cl_idx_1) // 4 - oct1_idx = lin_idx < n_cand_per_oct - n_est_in_oct1 = np.sum(oct1_idx, dtype=int) - if n_est_in_oct1 > 0: - Rijs_est[oct1_idx] = self._get_Rijs_from_oct(lin_idx[oct1_idx], octant=1) - if n_est_in_oct1 <= len(lin_idx): - Rijs_est[~oct1_idx] = self._get_Rijs_from_oct( - lin_idx[~oct1_idx] - n_cand_per_oct, octant=2 - ) - - return Rijs_est - - def _get_Rijs_from_oct(self, lin_idx, octant=1): - if octant not in [1, 2]: - raise ValueError("`octant` must be 1 or 2.") - - # Get pairs lookup table. - if octant == 1: - unique_pairs = self.eq2eq_Rij_table_11 - else: - unique_pairs = self.eq2eq_Rij_table_12 - - n_theta = self.n_inplane_rots - n_lookup_pairs = np.sum(unique_pairs, dtype=np.int64) - n_rots = len(self.sphere_grid1) - if octant == 1: - n_rots2 = n_rots - else: - n_rots2 = len(self.sphere_grid2) - n_pairs = len(lin_idx) - - # Map linear indices of chosen pairs of rotation candidates from ML to regular indices. - p_idx, inplane_i, inplane_j = np.unravel_index( - lin_idx, (2 * n_lookup_pairs, n_theta, n_theta // 2) + # Get self-commonline angles. + self.scl_angles1 = self._generate_scl_angles( + self.inplane_rotated_grid1, + self.eq_idx1, + self.eq_class1, ) - transpose_idx = p_idx >= n_lookup_pairs - p_idx[transpose_idx] -= n_lookup_pairs - s = self.inplane_rotated_grid1.shape - inplane_rotated_grid = np.reshape( - self.inplane_rotated_grid1, (np.prod(s[0:2]), 3, 3) + self.scl_angles2 = self._generate_scl_angles( + self.inplane_rotated_grid2, + self.eq_idx2, + self.eq_class2, ) - if octant == 1: - s2 = s - inplane_rotated_grid2 = inplane_rotated_grid - else: - s2 = self.inplane_rotated_grid2.shape - inplane_rotated_grid2 = np.reshape( - self.inplane_rotated_grid2, (np.prod(s2[0:2]), 3, 3) - ) - Rijs_est = np.zeros((n_pairs, 4, 3, 3), dtype=self.dtype) + # Get self-commonline indices. + self.scl_idx_1, self.scl_eq_lin_idx_lists_1 = self._generate_scl_indices( + self.scl_angles1, self.eq_class1 + ) + self.scl_idx_2, self.scl_eq_lin_idx_lists_2 = self._generate_scl_indices( + self.scl_angles2, self.eq_class2 + ) + self.scl_idx_lists = np.concatenate( + (self.scl_eq_lin_idx_lists_1, self.scl_eq_lin_idx_lists_2), axis=1 + ) - # Convert linear indices of unique table to linear indices of index pairs table. - idx_vec = np.arange(np.prod(unique_pairs.shape)) - unique_lin_idx = idx_vec[unique_pairs.flatten()] - I, J = np.unravel_index(unique_lin_idx, (n_rots, n_rots2)) - est_idx = np.vstack((I[p_idx], J[p_idx])) + # Compute non-equator indices. + # Register non equator indices. Denote by C_ij the j'th in-plane rotation of + # the i'th ML candidate, and arrange all candidates in a list with their in-plane + # rotations in the order: C_11,...,C_1r,...,C_m1,...,C_mr where m is the + # number of candidates and r is the number of in plane rotations. Here we + # create a sub-list of only non equator candidates, i.e., if i_1,...,i_p are + # non equators then we have the sub list is + # C_(i_1)1,...,C(i_1)r,...C_(i_p)1,...,C_(i_p)r. + n_non_eq = np.sum(self.eq_class1 == 0) + np.sum(self.eq_class2 == 0) + non_eq_idx = np.zeros((n_non_eq, int(self.n_inplane_rots))) + non_eq_idx[:, 0] = ( + np.hstack( + ( + np.where(self.eq_class1 == 0)[0], + len(self.eq_class1) + np.where(self.eq_class2 == 0)[0], + ) + ) + * self.n_inplane_rots + ) + for i in range(1, self.n_inplane_rots): + non_eq_idx[:, i] = non_eq_idx[:, 0] + i - # Assemble relative rotations Ri^TgRj using linear indices, where g is a group member of D2. - Ris_lin_idx = np.ravel_multi_index((est_idx[0], inplane_i), s[:2]) - Rjs_lin_idx = np.ravel_multi_index((est_idx[1], inplane_j), s2[:2]) - Ris_t = np.transpose(inplane_rotated_grid[Ris_lin_idx], (0, 2, 1)) - Rjs = inplane_rotated_grid2[Rjs_lin_idx] + self.non_eq_idx = non_eq_idx.astype(int) - for k, g in enumerate(self.gs): - Rijs_est[:, k] = Ris_t @ (g * Rjs) + # Non-topview equator indices. + non_tv_eq_idx = np.concatenate( + ( + np.where(self.eq_class1 > 0)[0], + len(self.eq_class1) + np.where(self.eq_class2 > 0)[0], + ) + ) - Rijs_est[transpose_idx] = np.transpose(Rijs_est[transpose_idx], (0, 1, 3, 2)) + self.non_tv_eq_idx = non_tv_eq_idx.astype(int) - return Rijs_est + # Generate maps from scl indices to relative rotations. + self._generate_scl_scores_idx_map() - def _compute_scl_scores(self): - """ - Compute correlations for self-commonline candidates. + def _generate_scl_angles(self, Ris, eq_idx, eq_class): """ - n_img = self.n_img - n_theta = self.n_theta - n_eq = len(self.non_tv_eq_idx) - n_inplane = self.n_inplane_rots + Generate self-commonline angles. - # Run ML in parallel - scl_matrix = np.concatenate((self.scl_idx_1, self.scl_idx_2)) + :param Ris: Candidate rotation matrices, (n_sphere_grid, n_inplane_rots, 3, 3). + :param eq_idx: Equator index mask for Ris. + :param eq_class: Equator classification for Ris. + """ + L = 360 # TODO: Maybe this should be self.n_theta + + # For each candidate rotation Ri we generate the set of 3 self-commonlines. + scl_angles = np.zeros((*Ris.shape[:2], 3, 2), dtype=Ris.dtype) + n_rots = len(Ris) + for i in range(n_rots): + Ri = Ris[i] + # TODO: Reversing self.gs here to match matlab. Should use as is. + for k, g in enumerate(self.gs[::-1][:3]): + g_Ri = g * Ri + Riis = np.transpose(Ri, axes=(0, 2, 1)) @ g_Ri + + scl_angles[i, :, k, 0] = np.arctan2(Riis[:, 2, 0], -Riis[:, 2, 1]) + scl_angles[i, :, k, 1] = np.arctan2(-Riis[:, 0, 2], Riis[:, 1, 2]) + + # Prepare self commonline coordinates. + scl_angles = scl_angles % (2 * np.pi) + + # Deal with non top view equators + # A non-TV equator has only one self common line. However, we clasify an + # equator as an image whose projection direction is at radial distance < + # eq_filter_angle from the great circle perpendicural to a symmetry axis, + # and not strictly zero distance. Thus in most cases we get 2 common lines + # differing by a small difference in degrees. Actually the calculation above + # gives us two NEARLY antipodal lines, so we first flip one of them by + # adding 180 degrees to it. Then we aggregate all the rays within the range + # between these two resulting lines to compute the score of this self common + # line for this candidate. The scoring part is done in the ML function itself. + # Furthermore, the line perpendicular to the self common line, though not + # really a self common line, has the property that all its values are real + # and both halves of the line (rays differing by pi, emanating from the + # origin) have the same values, and so it 'behaves like' a self common + # line which we also register here and exploit in the ML function. + # We put the 'real' self common line at 2 first coordinates, the + # candidate for perpendicular line is in 3rd coordinate. + + # If this is a self common line with respect to x-equator then the actual self + # common line(s) is given by the self relative rotations given by the y and z + # rotation (by 180 degrees) group members, i.e. Ri^TgyRj and Ri^TgzRj + scl_angles[eq_class == 1] = scl_angles[eq_class == 1][:, :, [1, 2, 0]] + scl_angles[eq_class == 1, :, 0] = scl_angles[eq_class == 1][:, :, 0, [1, 0]] + + # If this is a self common line with respect to y-equator then the actual self + # common line(s) is given by the self relative rotations given by the x and z + # rotation (by 180 degrees) group members, i.e. Ri^TgxRj and Ri^TgzRj + scl_angles[eq_class == 2] = scl_angles[eq_class == 2][:, :, [0, 2, 1]] + scl_angles[eq_class == 2, :, 0] = scl_angles[eq_class == 2][:, :, 0, [1, 0]] + + # If this is a self common line with respect to z-equator then the actual self + # common line(s) is given by the self relative rotations given by the x and y + # rotation (by 180 degrees) group members, i.e. Ri^TgxRj and Ri^TgyRj + # No need to rearrange entries, the "real" common lines are already in + # indices 1 and 2, but flip one common line to antipodal. + scl_angles[eq_class == 3, :, 0] = scl_angles[eq_class == 3][:, :, 0, [1, 0]] + + # TODO: Maybe a cleaner way to do this. + # Make sure angle range is <= 180 degrees. + # p1 marks "equator" self-commonlines where both entries of the first + # scl are greater than both entries of the second scl. + p1 = scl_angles[eq_class > 0, :, 0] > scl_angles[eq_class > 0, :, 1] + p1 = p1[:, :, 0] & p1[:, :, 1] + # p2 marks "equator" self-commonlines where the angle range between the + # first and second sets of self-commonlines is greater than 180. + p2 = scl_angles[eq_class > 0, :, 0] - scl_angles[eq_class > 0, :, 1] < -np.pi + p2 = p2[:, :, 0] | p2[:, :, 1] + p = p1 | p2 + + # Swap entries satisfying either of the above conditions. + scl_angles[eq_class > 0] = ( + scl_angles[eq_class > 0][:, :, [1, 0, 2]] * p[:, :, None, None] + + scl_angles[eq_class > 0] * ~p[:, :, None, None] + ) + + # Convert angles from radians to degrees (indices). + scl_angles = np.round(scl_angles * 180 / np.pi) % L + + return scl_angles + + def _generate_scl_indices(self, scl_angles, eq_class): + L = 360 + + # Create candidate common line linear indices lists for equators. + # As indicated above for equator candidate, for each self common line we + # don't get a single coordinate but a range of them. Here we register a + # list of coordinates for each such self common line candidate. + non_top_view_eq_idx = np.where(eq_class > 0)[0] + n_eq = len(non_top_view_eq_idx) + n_inplane_rots = scl_angles.shape[1] + count_eq = 0 + + # eq_lin_idx_lists[1,i,j] registers a list of linear indices of the j'th + # in-plane rotation of the range for the (only) self common line of the i'th + # candidate. eq_lin_idx_lists[2,i,j] registers the actual (integer) angle + # of the self common line in the 2D Fourier space. Note that we need only + # one number since each self common line has radial coordinates of the form + # (theta, theta+180). + eq_lin_idx_lists = np.empty((2, n_eq, n_inplane_rots), dtype=object) + for i in non_top_view_eq_idx.tolist(): + for j in range(n_inplane_rots): + idx1 = self._circ_seq(scl_angles[i, j, 0, 0], scl_angles[i, j, 1, 0], L) + idx2 = self._circ_seq(scl_angles[i, j, 0, 1], scl_angles[i, j, 1, 1], L) + + # Adjust so idx1 is in [0, 180) range. + geq_180 = idx1 >= 180 + idx1[geq_180] = (idx1[geq_180] - L // 2) % (L // 2) + idx2[geq_180] = (idx2[geq_180] + L // 2) % L + + # register indices in list. + eq_lin_idx_lists[0, count_eq, j] = np.ravel_multi_index( + (idx1, idx2), (L // 2, L) + ) + eq_lin_idx_lists[1, count_eq, j] = idx1 + count_eq += 1 + + scl_indices, _ = self._generate_commonline_indices(scl_angles) + + return scl_indices, eq_lin_idx_lists + + def _generate_scl_scores_idx_map(self): + n_rot_1 = len(self.scl_idx_1) // (3 * self.n_inplane_rots) + n_rot_2 = len(self.scl_idx_2) // (3 * self.n_inplane_rots) + + # First the map for i 0] + if len(unique_pairs_i) == 0: + continue + i_idx_plus_offset = i_idx + (i * self.n_inplane_rots) + + for j in unique_pairs_i: + j_idx_plus_offset = j_idx + (j * self.n_inplane_rots) + oct2_ij_map[:, :, idx] = np.column_stack( + (i_idx_plus_offset, j_idx_plus_offset) + ) + idx += 1 + + tmp1 = oct1_ij_map[:, 0, :] + tmp2 = oct1_ij_map[:, 1, :] + self.oct1_ij_map = np.column_stack( + (tmp1.flatten(order="F"), tmp2.flatten(order="F")) + ) + + tmp1 = oct2_ij_map[:, 0, :] + tmp2 = oct2_ij_map[:, 1, :] + self.oct2_ij_map = np.column_stack( + (tmp1.flatten(order="F"), tmp2.flatten(order="F")) + ) + + ############################################## + # Compute Self-Commonline Correlation Scores # + ############################################## + + def _compute_scl_scores(self): + """ + Compute correlations for self-commonline candidates. + """ + n_img = self.n_img + n_theta = self.n_theta + n_eq = len(self.non_tv_eq_idx) + n_inplane = self.n_inplane_rots + + # Run ML in parallel + scl_matrix = np.concatenate((self.scl_idx_1, self.scl_idx_2)) M = len(scl_matrix) // 3 corrs_out = np.zeros((n_img, M), dtype=self.dtype) scl_idx = scl_matrix.reshape(M, 3) @@ -398,340 +604,154 @@ def _all_eq_measures(self, corrs): return corrs_mean * normal_corrs_max - def _generate_lookup_data(self): + ######################################### + # Compute Commonline Correlation Scores # + ######################################### + + def _compute_cl_scores(self): """ - Generate candidate relative rotations and corresponding common line indices. + Run common lines Maximum likelihood procedure for a D2 molecule, to find + the set of rotations Ri^TgkRj, k=1,2,3,4 for each pair of images i and j. """ - # Generate uniform grid on sphere with Saff-Kuijlaars and take one quarter - # of sphere because of D2 symmetry redundancy. - sphere_grid = self._saff_kuijlaars(self.grid_res) - octant1_mask = np.all(sphere_grid > 0, axis=1) - octant2_mask = ( - (sphere_grid[:, 0] > 0) & (sphere_grid[:, 1] > 0) & (sphere_grid[:, 2] < 0) - ) - sphere_grid1 = sphere_grid[octant1_mask] - sphere_grid2 = sphere_grid[octant2_mask] + # Map the self common line scores of each 2 candidate rotations R_i,R_j to + # the respective relative rotation candidate R_i^TR_j. + n_lookup_1 = len(self.scl_idx_1) // 3 + oct1_ij_map = np.vstack((self.oct1_ij_map, self.oct1_ij_map[:, [1, 0]])) + oct2_ij_map = self.oct2_ij_map + oct2_ij_map[:, 1] += n_lookup_1 + oct2_ij_map = np.vstack((oct2_ij_map, oct2_ij_map[:, [1, 0]])) + ij_map = np.vstack((oct1_ij_map, oct2_ij_map)) - # Mark Equator Directions. - # Common lines between projection directions which are perpendicular to - # symmetry axes (equator images) have common line degeneracies. Two images - # taken from directions on the same great circle which is perpendicular to - # some symmetry axis only have 2 common lines instead of 4, and must be - # treated separately. - # We detect such directions by taking a strip of radius - # eq_filter_angle about the 3 great circles perpendicular to the symmetry - # axes of D2 (i.e to X,Y and Z axes). - eq_idx1, eq_class1 = self._mark_equators(sphere_grid1, self.eq_min_dist) - eq_idx2, eq_class2 = self._mark_equators(sphere_grid2, self.eq_min_dist) + # Allocate output variables. + n_pairs = self.n_img * (self.n_img - 1) // 2 + corrs_idx = np.zeros(n_pairs, dtype=np.int64) + corrs_out = np.zeros(n_pairs, dtype=self.dtype) + ij_idx = 0 - # Mark Top View Directions. - # A Top view projection image is taken from the direction of one of the - # symmetry axes. Since all symmetry axes of D2 molecules are perpendicular - # this means that such an image is an equator with repect to both symmetry - # axes which are perpendicular to the direction of the symmetry axis from - # which the image was made, e.g. if the image was formed by projecting in - # the direction of the X (symmetry) axis, then it is an equator with - # respect to both Y and Z symmetry axes (it's direction is the - # interesection of 2 great circles perpendicular to Y and Z axes). - # Such images have severe degeneracies. A pair of Top View images (taken - # from different directions or a Top View and equator image only have a - # single common line. A top view and a regular non-equator image only have - # two common lines. + # Search for common lines between pairs of projections. + pbar = tqdm( + desc="Searching for commonlines between pairs of images", total=n_pairs + ) + for i in range(self.n_img): + pf_i = self.pf_shifted[i] + scores_i = self.scls_scores[i] - # Remove top views from sphere grids and update equator indices and classes. - self.sphere_grid1 = sphere_grid1[eq_class1 < 4] - self.sphere_grid2 = sphere_grid2[eq_class2 < 4] - self.eq_idx1 = eq_idx1[eq_class1 < 4] - self.eq_idx2 = eq_idx2[eq_class2 < 4] - self.eq_idx = np.concatenate((self.eq_idx1, self.eq_idx2)) - self.eq_class1 = eq_class1[eq_class1 < 4] - self.eq_class2 = eq_class2[eq_class2 < 4] - - # Generate in-plane rotations for each grid point on the sphere. - self.inplane_rotated_grid1 = self._generate_inplane_rots( - self.sphere_grid1, self.inplane_res - ) - self.inplane_rotated_grid2 = self._generate_inplane_rots( - self.sphere_grid2, self.inplane_res - ) - - # Generate commmonline angles induced by all relative rotation candidates. - cl_angles1, self.eq2eq_Rij_table_11 = self._generate_commonline_angles( - self.inplane_rotated_grid1, - self.inplane_rotated_grid1, - self.eq_idx1, - self.eq_idx1, - self.eq_class1, - self.eq_class1, - ) - cl_angles2, self.eq2eq_Rij_table_12 = self._generate_commonline_angles( - self.inplane_rotated_grid1, - self.inplane_rotated_grid2, - self.eq_idx1, - self.eq_idx2, - self.eq_class1, - self.eq_class2, - triu=False, - ) - - # Generate commonline indices. - self.cl_idx_1, self.cl_angles1 = self._generate_commonline_indices(cl_angles1) - self.cl_idx_2, self.cl_angles2 = self._generate_commonline_indices(cl_angles2) - self.cl_idx = np.hstack((self.cl_idx_1, self.cl_idx_2)) - - def _generate_scl_lookup_data(self): - """ - Generate lookup data for self-commonlines. - """ - # Get self-commonline angles. - self.scl_angles1 = self._generate_scl_angles( - self.inplane_rotated_grid1, - self.eq_idx1, - self.eq_class1, - ) - self.scl_angles2 = self._generate_scl_angles( - self.inplane_rotated_grid2, - self.eq_idx2, - self.eq_class2, - ) + for j in range(i + 1, self.n_img): + pf_j = self.pf_full[j] - # Get self-commonline indices. - self.scl_idx_1, self.scl_eq_lin_idx_lists_1 = self._generate_scl_indices( - self.scl_angles1, self.eq_class1 - ) - self.scl_idx_2, self.scl_eq_lin_idx_lists_2 = self._generate_scl_indices( - self.scl_angles2, self.eq_class2 - ) - self.scl_idx_lists = np.concatenate( - (self.scl_eq_lin_idx_lists_1, self.scl_eq_lin_idx_lists_2), axis=1 - ) + # Compute maximum correlation over all shifts. + corrs = 2 * np.real(pf_i @ np.conj(pf_j).T) + corrs = np.reshape( + corrs, (self.n_shifts, self.n_theta // 2, self.n_theta) + ) + corrs = np.max(corrs, axis=0) - # Compute non-equator indices. - # Register non equator indices. Denote by C_ij the j'th in-plane rotation of - # the i'th ML candidate, and arrange all candidates in a list with their in-plane - # rotations in the order: C_11,...,C_1r,...,C_m1,...,C_mr where m is the - # number of candidates and r is the number of in plane rotations. Here we - # create a sub-list of only non equator candidates, i.e., if i_1,...,i_p are - # non equators then we have the sub list is - # C_(i_1)1,...,C(i_1)r,...C_(i_p)1,...,C_(i_p)r. - n_non_eq = np.sum(self.eq_class1 == 0) + np.sum(self.eq_class2 == 0) - non_eq_idx = np.zeros((n_non_eq, int(self.n_inplane_rots))) - non_eq_idx[:, 0] = ( - np.hstack( - ( - np.where(self.eq_class1 == 0)[0], - len(self.eq_class1) + np.where(self.eq_class2 == 0)[0], + # Take the product over symmetrically induced candidates. Eq. 4.5 in paper. + cl_idx = np.unravel_index( + self.cl_idx, (self.n_theta // 2, self.n_theta) ) - ) - * self.n_inplane_rots - ) - for i in range(1, self.n_inplane_rots): - non_eq_idx[:, i] = non_eq_idx[:, 0] + i - self.non_eq_idx = non_eq_idx.astype(int) + prod_corrs = corrs[cl_idx] + prod_corrs = prod_corrs.reshape(len(prod_corrs) // 4, 4) + prod_corrs = np.prod(prod_corrs, axis=1) - # Non-topview equator indices. - non_tv_eq_idx = np.concatenate( - ( - np.where(self.eq_class1 > 0)[0], - len(self.eq_class1) + np.where(self.eq_class2 > 0)[0], - ) - ) + # Incorporate scores of individual rotations from self-commonlines. + scores_j = self.scls_scores[j] + scores_ij = scores_i[ij_map[:, 0]] * scores_j[ij_map[:, 1]] - self.non_tv_eq_idx = non_tv_eq_idx.astype(int) + # Find maximum correlations. + prod_corrs = prod_corrs * scores_ij + max_idx = np.argmax(prod_corrs) + corrs_idx[ij_idx] = max_idx + corrs_out[ij_idx] = prod_corrs[max_idx] + ij_idx += 1 - # Generate maps from scl indices to relative rotations. - self._generate_scl_scores_idx_map() + pbar.update() + pbar.close() - def _generate_scl_angles(self, Ris, eq_idx, eq_class): - """ - Generate self-commonline angles. + # Get estimated relative viewing directions. + self.Rijs_est = self._get_Rijs_from_lin_idx(corrs_idx) - :param Ris: Candidate rotation matrices, (n_sphere_grid, n_inplane_rots, 3, 3). - :param eq_idx: Equator index mask for Ris. - :param eq_class: Equator classification for Ris. + def _get_Rijs_from_lin_idx(self, lin_idx): """ - L = 360 # TODO: Maybe this should be self.n_theta - - # For each candidate rotation Ri we generate the set of 3 self-commonlines. - scl_angles = np.zeros((*Ris.shape[:2], 3, 2), dtype=Ris.dtype) - n_rots = len(Ris) - for i in range(n_rots): - Ri = Ris[i] - # TODO: Reversing self.gs here to match matlab. Should use as is. - for k, g in enumerate(self.gs[::-1][:3]): - g_Ri = g * Ri - Riis = np.transpose(Ri, axes=(0, 2, 1)) @ g_Ri - - scl_angles[i, :, k, 0] = np.arctan2(Riis[:, 2, 0], -Riis[:, 2, 1]) - scl_angles[i, :, k, 1] = np.arctan2(-Riis[:, 0, 2], Riis[:, 1, 2]) - - # Prepare self commonline coordinates. - scl_angles = scl_angles % (2 * np.pi) - - # Deal with non top view equators - # A non-TV equator has only one self common line. However, we clasify an - # equator as an image whose projection direction is at radial distance < - # eq_filter_angle from the great circle perpendicural to a symmetry axis, - # and not strictly zero distance. Thus in most cases we get 2 common lines - # differing by a small difference in degrees. Actually the calculation above - # gives us two NEARLY antipodal lines, so we first flip one of them by - # adding 180 degrees to it. Then we aggregate all the rays within the range - # between these two resulting lines to compute the score of this self common - # line for this candidate. The scoring part is done in the ML function itself. - # Furthermore, the line perpendicular to the self common line, though not - # really a self common line, has the property that all its values are real - # and both halves of the line (rays differing by pi, emanating from the - # origin) have the same values, and so it 'behaves like' a self common - # line which we also register here and exploit in the ML function. - # We put the 'real' self common line at 2 first coordinates, the - # candidate for perpendicular line is in 3rd coordinate. + Restore map results from maximum-likelihood over commonlines to corresponding + relative rotations. + """ + Rijs_est = np.zeros((len(lin_idx), 4, 3, 3), dtype=self.dtype) + n_cand_per_oct = len(self.cl_idx_1) // 4 + oct1_idx = lin_idx < n_cand_per_oct + n_est_in_oct1 = np.sum(oct1_idx, dtype=int) + if n_est_in_oct1 > 0: + Rijs_est[oct1_idx] = self._get_Rijs_from_oct(lin_idx[oct1_idx], octant=1) + if n_est_in_oct1 <= len(lin_idx): + Rijs_est[~oct1_idx] = self._get_Rijs_from_oct( + lin_idx[~oct1_idx] - n_cand_per_oct, octant=2 + ) - # If this is a self common line with respect to x-equator then the actual self - # common line(s) is given by the self relative rotations given by the y and z - # rotation (by 180 degrees) group members, i.e. Ri^TgyRj and Ri^TgzRj - scl_angles[eq_class == 1] = scl_angles[eq_class == 1][:, :, [1, 2, 0]] - scl_angles[eq_class == 1, :, 0] = scl_angles[eq_class == 1][:, :, 0, [1, 0]] + return Rijs_est - # If this is a self common line with respect to y-equator then the actual self - # common line(s) is given by the self relative rotations given by the x and z - # rotation (by 180 degrees) group members, i.e. Ri^TgxRj and Ri^TgzRj - scl_angles[eq_class == 2] = scl_angles[eq_class == 2][:, :, [0, 2, 1]] - scl_angles[eq_class == 2, :, 0] = scl_angles[eq_class == 2][:, :, 0, [1, 0]] + def _get_Rijs_from_oct(self, lin_idx, octant=1): + if octant not in [1, 2]: + raise ValueError("`octant` must be 1 or 2.") - # If this is a self common line with respect to z-equator then the actual self - # common line(s) is given by the self relative rotations given by the x and y - # rotation (by 180 degrees) group members, i.e. Ri^TgxRj and Ri^TgyRj - # No need to rearrange entries, the "real" common lines are already in - # indices 1 and 2, but flip one common line to antipodal. - scl_angles[eq_class == 3, :, 0] = scl_angles[eq_class == 3][:, :, 0, [1, 0]] + # Get pairs lookup table. + if octant == 1: + unique_pairs = self.eq2eq_Rij_table_11 + else: + unique_pairs = self.eq2eq_Rij_table_12 - # TODO: Maybe a cleaner way to do this. - # Make sure angle range is <= 180 degrees. - # p1 marks "equator" self-commonlines where both entries of the first - # scl are greater than both entries of the second scl. - p1 = scl_angles[eq_class > 0, :, 0] > scl_angles[eq_class > 0, :, 1] - p1 = p1[:, :, 0] & p1[:, :, 1] - # p2 marks "equator" self-commonlines where the angle range between the - # first and second sets of self-commonlines is greater than 180. - p2 = scl_angles[eq_class > 0, :, 0] - scl_angles[eq_class > 0, :, 1] < -np.pi - p2 = p2[:, :, 0] | p2[:, :, 1] - p = p1 | p2 + n_theta = self.n_inplane_rots + n_lookup_pairs = np.sum(unique_pairs, dtype=np.int64) + n_rots = len(self.sphere_grid1) + if octant == 1: + n_rots2 = n_rots + else: + n_rots2 = len(self.sphere_grid2) + n_pairs = len(lin_idx) - # Swap entries satisfying either of the above conditions. - scl_angles[eq_class > 0] = ( - scl_angles[eq_class > 0][:, :, [1, 0, 2]] * p[:, :, None, None] - + scl_angles[eq_class > 0] * ~p[:, :, None, None] + # Map linear indices of chosen pairs of rotation candidates from ML to regular indices. + p_idx, inplane_i, inplane_j = np.unravel_index( + lin_idx, (2 * n_lookup_pairs, n_theta, n_theta // 2) ) - - # Convert angles from radians to degrees (indices). - scl_angles = np.round(scl_angles * 180 / np.pi) % L - - return scl_angles - - def _generate_scl_indices(self, scl_angles, eq_class): - L = 360 - - # Create candidate common line linear indices lists for equators. - # As indicated above for equator candidate, for each self common line we - # don't get a single coordinate but a range of them. Here we register a - # list of coordinates for each such self common line candidate. - non_top_view_eq_idx = np.where(eq_class > 0)[0] - n_eq = len(non_top_view_eq_idx) - n_inplane_rots = scl_angles.shape[1] - count_eq = 0 - - # eq_lin_idx_lists[1,i,j] registers a list of linear indices of the j'th - # in-plane rotation of the range for the (only) self common line of the i'th - # candidate. eq_lin_idx_lists[2,i,j] registers the actual (integer) angle - # of the self common line in the 2D Fourier space. Note that we need only - # one number since each self common line has radial coordinates of the form - # (theta, theta+180). - eq_lin_idx_lists = np.empty((2, n_eq, n_inplane_rots), dtype=object) - for i in non_top_view_eq_idx.tolist(): - for j in range(n_inplane_rots): - idx1 = self._circ_seq(scl_angles[i, j, 0, 0], scl_angles[i, j, 1, 0], L) - idx2 = self._circ_seq(scl_angles[i, j, 0, 1], scl_angles[i, j, 1, 1], L) - - # Adjust so idx1 is in [0, 180) range. - geq_180 = idx1 >= 180 - idx1[geq_180] = (idx1[geq_180] - L // 2) % (L // 2) - idx2[geq_180] = (idx2[geq_180] + L // 2) % L - - # register indices in list. - eq_lin_idx_lists[0, count_eq, j] = np.ravel_multi_index( - (idx1, idx2), (L // 2, L) - ) - eq_lin_idx_lists[1, count_eq, j] = idx1 - count_eq += 1 - - scl_indices, _ = self._generate_commonline_indices(scl_angles) - - return scl_indices, eq_lin_idx_lists - - def _generate_scl_scores_idx_map(self): - n_rot_1 = len(self.scl_idx_1) // (3 * self.n_inplane_rots) - n_rot_2 = len(self.scl_idx_2) // (3 * self.n_inplane_rots) - - # First the map for i= n_lookup_pairs + p_idx[transpose_idx] -= n_lookup_pairs + s = self.inplane_rotated_grid1.shape + inplane_rotated_grid = np.reshape( + self.inplane_rotated_grid1, (np.prod(s[0:2]), 3, 3) ) - i_idx = np.repeat(np.arange(self.n_inplane_rots), self.n_inplane_rots // 2) - j_idx = np.tile(np.arange(self.n_inplane_rots // 2), self.n_inplane_rots) - idx_vec = np.arange(n_rot_1) - idx = 0 - - for i in range(n_rot_1): - unique_pairs_i = idx_vec[self.eq2eq_Rij_table_11[i]] - if len(unique_pairs_i) == 0: - continue - i_idx_plus_offset = i_idx + (i * self.n_inplane_rots) + if octant == 1: + s2 = s + inplane_rotated_grid2 = inplane_rotated_grid + else: + s2 = self.inplane_rotated_grid2.shape + inplane_rotated_grid2 = np.reshape( + self.inplane_rotated_grid2, (np.prod(s2[0:2]), 3, 3) + ) - for j in unique_pairs_i: - j_idx_plus_offset = j_idx + (j * self.n_inplane_rots) - oct1_ij_map[:, :, idx] = np.column_stack( - (i_idx_plus_offset, j_idx_plus_offset) - ) - idx += 1 + Rijs_est = np.zeros((n_pairs, 4, 3, 3), dtype=self.dtype) - # First the map for i 0] - if len(unique_pairs_i) == 0: - continue - i_idx_plus_offset = i_idx + (i * self.n_inplane_rots) + # Assemble relative rotations Ri^TgRj using linear indices, where g is a group member of D2. + Ris_lin_idx = np.ravel_multi_index((est_idx[0], inplane_i), s[:2]) + Rjs_lin_idx = np.ravel_multi_index((est_idx[1], inplane_j), s2[:2]) + Ris_t = np.transpose(inplane_rotated_grid[Ris_lin_idx], (0, 2, 1)) + Rjs = inplane_rotated_grid2[Rjs_lin_idx] - for j in unique_pairs_i: - j_idx_plus_offset = j_idx + (j * self.n_inplane_rots) - oct2_ij_map[:, :, idx] = np.column_stack( - (i_idx_plus_offset, j_idx_plus_offset) - ) - idx += 1 + for k, g in enumerate(self.gs): + Rijs_est[:, k] = Ris_t @ (g * Rjs) - tmp1 = oct1_ij_map[:, 0, :] - tmp2 = oct1_ij_map[:, 1, :] - self.oct1_ij_map = np.column_stack( - (tmp1.flatten(order="F"), tmp2.flatten(order="F")) - ) + Rijs_est[transpose_idx] = np.transpose(Rijs_est[transpose_idx], (0, 1, 3, 2)) - tmp1 = oct2_ij_map[:, 0, :] - tmp2 = oct2_ij_map[:, 1, :] - self.oct2_ij_map = np.column_stack( - (tmp1.flatten(order="F"), tmp2.flatten(order="F")) - ) + return Rijs_est - ############################# - # Methods for Global J Sync # - ############################# + #################################### + # Perform Global J Synchronization # + #################################### def _global_J_sync(self, Rijs): """ From 887e88234a806adda46f2bdc25e250c33e8e2886 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 14 May 2024 11:51:48 -0400 Subject: [PATCH 340/433] Test for global_J_sync. --- src/aspire/abinitio/commonline_d2.py | 25 +++++------ tests/test_orient_d2.py | 65 +++++++++++++++++++++++++++- 2 files changed, 76 insertions(+), 14 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 4b860b86d7..60e6553954 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -72,6 +72,7 @@ def __init__( self._generate_gs() self.triplets = all_triplets(self.n_img) self.pairs, self.pairs_to_linear = all_pairs(self.n_img, return_map=True) + self.n_pairs = len(self.pairs) def estimate_rotations(self): """ @@ -128,7 +129,7 @@ def _compute_shifted_pf(self): pf *= ( np.sqrt(2) / 2 ) # Magic number to match matlab pf. (root2 over 2) Remove after debug. - pf = pf[:, :, ::-1] # also to match matlab + pf = pf[:, :, ::-1] # also to match matlab. Can remove. self.pf_full = PolarFT.half_to_full(pf) # Pre-compute shifted pf's. @@ -791,8 +792,6 @@ def _J_configuration(self, Rijs): :return: List of n-choose-3 indices in {0,1,2,3} indicating which J-configuration for each triplet of Rijs, i, where the rows and columns of S are indexed by # double indexes (i,j), 1<=i Date: Tue, 14 May 2024 14:24:38 -0400 Subject: [PATCH 341/433] Fix J-sync test logic. --- tests/test_orient_d2.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index f8177ca52f..933ce01091 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -98,7 +98,10 @@ def orient_est(source): def test_estimate_rotations(orient_est): """ This test runs through the complete D2 algorithm and compares the - estimated rotations to the ground truth rotations. + estimated rotations to the ground truth rotations. In particular, + we check that the estimates are close to the ground truth up to + a local rotation by a D2 symmetry group member, a global J-conjugation, + and a globally aligning rotation. """ # Estimate rotations. orient_est.estimate_rotations() @@ -170,7 +173,7 @@ def test_global_J_sync(orient_est): # Perform global J-synchronization and check that # Rijs_sync is equal to either Rijs or J_conjugate(Rijs). Rijs_sync = orient_est._global_J_sync(Rijs_conj) - need_to_conj_Rijs = ~np.allclose(Rijs_sync[inds][0], Rijs[inds][0]) + need_to_conj_Rijs = not np.allclose(Rijs_sync[inds][0], Rijs[inds][0]) if need_to_conj_Rijs: np.testing.assert_allclose(Rijs_sync, J_conjugate(Rijs)) else: From 047febe357a07c19b9a0b9f42595f3d9b9f60ab5 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 17 May 2024 12:06:28 -0400 Subject: [PATCH 342/433] Seed initial vec for scipy eigs. single triplet J-sync test. Color sync test. --- src/aspire/abinitio/commonline_d2.py | 14 ++-- tests/test_orient_d2.py | 98 +++++++++++++++++++++++++++- 2 files changed, 104 insertions(+), 8 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 60e6553954..eebcf0e0a7 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -126,9 +126,7 @@ def _compute_shifted_pf(self): # Reconstruct full polar Fourier for use in correlation. pf[:, :, 0] = 0 # Matching matlab convention to zero out the lowest frequency. pf /= norm(pf, axis=2)[..., np.newaxis] # Normalize each ray. - pf *= ( - np.sqrt(2) / 2 - ) # Magic number to match matlab pf. (root2 over 2) Remove after debug. + pf *= np.sqrt(2) / 2 # Magic number to match matlab pf. Remove after debug. pf = pf[:, :, ::-1] # also to match matlab. Can remove. self.pf_full = PolarFT.half_to_full(pf) @@ -977,7 +975,11 @@ def _sync_colors(self, Rijs): color_mat = la.LinearOperator( (3 * n_pairs,) * 2, lambda v: self._mult_cmat_by_vec(color_perms, v) ) - vals, colors = la.eigs(color_mat, k=3, which="LR") + v0 = randn( + 3 * n_pairs, seed=self.seed + ) # Seed eigs initial vector for iterative method + v0 = v0 / norm(v0) + vals, colors = la.eigs(color_mat, k=3, which="LM", v0=v0) # Changed from "LR" vals = np.real(vals) colors = np.real(colors) colors = np.sign(colors[0]) * colors # Stable eigs @@ -1269,7 +1271,7 @@ def R_theta(theta): else: colors[i] = p_i_sqr colors = colors.flatten() - colors = 2 - colors # For debug. remove + # colors = 2 - colors # For debug. remove return colors, best_unmix ##################### @@ -1283,7 +1285,7 @@ def _sync_signs(self, rr, c_vec): and the matrices Ri are assembled. """ # Partition the union of tuples {0.5*(Ri^TRj+Ri^TgkRj), k=1:3} according - # to the color partition established in color synchroniztion procedure. + # to the color partition established in color synchronization procedure. # The partition is stored in two different arrays each with the purpose # of a computational speed up for two different computations performed # later (space considerations are of little concern since arrays are ~ diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index 933ce01091..079acc8a25 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -3,7 +3,13 @@ from aspire.abinitio import CLSymmetryD2 from aspire.source import Simulation -from aspire.utils import J_conjugate, all_pairs, mean_aligned_angular_distance +from aspire.utils import ( + J_conjugate, + Rotation, + all_pairs, + mean_aligned_angular_distance, + utest_tolerance, +) from aspire.volume import DnSymmetricVolume, DnSymmetryGroup ############## @@ -138,7 +144,9 @@ def test_global_J_sync(orient_est): # J-conjugate a random set of Rijs. Rijs_conj = Rijs.copy() - inds = np.random.choice(orient_est.n_pairs, size=15, replace=False) + inds = np.random.choice( + orient_est.n_pairs, size=orient_est.n_pairs // 2, replace=False + ) Rijs_conj[inds] = J_conjugate(Rijs[inds]) # Create J-configuration conditions for the triplet Rij, Rjk, Rik. @@ -180,6 +188,92 @@ def test_global_J_sync(orient_est): np.testing.assert_allclose(Rijs_sync, Rijs) +@pytest.mark.parametrize("dtype", [np.float32, np.float64]) +def test_global_J_sync_single_triplet(dtype): + """ + This exercises the J-synchronization algorithm using the smallest + possible problem size, a single triplets of relative rotations Rijs. + """ + # Generate 3 image source and orientation object. + src = Simulation(n=3, L=10, dtype=dtype, seed=SEED) + orient_est = CLSymmetryD2(src, n_theta=360, seed=SEED) + + # Grab set of rotations and generate a set of relative rotations, Rijs. + rots = orient_est.src.rotations + Rijs = np.zeros((orient_est.n_pairs, 4, 3, 3), dtype=orient_est.dtype) + for p, (i, j) in enumerate(orient_est.pairs): + for k, g in enumerate(orient_est.gs): + k = (k + p) % 4 # Mix up the ordering of symmetric Rijs + Rijs[p, k] = rots[i].T @ (g * rots[j]) + + # J-conjugate a random Rij. + Rijs_conj = Rijs.copy() + inds = np.random.choice(orient_est.n_pairs, size=1, replace=False) + Rijs_conj[inds] = J_conjugate(Rijs[inds]) + + # Perform global J-synchronization and check that + # Rijs_sync is equal to either Rijs or J_conjugate(Rijs). + Rijs_sync = orient_est._global_J_sync(Rijs_conj) + need_to_conj_Rijs = not np.allclose(Rijs_sync[inds][0], Rijs[inds][0]) + if need_to_conj_Rijs: + np.testing.assert_allclose(Rijs_sync, J_conjugate(Rijs)) + else: + np.testing.assert_allclose(Rijs_sync, Rijs) + + +def test_sync_colors(orient_est): + # Grab set of rotations and generate a set of relative rotations, Rijs. + rots = orient_est.src.rotations + Rijs = np.zeros((orient_est.n_pairs, 4, 3, 3), dtype=orient_est.dtype) + for p, (i, j) in enumerate(orient_est.pairs): + for k, g in enumerate(orient_est.gs): + k = (k + p) % 4 # Mix up the ordering of symmetric Rijs + Rijs[p, k] = rots[i].T @ (g * rots[j]) + + # Perform color synchronization. + colors, Rijs_rows = orient_est._sync_colors(Rijs) + + # Rijs_rows is shape (n_pairs, 3, 3, 3) where Rijs_rows[ij, m] corresponds + # to the outer product vij_m = rots[i, m].T @ rots[j, m] where m is the m'th row + # of the rotations matrices Ri and Rj. `colors` partitions the set of Rijs_rows + # such that the indices of `colors` corresponds to the row index m. + vijs = np.zeros((orient_est.n_pairs, 3, 3, 3), dtype=orient_est.dtype) + for p, (i, j) in enumerate(orient_est.pairs): + for m in range(3): + vijs[p, m] = np.outer(rots[i][m], rots[j][m]) + + # Reshape `colors` to shape (n_pairs, 3) and use to index Rijs_rows into the + # correctly order 3rd row outer products vijs. + colors = colors.reshape(orient_est.n_pairs, 3) + + # `colors` is an arbitrary permutation (but globally consistent), and we know + # that colors[0] should correspond to the ordering [0, 1, 2] due to the construction + # of Rijs[0] using the symmetric rotations g0, g1, g2, g3 in non-permuted order. + # So we sort the columns such that colors[0] = [0,1,2]. + + # Create a mapping array + perm = colors[0] + mapping = np.zeros_like(perm) + mapping[perm] = np.arange(3) + + # Apply this mapping to all rows of the colors array + colors_mapped = mapping[colors] + + # Synchronize Rijs_rows according to the color map. + row_indices = np.arange(orient_est.n_pairs)[:, None] + Rijs_rows_synced = Rijs_rows[row_indices, colors_mapped] + + # Rijs_rows_synced should match the ground truth vijs up to the sign of each row. + # So we multiply by the sign of the first column of the last two axes to sync signs. + vijs = vijs * np.sign(vijs[..., :, 0])[..., np.newaxis] + Rijs_rows_synced = ( + Rijs_rows_synced * np.sign(Rijs_rows_synced[..., :, 0])[..., np.newaxis] + ) + np.testing.assert_allclose( + vijs, Rijs_rows_synced, atol=utest_tolerance(orient_est.dtype) + ) + + #################### # Helper Functions # #################### From f839aa3c39f12140c53ecc3346af9b83da5cc17b Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 17 May 2024 12:10:00 -0400 Subject: [PATCH 343/433] unused import --- tests/test_orient_d2.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index 079acc8a25..c640f7262a 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -5,7 +5,6 @@ from aspire.source import Simulation from aspire.utils import ( J_conjugate, - Rotation, all_pairs, mean_aligned_angular_distance, utest_tolerance, From dd032c29f678a3aeb4ba3a595485369eaadaeea5 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 17 May 2024 15:57:43 -0400 Subject: [PATCH 344/433] test for sign sync. --- tests/test_orient_d2.py | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index c640f7262a..2270ee47a1 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -230,12 +230,13 @@ def test_sync_colors(orient_est): Rijs[p, k] = rots[i].T @ (g * rots[j]) # Perform color synchronization. - colors, Rijs_rows = orient_est._sync_colors(Rijs) - # Rijs_rows is shape (n_pairs, 3, 3, 3) where Rijs_rows[ij, m] corresponds # to the outer product vij_m = rots[i, m].T @ rots[j, m] where m is the m'th row # of the rotations matrices Ri and Rj. `colors` partitions the set of Rijs_rows # such that the indices of `colors` corresponds to the row index m. + colors, Rijs_rows = orient_est._sync_colors(Rijs) + + # Compute ground truth m'th row outer products. vijs = np.zeros((orient_est.n_pairs, 3, 3, 3), dtype=orient_est.dtype) for p, (i, j) in enumerate(orient_est.pairs): for m in range(3): @@ -273,6 +274,37 @@ def test_sync_colors(orient_est): ) +def test_sync_signs(orient_est): + """ + Sign synchronization consumes a set of m'th row outer products along with + a color synchronizing vector and returns a set of rotation matrices + that are the result of synchronizing the signs of the rows of the outer + products and factoring the outer products to form the rows of the rotations. + + In this test we provide a color-synchronized set of m'th row outer products + with a corresponding color vector and test that the output rotations + equivalent to the ground truth rotations up to a global alignment. + """ + rots = orient_est.src.rotations + + # Compute ground truth m'th row outer products. + vijs = np.zeros((orient_est.n_pairs, 3, 3, 3), dtype=orient_est.dtype) + for p, (i, j) in enumerate(orient_est.pairs): + for m in range(3): + vijs[p, m] = np.outer(rots[i][m], rots[j][m]) + + # We will pass in m'th row outer products that are color synchronized, + # ie. colors = [0, 1, 2, 0, 1, 2, ...] + perm = np.array([0, 2, 1]) + colors = np.tile(perm, orient_est.n_pairs) + + # Estimate rotations and check against ground truth. + rots_est = orient_est._sync_signs(vijs, colors) + mean_aligned_angular_distance( + rots, rots_est, degree_tol=utest_tolerance(orient_est.dtype) + ) + + #################### # Helper Functions # #################### From 3f75bb14fb4c4f8e294cc0254ab73bc5dc9bfe0a Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 20 May 2024 09:02:03 -0400 Subject: [PATCH 345/433] adjust angular distance tol. --- tests/test_orient_d2.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index 2270ee47a1..6f0b524ce5 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -300,9 +300,7 @@ def test_sync_signs(orient_est): # Estimate rotations and check against ground truth. rots_est = orient_est._sync_signs(vijs, colors) - mean_aligned_angular_distance( - rots, rots_est, degree_tol=utest_tolerance(orient_est.dtype) - ) + mean_aligned_angular_distance(rots, rots_est, degree_tol=1e-5) #################### From 06ba07638fbf85b828efb30ce5b60b804c805e02 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 20 May 2024 14:35:28 -0400 Subject: [PATCH 346/433] Test self-commonline score. --- src/aspire/abinitio/commonline_d2.py | 1 + tests/test_orient_d2.py | 117 ++++++++++++++++++++------- 2 files changed, 90 insertions(+), 28 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index eebcf0e0a7..f8e8ee57fc 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -669,6 +669,7 @@ def _compute_cl_scores(self): pbar.close() # Get estimated relative viewing directions. + self.corrs_idx = corrs_idx # Used in unit test self.Rijs_est = self._get_Rijs_from_lin_idx(corrs_idx) def _get_Rijs_from_lin_idx(self, lin_idx): diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index 6f0b524ce5..64889db2e7 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -5,6 +5,7 @@ from aspire.source import Simulation from aspire.utils import ( J_conjugate, + Rotation, all_pairs, mean_aligned_angular_distance, utest_tolerance, @@ -27,22 +28,22 @@ SEED = 3 -@pytest.fixture(params=DTYPE, ids=lambda x: f"dtype={x}") +@pytest.fixture(params=DTYPE, ids=lambda x: f"dtype={x}", scope="module") def dtype(request): return request.param -@pytest.fixture(params=RESOLUTION, ids=lambda x: f"resolution={x}") +@pytest.fixture(params=RESOLUTION, ids=lambda x: f"resolution={x}", scope="module") def resolution(request): return request.param -@pytest.fixture(params=N_IMG, ids=lambda x: f"n images={x}") +@pytest.fixture(params=N_IMG, ids=lambda x: f"n images={x}", scope="module") def n_img(request): return request.param -@pytest.fixture(params=OFFSETS, ids=lambda x: f"offsets={x}") +@pytest.fixture(params=OFFSETS, ids=lambda x: f"offsets={x}", scope="module") def offsets(request): return request.param @@ -52,7 +53,7 @@ def offsets(request): ############ -@pytest.fixture +@pytest.fixture(scope="module") def source(n_img, resolution, dtype, offsets): vol = DnSymmetricVolume( L=resolution, order=2, C=1, K=100, dtype=dtype, seed=SEED @@ -70,29 +71,9 @@ def source(n_img, resolution, dtype, offsets): return src -@pytest.fixture +@pytest.fixture(scope="module") def orient_est(source): - # Search for common lines over less shifts for 0 offsets. - max_shift = 0 - shift_step = 1 - if source.offsets.all() != 0: - max_shift = 0.2 - shift_step = 0.1 # Reduce shift steps for non-integer offsets of Simulation. - - orient_est = CLSymmetryD2( - source, - max_shift=max_shift, - shift_step=shift_step, - n_theta=360, - n_rad=source.L, - grid_res=350, # Tuned for speed - inplane_res=15, # Tuned for speed - eq_min_dist=10, # Tuned for speed - epsilon=0.001, - seed=SEED, - ) - - return orient_est + return build_CL_from_source(source) ######### @@ -126,6 +107,63 @@ def test_estimate_rotations(orient_est): mean_aligned_angular_distance(rots_est, rots_gt_sync, degree_tol=deg_tol) +def test_scl_scores(orient_est): + + # Generate lookup data and extract rotations from the candidate `sphere_grid`. + orient_est._generate_lookup_data() + cand_rots = orient_est.inplane_rotated_grid1 + non_eq_idx = int( + np.argwhere(orient_est.eq_class1 == 0)[0] + ) # Take first non equator viewing direction + rots = cand_rots[ + non_eq_idx, :10 + ] # Take the first 10 inplane rots from non_eq viewing direction. + angles = Rotation(rots).angles + + # Create a Simulation using those first 10 candidate rotations. + vol = DnSymmetricVolume( + L=orient_est.src.L, order=2, C=1, K=100, dtype=orient_est.dtype, seed=SEED + ).generate() + + src = Simulation( + n=orient_est.src.n, + L=orient_est.src.L, + vols=vol, + angles=angles, + offsets=orient_est.src.offsets, + amplitudes=1, + seed=SEED, + ) + + # Initialize CL instance with new source. + CL = build_CL_from_source(src) + + # Generate lookup data and compute scl scores. + # Pre-compute phase-shifted polar Fourier. + CL._compute_shifted_pf() + + # Generate lookup data + CL._generate_lookup_data() + CL._generate_scl_lookup_data() + + # Compute self-commonline scores. + CL._compute_scl_scores() + + # CL.scls_scores is shape (n_img, n_cand_rots). Since we used the first + # 10 candidate rotations of the first non-equator viewing direction as our + # Simulation rotations, the maximum correlation for image i should occur at + # candidate rotation index (non_eq_idx * CL.n_inplane_rots + i). + max_corr_idx = np.argmax(CL.scls_scores, axis=1) + gt_idx = CL.n_inplane_rots * non_eq_idx + np.arange(10) + + # Check that self-commonline indices match ground truth. + n_match = np.sum(max_corr_idx == gt_idx) + match_tol = 0.99 # match at least 99%. + if not (src.offsets == 0.0).all(): + match_tol = 0.89 # match at least 89% with offsets. + np.testing.assert_array_less(match_tol, n_match / src.n) + + def test_global_J_sync(orient_est): """ For this test we build a set of relative rotations, Rijs, of shape @@ -295,7 +333,7 @@ def test_sync_signs(orient_est): # We will pass in m'th row outer products that are color synchronized, # ie. colors = [0, 1, 2, 0, 1, 2, ...] - perm = np.array([0, 2, 1]) + perm = np.array([0, 1, 2]) colors = np.tile(perm, orient_est.n_pairs) # Estimate rotations and check against ground truth. @@ -374,3 +412,26 @@ def g_sync_d2(rots, rots_gt): rots_gt_sync[i] = rots_symm[power_g_Ri] @ rot_gt return rots_gt_sync + + +def build_CL_from_source(source): + # Search for common lines over less shifts for 0 offsets. + max_shift = 0 + shift_step = 1 + if source.offsets.all() != 0: + max_shift = 0.2 + shift_step = 0.1 # Reduce shift steps for non-integer offsets of Simulation. + + orient_est = CLSymmetryD2( + source, + max_shift=max_shift, + shift_step=shift_step, + n_theta=360, + n_rad=source.L, + grid_res=350, # Tuned for speed + inplane_res=15, # Tuned for speed + eq_min_dist=10, # Tuned for speed + epsilon=0.001, + seed=SEED, + ) + return orient_est From f4ccf6002cf113b2cf1e78f6d3df86bc1f5ddf9a Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 23 May 2024 13:33:33 -0400 Subject: [PATCH 347/433] Refactor to use n_theta other than 360. --- src/aspire/abinitio/commonline_d2.py | 108 +++++++++++++++------------ tests/test_orient_d2.py | 47 +++++------- 2 files changed, 79 insertions(+), 76 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index f8e8ee57fc..5e6b0c543d 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -297,7 +297,6 @@ def _generate_scl_angles(self, Ris, eq_idx, eq_class): :param eq_idx: Equator index mask for Ris. :param eq_class: Equator classification for Ris. """ - L = 360 # TODO: Maybe this should be self.n_theta # For each candidate rotation Ri we generate the set of 3 self-commonlines. scl_angles = np.zeros((*Ris.shape[:2], 3, 2), dtype=Ris.dtype) @@ -370,13 +369,15 @@ def _generate_scl_angles(self, Ris, eq_idx, eq_class): + scl_angles[eq_class > 0] * ~p[:, :, None, None] ) - # Convert angles from radians to degrees (indices). - scl_angles = np.round(scl_angles * 180 / np.pi) % L - - return scl_angles + # Convert from angles [0,2*pi) to degrees [0, 360). + return np.round(scl_angles * 180 / np.pi) % 360 def _generate_scl_indices(self, scl_angles, eq_class): - L = 360 + L = self.n_theta + + # Convert from angles to indices. + scl_indices, _ = self._generate_commonline_indices(scl_angles) + scl_angles = np.mod(np.round(scl_angles / (2 * np.pi) * L), L).astype(int) # Create candidate common line linear indices lists for equators. # As indicated above for equator candidate, for each self common line we @@ -399,10 +400,15 @@ def _generate_scl_indices(self, scl_angles, eq_class): idx1 = self._circ_seq(scl_angles[i, j, 0, 0], scl_angles[i, j, 1, 0], L) idx2 = self._circ_seq(scl_angles[i, j, 0, 1], scl_angles[i, j, 1, 1], L) + # Ensure idx1 and idx2 have same number of elements. + # Might be off by one due to n_theta discretization. + end = np.minimum(len(idx1), len(idx2)) + idx1, idx2 = idx1[:end], idx2[:end] + # Adjust so idx1 is in [0, 180) range. - geq_180 = idx1 >= 180 - idx1[geq_180] = (idx1[geq_180] - L // 2) % (L // 2) - idx2[geq_180] = (idx2[geq_180] + L // 2) % L + is_geq_than_pi = idx1 >= L // 2 + idx1[is_geq_than_pi] = (idx1[is_geq_than_pi] - L // 2) % (L // 2) + idx2[is_geq_than_pi] = (idx2[is_geq_than_pi] + L // 2) % L # register indices in list. eq_lin_idx_lists[0, count_eq, j] = np.ravel_multi_index( @@ -411,8 +417,6 @@ def _generate_scl_indices(self, scl_angles, eq_class): eq_lin_idx_lists[1, count_eq, j] = idx1 count_eq += 1 - scl_indices, _ = self._generate_commonline_indices(scl_angles) - return scl_indices, eq_lin_idx_lists def _generate_scl_scores_idx_map(self): @@ -543,10 +547,10 @@ def _compute_scl_scores(self): def _all_eq_measures(self, corrs): """ - Compute a measure of how much an image from data is close to be an equator. + Compute a measure of how much an image from data is close to an equator. """ # First compute the eq measure (corrs(scl-k,scl+k) for k=1:90) - # An eqautor image of a D2 molecule has the following property: If t_i is + # An equator image of a D2 molecule has the following property: If t_i is # the angle of one of the rays of the self common line then all the pairs of # rays of the form (t_i-k,t_i+k) for k=1:90 are identical. For each t_i we # average over correlations between the lines (t_i-k,t_i+k) for k=1:90 @@ -554,24 +558,28 @@ def _all_eq_measures(self, corrs): # with angle t_i is a self common line. # (This first loop can be done once outside this function and then pass # idx as an argument). - idx = np.zeros((180, 90, 2)) - idx_1 = np.mod(np.vstack((-np.arange(1, 91), np.arange(1, 91))), 360) + L = self.n_theta + idx = np.zeros((L // 2, L // 4, 2)) + idx_1 = np.mod( + np.vstack((-np.arange(1, L // 4 + 1), np.arange(1, L // 4 + 1))), L + ) idx[0, :, :] = idx_1.T - for k in range(1, 180): - idx[k, :, :] = np.mod(idx_1.T + k, 360) - idx = np.mod(idx, 360) + for k in range(1, L // 2): + idx[k, :, :] = np.mod(idx_1.T + k, L) + idx = np.mod(idx, L) + # Convert to Fourier ray indices. idx_1 = idx[:, :, 0].flatten() idx_2 = idx[:, :, 1].flatten() # Make all Ri coordinates < 180 and compute linear indices for corrrelations - bigger_than_180 = idx_1 >= 180 - idx_1[bigger_than_180] = idx_1[bigger_than_180] - 180 - idx_2[bigger_than_180] = (idx_2[bigger_than_180] + 180) % 360 + is_geq_than_pi = idx_1 >= L // 2 + idx_1[is_geq_than_pi] = idx_1[is_geq_than_pi] - (L // 2) + idx_2[is_geq_than_pi] = (idx_2[is_geq_than_pi] + (L // 2)) % L # Compute correlations. eq_corrs = corrs[idx_1.astype(int), idx_2.astype(int)] - eq_corrs = eq_corrs.reshape(180, 90) + eq_corrs = eq_corrs.reshape(L // 2, L // 4) corrs_mean = np.mean(eq_corrs, axis=1) # Now compute correlations for normals to scls. @@ -581,24 +589,24 @@ def _all_eq_measures(self, corrs): # between one Fourier ray of the normal to a self common line candidate t_i # with its anti-podal as an additional way to measure if the image is an # equator and t_i+0.5*pi is the normal to its self common line. - r = 2 + r = (2 * L) // 360 - normal_2_scl_idx = np.zeros((180, 2 * r + 1)) - normal_2_scl_idx_1 = np.mod(180 - np.arange(90 - r, 90 + r + 1), 360) + normal_2_scl_idx = np.zeros((L // 2, 2 * r + 1)) + normal_2_scl_idx_1 = np.mod(L // 2 - np.arange(L // 4 - r, L // 4 + r + 1), L) normal_2_scl_idx[0, :] = normal_2_scl_idx_1 - for k in range(1, 180): - normal_2_scl_idx[k, :] = np.mod(normal_2_scl_idx_1 + k, 360) + for k in range(1, L // 2): + normal_2_scl_idx[k, :] = np.mod(normal_2_scl_idx_1 + k, L) # Make all Ri coordinates <=180 and compute linear indices for corrrelations - bigger_than_180 = normal_2_scl_idx >= 180 - normal_2_scl_idx[bigger_than_180] = normal_2_scl_idx[bigger_than_180] - 180 + is_geq_than_pi = normal_2_scl_idx >= L // 2 + normal_2_scl_idx[is_geq_than_pi] = normal_2_scl_idx[is_geq_than_pi] - (L // 2) # Compute correlations for normals. normal_2_scl_idx = normal_2_scl_idx.flatten() normal_corrs = corrs[ - normal_2_scl_idx.astype(int), normal_2_scl_idx.astype(int) + 180 + normal_2_scl_idx.astype(int), normal_2_scl_idx.astype(int) + (L // 2) ] - normal_corrs = normal_corrs.reshape(180, 2 * r + 1) + normal_corrs = normal_corrs.reshape(L // 2, 2 * r + 1) normal_corrs_max = np.max(normal_corrs, axis=1) return corrs_mean * normal_corrs_max @@ -612,6 +620,8 @@ def _compute_cl_scores(self): Run common lines Maximum likelihood procedure for a D2 molecule, to find the set of rotations Ri^TgkRj, k=1,2,3,4 for each pair of images i and j. """ + L = self.n_theta + # Map the self common line scores of each 2 candidate rotations R_i,R_j to # the respective relative rotation candidate R_i^TR_j. n_lookup_1 = len(self.scl_idx_1) // 3 @@ -640,15 +650,11 @@ def _compute_cl_scores(self): # Compute maximum correlation over all shifts. corrs = 2 * np.real(pf_i @ np.conj(pf_j).T) - corrs = np.reshape( - corrs, (self.n_shifts, self.n_theta // 2, self.n_theta) - ) + corrs = np.reshape(corrs, (self.n_shifts, L // 2, L)) corrs = np.max(corrs, axis=0) # Take the product over symmetrically induced candidates. Eq. 4.5 in paper. - cl_idx = np.unravel_index( - self.cl_idx, (self.n_theta // 2, self.n_theta) - ) + cl_idx = np.unravel_index(self.cl_idx, (L // 2, L)) prod_corrs = corrs[cl_idx] prod_corrs = prod_corrs.reshape(len(prod_corrs) // 4, 4) @@ -1208,8 +1214,8 @@ def _unmix_colors(self, color_vecs): 2D rotation of these vectors (see Section 7.3 of D2 paper for details). """ n_p = color_vecs.shape[0] // 3 - d_theta = 360 // self.n_theta - max_t = 360 // d_theta + 1 + d_theta = self.n_theta // self.n_theta + max_t = self.n_theta // d_theta + 1 def R_theta(theta): R = np.array( @@ -1592,7 +1598,7 @@ def _circ_seq(n1, n2, L): if n2 < n1: n2 += L if n1 == n2: - return np.array(n1).astype(int) + return np.array([n1]).astype(int) % L seq = np.arange(n1, n2 + 1).astype(int) % L @@ -1806,25 +1812,29 @@ def _generate_commonline_angles( return cl_angles, eq2eq_Rij_table - @staticmethod - def _generate_commonline_indices(cl_angles): + def _generate_commonline_indices(self, cl_angles): + """ + Converts pairs pf commonline angles in [0, 360) first into polar Fourier + indices in [0, self.n_theta), then in commonline linear indices. + """ # TODO: This is not accounting for n_theta other than 360! + L = self.n_theta # Flatten the stack og_shape = cl_angles.shape cl_angles = np.reshape(cl_angles, (np.prod(og_shape[:-1]), 2)) # Fourier ray index - row_sub = np.round(cl_angles[:, 0]).astype("int") % 360 - col_sub = np.round(cl_angles[:, 1]).astype("int") % 360 + row_sub = np.round(cl_angles[:, 0] * L / 360).astype("int") % L + col_sub = np.round(cl_angles[:, 1] * L / 360).astype("int") % L # Restrict Ri in-plane coordinates to <180 degrees. - is_geq_than_pi = row_sub >= 180 - row_sub[is_geq_than_pi] = row_sub[is_geq_than_pi] - 180 - col_sub[is_geq_than_pi] = (col_sub[is_geq_than_pi] + 180) % 360 + is_geq_than_pi = row_sub >= L // 2 + row_sub[is_geq_than_pi] = row_sub[is_geq_than_pi] - L // 2 + col_sub[is_geq_than_pi] = (col_sub[is_geq_than_pi] + (L // 2)) % L - # Convert to linear indices in 360*180 correlation matrix (same as cls_lookup in matlab) - cl_idx = np.ravel_multi_index((row_sub, col_sub), dims=(180, 360)) + # Convert to linear indices in 180x360 correlation matrix. + cl_idx = np.ravel_multi_index((row_sub, col_sub), dims=(L // 2, L)) # Reshape cl_angles (to match matlab `cls`) cl_angles = cl_angles.reshape(og_shape) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index 64889db2e7..1f757dee66 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -108,27 +108,25 @@ def test_estimate_rotations(orient_est): def test_scl_scores(orient_est): - + """ + This test uses a Simulation generated with rotations taken directly + from the D2 algorithm `sphere_grid` of candidate rotations. It is + these candidates which should produce maximum correlation scores since + they match perfectly the Simulation rotations. + """ # Generate lookup data and extract rotations from the candidate `sphere_grid`. + # In this case, we take first 10 candidates from a non-equator viewing direction. orient_est._generate_lookup_data() cand_rots = orient_est.inplane_rotated_grid1 - non_eq_idx = int( - np.argwhere(orient_est.eq_class1 == 0)[0] - ) # Take first non equator viewing direction - rots = cand_rots[ - non_eq_idx, :10 - ] # Take the first 10 inplane rots from non_eq viewing direction. + non_eq_idx = int(np.argwhere(orient_est.eq_class1 == 0)[0]) + rots = cand_rots[non_eq_idx, :10] angles = Rotation(rots).angles # Create a Simulation using those first 10 candidate rotations. - vol = DnSymmetricVolume( - L=orient_est.src.L, order=2, C=1, K=100, dtype=orient_est.dtype, seed=SEED - ).generate() - src = Simulation( n=orient_est.src.n, L=orient_est.src.L, - vols=vol, + vols=orient_est.src.vols, angles=angles, offsets=orient_est.src.offsets, amplitudes=1, @@ -138,11 +136,8 @@ def test_scl_scores(orient_est): # Initialize CL instance with new source. CL = build_CL_from_source(src) - # Generate lookup data and compute scl scores. - # Pre-compute phase-shifted polar Fourier. + # Generate lookup data. CL._compute_shifted_pf() - - # Generate lookup data CL._generate_lookup_data() CL._generate_scl_lookup_data() @@ -154,7 +149,7 @@ def test_scl_scores(orient_est): # Simulation rotations, the maximum correlation for image i should occur at # candidate rotation index (non_eq_idx * CL.n_inplane_rots + i). max_corr_idx = np.argmax(CL.scls_scores, axis=1) - gt_idx = CL.n_inplane_rots * non_eq_idx + np.arange(10) + gt_idx = non_eq_idx * CL.n_inplane_rots + np.arange(10) # Check that self-commonline indices match ground truth. n_match = np.sum(max_corr_idx == gt_idx) @@ -176,7 +171,7 @@ def test_global_J_sync(orient_est): Rijs = np.zeros((orient_est.n_pairs, 4, 3, 3), dtype=orient_est.dtype) for p, (i, j) in enumerate(orient_est.pairs): for k, g in enumerate(orient_est.gs): - k = (k + p) % 4 # Mix up the ordering of symmetric Rijs + k = (k + p) % 4 # Mix up the ordering of Rijs Rijs[p, k] = rots[i].T @ (g * rots[j]) # J-conjugate a random set of Rijs. @@ -240,7 +235,7 @@ def test_global_J_sync_single_triplet(dtype): Rijs = np.zeros((orient_est.n_pairs, 4, 3, 3), dtype=orient_est.dtype) for p, (i, j) in enumerate(orient_est.pairs): for k, g in enumerate(orient_est.gs): - k = (k + p) % 4 # Mix up the ordering of symmetric Rijs + k = (k + p) % 4 # Mix up the ordering of Rijs Rijs[p, k] = rots[i].T @ (g * rots[j]) # J-conjugate a random Rij. @@ -264,7 +259,7 @@ def test_sync_colors(orient_est): Rijs = np.zeros((orient_est.n_pairs, 4, 3, 3), dtype=orient_est.dtype) for p, (i, j) in enumerate(orient_est.pairs): for k, g in enumerate(orient_est.gs): - k = (k + p) % 4 # Mix up the ordering of symmetric Rijs + k = (k + p) % 4 # Mix up the ordering of Rijs Rijs[p, k] = rots[i].T @ (g * rots[j]) # Perform color synchronization. @@ -303,10 +298,8 @@ def test_sync_colors(orient_est): # Rijs_rows_synced should match the ground truth vijs up to the sign of each row. # So we multiply by the sign of the first column of the last two axes to sync signs. - vijs = vijs * np.sign(vijs[..., :, 0])[..., np.newaxis] - Rijs_rows_synced = ( - Rijs_rows_synced * np.sign(Rijs_rows_synced[..., :, 0])[..., np.newaxis] - ) + vijs = vijs * np.sign(vijs[..., 0])[..., None] + Rijs_rows_synced = Rijs_rows_synced * np.sign(Rijs_rows_synced[..., 0])[..., None] np.testing.assert_allclose( vijs, Rijs_rows_synced, atol=utest_tolerance(orient_est.dtype) ) @@ -420,16 +413,16 @@ def build_CL_from_source(source): shift_step = 1 if source.offsets.all() != 0: max_shift = 0.2 - shift_step = 0.1 # Reduce shift steps for non-integer offsets of Simulation. + shift_step = 0.02 # Reduce shift steps for non-integer offsets of Simulation. orient_est = CLSymmetryD2( source, max_shift=max_shift, shift_step=shift_step, - n_theta=360, + n_theta=180, n_rad=source.L, grid_res=350, # Tuned for speed - inplane_res=15, # Tuned for speed + inplane_res=12, # Tuned for speed eq_min_dist=10, # Tuned for speed epsilon=0.001, seed=SEED, From 8314035e511fb99876fb8445191b5d17305bd49e Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 31 May 2024 15:55:03 -0400 Subject: [PATCH 348/433] add documentation. --- src/aspire/abinitio/commonline_d2.py | 236 +++++++++++++++------------ tests/test_orient_d2.py | 4 +- 2 files changed, 138 insertions(+), 102 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 5e6b0c543d..f3537e0edf 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -46,12 +46,15 @@ def __init__( :param max_shift: Maximum range for shifts as a proportion of resolution. Default = 0.15. :param shift_step: Resolution of shift estimation in pixels. Default = 1 pixel. :param grid_res: Number of sampling points on sphere for projetion directions. - These are generated using the Saaf - Kuijlaars algorithm. Default value is 1200. + These are generated using the Saaf-Kuijlaars algorithm. Default value is 1200. :param inplane_res: The sampling resolution of in-plane rotations for each - projetion direction. Default value is 5. + projetion direction. Default value is 5 degrees. :param eq_min_dist: Width of strip around equator projection directions from - which we DO NOT sample directions. Default value is 7. + which we DO NOT sample directions. Default value is 7 degrees. + :param epsilon: Tolerance for J-synchronization power method. :param seed: Optional seed for RNG. + :param mask: Option to mask `src.images` with a fuzzy mask (boolean). + Default, `True`, applies a mask. """ super().__init__( @@ -76,9 +79,8 @@ def __init__( def estimate_rotations(self): """ - Estimate rotation matrices for molecules with D2 symmetry. - - :return: Array of rotation matrices, size n_imgx3x3. + Estimate rotation matrices for molecules with D2 symmetry. Sets the attribute + self.rotations with an array of estimated rotation matrices, size src.nx3x3. """ # Pre-compute phase-shifted polar Fourier. self._compute_shifted_pf() @@ -221,6 +223,82 @@ def _generate_lookup_data(self): self.cl_idx_2, self.cl_angles2 = self._generate_commonline_indices(cl_angles2) self.cl_idx = np.hstack((self.cl_idx_1, self.cl_idx_2)) + def _generate_commonline_angles( + self, + Ris, + Rjs, + Ri_eq_idx, + Rj_eq_idx, + Ri_eq_class, + Rj_eq_class, + triu=True, + ): + """ + Compute commonline angles induced by the 4 sets of relative rotations + Rij = Ri.T @ g_m @ Rj, m = 0,1,2,3, where g_m is the identity and rotations + about the three axes of symmetry of a D2 symmetric molecule. + + :param Ris: First set of candidate rotations. + :param Rjs: Second set of candidate rotation. + :param Ri_eq_idx: Equator index mask. + :param Rj_eq_idx: Equator index mask. + :param Ri_eq_class: Equator classification for Ris. + :param Rj_eq_class: Equator classification for Rjs. + + :return: Commonline angles induced by relative rotation candidates. + """ + n_rots_i = len(Ris) + n_theta = Ris.shape[1] # Same for Rjs, TODO: Don't call this n_theta + + # Generate upper triangular table of indicators of all pairs which are not + # equators with respect to the same symmetry axis (named unique_pairs). + eq_table = np.outer(Ri_eq_idx, Rj_eq_idx) + in_same_class = (Ri_eq_class[:, None] - Rj_eq_class.T[None]) == 0 + eq2eq_Rij_table = ~(eq_table * in_same_class) + + # This is to match matlab code that uses triu with octant 1 table, but not + # with octants 1 and 2. + if triu: + eq2eq_Rij_table = np.triu(eq2eq_Rij_table, 1) + + n_pairs = np.sum(eq2eq_Rij_table) + idx = 0 + cl_angles = np.zeros((2 * n_pairs, n_theta, n_theta // 2, 4, 2)) + + for i in range(n_rots_i): + unique_pairs_i = np.where(eq2eq_Rij_table[i])[0] + if len(unique_pairs_i) == 0: + continue + Ri = Ris[i] + for j in unique_pairs_i: + Rj = Rjs[j, : n_theta // 2] + for k, g in enumerate(self.gs): + # Compute relative rotations candidates Rij = Ri.T @ gs @ Rj + g_Rj = g * Rj + Rijs = np.transpose(g_Rj, axes=(0, 2, 1)) @ Ri[:, None] + + # Common line indices induced by Rijs + cl_angles[idx, :, :, k, 0] = np.arctan2( + Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1] + ) + cl_angles[idx, :, :, k, 1] = np.arctan2( + -Rijs[:, :, 0, 2], Rijs[:, :, 1, 2] + ) + cl_angles[idx + n_pairs, :, :, k, 0] = np.arctan2( + Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] + ) + cl_angles[idx + n_pairs, :, :, k, 1] = np.arctan2( + -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] + ) + + idx += 1 + + # Make all angles non-negative and convert to degrees. + cl_angles = (cl_angles + 2 * np.pi) % (2 * np.pi) + cl_angles = cl_angles * 180 / np.pi + + return cl_angles, eq2eq_Rij_table + ######################################## # Generate Self-Commonline Lookup Data # ######################################## @@ -291,11 +369,14 @@ def _generate_scl_lookup_data(self): def _generate_scl_angles(self, Ris, eq_idx, eq_class): """ - Generate self-commonline angles. + Generate self-commonline angles. For each candidate rotation a pair of self-commonline + angles are generated for each of the 3 self-commonlines induced by D2 symmetry. :param Ris: Candidate rotation matrices, (n_sphere_grid, n_inplane_rots, 3, 3). :param eq_idx: Equator index mask for Ris. :param eq_class: Equator classification for Ris. + + :return: `scl_angles` of shape (n_sphere_grid, n_inplane_rots, 3, 2). """ # For each candidate rotation Ri we generate the set of 3 self-commonlines. @@ -351,8 +432,7 @@ def _generate_scl_angles(self, Ris, eq_idx, eq_class): # indices 1 and 2, but flip one common line to antipodal. scl_angles[eq_class == 3, :, 0] = scl_angles[eq_class == 3][:, :, 0, [1, 0]] - # TODO: Maybe a cleaner way to do this. - # Make sure angle range is <= 180 degrees. + # Make sure angle range is < 180 degrees. # p1 marks "equator" self-commonlines where both entries of the first # scl are greater than both entries of the second scl. p1 = scl_angles[eq_class > 0, :, 0] > scl_angles[eq_class > 0, :, 1] @@ -373,6 +453,20 @@ def _generate_scl_angles(self, Ris, eq_idx, eq_class): return np.round(scl_angles * 180 / np.pi) % 360 def _generate_scl_indices(self, scl_angles, eq_class): + """ + Generate self-commonline indices. This includes a set of linear indices for + all candidate rotations as well as lists of self-commonline index ranges for + equator candidates. + + :param scl_angles: Self-commonline angles, shape (n_sphere_grid, n_inplane_rots, 3, 2). + :param eq_class: Equator classification for the sphere_grid points represented + by the first axis of `scl_angles`. + + :returns: + - scl_indices, self-commonline linear indices. + - eq_lin_idx_lists, a list containing a range of self-commonline + indices for each equator candidate. + """ L = self.n_theta # Convert from angles to indices. @@ -388,9 +482,9 @@ def _generate_scl_indices(self, scl_angles, eq_class): n_inplane_rots = scl_angles.shape[1] count_eq = 0 - # eq_lin_idx_lists[1,i,j] registers a list of linear indices of the j'th + # eq_lin_idx_lists[0,i,j] registers a list of linear indices of the j'th # in-plane rotation of the range for the (only) self common line of the i'th - # candidate. eq_lin_idx_lists[2,i,j] registers the actual (integer) angle + # candidate. eq_lin_idx_lists[1,i,j] registers the actual (integer) angle # of the self common line in the 2D Fourier space. Note that we need only # one number since each self common line has radial coordinates of the form # (theta, theta+180). @@ -420,6 +514,10 @@ def _generate_scl_indices(self, scl_angles, eq_class): return scl_indices, eq_lin_idx_lists def _generate_scl_scores_idx_map(self): + """ + Generates lookup tables for maximum likelihood scheme to estimate commonlines + between images. + """ n_rot_1 = len(self.scl_idx_1) // (3 * self.n_inplane_rots) n_rot_2 = len(self.scl_idx_2) // (3 * self.n_inplane_rots) @@ -446,7 +544,7 @@ def _generate_scl_scores_idx_map(self): ) idx += 1 - # First the map for i, where the rows and columns of S are indexed by # double indexes (i,j), 1<=i Date: Mon, 3 Jun 2024 15:46:17 -0400 Subject: [PATCH 349/433] Self-review: Use DnSymmetryGroup for gs, Remove matlab pf convention, Update docstrings, other cleanup. --- src/aspire/abinitio/commonline_d2.py | 76 ++++++++++++---------------- tests/test_orient_d2.py | 15 +++--- 2 files changed, 37 insertions(+), 54 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index f3537e0edf..30b6e865ab 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -8,6 +8,7 @@ from aspire.operators import PolarFT from aspire.utils import J_conjugate, Rotation, all_pairs, all_triplets, tqdm, trange from aspire.utils.random import randn +from aspire.volume import DnSymmetryGroup logger = logging.getLogger(__name__) @@ -72,11 +73,15 @@ def __init__( self.eq_min_dist = eq_min_dist self.seed = seed self.epsilon = epsilon - self._generate_gs() + self.triplets = all_triplets(self.n_img) self.pairs, self.pairs_to_linear = all_pairs(self.n_img, return_map=True) self.n_pairs = len(self.pairs) + # D2 symmetry group. + # Rearrange in order Identity, about_x, about_y, about_z. + self.gs = DnSymmetryGroup(order=2, dtype=self.dtype).matrices[[0, 3, 2, 1]] + def estimate_rotations(self): """ Estimate rotation matrices for molecules with D2 symmetry. Sets the attribute @@ -128,8 +133,6 @@ def _compute_shifted_pf(self): # Reconstruct full polar Fourier for use in correlation. pf[:, :, 0] = 0 # Matching matlab convention to zero out the lowest frequency. pf /= norm(pf, axis=2)[..., np.newaxis] # Normalize each ray. - pf *= np.sqrt(2) / 2 # Magic number to match matlab pf. Remove after debug. - pf = pf[:, :, ::-1] # also to match matlab. Can remove. self.pf_full = PolarFT.half_to_full(pf) # Pre-compute shifted pf's. @@ -163,7 +166,7 @@ def _generate_lookup_data(self): # some symmetry axis only have 2 common lines instead of 4, and must be # treated separately. # We detect such directions by taking a strip of radius - # eq_filter_angle about the 3 great circles perpendicular to the symmetry + # `eq_min_dist` about the 3 great circles perpendicular to the symmetry # axes of D2 (i.e to X,Y and Z axes). eq_idx1, eq_class1 = self._mark_equators(sphere_grid1, self.eq_min_dist) eq_idx2, eq_class2 = self._mark_equators(sphere_grid2, self.eq_min_dist) @@ -215,7 +218,7 @@ def _generate_lookup_data(self): self.eq_idx2, self.eq_class1, self.eq_class2, - triu=False, + same_octant=False, ) # Generate commonline indices. @@ -231,7 +234,7 @@ def _generate_commonline_angles( Rj_eq_idx, Ri_eq_class, Rj_eq_class, - triu=True, + same_octant=True, ): """ Compute commonline angles induced by the 4 sets of relative rotations @@ -244,6 +247,7 @@ def _generate_commonline_angles( :param Rj_eq_idx: Equator index mask. :param Ri_eq_class: Equator classification for Ris. :param Rj_eq_class: Equator classification for Rjs. + :param same_octant: True if both sets of candidates are in the same octant. :return: Commonline angles induced by relative rotation candidates. """ @@ -256,9 +260,8 @@ def _generate_commonline_angles( in_same_class = (Ri_eq_class[:, None] - Rj_eq_class.T[None]) == 0 eq2eq_Rij_table = ~(eq_table * in_same_class) - # This is to match matlab code that uses triu with octant 1 table, but not - # with octants 1 and 2. - if triu: + # For candidates in the same octant only need upper triangle of table. + if same_octant: eq2eq_Rij_table = np.triu(eq2eq_Rij_table, 1) n_pairs = np.sum(eq2eq_Rij_table) @@ -274,7 +277,7 @@ def _generate_commonline_angles( Rj = Rjs[j, : n_theta // 2] for k, g in enumerate(self.gs): # Compute relative rotations candidates Rij = Ri.T @ gs @ Rj - g_Rj = g * Rj + g_Rj = g @ Rj Rijs = np.transpose(g_Rj, axes=(0, 2, 1)) @ Ri[:, None] # Common line indices induced by Rijs @@ -339,7 +342,7 @@ def _generate_scl_lookup_data(self): # non equators then we have the sub list is # C_(i_1)1,...,C(i_1)r,...C_(i_p)1,...,C_(i_p)r. n_non_eq = np.sum(self.eq_class1 == 0) + np.sum(self.eq_class2 == 0) - non_eq_idx = np.zeros((n_non_eq, int(self.n_inplane_rots))) + non_eq_idx = np.zeros((n_non_eq, self.n_inplane_rots), dtype=int) non_eq_idx[:, 0] = ( np.hstack( ( @@ -352,18 +355,16 @@ def _generate_scl_lookup_data(self): for i in range(1, self.n_inplane_rots): non_eq_idx[:, i] = non_eq_idx[:, 0] + i - self.non_eq_idx = non_eq_idx.astype(int) + self.non_eq_idx = non_eq_idx # Non-topview equator indices. - non_tv_eq_idx = np.concatenate( + self.non_tv_eq_idx = np.concatenate( ( np.where(self.eq_class1 > 0)[0], len(self.eq_class1) + np.where(self.eq_class2 > 0)[0], ) ) - self.non_tv_eq_idx = non_tv_eq_idx.astype(int) - # Generate maps from scl indices to relative rotations. self._generate_scl_scores_idx_map() @@ -384,9 +385,8 @@ def _generate_scl_angles(self, Ris, eq_idx, eq_class): n_rots = len(Ris) for i in range(n_rots): Ri = Ris[i] - # TODO: Reversing self.gs here to match matlab. Should use as is. - for k, g in enumerate(self.gs[::-1][:3]): - g_Ri = g * Ri + for k, g in enumerate(self.gs[1:]): + g_Ri = g @ Ri Riis = np.transpose(Ri, axes=(0, 2, 1)) @ g_Ri scl_angles[i, :, k, 0] = np.arctan2(Riis[:, 2, 0], -Riis[:, 2, 1]) @@ -398,7 +398,7 @@ def _generate_scl_angles(self, Ris, eq_idx, eq_class): # Deal with non top view equators # A non-TV equator has only one self common line. However, we clasify an # equator as an image whose projection direction is at radial distance < - # eq_filter_angle from the great circle perpendicural to a symmetry axis, + # `eq_min_dist` from the great circle perpendicural to a symmetry axis, # and not strictly zero distance. Thus in most cases we get 2 common lines # differing by a small difference in degrees. Actually the calculation above # gives us two NEARLY antipodal lines, so we first flip one of them by @@ -608,7 +608,7 @@ def _compute_scl_scores(self): pf_i_shifted = self.pf_shifted[i] # Compute max correlation over all shifts. - corrs = 2 * np.real(pf_i_shifted @ np.conj(pf_full_i).T) + corrs = np.real(pf_i_shifted @ np.conj(pf_full_i).T) corrs = np.reshape(corrs, (self.n_shifts, n_theta // 2, n_theta)) corrs = np.max(corrs, axis=0) @@ -691,7 +691,7 @@ def _all_eq_measures(self, corrs): # between one Fourier ray of the normal to a self common line candidate t_i # with its anti-podal as an additional way to measure if the image is an # equator and t_i+0.5*pi is the normal to its self common line. - r = (2 * L) // 360 + r = 2 # Search radius within 2 adjacent rays of normal ray. normal_2_scl_idx = np.zeros((L // 2, 2 * r + 1)) normal_2_scl_idx_1 = np.mod(L // 2 - np.arange(L // 4 - r, L // 4 + r + 1), L) @@ -751,7 +751,7 @@ def _compute_cl_scores(self): pf_j = self.pf_full[j] # Compute maximum correlation over all shifts. - corrs = 2 * np.real(pf_i @ np.conj(pf_j).T) + corrs = np.real(pf_i @ np.conj(pf_j).T) corrs = np.reshape(corrs, (self.n_shifts, L // 2, L)) corrs = np.max(corrs, axis=0) @@ -855,7 +855,7 @@ def _get_Rijs_from_oct(self, lin_idx, octant=1): Rjs = inplane_rotated_grid2[Rjs_lin_idx] for k, g in enumerate(self.gs): - Rijs_est[:, k] = Ris_t @ (g * Rjs) + Rijs_est[:, k] = Ris_t @ g @ Rjs Rijs_est[transpose_idx] = np.transpose(Rijs_est[transpose_idx], (0, 1, 3, 2)) @@ -867,13 +867,12 @@ def _get_Rijs_from_oct(self, lin_idx, octant=1): def _global_J_sync(self, Rijs): """ - Global J-synchronization of all third row outer products. Given 3x3 matrices Rijs and viis, each - of which might contain a spurious J (ie. vij = J*vi*vj^T*J instead of vij = vi*vj^T), - we return Rijs and viis that all have either a spurious J or not. + Global J-synchronization of all third row outer products. Given n_pairsx4x3x3 matrices Rijs, each + of which might contain a spurious J (ie. Rij = J @ Ri.T @ gs @ Rj @ J instead of Rij = Ri.T @ gs @ Rj), + we return Rijs that all have either a spurious J or not. :param Rijs: An (n-choose-2)x4 x3x3 array where each 3x3 slice holds an estimate for the corresponding - outer-product vi*vj^T between the third rows of the rotation matrices Ri and Rj. Each estimate - might have a spurious J independently of other estimates. + outer-product Ri.T @ Rj. Each estimate might have a spurious J independently of other estimates. :return: Rijs, all of which have a spurious J or not. """ @@ -1008,16 +1007,16 @@ def _signs_times_v2(self, J_list, vec): The J-synchronization matrix is a matrix representation of the handedness graph, Gamma, whose set of nodes consists of the estimates Rijs and whose set of edges consists of the undirected edges between - all triplets of estimates vij, vjk, and vik, where i Date: Wed, 5 Jun 2024 14:55:21 -0400 Subject: [PATCH 350/433] Add logging to main functions. --- src/aspire/abinitio/commonline_d2.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 30b6e865ab..167ec07912 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -120,6 +120,7 @@ def _compute_shifted_pf(self): """ Pre-compute shifted and full polar Fourier transforms. """ + logger.info("Preparing polar Fourier transform.") pf = self.pf # Generate shift phases. @@ -149,6 +150,7 @@ def _generate_lookup_data(self): """ Generate candidate relative rotations and corresponding common line indices. """ + logger.info("Generating commonline lookup data.") # Generate uniform grid on sphere with Saff-Kuijlaars and take one quarter # of sphere because of D2 symmetry redundancy. sphere_grid = self._saff_kuijlaars(self.grid_res) @@ -310,6 +312,7 @@ def _generate_scl_lookup_data(self): """ Generate lookup data for self-commonlines. """ + logger.info("Generating self-commonline lookup data.") # Get self-commonline angles. self.scl_angles1 = self._generate_scl_angles( self.inplane_rotated_grid1, @@ -585,6 +588,7 @@ def _compute_scl_scores(self): """ Compute correlations for self-commonline candidates. """ + logger.info("Computing self-commonline correlation scores.") n_img = self.n_img n_theta = self.n_theta n_eq = len(self.non_tv_eq_idx) @@ -722,6 +726,7 @@ def _compute_cl_scores(self): Run common lines Maximum likelihood procedure for a D2 molecule, to find the set of rotations Ri^TgkRj, k=1,2,3,4 for each pair of images i and j. """ + logger.info("Computing commonline correlation scores.") L = self.n_theta # Map the self common line scores of each 2 candidate rotations R_i,R_j to @@ -876,6 +881,7 @@ def _global_J_sync(self, Rijs): :return: Rijs, all of which have a spurious J or not. """ + logger.info("Performing global handedness synchronization.") # Find best J_configuration. J_list = self._J_configuration(Rijs) @@ -1068,6 +1074,7 @@ def _sync_colors(self, Rijs): The color sync procedure partitions the set of 3-tuples of m'th row outer products into 3 sets of row-consistent outer products up to the sign of each. """ + logger.info("Performing rotations' rows synchronization.") # Generate array of one rank matrices from which we can extract rows. # Matrices are of the form 0.5(Ri^TRj+Ri^TgkRj). Each such matrix can be # written in the form Qi^T*Ik*Qj where Ik is a 3x3 matrix with all zero @@ -1404,6 +1411,7 @@ def _sync_signs(self, rr, c_vec): synchroniztion. At the end all rows of the rotations Ri are exctracted and the matrices Ri are assembled. """ + logger.info("Performing signs synchronization.") # Partition the union of tuples {0.5*(Ri^TRj+Ri^TgkRj), k=1:3} according # to the color partition established in color synchronization procedure. # The partition is stored in two different arrays each with the purpose @@ -1582,7 +1590,7 @@ def _sync_signs(self, rr, c_vec): signs = np.zeros((3, self.n_pairs), dtype=self.dtype) s_out = np.zeros((3, 3), dtype=self.dtype) - logger.info("Constructing and decomposing 3 sign synchroniztion matrices...") + logger.info("Constructing and decomposing 3 sign synchroniztion matrices.") # The matrix S requires space on order of O(N^4). Instead of storing it # in memory we compute its SVD using the function smat which multiplies # (N over 2)x1 vectors by S. @@ -1618,7 +1626,7 @@ def _sync_signs(self, rr, c_vec): # Adjust the signs of Qij^c in the matrices cMat(:,:,c) for all c=1,2,3 # and 1<=i Date: Mon, 10 Jun 2024 08:46:24 -0400 Subject: [PATCH 351/433] remove unnecesary mod --- src/aspire/abinitio/commonline_d2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 167ec07912..fced6a30fa 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -504,7 +504,7 @@ def _generate_scl_indices(self, scl_angles, eq_class): # Adjust so idx1 is in [0, 180) range. is_geq_than_pi = idx1 >= L // 2 - idx1[is_geq_than_pi] = (idx1[is_geq_than_pi] - L // 2) % (L // 2) + idx1[is_geq_than_pi] = (idx1[is_geq_than_pi] - L // 2) idx2[is_geq_than_pi] = (idx2[is_geq_than_pi] + L // 2) % L # register indices in list. From 690a56b28bfc0538c1a770020ee94c2843564468 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 10 Jun 2024 08:54:17 -0400 Subject: [PATCH 352/433] Revert eigs to use largest real. black. --- src/aspire/abinitio/commonline_d2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index fced6a30fa..dd27d5ff61 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -504,7 +504,7 @@ def _generate_scl_indices(self, scl_angles, eq_class): # Adjust so idx1 is in [0, 180) range. is_geq_than_pi = idx1 >= L // 2 - idx1[is_geq_than_pi] = (idx1[is_geq_than_pi] - L // 2) + idx1[is_geq_than_pi] = idx1[is_geq_than_pi] - L // 2 idx2[is_geq_than_pi] = (idx2[is_geq_than_pi] + L // 2) % L # register indices in list. @@ -1106,7 +1106,7 @@ def _sync_colors(self, Rijs): 3 * n_pairs, seed=self.seed ) # Seed eigs initial vector for iterative method v0 = v0 / norm(v0) - vals, colors = la.eigs(color_mat, k=3, which="LM", v0=v0) # Changed from "LR" + vals, colors = la.eigs(color_mat, k=3, which="LR", v0=v0) vals = np.real(vals) colors = np.real(colors) colors = np.sign(colors[0]) * colors # Stable eigs From d95f328155723395fb6d4907af98c377005f7bf2 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 10 Jun 2024 15:44:19 -0400 Subject: [PATCH 353/433] Add dtype pass-through checks to tests. --- tests/test_orient_d2.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index 6c50df17e9..6e8f2741ee 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -103,6 +103,9 @@ def test_estimate_rotations(orient_est): # distance between them is less than 5 degrees. mean_aligned_angular_distance(rots_est, rots_gt_sync, degree_tol=5) + # Check dtype pass-through. + assert rots_est.dtype == orient_est.dtype + def test_scl_scores(orient_est): """ @@ -155,6 +158,9 @@ def test_scl_scores(orient_est): match_tol = 0.89 # match at least 89% with offsets. np.testing.assert_array_less(match_tol, n_match / src.n) + # Check dtype pass-through. + assert CL.scls_scores.dtype == orient_est.dtype + def test_global_J_sync(orient_est): """ @@ -216,6 +222,9 @@ def test_global_J_sync(orient_est): else: np.testing.assert_allclose(Rijs_sync, Rijs) + # Check dtype pass-through. + assert Rijs_sync.dtype == orient_est.dtype + @pytest.mark.parametrize("dtype", [np.float32, np.float64]) def test_global_J_sync_single_triplet(dtype): @@ -301,6 +310,9 @@ def test_sync_colors(orient_est): vijs, Rijs_rows_synced, atol=utest_tolerance(orient_est.dtype) ) + # Check dtype pass-through. + assert Rijs_rows.dtype == orient_est.dtype + def test_sync_signs(orient_est): """ @@ -330,6 +342,9 @@ def test_sync_signs(orient_est): rots_est = orient_est._sync_signs(vijs, colors) mean_aligned_angular_distance(rots, rots_est, degree_tol=1e-5) + # Check dtype pass-through. + assert rots_est.dtype == orient_est.dtype + #################### # Helper Functions # From 59e7072fbfe48cd10f0058f5adc5a5acd51c9aab Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 17 Jun 2024 08:55:21 -0400 Subject: [PATCH 354/433] remove einsum for Garrett --- src/aspire/abinitio/commonline_d2.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index dd27d5ff61..5df3e24f83 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -945,7 +945,9 @@ def _compare_rots(self, Rij, Rjk_t, Rik): corresponding to best configuration for the provided triplet of relative rotations. """ - prod_arr = np.einsum("nij,mjk->nmik", Rik, Rjk_t) + # We compute the four sets of 4^3 norms |Rik @ Rjk.T - Rij| + # See equation (6.11) in publication. + prod_arr = Rik[:, None, :, :] @ Rjk_t[None, :, :, :] arr = np.zeros((8, 8, 3, 3), dtype=self.dtype) arr[0:4, 0:4] = prod_arr - Rij[0] From 6bdbb77a5f993b520d063d6706df1d4ce8c34ab0 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 17 Jun 2024 09:41:26 -0400 Subject: [PATCH 355/433] Remove more einsums. --- src/aspire/abinitio/commonline_d2.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 5df3e24f83..69798fd145 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -18,7 +18,7 @@ class CLSymmetryD2(CLOrient3D): Define a class to estimate 3D orientations using common lines methods for molecules with D2 (dihedral) symmetry. - The related publications are: + Corresponding publication: E. Rosen and Y. Shkolnisky, Common lines ab-initio reconstruction of D2-symmetric molecules, SIAM Journal on Imaging Sciences, volume 13-4, p. 1898-1994, 2020 @@ -94,7 +94,7 @@ def estimate_rotations(self): self._generate_lookup_data() self._generate_scl_lookup_data() - # Compute common-line scores. + # Compute self common-line scores. self._compute_scl_scores() # Compute common-lines and estimate relative rotations Rijs. @@ -947,7 +947,7 @@ def _compare_rots(self, Rij, Rjk_t, Rik): """ # We compute the four sets of 4^3 norms |Rik @ Rjk.T - Rij| # See equation (6.11) in publication. - prod_arr = Rik[:, None, :, :] @ Rjk_t[None, :, :, :] + prod_arr = Rik[:, None] @ Rjk_t[None] arr = np.zeros((8, 8, 3, 3), dtype=self.dtype) arr[0:4, 0:4] = prod_arr - Rij[0] @@ -1147,11 +1147,9 @@ def _match_colors(self, Rijs_rows): ik = self.pairs_to_linear[i, k] # For r=1:3 compute 3*3 products v_{ji}(r)v_{ik}v_{kj} - prod_arr = np.einsum("nij,mjk->mnik", Rijs_rows[ik], Rijs_rows_t[jk]) + prod_arr = Rijs_rows[ik, None] @ Rijs_rows_t[jk, :, None] prod_arr_tmp = prod_arr.copy() - prod_arr = np.einsum( - "nij,mjk->nmik", Rijs_rows_t[ij], prod_arr.reshape((9, 3, 3)) - ) + prod_arr = Rijs_rows_t[ij, :, None] @ prod_arr_tmp.reshape((9, 3, 3))[None] prod_arr = np.transpose( prod_arr.reshape((3, 3, 3, 9), order="F"), (2, 1, 0, 3) ) @@ -1191,13 +1189,10 @@ def _match_colors(self, Rijs_rows): # For r=1:3 compute 3*3 products v_{ij}(r)v_{jk}v_{ki} and compare to # Compare to v_{ii}(r)=v_{ij}v_{ji} prod_arr = np.transpose(prod_arr_tmp, (0, 1, 3, 2)) - prod_arr = np.einsum( - "nij,mjk->mnik", Rijs_rows[ij], prod_arr.reshape(9, 3, 3) - ) + prod_arr = Rijs_rows[ij, :, None] @ prod_arr.reshape((9, 3, 3))[None] prod_arr = np.transpose( prod_arr.reshape((3, 3, 3, 9), order="F"), (1, 0, 2, 3) ) - # Commented out calculations in matlab here. # Compare to v_{ii}(r)=v_{ik}v_{ki}. self_prods = Rijs_rows[ik] @ Rijs_rows_t[ik] From c2993c9d6752898fb3afbe27abfd3258225aa69c Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 17 Jun 2024 10:35:01 -0400 Subject: [PATCH 356/433] line wrap docstrings --- src/aspire/abinitio/commonline_d2.py | 47 +++++++++++++++------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 69798fd145..8ccc0fe81c 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -872,12 +872,14 @@ def _get_Rijs_from_oct(self, lin_idx, octant=1): def _global_J_sync(self, Rijs): """ - Global J-synchronization of all third row outer products. Given n_pairsx4x3x3 matrices Rijs, each - of which might contain a spurious J (ie. Rij = J @ Ri.T @ gs @ Rj @ J instead of Rij = Ri.T @ gs @ Rj), - we return Rijs that all have either a spurious J or not. + Global J-synchronization of all third row outer products. Given n_pairsx4x3x3 + matrices Rijs, each of which might contain a spurious J, ie. + Rij = J @ Ri.T @ gs @ Rj @ J instead of Rij = Ri.T @ gs @ Rj, we return Rijs + that all have either a spurious J or not. - :param Rijs: An (n-choose-2)x4 x3x3 array where each 3x3 slice holds an estimate for the corresponding - outer-product Ri.T @ Rj. Each estimate might have a spurious J independently of other estimates. + :param Rijs: An (n-choose-2)x4 x3x3 array where each 3x3 slice holds an estimate + for the corresponding outer-product Ri.T @ Rj. Each estimate might have a + spurious J independently of other estimates. :return: Rijs, all of which have a spurious J or not. """ @@ -1013,27 +1015,30 @@ def _signs_times_v2(self, J_list, vec): """ Multiplication of the J-synchronization matrix by a candidate eigenvector. - The J-synchronization matrix is a matrix representation of the handedness graph, Gamma, whose set of - nodes consists of the estimates Rijs and whose set of edges consists of the undirected edges between - all triplets of estimates Rij, Rjk, and Rik, where i Date: Mon, 17 Jun 2024 14:22:57 -0400 Subject: [PATCH 357/433] remove debug comment. --- src/aspire/abinitio/commonline_d2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 8ccc0fe81c..b41bf2a1c6 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1400,7 +1400,7 @@ def R_theta(theta): else: colors[i] = p_i_sqr colors = colors.flatten() - # colors = 2 - colors # For debug. remove + return colors, best_unmix ##################### From 9ec4fc37c80efd3890f9cd9b373a148425d0197b Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 22 Jul 2024 11:03:34 -0400 Subject: [PATCH 358/433] remove CAPS --- src/aspire/abinitio/commonline_d2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index b41bf2a1c6..e1791ba847 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -51,7 +51,7 @@ def __init__( :param inplane_res: The sampling resolution of in-plane rotations for each projetion direction. Default value is 5 degrees. :param eq_min_dist: Width of strip around equator projection directions from - which we DO NOT sample directions. Default value is 7 degrees. + which we do not sample directions. Default value is 7 degrees. :param epsilon: Tolerance for J-synchronization power method. :param seed: Optional seed for RNG. :param mask: Option to mask `src.images` with a fuzzy mask (boolean). From 990ed2f91bfb49128acd4ad549739e19aefb3888 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 22 Jul 2024 11:11:54 -0400 Subject: [PATCH 359/433] reshape pf.shifted --- src/aspire/abinitio/commonline_d2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index e1791ba847..b3b45500b0 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -137,7 +137,7 @@ def _compute_shifted_pf(self): self.pf_full = PolarFT.half_to_full(pf) # Pre-compute shifted pf's. - pf_shifted = (pf * shift_phases[:, None, None]).swapaxes(0, 1) + pf_shifted = pf[:, None] * shift_phases[None, :, None] self.pf_shifted = pf_shifted.reshape( (self.n_img, self.n_shifts * (self.n_theta // 2), r_max) ) From cdee9fd0cfbbd924aa26e8958152275339db9fe1 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 22 Jul 2024 11:36:01 -0400 Subject: [PATCH 360/433] use count_nonzero instead of sum --- src/aspire/abinitio/commonline_d2.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index b3b45500b0..dcc6536972 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -266,7 +266,7 @@ def _generate_commonline_angles( if same_octant: eq2eq_Rij_table = np.triu(eq2eq_Rij_table, 1) - n_pairs = np.sum(eq2eq_Rij_table) + n_pairs = np.count_nonzero(eq2eq_Rij_table) idx = 0 cl_angles = np.zeros((2 * n_pairs, n_theta, n_theta // 2, 4, 2)) @@ -344,7 +344,9 @@ def _generate_scl_lookup_data(self): # create a sub-list of only non equator candidates, i.e., if i_1,...,i_p are # non equators then we have the sub list is # C_(i_1)1,...,C(i_1)r,...C_(i_p)1,...,C_(i_p)r. - n_non_eq = np.sum(self.eq_class1 == 0) + np.sum(self.eq_class2 == 0) + n_non_eq = np.count_nonzero(self.eq_class1 == 0) + np.count_nonzero( + self.eq_class2 == 0 + ) non_eq_idx = np.zeros((n_non_eq, self.n_inplane_rots), dtype=int) non_eq_idx[:, 0] = ( np.hstack( @@ -525,7 +527,7 @@ def _generate_scl_scores_idx_map(self): n_rot_2 = len(self.scl_idx_2) // (3 * self.n_inplane_rots) # First the map for i 0: Rijs_est[oct1_idx] = self._get_Rijs_from_oct(lin_idx[oct1_idx], octant=1) if n_est_in_oct1 <= len(lin_idx): @@ -818,7 +820,7 @@ def _get_Rijs_from_oct(self, lin_idx, octant=1): unique_pairs = self.eq2eq_Rij_table_12 n_theta = self.n_inplane_rots - n_lookup_pairs = np.sum(unique_pairs, dtype=np.int64) + n_lookup_pairs = np.count_nonzero(unique_pairs) n_rots = len(self.sphere_grid1) if octant == 1: n_rots2 = n_rots @@ -1687,7 +1689,7 @@ def _calc_Rij_prods(self, c_mat_5d, i, j, c): # In case we get a zero score arbitrarily choose sign +1. ij_signs = np.sum(Rij, axis=(-2, -1)) zeros_idx = ij_signs == 0 - if np.sum(zeros_idx) > 0: + if np.count_nonzero(zeros_idx) > 0: ij_signs[zeros_idx] = 1 return np.sign(ij_signs) @@ -1793,7 +1795,7 @@ def _mark_equators(sphere_grid, eq_filter_angle): # Mark all views close to an equator. eq_min_dist = np.cos(eq_filter_angle * np.pi / 180) - n_eqs = np.sum(angular_dists > eq_min_dist, axis=1) + n_eqs = np.count_nonzero(angular_dists > eq_min_dist, axis=1) eq_idx = n_eqs > 0 # Classify equators. From 43a53cab83c5d6544e22360611953d2d0387abf3 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 22 Jul 2024 11:57:09 -0400 Subject: [PATCH 361/433] fix typos. --- src/aspire/abinitio/commonline_d2.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index dcc6536972..b06114241b 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -403,7 +403,7 @@ def _generate_scl_angles(self, Ris, eq_idx, eq_class): # Deal with non top view equators # A non-TV equator has only one self common line. However, we clasify an # equator as an image whose projection direction is at radial distance < - # `eq_min_dist` from the great circle perpendicural to a symmetry axis, + # `eq_min_dist` from the great circle perpendicular to a symmetry axis, # and not strictly zero distance. Thus in most cases we get 2 common lines # differing by a small difference in degrees. Actually the calculation above # gives us two NEARLY antipodal lines, so we first flip one of them by @@ -454,7 +454,7 @@ def _generate_scl_angles(self, Ris, eq_idx, eq_class): + scl_angles[eq_class > 0] * ~p[:, :, None, None] ) - # Convert from angles [0,2*pi) to degrees [0, 360). + # Convert from radians [0,2*pi) to degrees [0, 360). return np.round(scl_angles * 180 / np.pi) % 360 def _generate_scl_indices(self, scl_angles, eq_class): @@ -596,10 +596,9 @@ def _compute_scl_scores(self): n_eq = len(self.non_tv_eq_idx) n_inplane = self.n_inplane_rots - # Run ML in parallel + # Prepare self-commonline indices. scl_matrix = np.concatenate((self.scl_idx_1, self.scl_idx_2)) M = len(scl_matrix) // 3 - corrs_out = np.zeros((n_img, M), dtype=self.dtype) scl_idx = scl_matrix.reshape(M, 3) # Get non-equator indices to use with corrs matrix. @@ -609,6 +608,7 @@ def _compute_scl_scores(self): scl_idx[non_eq_lin_idx].flatten(), (n_theta // 2, n_theta) ) + corrs_out = np.zeros((n_img, M), dtype=self.dtype) for i in trange(n_img): pf_full_i = self.pf_full[i] pf_i_shifted = self.pf_shifted[i] @@ -1102,7 +1102,7 @@ def _sync_colors(self, Rijs): # Compute eigenvectors of color matrix. This is just a matrix of dimensions # 3(N choose 2)x3(N choose 2) where each entry corresponds to a pair of - # matrices {Qi^T*Ir*Qj} and {Qr^T*Il*Qj} and eqauls \delta_rl. + # matrices {Qi^T*Ir*Qj} and {Qr^T*Il*Qj} and equals \delta_rl. # The 2 leading eigenvectors span a linear subspace which contains a # vector which encodes the partition. All the entries of the vector are # either 1,0 or -1, where the number encodes which the index r in Ir. From cd0563a2dff6328258109be5d5152eaff0f45fb7 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 23 Jul 2024 10:51:25 -0400 Subject: [PATCH 362/433] Fix comment to use n_theta. --- src/aspire/abinitio/commonline_d2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index b06114241b..e3f20cd9e8 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -657,11 +657,11 @@ def _all_eq_measures(self, corrs): :return: (n_theta // 2) likelihood scores. """ - # First compute the eq measure (corrs(scl-k,scl+k) for k=1:90) + # First compute the eq measure (corrs(scl-k,scl+k) for k=1:n_theta // 4) # An equator image of a D2 molecule has the following property: If t_i is # the angle of one of the rays of the self common line then all the pairs of - # rays of the form (t_i-k,t_i+k) for k=1:90 are identical. For each t_i we - # average over correlations between the lines (t_i-k,t_i+k) for k=1:90 + # rays of the form (t_i-k,t_i+k) for k=1:n_theta // 4 are identical. For each t_i we + # average over correlations between the lines (t_i-k,t_i+k) for k=1:n_theta // 4 # to measure the likelihood that the image is an equator and the ray (line) # with angle t_i is a self common line. # (This first loop can be done once outside this function and then pass From 91925f98b95ba99ff039e5587f948c05ccc60031 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 30 Jul 2024 10:44:57 -0400 Subject: [PATCH 363/433] reshape cl_angles. Remove unused attribute self.cl_angles*. --- src/aspire/abinitio/commonline_d2.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index e3f20cd9e8..69b45cb224 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -224,8 +224,8 @@ def _generate_lookup_data(self): ) # Generate commonline indices. - self.cl_idx_1, self.cl_angles1 = self._generate_commonline_indices(cl_angles1) - self.cl_idx_2, self.cl_angles2 = self._generate_commonline_indices(cl_angles2) + self.cl_idx_1 = self._generate_commonline_indices(cl_angles1) + self.cl_idx_2 = self._generate_commonline_indices(cl_angles2) self.cl_idx = np.hstack((self.cl_idx_1, self.cl_idx_2)) def _generate_commonline_angles( @@ -268,7 +268,7 @@ def _generate_commonline_angles( n_pairs = np.count_nonzero(eq2eq_Rij_table) idx = 0 - cl_angles = np.zeros((2 * n_pairs, n_theta, n_theta // 2, 4, 2)) + cl_angles = np.zeros((2, n_pairs, n_theta, n_theta // 2, 4, 2)) for i in range(n_rots_i): unique_pairs_i = np.where(eq2eq_Rij_table[i])[0] @@ -283,16 +283,16 @@ def _generate_commonline_angles( Rijs = np.transpose(g_Rj, axes=(0, 2, 1)) @ Ri[:, None] # Common line indices induced by Rijs - cl_angles[idx, :, :, k, 0] = np.arctan2( + cl_angles[0, idx, :, :, k, 0] = np.arctan2( Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1] ) - cl_angles[idx, :, :, k, 1] = np.arctan2( + cl_angles[0, idx, :, :, k, 1] = np.arctan2( -Rijs[:, :, 0, 2], Rijs[:, :, 1, 2] ) - cl_angles[idx + n_pairs, :, :, k, 0] = np.arctan2( + cl_angles[1, idx, :, :, k, 0] = np.arctan2( Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] ) - cl_angles[idx + n_pairs, :, :, k, 1] = np.arctan2( + cl_angles[1, idx, :, :, k, 1] = np.arctan2( -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] ) @@ -475,7 +475,7 @@ def _generate_scl_indices(self, scl_angles, eq_class): L = self.n_theta # Convert from angles to indices. - scl_indices, _ = self._generate_commonline_indices(scl_angles) + scl_indices = self._generate_commonline_indices(scl_angles) scl_angles = np.mod(np.round(scl_angles / (2 * np.pi) * L), L).astype(int) # Create candidate common line linear indices lists for equators. @@ -1887,4 +1887,4 @@ def _generate_commonline_indices(self, cl_angles): cl_angles = np.rint(cl_angles.reshape(og_shape)).astype(int) # Return as integer indices. - return cl_idx, cl_angles + return cl_idx From 698fe354774f84e0a43882894e35afbd11e8dbf1 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 30 Jul 2024 11:47:23 -0400 Subject: [PATCH 364/433] replace loop with broadcast. --- src/aspire/abinitio/commonline_d2.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 69b45cb224..6c114efc74 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -357,8 +357,7 @@ def _generate_scl_lookup_data(self): ) * self.n_inplane_rots ) - for i in range(1, self.n_inplane_rots): - non_eq_idx[:, i] = non_eq_idx[:, 0] + i + non_eq_idx[:, 1:] = non_eq_idx[:, [0]] + np.arange(1, self.n_inplane_rots) self.non_eq_idx = non_eq_idx From 1ca164f8d8a8d258c9a005ebb8294b017bd10125 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 30 Jul 2024 13:26:05 -0400 Subject: [PATCH 365/433] Clean up _all_eq_measures using broadcasting. --- src/aspire/abinitio/commonline_d2.py | 53 +++++++++++++--------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 6c114efc74..5e29f6a522 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -666,27 +666,27 @@ def _all_eq_measures(self, corrs): # (This first loop can be done once outside this function and then pass # idx as an argument). L = self.n_theta - idx = np.zeros((L // 2, L // 4, 2)) - idx_1 = np.mod( - np.vstack((-np.arange(1, L // 4 + 1), np.arange(1, L // 4 + 1))), L - ) - idx[0, :, :] = idx_1.T - for k in range(1, L // 2): - idx[k, :, :] = np.mod(idx_1.T + k, L) - idx = np.mod(idx, L) + L_half = L // 2 + + # Generate indices using broadcasting. + t_i = np.arange(L_half)[:, None, None] + k_vals = np.arange(1, L // 4 + 1)[None, :, None] + neg_pos_k = np.array([-1, 1])[None, None, :] + + # Calculate indices, shape: (L//2, L//4, 2). + idx = np.mod(t_i + k_vals * neg_pos_k, L) # Convert to Fourier ray indices. idx_1 = idx[:, :, 0].flatten() idx_2 = idx[:, :, 1].flatten() - # Make all Ri coordinates < 180 and compute linear indices for corrrelations - is_geq_than_pi = idx_1 >= L // 2 - idx_1[is_geq_than_pi] = idx_1[is_geq_than_pi] - (L // 2) - idx_2[is_geq_than_pi] = (idx_2[is_geq_than_pi] + (L // 2)) % L + # Adjust idx_1 to be within [0, 180) and adjust idx_2 accordingly. + is_geq_than_pi = idx_1 >= L_half + idx_1[is_geq_than_pi] -= L_half + idx_2[is_geq_than_pi] = (idx_2[is_geq_than_pi] + L_half) % L - # Compute correlations. - eq_corrs = corrs[idx_1.astype(int), idx_2.astype(int)] - eq_corrs = eq_corrs.reshape(L // 2, L // 4) + # Compute correlations + eq_corrs = corrs[idx_1, idx_2].reshape(L_half, L // 4) corrs_mean = np.mean(eq_corrs, axis=1) # Now compute correlations for normals to scls. @@ -698,22 +698,19 @@ def _all_eq_measures(self, corrs): # equator and t_i+0.5*pi is the normal to its self common line. r = 2 # Search radius within 2 adjacent rays of normal ray. - normal_2_scl_idx = np.zeros((L // 2, 2 * r + 1)) - normal_2_scl_idx_1 = np.mod(L // 2 - np.arange(L // 4 - r, L // 4 + r + 1), L) - normal_2_scl_idx[0, :] = normal_2_scl_idx_1 - for k in range(1, L // 2): - normal_2_scl_idx[k, :] = np.mod(normal_2_scl_idx_1 + k, L) + # Generate indices for normal to scl index. + normal_2_scl_idx_0 = ( + L_half - np.arange(L_half // 2 - r, L_half // 2 + r + 1) + ) % L + normal_2_scl_idx = (normal_2_scl_idx_0 + np.arange(L_half).reshape(-1, 1)) % L - # Make all Ri coordinates <=180 and compute linear indices for corrrelations - is_geq_than_pi = normal_2_scl_idx >= L // 2 - normal_2_scl_idx[is_geq_than_pi] = normal_2_scl_idx[is_geq_than_pi] - (L // 2) + # Adjust indices to be within [0, 180) range. + normal_2_scl_idx = np.where( + normal_2_scl_idx >= L_half, normal_2_scl_idx - L_half, normal_2_scl_idx + ) # Compute correlations for normals. - normal_2_scl_idx = normal_2_scl_idx.flatten() - normal_corrs = corrs[ - normal_2_scl_idx.astype(int), normal_2_scl_idx.astype(int) + (L // 2) - ] - normal_corrs = normal_corrs.reshape(L // 2, 2 * r + 1) + normal_corrs = corrs[normal_2_scl_idx, normal_2_scl_idx + L_half] normal_corrs_max = np.max(normal_corrs, axis=1) return corrs_mean * normal_corrs_max From df014a1b1bbe98536c546921a1c720d8676ac7f6 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 30 Jul 2024 14:49:47 -0400 Subject: [PATCH 366/433] Vectorize _compute_cl_scores. --- src/aspire/abinitio/commonline_d2.py | 72 +++++++++++++++------------- 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 5e29f6a522..680f22e79a 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -726,9 +726,9 @@ def _compute_cl_scores(self): """ logger.info("Computing commonline correlation scores.") L = self.n_theta + n_pairs = self.n_img * (self.n_img - 1) // 2 - # Map the self common line scores of each 2 candidate rotations R_i,R_j to - # the respective relative rotation candidate R_i^TR_j. + # Map the self common line scores of each 2 candidate rotations R_i, R_j n_lookup_1 = len(self.scl_idx_1) // 3 oct1_ij_map = np.vstack((self.oct1_ij_map, self.oct1_ij_map[:, [1, 0]])) oct2_ij_map = self.oct2_ij_map @@ -736,50 +736,56 @@ def _compute_cl_scores(self): oct2_ij_map = np.vstack((oct2_ij_map, oct2_ij_map[:, [1, 0]])) ij_map = np.vstack((oct1_ij_map, oct2_ij_map)) - # Allocate output variables. - n_pairs = self.n_img * (self.n_img - 1) // 2 + # Gather commonline indices and unravel to index into correlations. + cl_idx = np.unravel_index(self.cl_idx, (L // 2, L)) + + # Allocate output variables corrs_idx = np.zeros(n_pairs, dtype=np.int64) corrs_out = np.zeros(n_pairs, dtype=self.dtype) - ij_idx = 0 - # Search for common lines between pairs of projections. + ij_idx = 0 pbar = tqdm( desc="Searching for commonlines between pairs of images", total=n_pairs ) - for i in range(self.n_img): + + # Vectorize over pairs of images + for i in range(self.n_img - 1): pf_i = self.pf_shifted[i] scores_i = self.scls_scores[i] - for j in range(i + 1, self.n_img): - pf_j = self.pf_full[j] - - # Compute maximum correlation over all shifts. - corrs = np.real(pf_i @ np.conj(pf_j).T) - corrs = np.reshape(corrs, (self.n_shifts, L // 2, L)) - corrs = np.max(corrs, axis=0) - - # Take the product over symmetrically induced candidates. Eq. 4.5 in paper. - cl_idx = np.unravel_index(self.cl_idx, (L // 2, L)) - - prod_corrs = corrs[cl_idx] - prod_corrs = prod_corrs.reshape(len(prod_corrs) // 4, 4) - prod_corrs = np.prod(prod_corrs, axis=1) - - # Incorporate scores of individual rotations from self-commonlines. - scores_j = self.scls_scores[j] - scores_ij = scores_i[ij_map[:, 0]] * scores_j[ij_map[:, 1]] + # Gather all pf_j in one array for vectorized computation + pf_js = self.pf_full[i + 1 : self.n_img] + n_pf_js = pf_js.shape[0] + + # Compute maximum correlation over all shifts for all pf_j + corrs = np.real(pf_i @ np.conj(pf_js.transpose(0, 2, 1))) + corrs = corrs.reshape(n_pf_js, self.n_shifts, L // 2, L) + corrs = np.max(corrs, axis=1) # Max over shifts + + # Take the product over symmetrically induced candidates. Eq. 4.5 in paper. + # Vectorize extraction and processing of correlations + prod_corrs = corrs[:, cl_idx[0], cl_idx[1]] + prod_corrs = prod_corrs.reshape(n_pf_js, len(prod_corrs[0]) // 4, 4) + prod_corrs = np.prod(prod_corrs, axis=2) + + # Incorporate scores of individual rotations from self-commonlines + scores_js = self.scls_scores[i + 1 : self.n_img] + scores_ij = scores_i[ij_map[:, 0]] * scores_js[:, ij_map[:, 1]] + + # Find maximum correlations and update results + prod_corrs = prod_corrs * scores_ij + max_indices = np.argmax(prod_corrs, axis=1) + corrs_idx[ij_idx : ij_idx + len(max_indices)] = max_indices + corrs_out[ij_idx : ij_idx + len(max_indices)] = prod_corrs[ + np.arange(len(max_indices)), max_indices + ] - # Find maximum correlations. - prod_corrs = prod_corrs * scores_ij - max_idx = np.argmax(prod_corrs) - corrs_idx[ij_idx] = max_idx - corrs_out[ij_idx] = prod_corrs[max_idx] - ij_idx += 1 + ij_idx += len(max_indices) + pbar.update(len(max_indices)) - pbar.update() pbar.close() - # Get estimated relative viewing directions. + # Get estimated relative viewing directions self.corrs_idx = corrs_idx self.Rijs_est = self._get_Rijs_from_lin_idx(corrs_idx) From 90bcb2356f1b279482c411ab0216a463e7141360 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 5 Aug 2024 09:15:46 -0400 Subject: [PATCH 367/433] Broadcast when computing Rijs. --- src/aspire/abinitio/commonline_d2.py | 39 +++++++++++++++------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 680f22e79a..6eacd50d05 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -277,24 +277,27 @@ def _generate_commonline_angles( Ri = Ris[i] for j in unique_pairs_i: Rj = Rjs[j, : n_theta // 2] - for k, g in enumerate(self.gs): - # Compute relative rotations candidates Rij = Ri.T @ gs @ Rj - g_Rj = g @ Rj - Rijs = np.transpose(g_Rj, axes=(0, 2, 1)) @ Ri[:, None] - - # Common line indices induced by Rijs - cl_angles[0, idx, :, :, k, 0] = np.arctan2( - Rijs[:, :, 2, 0], -Rijs[:, :, 2, 1] - ) - cl_angles[0, idx, :, :, k, 1] = np.arctan2( - -Rijs[:, :, 0, 2], Rijs[:, :, 1, 2] - ) - cl_angles[1, idx, :, :, k, 0] = np.arctan2( - Rijs[:, :, 0, 2], -Rijs[:, :, 1, 2] - ) - cl_angles[1, idx, :, :, k, 1] = np.arctan2( - -Rijs[:, :, 2, 0], Rijs[:, :, 2, 1] - ) + + # Compute relative rotations candidates Rij = Ri.T @ gs @ Rj + Rijs = ( + np.transpose(Ri, axes=(0, 2, 1))[:, None, None] + @ self.gs + @ Rj[:, None] + ) + + # Common line indices induced by Rijs + cl_angles[0, idx, :, :, :, 0] = np.arctan2( + -Rijs[..., 0, 2], Rijs[..., 1, 2] + ) + cl_angles[0, idx, :, :, :, 1] = np.arctan2( + Rijs[..., 2, 0], -Rijs[..., 2, 1] + ) + cl_angles[1, idx, :, :, :, 0] = np.arctan2( + -Rijs[..., 2, 0], Rijs[..., 2, 1] + ) + cl_angles[1, idx, :, :, :, 1] = np.arctan2( + Rijs[..., 0, 2], -Rijs[..., 1, 2] + ) idx += 1 From f30a8e4207d62fc6028c576a9e5a1627f236878c Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 5 Aug 2024 10:00:05 -0400 Subject: [PATCH 368/433] loop -> broadcast --- src/aspire/abinitio/commonline_d2.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 6eacd50d05..e8374ff0e0 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -852,8 +852,6 @@ def _get_Rijs_from_oct(self, lin_idx, octant=1): self.inplane_rotated_grid2, (np.prod(s2[0:2]), 3, 3) ) - Rijs_est = np.zeros((n_pairs, 4, 3, 3), dtype=self.dtype) - # Convert linear indices of unique table to linear indices of index pairs table. idx_vec = np.arange(np.prod(unique_pairs.shape)) unique_lin_idx = idx_vec[unique_pairs.flatten()] @@ -865,9 +863,7 @@ def _get_Rijs_from_oct(self, lin_idx, octant=1): Rjs_lin_idx = np.ravel_multi_index((est_idx[1], inplane_j), s2[:2]) Ris_t = np.transpose(inplane_rotated_grid[Ris_lin_idx], (0, 2, 1)) Rjs = inplane_rotated_grid2[Rjs_lin_idx] - - for k, g in enumerate(self.gs): - Rijs_est[:, k] = Ris_t @ g @ Rjs + Rijs_est = Ris_t[:, None] @ self.gs @ Rjs[:, None] Rijs_est[transpose_idx] = np.transpose(Rijs_est[transpose_idx], (0, 1, 3, 2)) From 0ee84cedc7ca58e3d347aead75efa40ce149e2db Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 5 Aug 2024 10:15:17 -0400 Subject: [PATCH 369/433] rename func --- src/aspire/abinitio/commonline_d2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index e8374ff0e0..d502be9274 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1000,7 +1000,7 @@ def _J_sync_power_method(self, J_list): ) while itr < max_iters and residual > epsilon: itr += 1 - vec_new = self._signs_times_v2(J_list, vec) + vec_new = self._signs_times_v(J_list, vec) vec_new = vec_new / norm(vec_new) residual = norm(vec_new - vec) vec = vec_new @@ -1014,7 +1014,7 @@ def _J_sync_power_method(self, J_list): return J_sync - def _signs_times_v2(self, J_list, vec): + def _signs_times_v(self, J_list, vec): """ Multiplication of the J-synchronization matrix by a candidate eigenvector. From b5aa47cc357c2df2352149d2c0bdb998582021e6 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 5 Aug 2024 11:10:16 -0400 Subject: [PATCH 370/433] _compare_rots docstring and broadcast. --- src/aspire/abinitio/commonline_d2.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index d502be9274..6ecb2ed008 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -949,21 +949,25 @@ def _compare_rots(self, Rij, Rjk_t, Rik): Compute norms for the 4 J-configurations and return indices corresponding to best configuration for the provided triplet of relative rotations. + + :param Rij: Relative rotation between i'th and j'th candidate rotations + of shape (4, 3, 3). + :param Rjk_t: Transpose of relative rotation between j'th and k'th candidate + rotations of shape (4, 3, 3). + :param Rik: Relative rotation between i'th and k'th candidate rotations + of shape (4, 3, 3). + :return: Score for this J-configuration of the given rotation triplet. """ # We compute the four sets of 4^3 norms |Rik @ Rjk.T - Rij| # See equation (6.11) in publication. prod_arr = Rik[:, None] @ Rjk_t[None] + diff_arr = prod_arr[:, :, None] - Rij + diff_arr = diff_arr.reshape((64, 9)) + norm_arr = np.sum(diff_arr**2, axis=1) - arr = np.zeros((8, 8, 3, 3), dtype=self.dtype) - arr[0:4, 0:4] = prod_arr - Rij[0] - arr[0:4, 4:8] = prod_arr - Rij[1] - arr[4:8, 0:4] = prod_arr - Rij[2] - arr[4:8, 4:8] = prod_arr - Rij[3] - - arr = arr.reshape((64, 9)) - arr = np.sum(arr**2, axis=1) - - m = np.sort(arr.flatten()) + # For perfect estimates, 16 of the 64 norms will equal zero. + # We sum over the smallest 16 values to get a vote for this J-configuration. + m = np.sort(norm_arr) vote = np.sum(m[:16]) return vote From f0eb44477add92509f80e824319ab50a6fb3b93b Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 6 Aug 2024 09:31:08 -0400 Subject: [PATCH 371/433] broadcasting --- src/aspire/abinitio/commonline_d2.py | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 6ecb2ed008..d3771c9168 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1171,15 +1171,11 @@ def _match_colors(self, Rijs_rows): self_prods = self_prods.reshape(3, 9) prod_arr1 = prod_arr.copy() - prod_arr1[:, :, 0, :] = prod_arr1[:, :, 0, :] - self_prods[0] - prod_arr1[:, :, 1, :] = prod_arr1[:, :, 1, :] - self_prods[1] - prod_arr1[:, :, 2, :] = prod_arr1[:, :, 2, :] - self_prods[2] + prod_arr1 -= self_prods norms1 = np.sum(prod_arr1**2, axis=3) prod_arr2 = prod_arr.copy() - prod_arr2[:, :, 0, :] = prod_arr2[:, :, 0, :] + self_prods[0] - prod_arr2[:, :, 1, :] = prod_arr2[:, :, 1, :] + self_prods[1] - prod_arr2[:, :, 2, :] = prod_arr2[:, :, 2, :] + self_prods[2] + prod_arr2 += self_prods norms2 = np.sum(prod_arr2**2, axis=3) # Compare to v_{jj}(r)=v_{jk}v_{kj}. @@ -1187,15 +1183,11 @@ def _match_colors(self, Rijs_rows): self_prods = self_prods.reshape(3, 9) prod_arr1 = prod_arr.copy() - prod_arr1[0] = prod_arr1[0] - self_prods[0] - prod_arr1[1] = prod_arr1[1] - self_prods[1] - prod_arr1[2] = prod_arr1[2] - self_prods[2] + prod_arr1 -= self_prods[:, None, None] norms1 = norms1 + np.sum(prod_arr1**2, axis=3) prod_arr2 = prod_arr.copy() - prod_arr2[0] = prod_arr2[0] + self_prods[0] - prod_arr2[1] = prod_arr2[1] + self_prods[1] - prod_arr2[2] = prod_arr2[2] + self_prods[2] + prod_arr2 += self_prods[:, None, None] norms2 = norms2 + np.sum(prod_arr2**2, axis=3) # For r=1:3 compute 3*3 products v_{ij}(r)v_{jk}v_{ki} and compare to @@ -1211,15 +1203,11 @@ def _match_colors(self, Rijs_rows): self_prods = self_prods.reshape(3, 9) prod_arr1 = prod_arr.copy() - prod_arr1[:, 0] = prod_arr1[:, 0] - self_prods[0] - prod_arr1[:, 1] = prod_arr1[:, 1] - self_prods[1] - prod_arr1[:, 2] = prod_arr1[:, 2] - self_prods[2] + prod_arr1 -= self_prods[None, :, None] norms1 = norms1 + np.sum(prod_arr1**2, axis=3) prod_arr2 = prod_arr.copy() - prod_arr2[:, 0] = prod_arr2[:, 0] + self_prods[0] - prod_arr2[:, 1] = prod_arr2[:, 1] + self_prods[1] - prod_arr2[:, 2] = prod_arr2[:, 2] + self_prods[2] + prod_arr2 += self_prods[None, :, None] norms2 = norms2 + np.sum(prod_arr2**2, axis=3) norms = np.minimum(norms1, norms2) From b1158c175e5d565f53b7a77078a0a48daccca02d Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 6 Aug 2024 14:00:48 -0400 Subject: [PATCH 372/433] Reshape arrays and use cleaner indexing. --- src/aspire/abinitio/commonline_d2.py | 41 ++++++++-------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index d3771c9168..9871be3325 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1417,19 +1417,13 @@ def _sync_signs(self, rr, c_vec): # o(N^2) which doesn't pose a constraint for inputs on the scale of 10^3-10^4. c_mat_5d = np.zeros((self.n_img, self.n_img, 3, 3, 3), dtype=self.dtype) c_mat_4d = np.zeros((self.n_pairs, 3, 3, 3), dtype=self.dtype) + c_vec = c_vec.reshape(self.n_pairs, 3) for i in range(self.n_img - 1): for j in range(i + 1, self.n_img): ij = self.pairs_to_linear[i, j] - c_mat_5d[i, j, c_vec[3 * ij]] = rr[ij, 0] - c_mat_5d[i, j, c_vec[3 * ij + 1]] = rr[ij, 1] - c_mat_5d[i, j, c_vec[3 * ij + 2]] = rr[ij, 2] - c_mat_5d[j, i, c_vec[3 * ij]] = rr[ij, 0].T - c_mat_5d[j, i, c_vec[3 * ij + 1]] = rr[ij, 1].T - c_mat_5d[j, i, c_vec[3 * ij + 2]] = rr[ij, 2].T - - c_mat_4d[ij, c_vec[3 * ij]] = rr[ij, 0] - c_mat_4d[ij, c_vec[3 * ij + 1]] = rr[ij, 1] - c_mat_4d[ij, c_vec[3 * ij + 2]] = rr[ij, 2] + c_mat_5d[i, j, c_vec[ij]] = rr[ij] + c_mat_5d[j, i, c_vec[ij]] = rr[ij].transpose(0, 2, 1) + c_mat_4d[ij, c_vec[ij]] = rr[ij] # Compute estimates for the tuples {0.5*(Ri^TRi+Ri^TgkRi), k=1:3} for # i=1:N. For 1<=i,j<=N and c=1,2,3 write Qij^c=0.5*(Ri^TRj+Ri^TgmRj). @@ -1452,26 +1446,18 @@ def _sync_signs(self, rr, c_vec): # In C_2 one such matrix is constructed for the 3rd rows # and is rank 1 by construction. In practice, thus far, for each c and # (i,j) we either have Qij^c or -Qij^c independently. - c_mat = np.zeros((3, 3 * self.n_img, 3 * self.n_img), dtype=self.dtype) + c_mat = np.zeros((3, self.n_img, 3, self.n_img, 3), dtype=self.dtype) rot = np.zeros((self.n_img, 3, 3), dtype=self.dtype) for i in range(self.n_img - 1): for j in range(i + 1, self.n_img): ij = self.pairs_to_linear[i, j] - c_mat[c_vec[3 * ij], 3 * i : 3 * i + 3, 3 * j : 3 * j + 3] = rr[ij, 0] - c_mat[c_vec[3 * ij + 1], 3 * i : 3 * i + 3, 3 * j : 3 * j + 3] = rr[ - ij, 1 - ] - c_mat[c_vec[3 * ij + 2], 3 * i : 3 * i + 3, 3 * j : 3 * j + 3] = rr[ - ij, 2 - ] - - c_mat[0] = c_mat[0] + c_mat[0].T - c_mat[1] = c_mat[1] + c_mat[1].T - c_mat[2] = c_mat[2] + c_mat[2].T + c_mat[c_vec[ij], i, :, j, :] = rr[ij] + + c_mat = c_mat + c_mat.transpose(0, 3, 4, 1, 2) for c in range(3): for i in range(self.n_img): - c_mat[c, 3 * i : 3 * i + 3, 3 * i : 3 * i + 3] = c_mat_5d[i, i, c] + c_mat[c, i, :, i, :] = c_mat_5d[i, i, c] # To decompose cMat as a rank 1 matrix we need to adjust the signs of the # Qij^c so that sign(Qij^c*Qjk^c) = sign(Qik^c) for all c=1,2,3 and (i,j). @@ -1628,15 +1614,12 @@ def _sync_signs(self, rr, c_vec): idx = 0 for i in range(self.n_img - 1): for j in range(i + 1, self.n_img): - c_mat[c, 3 * j : 3 * j + 3, 3 * i : 3 * i + 3] = ( - signs[c, idx] * c_mat[c, 3 * j : 3 * j + 3, 3 * i : 3 * i + 3] - ) - c_mat[c, 3 * i : 3 * i + 3, 3 * j : 3 * j + 3] = ( - signs[c, idx] * c_mat[c, 3 * i : 3 * i + 3, 3 * j : 3 * j + 3] - ) + c_mat[c, j, :, i, :] *= signs[c, idx] + c_mat[c, i, :, j, :] *= signs[c, idx] idx += 1 # cMat(:,:,c) are now rank 1. Decompose using SVD and take leading eigenvector. + c_mat = c_mat.reshape(3, 3 * self.n_img, 3 * self.n_img) U1, S1, _ = la.svds(c_mat[0], k=3, which="LM") U2, S2, _ = la.svds(c_mat[1], k=3, which="LM") U3, S3, _ = la.svds(c_mat[2], k=3, which="LM") From a3b4d2dfa88586fbd518f17edfdb468408ed2e90 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 6 Aug 2024 15:18:55 -0400 Subject: [PATCH 373/433] more indexing cleanup --- src/aspire/abinitio/commonline_d2.py | 42 +++++++++++----------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 9871be3325..f6f405f209 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1447,7 +1447,6 @@ def _sync_signs(self, rr, c_vec): # and is rank 1 by construction. In practice, thus far, for each c and # (i,j) we either have Qij^c or -Qij^c independently. c_mat = np.zeros((3, self.n_img, 3, self.n_img, 3), dtype=self.dtype) - rot = np.zeros((self.n_img, 3, 3), dtype=self.dtype) for i in range(self.n_img - 1): for j in range(i + 1, self.n_img): ij = self.pairs_to_linear[i, j] @@ -1620,34 +1619,27 @@ def _sync_signs(self, rr, c_vec): # cMat(:,:,c) are now rank 1. Decompose using SVD and take leading eigenvector. c_mat = c_mat.reshape(3, 3 * self.n_img, 3 * self.n_img) - U1, S1, _ = la.svds(c_mat[0], k=3, which="LM") - U2, S2, _ = la.svds(c_mat[1], k=3, which="LM") - U3, S3, _ = la.svds(c_mat[2], k=3, which="LM") - svals2 = np.zeros((3, 3), dtype=self.dtype) - svals2[0] = S1[::-1] - svals2[1] = S2[::-1] - svals2[2] = S3[::-1] - - # Stable eigenvectors. - U1 = np.sign(U1[0]) * U1 - U2 = np.sign(U2[0]) * U2 - U3 = np.sign(U3[0]) * U3 + U1, _, _ = la.svds(c_mat[0], k=3, which="LM") + U2, _, _ = la.svds(c_mat[1], k=3, which="LM") + U3, _, _ = la.svds(c_mat[2], k=3, which="LM") + + # Stabilize and take leading eigenvector. + U1 = np.sign(U1[0, -1]) * U1[:, -1] + U2 = np.sign(U2[0, -1]) * U2[:, -1] + U3 = np.sign(U3[0, -1]) * U3[:, -1] # The c'th row of the rotation Rj is Uc(3*j-2:3*j,1)/norm(Uc(3*j-2:3*j,1)), # (Rows must be normalized to length 1). logger.info("Assembeling rows to rotations matrices.") - for i in range(self.n_img): - rot[i, 0] = U1[3 * i : 3 * i + 3, -1] / np.linalg.norm( - U1[3 * i : 3 * i + 3, -1] - ) - rot[i, 1] = U2[3 * i : 3 * i + 3, -1] / np.linalg.norm( - U2[3 * i : 3 * i + 3, -1] - ) - rot[i, 2] = U3[3 * i : 3 * i + 3, -1] / np.linalg.norm( - U3[3 * i : 3 * i + 3, -1] - ) - if np.linalg.det(rot[i]) < 0: - rot[i, 2] = -rot[i, 2] + rot = np.zeros((self.n_img, 3, 3), dtype=self.dtype) + rot[:, 0] = U1.reshape(self.n_img, 3) + rot[:, 1] = U2.reshape(self.n_img, 3) + rot[:, 2] = U3.reshape(self.n_img, 3) + rot /= np.linalg.norm(rot, axis=-1)[:, :, None] + + # Ensure we have rotations. + not_a_rot = np.argwhere(np.linalg.det(rot) < 0) + rot[not_a_rot, 2] *= -1 return rot From 8b7373d85c1f22283a8e780525c2fa0cfd7e5cbe Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 6 Aug 2024 15:22:40 -0400 Subject: [PATCH 374/433] remove unused variable --- src/aspire/abinitio/commonline_d2.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index f6f405f209..8691f358f0 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -831,7 +831,6 @@ def _get_Rijs_from_oct(self, lin_idx, octant=1): n_rots2 = n_rots else: n_rots2 = len(self.sphere_grid2) - n_pairs = len(lin_idx) # Map linear indices of chosen pairs of rotation candidates from ML to regular indices. p_idx, inplane_i, inplane_j = np.unravel_index( From e951ce9e6f05976ede0438217c6476cfeccc3d46 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 6 Aug 2024 15:51:56 -0400 Subject: [PATCH 375/433] circ_seq value check --- src/aspire/abinitio/commonline_d2.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 8691f358f0..d1b070763e 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1679,13 +1679,18 @@ def _mult_smat_by_vec(self, v, sign_mat, pairs_map): @staticmethod def _circ_seq(n1, n2, L): """ - Make a circular sequence of integers between n1 and n2 modulo L. + For integers 0 <= n1, n2 < L, make a circular sequence of integers between + n1 and n2 modulo L. :param n1: First integer in sequence. :param n2: Last integer in sequence. :param L: Modulus of values in sequence. :return: Circular sequence modulo L. """ + if min(n1, n2) < 0 or max(n1, n2) >= L: + raise ValueError( + f"n1 and n2 must both be in [0, {L}). Found n1={n1}, n2={n2}." + ) if n2 < n1: n2 += L if n1 == n2: From 10acc78841f19e130b91473f190ef60339de06e2 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 8 Aug 2024 15:47:06 -0400 Subject: [PATCH 376/433] compute_scl_scores: Replace loop with vectorized operations. --- src/aspire/abinitio/commonline_d2.py | 77 +++++++++++++++------------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index d1b070763e..32815c1a3b 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -610,44 +610,47 @@ def _compute_scl_scores(self): scl_idx[non_eq_lin_idx].flatten(), (n_theta // 2, n_theta) ) + # Compute max correlation over all shifts. + corrs = np.real( + self.pf_shifted @ np.transpose(np.conj(self.pf_full), (0, 2, 1)) + ) + corrs = np.reshape(corrs, (self.n_img, self.n_shifts, n_theta // 2, n_theta)) + corrs = np.max(corrs, axis=1) + + # Map correlations to probabilities (in the spirit of Maximum Likelihood). + corrs = 0.5 * (corrs + 1) + + # Compute equator measures. + eq_measures = np.zeros((self.n_img, n_theta // 2), dtype=self.dtype) + for i in range(self.n_img): + eq_measures[i] = self._all_eq_measures(corrs[i]) + + # Handle the cases: Non-equator, Non-top-view equator images. + # 1. Non-equators: just take product of probabilities. corrs_out = np.zeros((n_img, M), dtype=self.dtype) - for i in trange(n_img): - pf_full_i = self.pf_full[i] - pf_i_shifted = self.pf_shifted[i] - - # Compute max correlation over all shifts. - corrs = np.real(pf_i_shifted @ np.conj(pf_full_i).T) - corrs = np.reshape(corrs, (self.n_shifts, n_theta // 2, n_theta)) - corrs = np.max(corrs, axis=0) - - # Map correlations to probabilities (in the spirit of Maximum Likelihood). - corrs = 0.5 * (corrs + 1) - - # Compute equator measures. - eq_measures = self._all_eq_measures(corrs) - - # Handle the cases: Non-equator, Non-top-view equator images. - # 1. Non-equators: just take product of probabilities. - prod_corrs = np.prod(corrs[non_eq_idx].reshape(n_non_eq, 3), axis=1) - corrs_out[i, non_eq_lin_idx] = prod_corrs - - # 2. Non-topview equators: adjust scores by eq_measures - for eq_idx in range(n_eq): - for j in range(n_inplane): - # Take the correlations for the self common line candidate of the - # "equator rotation" `eq_idx` with respect to image i, and - # multiply by all scores from the function eq_measures (see - # documentation inside the function ). Then take maximum over - # all the scores. - scl_idx_list = np.unravel_index( - self.scl_idx_lists[0, eq_idx, j], (n_theta // 2, n_theta) - ) - true_scls_corrs = corrs[scl_idx_list] - scls_cand_idx = self.scl_idx_lists[1, eq_idx, j] - eq_measures_j = eq_measures[scls_cand_idx] - measures_agg = np.outer(true_scls_corrs, eq_measures_j) - k = self.non_tv_eq_idx[eq_idx] - corrs_out[i, k * n_inplane + j] = np.max(measures_agg) + prod_corrs = np.prod( + corrs[:, non_eq_idx[0], non_eq_idx[1]].reshape(self.n_img, n_non_eq, 3), + axis=2, + ) + corrs_out[:, non_eq_lin_idx] = prod_corrs + + # 2. Non-topview equators: adjust scores by eq_measures + for eq_idx in range(n_eq): + for j in range(n_inplane): + # Take the correlations for the self common line candidate of the + # "equator rotation" `eq_idx` with respect to image i, and + # multiply by all scores from the function eq_measures (see + # documentation inside the function ). Then take maximum over + # all the scores. + scl_idx_list = np.unravel_index( + self.scl_idx_lists[0, eq_idx, j], (n_theta // 2, n_theta) + ) + true_scls_corrs = corrs[:, scl_idx_list[0], scl_idx_list[1]] + scls_cand_idx = self.scl_idx_lists[1, eq_idx, j] + eq_measures_j = eq_measures[:, scls_cand_idx] + measures_agg = true_scls_corrs[:, :, None] * eq_measures_j[:, None, :] + k = self.non_tv_eq_idx[eq_idx] + corrs_out[:, k * n_inplane + j] = np.max(measures_agg, axis=(-2, -1)) self.scls_scores = corrs_out From eed8b143ce9aba4c6a0890be1112405bf552c61d Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 13 Aug 2024 11:07:00 -0400 Subject: [PATCH 377/433] Add doc io --- src/aspire/abinitio/commonline_d2.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 32815c1a3b..d851767bda 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1409,6 +1409,12 @@ def _sync_signs(self, rr, c_vec): This function executes the final stage of the algorithm, Signs synchroniztion. At the end all rows of the rotations Ri are exctracted and the matrices Ri are assembled. + + :param rr: Array of color synchronized rotations' rows outer products of + shape (n_pairs, 3, 3, 3), where each rr[ij] corresponds to a 3-tuple + of m'th row outer product matrices, some of which having a spurious -1. + :param c_vec: A color mapping vector of length (n_pairs * 3) which permutes + the 3-tuples of `rr` to be globally row-consistent. """ logger.info("Performing signs synchronization.") # Partition the union of tuples {0.5*(Ri^TRj+Ri^TgkRj), k=1:3} according From 326f94900be792e79440bbd7564a96f80f3404ae Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 13 Aug 2024 11:32:41 -0400 Subject: [PATCH 378/433] Documentation for mark_equators. --- src/aspire/abinitio/commonline_d2.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index d851767bda..af0755f093 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1415,6 +1415,7 @@ def _sync_signs(self, rr, c_vec): of m'th row outer product matrices, some of which having a spurious -1. :param c_vec: A color mapping vector of length (n_pairs * 3) which permutes the 3-tuples of `rr` to be globally row-consistent. + :return: n_img x 3 x 3 array of rotation matrices. """ logger.info("Performing signs synchronization.") # Partition the union of tuples {0.5*(Ri^TRj+Ri^TgkRj), k=1:3} according @@ -1743,6 +1744,12 @@ def _saff_kuijlaars(N): @staticmethod def _mark_equators(sphere_grid, eq_filter_angle): """ + This method categorizes a set of 3D unit vectors into equator and non-equator + vectors determined by the parameter `eq_filter_angle`, returned as `eq_idx`. + It further categorizes the vectors into the classes non_equator, z-equator, + y-equator, x-equator, z-top_view, y-top_view, and x-top_view, which are labeled + respectively with the values 0 - 6 and returned as `eq_class`. + :param sphere_grid: Nx3 array of vertices in cartesian coordinates. :param eq_filter_angle: Angular distance from equator to be marked as an equator point. From e5eaafb98d0494d57e75b69547d48f363034e185 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 14 Aug 2024 08:57:35 -0400 Subject: [PATCH 379/433] Clean up mark_equators --- src/aspire/abinitio/commonline_d2.py | 30 +++++++++++----------------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index af0755f093..26258de789 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1763,23 +1763,12 @@ def _mark_equators(sphere_grid, eq_filter_angle): n_rots = len(sphere_grid) angular_dists = np.zeros((n_rots, 3), dtype=sphere_grid.dtype) - # Distance from z-axis equator. - proj_xy = sphere_grid.copy() - proj_xy[:, 2] = 0 - proj_xy /= np.linalg.norm(proj_xy, axis=1)[:, None] - angular_dists[:, 0] = np.sum(sphere_grid * proj_xy, axis=-1) - - # Distance from y-axis equator. - proj_xz = sphere_grid.copy() - proj_xz[:, 1] = 0 - proj_xz /= np.linalg.norm(proj_xz, axis=1)[:, None] - angular_dists[:, 1] = np.sum(sphere_grid * proj_xz, axis=-1) - - # Distance from x-axis equator. - proj_yz = sphere_grid.copy() - proj_yz[:, 0] = 0 - proj_yz /= np.linalg.norm(proj_yz, axis=1)[:, None] - angular_dists[:, 2] = np.sum(sphere_grid * proj_yz, axis=-1) + # For each grid point get the distance from the z, y, and x-axis equators. + for i in range(3): + proj_along_axis = sphere_grid.copy() + proj_along_axis[:, 2 - i] = 0 + proj_along_axis /= np.linalg.norm(proj_along_axis, axis=1)[:, None] + angular_dists[:, i] = np.sum(sphere_grid * proj_along_axis, axis=-1) # Mark all views close to an equator. eq_min_dist = np.cos(eq_filter_angle * np.pi / 180) @@ -1795,9 +1784,14 @@ def _mark_equators(sphere_grid, eq_filter_angle): # 5 -> y top view # 6 -> x top view eq_class = np.zeros(n_rots) + + # Grid points which are equator points with respect to 2 equators are considered top views. + # For example, a grid point that is close to both the x and y equator is a z top view. top_view_idx = n_eqs > 1 - top_view_class = np.argmin(angular_dists[top_view_idx] > eq_min_dist) + top_view_class = np.argmin(angular_dists[top_view_idx] > eq_min_dist, axis=1) eq_class[top_view_idx] = top_view_class + 4 + + # Assign grid points which are equator points with respect to only 1 equator. eq_view_idx = n_eqs == 1 eq_view_class = np.argmax(angular_dists[eq_view_idx] > eq_min_dist, axis=1) eq_class[eq_view_idx] = eq_view_class + 1 From 1f9395e2aa62ff14d9d83baeff5dfb46a112ab6b Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 14 Aug 2024 10:32:29 -0400 Subject: [PATCH 380/433] Add documentation to _generate_commonline_indices. --- src/aspire/abinitio/commonline_d2.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 26258de789..f6d6766a52 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1829,7 +1829,7 @@ def _generate_inplane_rots(sphere_grid, d_theta): # Generate in-plane rotations. d_theta *= np.pi / 180 - # TODO: Negative signs to match matlab. + # Negative signs to match matlab. inplane_rots = Rotation.about_axis( "z", np.arange(0, -2 * np.pi, -d_theta), dtype=dtype ).matrices @@ -1844,8 +1844,12 @@ def _generate_inplane_rots(sphere_grid, d_theta): def _generate_commonline_indices(self, cl_angles): """ - Converts pairs pf commonline angles in [0, 360) first into polar Fourier - indices in [0, self.n_theta), then into commonline linear indices. + Converts a multi-dimensional stack of pairs of commonline angles in [0, 360) degrees + into a flattened stack of polar Fourier linear indices, with the convention that + each linear index corresponds to an unraveled index in [0, n_theta // 2) x [0, n_theta). + + :param cl_angles: A multi-dimensional stack of commonline angles in degrees, shape (..., 2). + :return: cl_idx, a 1D array of linear indices. """ L = self.n_theta @@ -1865,8 +1869,4 @@ def _generate_commonline_indices(self, cl_angles): # Convert to linear indices in 180x360 correlation matrix. cl_idx = np.ravel_multi_index((row_sub, col_sub), dims=(L // 2, L)) - # Return cl_angles in original shape as integer indices. - cl_angles = np.rint(cl_angles.reshape(og_shape)).astype(int) - - # Return as integer indices. return cl_idx From 342df2f0b4fb0e4d82be5c5babb5ff02c6ce7706 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 14 Aug 2024 10:50:51 -0400 Subject: [PATCH 381/433] doubles for expensive testing --- tests/test_orient_d2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index 6e8f2741ee..c319be4acc 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -16,7 +16,7 @@ # Parameters # ############## -DTYPE = [np.float64, pytest.param(np.float32, marks=pytest.mark.expensive)] +DTYPE = [np.float32, pytest.param(np.float64, marks=pytest.mark.expensive)] RESOLUTION = [48, 49] N_IMG = [10] OFFSETS = [0, pytest.param(None, marks=pytest.mark.expensive)] From 610c56e3817fd4ceba548892a99d7c192bb52567 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 14 Aug 2024 10:58:07 -0400 Subject: [PATCH 382/433] Add detail to test comment about candidate rotation parameters. --- tests/test_orient_d2.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index c319be4acc..e83fcd37c7 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -23,6 +23,10 @@ # Since these tests are optimized for runtime, detuned parameters cause # the algorithm to be fickle, especially for small problem sizes. +# In particular, the parameters `grid_res`, inplane_res`, and `eq_min_dist` +# which control the number of candidate rotations used in the D2 algorithm +# will produce bad estimates if the candidates do not align closely with the +# ground truth rotations. # This seed is chosen so the tests pass CI on github's envs as well # as our self-hosted runner. SEED = 3 From b74aff6b9a52a64d17326ba4ce4e27b0a7fe9bc5 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 14 Aug 2024 11:39:57 -0400 Subject: [PATCH 383/433] cache source in test --- tests/test_orient_d2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index e83fcd37c7..dee2f25d8e 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -71,6 +71,7 @@ def source(n_img, resolution, dtype, offsets): amplitudes=1, seed=SEED, ) + src = src.cache() # Precompute image stack return src From 0529b525bfaf317961578c0f635bc6c9ab09fedc Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 14 Aug 2024 12:04:55 -0400 Subject: [PATCH 384/433] Use randomly ordered Rijs for J-sync tests --- tests/test_orient_d2.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index dee2f25d8e..4d79d37b0f 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -178,9 +178,9 @@ def test_global_J_sync(orient_est): rots = orient_est.src.rotations Rijs = np.zeros((orient_est.n_pairs, 4, 3, 3), dtype=orient_est.dtype) for p, (i, j) in enumerate(orient_est.pairs): - for k, g in enumerate(orient_est.gs): - k = (k + p) % 4 # Mix up the ordering of Rijs - Rijs[p, k] = rots[i].T @ g @ rots[j] + Rij = rots[i].T @ orient_est.gs @ rots[j] + np.random.shuffle(Rij) # Mix up the ordering of Rijs + Rijs[p] = Rij # J-conjugate a random set of Rijs. Rijs_conj = Rijs.copy() @@ -245,9 +245,9 @@ def test_global_J_sync_single_triplet(dtype): rots = orient_est.src.rotations Rijs = np.zeros((orient_est.n_pairs, 4, 3, 3), dtype=orient_est.dtype) for p, (i, j) in enumerate(orient_est.pairs): - for k, g in enumerate(orient_est.gs): - k = (k + p) % 4 # Mix up the ordering of Rijs - Rijs[p, k] = rots[i].T @ g @ rots[j] + Rij = rots[i].T @ orient_est.gs @ rots[j] + np.random.shuffle(Rij) # Mix up the ordering of Rijs + Rijs[p] = Rij # J-conjugate a random Rij. Rijs_conj = Rijs.copy() From 1661984d83327630631b3f5f938e87fcf917aff8 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 14 Aug 2024 16:04:47 -0400 Subject: [PATCH 385/433] randomize color sync test --- tests/test_orient_d2.py | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index 4d79d37b0f..7e997fa8b2 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -268,10 +268,20 @@ def test_sync_colors(orient_est): # Grab set of rotations and generate a set of relative rotations, Rijs. rots = orient_est.src.rotations Rijs = np.zeros((orient_est.n_pairs, 4, 3, 3), dtype=orient_est.dtype) + gt_colors = np.zeros((orient_est.n_pairs, 3), dtype=int) for p, (i, j) in enumerate(orient_est.pairs): - for k, g in enumerate(orient_est.gs): - k = (k + p) % 4 # Mix up the ordering of Rijs - Rijs[p, k] = rots[i].T @ g @ rots[j] + gs = orient_est.gs + if p > 0: + np.random.shuffle(gs) # Mix up the ordering of all but 1st Rijs + + # Compute the rotation row permutation created by the ordering of gs. + # See Proposition 5.1 in the related publication for details. + for m in range(3): + gt_colors[p, m] = np.argmax(np.sum(abs(0.5 * (gs[0] + gs[m + 1])), axis=0)) + + # Compute Rijs with shuffled gs. + Rij = rots[i].T @ gs @ rots[j] + Rijs[p] = Rij # Perform color synchronization. # Rijs_rows is shape (n_pairs, 3, 3, 3) where Rijs_rows[ij, m] corresponds @@ -284,7 +294,8 @@ def test_sync_colors(orient_est): vijs = np.zeros((orient_est.n_pairs, 3, 3, 3), dtype=orient_est.dtype) for p, (i, j) in enumerate(orient_est.pairs): for m in range(3): - vijs[p, m] = np.outer(rots[i][m], rots[j][m]) + row = gt_colors[p, m] + vijs[p, m] = np.outer(rots[i][row], rots[j][row]) # Reshape `colors` to shape (n_pairs, 3) and use to index Rijs_rows into the # correctly order 3rd row outer products vijs. @@ -303,17 +314,14 @@ def test_sync_colors(orient_est): # Apply this mapping to all rows of the colors array colors_mapped = mapping[colors] - # Synchronize Rijs_rows according to the color map. - row_indices = np.arange(orient_est.n_pairs)[:, None] - Rijs_rows_synced = Rijs_rows[row_indices, colors_mapped] + # Check that remapped color permutations match ground truth. + np.testing.assert_allclose(colors_mapped, gt_colors) # Rijs_rows_synced should match the ground truth vijs up to the sign of each row. # So we multiply by the sign of the first column of the last two axes to sync signs. vijs = vijs * np.sign(vijs[..., 0])[..., None] - Rijs_rows_synced = Rijs_rows_synced * np.sign(Rijs_rows_synced[..., 0])[..., None] - np.testing.assert_allclose( - vijs, Rijs_rows_synced, atol=utest_tolerance(orient_est.dtype) - ) + Rijs_rows = Rijs_rows * np.sign(Rijs_rows[..., 0])[..., None] + np.testing.assert_allclose(vijs, Rijs_rows, atol=utest_tolerance(orient_est.dtype)) # Check dtype pass-through. assert Rijs_rows.dtype == orient_est.dtype From 951b369a9ac1c55c517db51026afbc0a8e5a195e Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 15 Aug 2024 09:07:36 -0400 Subject: [PATCH 386/433] Add documentation to color_sync test. --- tests/test_orient_d2.py | 58 +++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index 7e997fa8b2..855d80cfa2 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -265,6 +265,24 @@ def test_global_J_sync_single_triplet(dtype): def test_sync_colors(orient_est): + """ + A set of estimated relative rotations, Rijs, have the shape (n_pairs, 4, 3, 3), + where each 4-tuple Rij is given by Rij = Ri.T @ g_m @ Rj, for m in [0, 1, 2, 3], + where each g_m is an element of the D2 symmetry group. The ordering of the symmetry + group elements, g_m, is unknown and independent between Rijs. The `_sync_colors` + algorithm forms the set of vijs of shape (n_pairs, 3, 3, 3), where each vij, given + by vij = (Rij[0] + Rij[m]) / 2 with m = 1, 2, 3, is some permutation of the outer + products of the k'th rows of the rotation matrices Ri and Rj, for k = 0, 1, 2. + + The 'sync_colors` algorithm uses a colored graph to partition the set of vijs + based on k'th row outer products and returns those outer products along with + a color mapping encoding a permutation for each vij. + + In this test we form a set of Rijs with randomly ordered symmetry group elements + and extract the ground truth color permutations based on that ordering. We then + construct a set of ground truth vijs adjusted by the ground truth color permuations. + We then compare estimated vijs and color permutations to ground truth. + """ # Grab set of rotations and generate a set of relative rotations, Rijs. rots = orient_est.src.rotations Rijs = np.zeros((orient_est.n_pairs, 4, 3, 3), dtype=orient_est.dtype) @@ -283,13 +301,6 @@ def test_sync_colors(orient_est): Rij = rots[i].T @ gs @ rots[j] Rijs[p] = Rij - # Perform color synchronization. - # Rijs_rows is shape (n_pairs, 3, 3, 3) where Rijs_rows[ij, m] corresponds - # to the outer product vij_m = rots[i, m].T @ rots[j, m] where m is the m'th row - # of the rotations matrices Ri and Rj. `colors` partitions the set of Rijs_rows - # such that the indices of `colors` corresponds to the row index m. - colors, Rijs_rows = orient_est._sync_colors(Rijs) - # Compute ground truth m'th row outer products. vijs = np.zeros((orient_est.n_pairs, 3, 3, 3), dtype=orient_est.dtype) for p, (i, j) in enumerate(orient_est.pairs): @@ -297,34 +308,41 @@ def test_sync_colors(orient_est): row = gt_colors[p, m] vijs[p, m] = np.outer(rots[i][row], rots[j][row]) - # Reshape `colors` to shape (n_pairs, 3) and use to index Rijs_rows into the + # Perform color synchronization. + # `est_vijs` is shape (n_pairs, 3, 3, 3) where est_vijs[ij, m] corresponds + # to the outer product vij_m = rots[i, m].T @ rots[j, m] where m is the m'th row + # of the rotations matrices Ri and Rj. `est_colors` partitions the set of `est_vijs` + # such that the indices of `est_colors` corresponds to the row index m. + est_colors, est_vijs = orient_est._sync_colors(Rijs) + + # Reshape `est_colors` to shape (n_pairs, 3) and use to index est_vijs into the # correctly order 3rd row outer products vijs. - colors = colors.reshape(orient_est.n_pairs, 3) + est_colors = est_colors.reshape(orient_est.n_pairs, 3) - # `colors` is an arbitrary permutation (but globally consistent), and we know - # that colors[0] should correspond to the ordering [0, 1, 2] due to the construction + # `est_colors` is an arbitrary permutation (but globally consistent), and we know + # that est_colors[0] should correspond to the ordering [0, 1, 2] due to the construction # of Rijs[0] using the symmetric rotations g0, g1, g2, g3 in non-permuted order. - # So we sort the columns such that colors[0] = [0,1,2]. + # So we sort the columns such that est_colors[0] = [0,1,2]. # Create a mapping array - perm = colors[0] + perm = est_colors[0] mapping = np.zeros_like(perm) mapping[perm] = np.arange(3) - # Apply this mapping to all rows of the colors array - colors_mapped = mapping[colors] + # Apply this mapping to all rows of the est_colors array + est_colors_mapped = mapping[est_colors] # Check that remapped color permutations match ground truth. - np.testing.assert_allclose(colors_mapped, gt_colors) + np.testing.assert_allclose(est_colors_mapped, gt_colors) - # Rijs_rows_synced should match the ground truth vijs up to the sign of each row. + # est_vijs_synced should match the ground truth vijs up to the sign of each row. # So we multiply by the sign of the first column of the last two axes to sync signs. vijs = vijs * np.sign(vijs[..., 0])[..., None] - Rijs_rows = Rijs_rows * np.sign(Rijs_rows[..., 0])[..., None] - np.testing.assert_allclose(vijs, Rijs_rows, atol=utest_tolerance(orient_est.dtype)) + est_vijs = est_vijs * np.sign(est_vijs[..., 0])[..., None] + np.testing.assert_allclose(vijs, est_vijs, atol=utest_tolerance(orient_est.dtype)) # Check dtype pass-through. - assert Rijs_rows.dtype == orient_est.dtype + assert est_vijs.dtype == orient_est.dtype def test_sync_signs(orient_est): From 76d8f8c05df0bb09fd6ac5666659223a8d706f2a Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 26 Aug 2024 10:17:25 -0400 Subject: [PATCH 387/433] remove F-order flatten --- src/aspire/abinitio/commonline_d2.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index f6d6766a52..231cd7a64d 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -531,7 +531,7 @@ def _generate_scl_scores_idx_map(self): # First the map for i Date: Mon, 26 Aug 2024 14:36:27 -0400 Subject: [PATCH 388/433] Reword docstring --- src/aspire/abinitio/commonline_d2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 231cd7a64d..66c6debadb 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -653,7 +653,7 @@ def _compute_scl_scores(self): def _all_eq_measures(self, corrs): """ - Compute a measure of how much an image from data is close to an equator. + Compute a measure indicating how likely an image is an equator image. :param corrs: Correlation table of shape (n_theta // 2, n_theta). From 62de30c946acfe7e64db02367b7c7ccc6d9fddb3 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 27 Aug 2024 10:49:20 -0400 Subject: [PATCH 389/433] Add docstrings --- src/aspire/abinitio/commonline_d2.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 66c6debadb..7a3d3b1652 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -580,7 +580,6 @@ def _generate_scl_scores_idx_map(self): tmp2 = oct2_ij_map[:, :, 1].flatten() self.oct2_ij_map = np.column_stack((tmp1, tmp2)) - ############################################## # Compute Self-Commonline Correlation Scores # ############################################## @@ -751,7 +750,7 @@ def _compute_cl_scores(self): desc="Searching for commonlines between pairs of images", total=n_pairs ) - # Vectorize over pairs of images + # For each i'th image compute the correlation with all j'th images, j > i. for i in range(self.n_img - 1): pf_i = self.pf_shifted[i] scores_i = self.scls_scores[i] @@ -766,7 +765,6 @@ def _compute_cl_scores(self): corrs = np.max(corrs, axis=1) # Max over shifts # Take the product over symmetrically induced candidates. Eq. 4.5 in paper. - # Vectorize extraction and processing of correlations prod_corrs = corrs[:, cl_idx[0], cl_idx[1]] prod_corrs = prod_corrs.reshape(n_pf_js, len(prod_corrs[0]) // 4, 4) prod_corrs = np.prod(prod_corrs, axis=2) @@ -815,6 +813,16 @@ def _get_Rijs_from_lin_idx(self, lin_idx): return Rijs_est def _get_Rijs_from_oct(self, lin_idx, octant=1): + """ + Calculate estimated relative rotations Rijs from the linear indices of + common-lines estimates from the search table. Rijs are generated from the + rotation grids from which the common-lines table was generated. + + :param lin_idx: Set of linear indices corresponding to best estimate of Rijs. + :param octant: Octant of rotation grid from which the Rj rotation was selected + when generating the common-lines table. + :return: Estimated Rijs. + """ if octant not in [1, 2]: raise ValueError("`octant` must be 1 or 2.") @@ -1128,6 +1136,16 @@ def _sync_colors(self, Rijs): return cp, Rijs_rows def _match_colors(self, Rijs_rows): + """ + Partition the set of matrices Rijs_rows, which correspond to a permutation of + the outer products of the m'th rows of Ri and Rj, into 3 sets of matrices each + corresponding to an m'th row. Returns the permutations which induce the partition. + + :param Rijs_rows: An n_pairsx3x3x3 array of m'th row outer products for the pairs + Ri, Rj, where Rijs_rows[:, i] is the m'th row outer product of unknown row m. + :return: n_pairs length array corresponding to the permutation which color matches + Rijs_rows. + """ Rijs_rows_t = np.transpose(Rijs_rows, (0, 1, 3, 2)) trip_perms = np.array( [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]], From c24609e5ed756baf8f324fcbf4c2f3ca27b57aac Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 5 Sep 2024 11:00:15 -0400 Subject: [PATCH 390/433] Use number rays in 2 degrees instead 2 pf rays in all_eq_measures. --- src/aspire/abinitio/commonline_d2.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 7a3d3b1652..099827b29d 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -698,7 +698,9 @@ def _all_eq_measures(self, corrs): # between one Fourier ray of the normal to a self common line candidate t_i # with its anti-podal as an additional way to measure if the image is an # equator and t_i+0.5*pi is the normal to its self common line. - r = 2 # Search radius within 2 adjacent rays of normal ray. + r = np.ceil(2 * L / 360).astype( + int + ) # Search radius within 2 degrees of normal ray. # Generate indices for normal to scl index. normal_2_scl_idx_0 = ( From fc43511ba5f9187099aaf87b6c1208ae0d4f9b41 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 5 Sep 2024 11:03:13 -0400 Subject: [PATCH 391/433] Add comment about necessary ordering of D2 symmetry group elements. --- src/aspire/abinitio/commonline_d2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 099827b29d..1cd6190c03 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -80,6 +80,7 @@ def __init__( # D2 symmetry group. # Rearrange in order Identity, about_x, about_y, about_z. + # This ordering is necessary for reproducing MATLAB code results. self.gs = DnSymmetryGroup(order=2, dtype=self.dtype).matrices[[0, 3, 2, 1]] def estimate_rotations(self): From 97e7efccdd7be578169836d98be1c28adfcfa719 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 5 Sep 2024 11:26:14 -0400 Subject: [PATCH 392/433] black --- src/aspire/abinitio/commonline_d2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 1cd6190c03..0abc0488f8 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -80,7 +80,7 @@ def __init__( # D2 symmetry group. # Rearrange in order Identity, about_x, about_y, about_z. - # This ordering is necessary for reproducing MATLAB code results. + # This ordering is necessary for reproducing MATLAB code results. self.gs = DnSymmetryGroup(order=2, dtype=self.dtype).matrices[[0, 3, 2, 1]] def estimate_rotations(self): From 59db8a69b9808b23c45f24d1f82db9ba20cfef01 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 5 Sep 2024 12:09:41 -0400 Subject: [PATCH 393/433] revert all_eq_measures search radius. --- src/aspire/abinitio/commonline_d2.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 0abc0488f8..ae820d9790 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -699,9 +699,7 @@ def _all_eq_measures(self, corrs): # between one Fourier ray of the normal to a self common line candidate t_i # with its anti-podal as an additional way to measure if the image is an # equator and t_i+0.5*pi is the normal to its self common line. - r = np.ceil(2 * L / 360).astype( - int - ) # Search radius within 2 degrees of normal ray. + r = 2 # Search radius within 2 adjacent rays of normal ray. # Generate indices for normal to scl index. normal_2_scl_idx_0 = ( From 758885ba6296688e99dd615f06cbf630cf83c7da Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 5 Sep 2024 12:11:38 -0400 Subject: [PATCH 394/433] black --- src/aspire/abinitio/commonline_d2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index ae820d9790..95d5d5db59 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -699,7 +699,7 @@ def _all_eq_measures(self, corrs): # between one Fourier ray of the normal to a self common line candidate t_i # with its anti-podal as an additional way to measure if the image is an # equator and t_i+0.5*pi is the normal to its self common line. - r = 2 # Search radius within 2 adjacent rays of normal ray. + r = 2 # Search radius within 2 adjacent rays of normal ray. # Generate indices for normal to scl index. normal_2_scl_idx_0 = ( From 019b69a1c55545bcffc405999e37378865ff5252 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 10 Sep 2024 11:10:49 -0400 Subject: [PATCH 395/433] Add seed to sporadically failing test. --- tests/test_orient_d2.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index 855d80cfa2..25b193a629 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -5,6 +5,7 @@ from aspire.source import Simulation from aspire.utils import ( J_conjugate, + Random, Rotation, all_pairs, mean_aligned_angular_distance, @@ -287,19 +288,23 @@ def test_sync_colors(orient_est): rots = orient_est.src.rotations Rijs = np.zeros((orient_est.n_pairs, 4, 3, 3), dtype=orient_est.dtype) gt_colors = np.zeros((orient_est.n_pairs, 3), dtype=int) - for p, (i, j) in enumerate(orient_est.pairs): - gs = orient_est.gs - if p > 0: - np.random.shuffle(gs) # Mix up the ordering of all but 1st Rijs - - # Compute the rotation row permutation created by the ordering of gs. - # See Proposition 5.1 in the related publication for details. - for m in range(3): - gt_colors[p, m] = np.argmax(np.sum(abs(0.5 * (gs[0] + gs[m + 1])), axis=0)) - # Compute Rijs with shuffled gs. - Rij = rots[i].T @ gs @ rots[j] - Rijs[p] = Rij + with Random(1234): + for p, (i, j) in enumerate(orient_est.pairs): + gs = orient_est.gs + if p > 0: + np.random.shuffle(gs) # Mix up the ordering of all but 1st Rijs. + + # Compute the rotation row permutation created by the ordering of gs. + # See Proposition 5.1 in the related publication for details. + for m in range(3): + gt_colors[p, m] = np.argmax( + np.sum(abs(0.5 * (gs[0] + gs[m + 1])), axis=0) + ) + + # Compute Rijs with shuffled gs. + Rij = rots[i].T @ gs @ rots[j] + Rijs[p] = Rij # Compute ground truth m'th row outer products. vijs = np.zeros((orient_est.n_pairs, 3, 3, 3), dtype=orient_est.dtype) From 0f498f40d21730914c92f6e8f474dcebfb25c76f Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 10 Sep 2024 11:33:05 -0400 Subject: [PATCH 396/433] revert search radius --- src/aspire/abinitio/commonline_d2.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 95d5d5db59..0abc0488f8 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -699,7 +699,9 @@ def _all_eq_measures(self, corrs): # between one Fourier ray of the normal to a self common line candidate t_i # with its anti-podal as an additional way to measure if the image is an # equator and t_i+0.5*pi is the normal to its self common line. - r = 2 # Search radius within 2 adjacent rays of normal ray. + r = np.ceil(2 * L / 360).astype( + int + ) # Search radius within 2 degrees of normal ray. # Generate indices for normal to scl index. normal_2_scl_idx_0 = ( From e5f61a5906900d30f6d6c7bf4172e7cab7f6d862 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 13 Sep 2024 09:22:55 -0400 Subject: [PATCH 397/433] typo --- src/aspire/abinitio/commonline_d2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 0abc0488f8..f7e0a86e87 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -49,7 +49,7 @@ def __init__( :param grid_res: Number of sampling points on sphere for projetion directions. These are generated using the Saaf-Kuijlaars algorithm. Default value is 1200. :param inplane_res: The sampling resolution of in-plane rotations for each - projetion direction. Default value is 5 degrees. + projection direction. Default value is 5 degrees. :param eq_min_dist: Width of strip around equator projection directions from which we do not sample directions. Default value is 7 degrees. :param epsilon: Tolerance for J-synchronization power method. From a3be20b4c753e167f63321e3c1e43af6f71abecf Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 13 Sep 2024 11:23:03 -0400 Subject: [PATCH 398/433] Use np.nonzero instead of np.where. --- src/aspire/abinitio/commonline_d2.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index f7e0a86e87..4c43bdcff5 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -272,7 +272,7 @@ def _generate_commonline_angles( cl_angles = np.zeros((2, n_pairs, n_theta, n_theta // 2, 4, 2)) for i in range(n_rots_i): - unique_pairs_i = np.where(eq2eq_Rij_table[i])[0] + unique_pairs_i = np.nonzero(eq2eq_Rij_table[i])[0] if len(unique_pairs_i) == 0: continue Ri = Ris[i] @@ -355,8 +355,8 @@ def _generate_scl_lookup_data(self): non_eq_idx[:, 0] = ( np.hstack( ( - np.where(self.eq_class1 == 0)[0], - len(self.eq_class1) + np.where(self.eq_class2 == 0)[0], + np.nonzero(self.eq_class1 == 0)[0], + len(self.eq_class1) + np.nonzero(self.eq_class2 == 0)[0], ) ) * self.n_inplane_rots @@ -368,8 +368,8 @@ def _generate_scl_lookup_data(self): # Non-topview equator indices. self.non_tv_eq_idx = np.concatenate( ( - np.where(self.eq_class1 > 0)[0], - len(self.eq_class1) + np.where(self.eq_class2 > 0)[0], + np.nonzero(self.eq_class1 > 0)[0], + len(self.eq_class1) + np.nonzero(self.eq_class2 > 0)[0], ) ) @@ -485,7 +485,7 @@ def _generate_scl_indices(self, scl_angles, eq_class): # As indicated above for equator candidate, for each self common line we # don't get a single coordinate but a range of them. Here we register a # list of coordinates for each such self common line candidate. - non_top_view_eq_idx = np.where(eq_class > 0)[0] + non_top_view_eq_idx = np.nonzero(eq_class > 0)[0] n_eq = len(non_top_view_eq_idx) n_inplane_rots = scl_angles.shape[1] count_eq = 0 From 01bc73409e7f99d79b42486e955a675fad77cd4b Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 13 Sep 2024 15:23:08 -0400 Subject: [PATCH 399/433] lowercase --- tests/test_orient_d2.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index 25b193a629..e9dbae5b0b 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -79,7 +79,7 @@ def source(n_img, resolution, dtype, offsets): @pytest.fixture(scope="module") def orient_est(source): - return build_CL_from_source(source) + return build_cl_from_source(source) ######### @@ -140,22 +140,22 @@ def test_scl_scores(orient_est): ) # Initialize CL instance with new source. - CL = build_CL_from_source(src) + cl = build_cl_from_source(src) # Generate lookup data. - CL._compute_shifted_pf() - CL._generate_lookup_data() - CL._generate_scl_lookup_data() + cl._compute_shifted_pf() + cl._generate_lookup_data() + cl._generate_scl_lookup_data() # Compute self-commonline scores. - CL._compute_scl_scores() + cl._compute_scl_scores() - # CL.scls_scores is shape (n_img, n_cand_rots). Since we used the first + # cl.scls_scores is shape (n_img, n_cand_rots). Since we used the first # 10 candidate rotations of the first non-equator viewing direction as our # Simulation rotations, the maximum correlation for image i should occur at - # candidate rotation index (non_eq_idx * CL.n_inplane_rots + i). - max_corr_idx = np.argmax(CL.scls_scores, axis=1) - gt_idx = non_eq_idx * CL.n_inplane_rots + np.arange(10) + # candidate rotation index (non_eq_idx * cl.n_inplane_rots + i). + max_corr_idx = np.argmax(cl.scls_scores, axis=1) + gt_idx = non_eq_idx * cl.n_inplane_rots + np.arange(10) # Check that self-commonline indices match ground truth. n_match = np.sum(max_corr_idx == gt_idx) @@ -165,7 +165,7 @@ def test_scl_scores(orient_est): np.testing.assert_array_less(match_tol, n_match / src.n) # Check dtype pass-through. - assert CL.scls_scores.dtype == orient_est.dtype + assert cl.scls_scores.dtype == orient_est.dtype def test_global_J_sync(orient_est): @@ -240,7 +240,7 @@ def test_global_J_sync_single_triplet(dtype): """ # Generate 3 image source and orientation object. src = Simulation(n=3, L=10, dtype=dtype, seed=SEED) - orient_est = build_CL_from_source(src) + orient_est = build_cl_from_source(src) # Grab set of rotations and generate a set of relative rotations, Rijs. rots = orient_est.src.rotations @@ -455,7 +455,7 @@ def g_sync_d2(rots, rots_gt): return rots_gt_sync -def build_CL_from_source(source): +def build_cl_from_source(source): # Search for common lines over less shifts for 0 offsets. max_shift = 0 shift_step = 1 From 3bac98424a02c3d3aaf4d02a60f4be927d29dbcf Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Fri, 13 Sep 2024 15:25:15 -0400 Subject: [PATCH 400/433] use ints --- src/aspire/abinitio/commonline_d2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 4c43bdcff5..2f0f29f24a 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1167,7 +1167,7 @@ def _match_colors(self, Rijs_rows): ) m = np.zeros((6, 6), dtype=self.dtype) - colors_i = np.zeros((len(self.triplets), 3), dtype=self.dtype) # ints? + colors_i = np.zeros((len(self.triplets), 3), dtype=int) n_trip = len(self.triplets) votes = np.zeros((n_trip)) trip_idx = 0 From d102991abed7999395edf2b5ee95b38f47134d98 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 16 Sep 2024 11:24:45 -0400 Subject: [PATCH 401/433] input/output docs --- src/aspire/abinitio/commonline_d2.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 2f0f29f24a..aa2ec66a5c 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1097,6 +1097,15 @@ def _sync_colors(self, Rijs): The color sync procedure partitions the set of 3-tuples of m'th row outer products into 3 sets of row-consistent outer products up to the sign of each. + + :param Rijs: Array of shape (n_pairs,4,3,3) consisting of the n_pairs of + hand-consistent 4-tuples of Rijs. + :returns: + - cp, A color mapping vector of length (n_pairs * 3) which permutes + the 3-tuples of `Rijs_rows` to be globally row-consistent. + - Rijs_rows, An array of color synchronized rotations' rows outer products of + shape (n_pairs, 3, 3, 3), where each Rijs_rows[ij] corresponds to a 3-tuple + of m'th row outer product matrices, some of which having a spurious -1. """ logger.info("Performing rotations' rows synchronization.") # Generate array of one rank matrices from which we can extract rows. From ee0e152715aeb46de723507b7781158f56f9c11d Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 17 Sep 2024 14:34:36 -0400 Subject: [PATCH 402/433] break up _sync_signs --- src/aspire/abinitio/commonline_d2.py | 121 ++++++++++++++++++++------- 1 file changed, 89 insertions(+), 32 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index aa2ec66a5c..29a45ff3ec 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1299,10 +1299,10 @@ def _mult_cmat_by_vec(self, c_perms, v): trip_idx = 0 for i in range(self.n_img): for j in range(i + 1, self.n_img - 1): - ij = 3 * self.pairs_to_linear[i, j] + ij_block = 3 * self.pairs_to_linear[i, j] for k in range(j + 1, self.n_img): - ik = 3 * self.pairs_to_linear[i, k] - jk = 3 * self.pairs_to_linear[j, k] + ik_block = 3 * self.pairs_to_linear[i, k] + jk_block = 3 * self.pairs_to_linear[j, k] # Extract permutation indices from c_perms n = c_perms[trip_idx] @@ -1319,36 +1319,36 @@ def _mult_cmat_by_vec(self, c_perms, v): # Multiply vector by color matrix # Upper triangular part - p = t_perms[p_n1] + ik - out[ij] = out[ij] - v[p[1]] - v[p[2]] + v[p[0]] - out[ij + 1] = out[ij + 1] - v[p[0]] - v[p[2]] + v[p[1]] - out[ij + 2] = out[ij + 2] - v[p[0]] - v[p[1]] + v[p[2]] + p = t_perms[p_n1] + ik_block + out[ij_block] = out[ij_block] - v[p[1]] - v[p[2]] + v[p[0]] + out[ij_block + 1] = out[ij_block + 1] - v[p[0]] - v[p[2]] + v[p[1]] + out[ij_block + 2] = out[ij_block + 2] - v[p[0]] - v[p[1]] + v[p[2]] - p = t_perms[p_n2] + jk - out[ij] = out[ij] - v[p[1]] - v[p[2]] + v[p[0]] - out[ij + 1] = out[ij + 1] - v[p[0]] - v[p[2]] + v[p[1]] - out[ij + 2] = out[ij + 2] - v[p[0]] - v[p[1]] + v[p[2]] + p = t_perms[p_n2] + jk_block + out[ij_block] = out[ij_block] - v[p[1]] - v[p[2]] + v[p[0]] + out[ij_block + 1] = out[ij_block + 1] - v[p[0]] - v[p[2]] + v[p[1]] + out[ij_block + 2] = out[ij_block + 2] - v[p[0]] - v[p[1]] + v[p[2]] - p = i_perms[p_n3] + jk - out[ik] = out[ik] - v[p[1]] - v[p[2]] + v[p[0]] - out[ik + 1] = out[ik + 1] - v[p[0]] - v[p[2]] + v[p[1]] - out[ik + 2] = out[ik + 2] - v[p[0]] - v[p[1]] + v[p[2]] + p = i_perms[p_n3] + jk_block + out[ik_block] = out[ik_block] - v[p[1]] - v[p[2]] + v[p[0]] + out[ik_block + 1] = out[ik_block + 1] - v[p[0]] - v[p[2]] + v[p[1]] + out[ik_block + 2] = out[ik_block + 2] - v[p[0]] - v[p[1]] + v[p[2]] # Lower triangular part - p = i_perms[p_n1] + ij - out[ik] = out[ik] - v[p[1]] - v[p[2]] + v[p[0]] - out[ik + 1] = out[ik + 1] - v[p[0]] - v[p[2]] + v[p[1]] - out[ik + 2] = out[ik + 2] - v[p[0]] - v[p[1]] + v[p[2]] - - p = i_perms[p_n2] + ij - out[jk] = out[jk] - v[p[1]] - v[p[2]] + v[p[0]] - out[jk + 1] = out[jk + 1] - v[p[0]] - v[p[2]] + v[p[1]] - out[jk + 2] = out[jk + 2] - v[p[0]] - v[p[1]] + v[p[2]] - - p = t_perms[p_n3] + ik - out[jk] = out[jk] - v[p[1]] - v[p[2]] + v[p[0]] - out[jk + 1] = out[jk + 1] - v[p[0]] - v[p[2]] + v[p[1]] - out[jk + 2] = out[jk + 2] - v[p[0]] - v[p[1]] + v[p[2]] + p = i_perms[p_n1] + ij_block + out[ik_block] = out[ik_block] - v[p[1]] - v[p[2]] + v[p[0]] + out[ik_block + 1] = out[ik_block + 1] - v[p[0]] - v[p[2]] + v[p[1]] + out[ik_block + 2] = out[ik_block + 2] - v[p[0]] - v[p[1]] + v[p[2]] + + p = i_perms[p_n2] + ij_block + out[jk_block] = out[jk_block] - v[p[1]] - v[p[2]] + v[p[0]] + out[jk_block + 1] = out[jk_block + 1] - v[p[0]] - v[p[2]] + v[p[1]] + out[jk_block + 2] = out[jk_block + 2] - v[p[0]] - v[p[1]] + v[p[2]] + + p = t_perms[p_n3] + ik_block + out[jk_block] = out[jk_block] - v[p[1]] - v[p[2]] + v[p[0]] + out[jk_block + 1] = out[jk_block + 1] - v[p[0]] - v[p[2]] + v[p[1]] + out[jk_block + 2] = out[jk_block + 2] - v[p[0]] - v[p[1]] + v[p[2]] return out def _unmix_colors(self, color_vecs): @@ -1434,8 +1434,14 @@ def R_theta(theta): def _sync_signs(self, rr, c_vec): """ This function executes the final stage of the algorithm, Signs - synchroniztion. At the end all rows of the rotations Ri are exctracted - and the matrices Ri are assembled. + synchroniztion. At this point, we have rotation rows + rr[ij, m] = sij_m * vi_m.T @ vj_m, where vi_m, vj_m are the m'th rows + of rotation matrices Ri and Rj and sij_m is an unknown sign. This method + uses the permutation vector, `c_vec`, to partition the rotation row + outer products and constructs a symmetric block matrix, H, with ij'th block + sij * vi.T @ vj. The signs sij are then adjusted so that H is rank-1. This + matrix is then factored to extract the rows of each rotation matrix. At the + end all rows of the rotations Ri are exctracted and the matrices Ri are assembled. :param rr: Array of color synchronized rotations' rows outer products of shape (n_pairs, 3, 3, 3), where each rr[ij] corresponds to a 3-tuple @@ -1445,6 +1451,28 @@ def _sync_signs(self, rr, c_vec): :return: n_img x 3 x 3 array of rotation matrices. """ logger.info("Performing signs synchronization.") + c_mat, c_mat_5d, c_mat_4d = self._construct_color_mats(rr, c_vec) + + sync_signs2 = self._compute_signs(c_mat_5d, c_mat_4d) + + rows_arr = self._estimate_rows(sync_signs2, c_mat_5d) + + signs = self._compute_signs_adjustment(rows_arr) + + rots = self._extract_rotations(c_mat, signs) + + return rots + + def _construct_color_mats(self, rr, c_vec): + """ + Construct the partitioned row synchronized color matrices, `c_mat`, where + c_mat[m] contains the 3x3 blocks sij*vi_m.T @ vj_m, where vi_m is the m'th + row of the i'th rotation Ri and sij is the unknown sign. + + :param rr: Non-partitioned rotation row matrices. + :param c_vec: Color partition vector. + :return: Partitioned row synchronized color matrices. + """ # Partition the union of tuples {0.5*(Ri^TRj+Ri^TgkRj), k=1:3} according # to the color partition established in color synchronization procedure. # The partition is stored in two different arrays each with the purpose @@ -1494,6 +1522,12 @@ def _sync_signs(self, rr, c_vec): for i in range(self.n_img): c_mat[c, i, :, i, :] = c_mat_5d[i, i, c] + return c_mat, c_mat_5d, c_mat_4d + + def _compute_signs(self, c_mat_5d, c_mat_4d): + """ + Compute signs for adjusting `c_mat` to be composed of all rank-1 3x3 blocks. + """ # To decompose cMat as a rank 1 matrix we need to adjust the signs of the # Qij^c so that sign(Qij^c*Qjk^c) = sign(Qik^c) for all c=1,2,3 and (i,j). # In practice we compare the sign of the sum of the entries of Qij^c*Qjk^c @@ -1552,6 +1586,14 @@ def _sync_signs(self, rr, c_vec): ) # The function (1-x)/2 maps 1->0 and -1->1 + return sync_signs2 + + def _estimate_rows(self, sync_signs2, c_mat_5d): + """ + Construct 3N x 3N matrix of rank-1 3x3 blocks of sij*vi_m.T @ vj_m, + the leading eigenvectors of which correspond to estimates for the rows + of the rotations Ri, up to signs. + """ c_mat_5d_mp = np.concatenate((c_mat_5d, -c_mat_5d), axis=1) rows_arr = np.zeros((3, self.n_img, 3 * self.n_img), dtype=self.dtype) svals = np.zeros((3, 2, self.n_img), dtype=self.dtype) @@ -1586,6 +1628,12 @@ def _sync_signs(self, rr, c_vec): svals[c, :, r] = S[:2] rows_arr[c, r] = U[:, 0] + return rows_arr + + def _compute_signs_adjustment(self, rows_arr): + """ + Compute signs adjustment vector. + """ # Sync signs according to results for each image. Dot products between # signed row estimates are used to construct an (N over 2)x(N over 2) # sign synchronization matrix S. If (v_i)k and (v_j)k are the i'th and @@ -1640,8 +1688,17 @@ def _sync_signs(self, rr, c_vec): signs[c] = U[:, -1] # svds returns in ascending order s_out[c] = S[::-1] - signs = np.sign(signs) + return np.sign(signs) + def _extract_rotations(self, c_mat, signs): + """ + Adjust the signs of each block of `c_mat` then extract the rotation + rows and construct the estimated rotations. + + :param c_mat: The color synchronization matrix. + :param signs: The signs adjustment matrix. + :return: Estimated rotations. + """ # Adjust the signs of Qij^c in the matrices cMat(:,:,c) for all c=1,2,3 # and 1<=i Date: Tue, 17 Sep 2024 15:33:25 -0400 Subject: [PATCH 403/433] Rewrite docstring --- src/aspire/abinitio/commonline_d2.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 29a45ff3ec..db5f799630 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1149,9 +1149,18 @@ def _sync_colors(self, Rijs): def _match_colors(self, Rijs_rows): """ - Partition the set of matrices Rijs_rows, which correspond to a permutation of - the outer products of the m'th rows of Ri and Rj, into 3 sets of matrices each - corresponding to an m'th row. Returns the permutations which induce the partition. + For each triplet of indices i < j < k, we consider the m'th row outer products stored + as Rijs_rows, ie. Rijs_rows[ij], Rijs_rows[jk], and Rijs_rows[ik]. Recall that + Rijs_rows[ij, n], n=0,1,2, corresponds to the 3x3 outer product vi_m.T @ vj_m, where + vi_m is an unknown row of the rotation matrices Ri and Rj. For each triplet of these + sets of row outer products this method finds a permutation sigma such that + Rijs_rows[ij, sigma(n)], Rijs_rows[jk, sigma(n)], and Rijs_rows[ik, sigma(n)] all + correspond to the same m'th row outer product. + + Framed as graph partioning problem we are coloring the vertices, Rijs_rows[ij, n], + with three colors such that each color corresponds to the same row of the rotations + Ris. This method returns the permutation that rearanges the elements of each triplet + of Rijs to have matching color. :param Rijs_rows: An n_pairsx3x3x3 array of m'th row outer products for the pairs Ri, Rj, where Rijs_rows[:, i] is the m'th row outer product of unknown row m. From 7eea30599e70fb3809159c53870b2d378dde7628 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 17 Sep 2024 15:54:28 -0400 Subject: [PATCH 404/433] resolve numpy deprecation warning. --- tests/test_orient_d2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index e9dbae5b0b..7414729799 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -124,7 +124,7 @@ def test_scl_scores(orient_est): # In this case, we take first 10 candidates from a non-equator viewing direction. orient_est._generate_lookup_data() cand_rots = orient_est.inplane_rotated_grid1 - non_eq_idx = int(np.argwhere(orient_est.eq_class1 == 0)[0]) + non_eq_idx = int(np.argwhere(orient_est.eq_class1 == 0)[0][0]) rots = cand_rots[non_eq_idx, :10] angles = Rotation(rots).angles From 81f2687325856528dd633f0dbcb4863e04d976ba Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 17 Sep 2024 15:56:45 -0400 Subject: [PATCH 405/433] try diff seed --- tests/test_orient_d2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index 7414729799..ca972bcf7c 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -289,7 +289,7 @@ def test_sync_colors(orient_est): Rijs = np.zeros((orient_est.n_pairs, 4, 3, 3), dtype=orient_est.dtype) gt_colors = np.zeros((orient_est.n_pairs, 3), dtype=int) - with Random(1234): + with Random(123): for p, (i, j) in enumerate(orient_est.pairs): gs = orient_est.gs if p > 0: From 8ccada5e23ea96b01b9b8e2a3d34a83acdbdbfc4 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 18 Sep 2024 10:00:18 -0400 Subject: [PATCH 406/433] switch test to doubles to diagnose osx-arm failures. --- tests/test_orient_d2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index ca972bcf7c..f3a05821fd 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -17,7 +17,7 @@ # Parameters # ############## -DTYPE = [np.float32, pytest.param(np.float64, marks=pytest.mark.expensive)] +DTYPE = [np.float64, pytest.param(np.float32, marks=pytest.mark.expensive)] RESOLUTION = [48, 49] N_IMG = [10] OFFSETS = [0, pytest.param(None, marks=pytest.mark.expensive)] From b5856a1b315e24803bc17242b733ee9e09db6b00 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 18 Sep 2024 13:16:11 -0400 Subject: [PATCH 407/433] Remove eq_idx --- src/aspire/abinitio/commonline_d2.py | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index db5f799630..61fd954325 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -171,8 +171,8 @@ def _generate_lookup_data(self): # We detect such directions by taking a strip of radius # `eq_min_dist` about the 3 great circles perpendicular to the symmetry # axes of D2 (i.e to X,Y and Z axes). - eq_idx1, eq_class1 = self._mark_equators(sphere_grid1, self.eq_min_dist) - eq_idx2, eq_class2 = self._mark_equators(sphere_grid2, self.eq_min_dist) + eq_class1 = self._mark_equators(sphere_grid1, self.eq_min_dist) + eq_class2 = self._mark_equators(sphere_grid2, self.eq_min_dist) # Mark Top View Directions. # A Top view projection image is taken from the direction of one of the @@ -191,9 +191,6 @@ def _generate_lookup_data(self): # Remove top views from sphere grids and update equator indices and classes. self.sphere_grid1 = sphere_grid1[eq_class1 < 4] self.sphere_grid2 = sphere_grid2[eq_class2 < 4] - self.eq_idx1 = eq_idx1[eq_class1 < 4] - self.eq_idx2 = eq_idx2[eq_class2 < 4] - self.eq_idx = np.concatenate((self.eq_idx1, self.eq_idx2)) self.eq_class1 = eq_class1[eq_class1 < 4] self.eq_class2 = eq_class2[eq_class2 < 4] @@ -209,16 +206,12 @@ def _generate_lookup_data(self): cl_angles1, self.eq2eq_Rij_table_11 = self._generate_commonline_angles( self.inplane_rotated_grid1, self.inplane_rotated_grid1, - self.eq_idx1, - self.eq_idx1, self.eq_class1, self.eq_class1, ) cl_angles2, self.eq2eq_Rij_table_12 = self._generate_commonline_angles( self.inplane_rotated_grid1, self.inplane_rotated_grid2, - self.eq_idx1, - self.eq_idx2, self.eq_class1, self.eq_class2, same_octant=False, @@ -233,8 +226,6 @@ def _generate_commonline_angles( self, Ris, Rjs, - Ri_eq_idx, - Rj_eq_idx, Ri_eq_class, Rj_eq_class, same_octant=True, @@ -246,8 +237,6 @@ def _generate_commonline_angles( :param Ris: First set of candidate rotations. :param Rjs: Second set of candidate rotation. - :param Ri_eq_idx: Equator index mask. - :param Rj_eq_idx: Equator index mask. :param Ri_eq_class: Equator classification for Ris. :param Rj_eq_class: Equator classification for Rjs. :param same_octant: True if both sets of candidates are in the same octant. @@ -259,7 +248,7 @@ def _generate_commonline_angles( # Generate upper triangular table of indicators of all pairs which are not # equators with respect to the same symmetry axis (named unique_pairs). - eq_table = np.outer(Ri_eq_idx, Rj_eq_idx) + eq_table = np.outer(Ri_eq_class > 0, Rj_eq_class > 0) in_same_class = (Ri_eq_class[:, None] - Rj_eq_class.T[None]) == 0 eq2eq_Rij_table = ~(eq_table * in_same_class) @@ -320,12 +309,10 @@ def _generate_scl_lookup_data(self): # Get self-commonline angles. self.scl_angles1 = self._generate_scl_angles( self.inplane_rotated_grid1, - self.eq_idx1, self.eq_class1, ) self.scl_angles2 = self._generate_scl_angles( self.inplane_rotated_grid2, - self.eq_idx2, self.eq_class2, ) @@ -376,7 +363,7 @@ def _generate_scl_lookup_data(self): # Generate maps from scl indices to relative rotations. self._generate_scl_scores_idx_map() - def _generate_scl_angles(self, Ris, eq_idx, eq_class): + def _generate_scl_angles(self, Ris, eq_class): """ Generate self-commonline angles. For each candidate rotation a pair of self-commonline angles are generated for each of the 3 self-commonlines induced by D2 symmetry. @@ -1847,9 +1834,7 @@ def _mark_equators(sphere_grid, eq_filter_angle): :param eq_filter_angle: Angular distance from equator to be marked as an equator point. - :returns: - - eq_idx, a boolean mask for equator indices. - - eq_class, n_rots length array of values indicating equator class. + :return: eq_class, n_rots length array of values indicating equator class. """ # Project each vector onto xy, xz, yz planes and measure angular distance # from each plane. @@ -1866,7 +1851,6 @@ def _mark_equators(sphere_grid, eq_filter_angle): # Mark all views close to an equator. eq_min_dist = np.cos(eq_filter_angle * np.pi / 180) n_eqs = np.count_nonzero(angular_dists > eq_min_dist, axis=1) - eq_idx = n_eqs > 0 # Classify equators. # 0 -> non-equator view @@ -1889,7 +1873,7 @@ def _mark_equators(sphere_grid, eq_filter_angle): eq_view_class = np.argmax(angular_dists[eq_view_idx] > eq_min_dist, axis=1) eq_class[eq_view_idx] = eq_view_class + 1 - return eq_idx, eq_class + return eq_class @staticmethod def _generate_inplane_rots(sphere_grid, d_theta): From cda5e30f5b49de125c604aa8d9016063d974ef34 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Wed, 18 Sep 2024 14:45:46 -0400 Subject: [PATCH 408/433] Add descript of eq2eq table to docs. --- src/aspire/abinitio/commonline_d2.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 61fd954325..99bbf9d898 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -233,7 +233,11 @@ def _generate_commonline_angles( """ Compute commonline angles induced by the 4 sets of relative rotations Rij = Ri.T @ g_m @ Rj, m = 0,1,2,3, where g_m is the identity and rotations - about the three axes of symmetry of a D2 symmetric molecule. + about the three axes of symmetry of a D2 symmetric molecule. Note, we only + compute commonline angles between pairs of images which are not equator + images with respect to the same axis of symmetry. To do this we build a + table, `eq2eq_Rij_table`, which is `False` for pairs of images that are + equator images with respect to the same axis of symmetry and `True` otherwise. :param Ris: First set of candidate rotations. :param Rjs: Second set of candidate rotation. From 38d4e516828fafe7240f3f07b43f85d40efdf752 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 19 Sep 2024 08:58:24 -0400 Subject: [PATCH 409/433] add more documentation. --- src/aspire/abinitio/commonline_d2.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 99bbf9d898..847236854c 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -516,17 +516,33 @@ def _generate_scl_scores_idx_map(self): """ Generates lookup tables for maximum likelihood scheme to estimate commonlines between images. + + This method creates two lookup tables (`oct1_ij_map` and `oct2_ij_map`) + for pairs of candidate rotations (i, j) under the following conditions: + + 1. Both rotations Ri and Rj are in octant 1. + 2. Ri is in octant 1 and Rj is in octant 2. + + For each pair of candidate rotations the tables give a map into the set of + self-commonlines induced by those rotations. This table will be used later + to incorporate a likelihood score for self-commonlines into the likelihood + score for common lines for each pair of images. """ + # Calculate number of rotations in each octant. n_rot_1 = len(self.scl_idx_1) // (3 * self.n_inplane_rots) n_rot_2 = len(self.scl_idx_2) // (3 * self.n_inplane_rots) - # First the map for i Date: Thu, 19 Sep 2024 13:49:45 -0400 Subject: [PATCH 410/433] Always doubles for scipy LinearOperator --- src/aspire/abinitio/commonline_d2.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/aspire/abinitio/commonline_d2.py b/src/aspire/abinitio/commonline_d2.py index 847236854c..a8e951c642 100644 --- a/src/aspire/abinitio/commonline_d2.py +++ b/src/aspire/abinitio/commonline_d2.py @@ -1146,13 +1146,15 @@ def _sync_colors(self, Rijs): color_mat = la.LinearOperator( (3 * n_pairs,) * 2, lambda v: self._mult_cmat_by_vec(color_perms, v) ) - v0 = randn( - 3 * n_pairs, seed=self.seed - ) # Seed eigs initial vector for iterative method + + # Seed eigs initial vector for iterative method. + # scipy LinearOperator needs doubles for some architectures (arm). + v0 = randn(3 * n_pairs, seed=self.seed).astype(np.float64, copy=False) + v0 = v0 / norm(v0) vals, colors = la.eigs(color_mat, k=3, which="LR", v0=v0) vals = np.real(vals) - colors = np.real(colors) + colors = np.real(colors).astype(self.dtype, copy=False) colors = np.sign(colors[0]) * colors # Stable eigs cp, _ = self._unmix_colors(colors[:, :2]) From f31d317b53f54fdea136b81e0b6853c0136ecf09 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 19 Sep 2024 13:52:40 -0400 Subject: [PATCH 411/433] revert test to singles --- tests/test_orient_d2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_orient_d2.py b/tests/test_orient_d2.py index f3a05821fd..ca972bcf7c 100644 --- a/tests/test_orient_d2.py +++ b/tests/test_orient_d2.py @@ -17,7 +17,7 @@ # Parameters # ############## -DTYPE = [np.float64, pytest.param(np.float32, marks=pytest.mark.expensive)] +DTYPE = [np.float32, pytest.param(np.float64, marks=pytest.mark.expensive)] RESOLUTION = [48, 49] N_IMG = [10] OFFSETS = [0, pytest.param(None, marks=pytest.mark.expensive)] From 80d192c93e2f9bd9f01068b5d59d1d166adefe82 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 23 Sep 2024 07:07:04 -0400 Subject: [PATCH 412/433] fix another bounds bug, triangle score ls --- src/aspire/abinitio/commonline_sync3n.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 6ec3b51e4a..db1dc69c12 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -455,10 +455,13 @@ def _triangle_scores_inner_host(self, Rijs): # Update histogram # Find integer bin [0,self.hist_intervals) - _l1, _l2, _l3 = np.minimum( - (self.hist_intervals * s).astype(int), # implicit floor - self.hist_intervals - 1, - ) # clamp upper bound + _l1, _l2, _l3 = np.maximum( + np.minimum( + (self.hist_intervals * s).astype(int), # implicit floor + self.hist_intervals - 1, # clamp upper bound + ), + 0, # clamp lower bound + ) scores_hist[_l1] += 1 scores_hist[_l2] += 1 From fde6ac2efd7c96973145356faa6758a7996f2744 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Thu, 26 Sep 2024 08:28:49 -0400 Subject: [PATCH 413/433] =?UTF-8?q?Bump=20version:=200.12.3=20=E2=86=92=20?= =?UTF-8?q?0.13.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- README.md | 4 ++-- docs/source/conf.py | 2 +- docs/source/index.rst | 2 +- pyproject.toml | 2 +- src/aspire/__init__.py | 2 +- src/aspire/config_default.yaml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index f1257cb71a..af2e0c8e7c 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.12.3 +current_version = 0.13.0 commit = True tag = True diff --git a/README.md b/README.md index ecb217a741..fd1b16c81f 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5657281.svg)](https://doi.org/10.5281/zenodo.5657281) [![Downloads](https://static.pepy.tech/badge/aspire/month)](https://pepy.tech/project/aspire) -# ASPIRE - Algorithms for Single Particle Reconstruction - v0.12.3 +# ASPIRE - Algorithms for Single Particle Reconstruction - v0.13.0 The ASPIRE-Python project supersedes [Matlab ASPIRE](https://github.com/PrincetonUniversity/aspire). @@ -20,7 +20,7 @@ For more information about the project, algorithms, and related publications ple Please cite using the following DOI. This DOI represents all versions, and will always resolve to the latest one. ``` -ComputationalCryoEM/ASPIRE-Python: v0.12.3 https://doi.org/10.5281/zenodo.5657281 +ComputationalCryoEM/ASPIRE-Python: v0.13.0 https://doi.org/10.5281/zenodo.5657281 ``` diff --git a/docs/source/conf.py b/docs/source/conf.py index 1ae8045688..3aa429641c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -86,7 +86,7 @@ # built documents. # # The full version, including alpha/beta/rc tags. -release = version = "0.12.3" +release = version = "0.13.0" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/source/index.rst b/docs/source/index.rst index f34b7a1f4c..dda90a41d7 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,4 +1,4 @@ -Aspire v0.12.3 +Aspire v0.13.0 ============== Algorithms for Single Particle Reconstruction diff --git a/pyproject.toml b/pyproject.toml index 7dff9dddaf..364ef107f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "aspire" -version = "0.12.3" +version = "0.13.0" description = "Algorithms for Single Particle Reconstruction" readme = "README.md" # Optional requires-python = ">=3.8" diff --git a/src/aspire/__init__.py b/src/aspire/__init__.py index 4a1419c7ed..e6b58dfbf5 100644 --- a/src/aspire/__init__.py +++ b/src/aspire/__init__.py @@ -12,7 +12,7 @@ from aspire.exceptions import handle_exception # version in maj.min.bld format -__version__ = "0.12.3" +__version__ = "0.13.0" # Setup `confuse` config diff --git a/src/aspire/config_default.yaml b/src/aspire/config_default.yaml index def78983c0..9af8732dd1 100644 --- a/src/aspire/config_default.yaml +++ b/src/aspire/config_default.yaml @@ -1,4 +1,4 @@ -version: 0.12.3 +version: 0.13.0 common: # numeric module to use - one of numpy/cupy numeric: numpy From 33aa87de64b9c73e1626aac65552a387b59fa0db Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 27 Sep 2024 10:00:19 -0400 Subject: [PATCH 414/433] use 50 as mean maxiters, match matlab --- src/aspire/reconstruction/estimator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/reconstruction/estimator.py b/src/aspire/reconstruction/estimator.py index 9d62a0b765..c04033e7a0 100644 --- a/src/aspire/reconstruction/estimator.py +++ b/src/aspire/reconstruction/estimator.py @@ -17,7 +17,7 @@ def __init__( preconditioner="circulant", checkpoint_iterations=10, checkpoint_prefix="volume_checkpoint", - maxiter=100, + maxiter=50, boost=True, ): """ From ba2ce1d0c364d126fa0d2beb28c82c22204c9df2 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 27 Sep 2024 10:02:28 -0400 Subject: [PATCH 415/433] convert error raise to warning --- src/aspire/reconstruction/mean.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aspire/reconstruction/mean.py b/src/aspire/reconstruction/mean.py index 58f9c566b6..ecfadc9e92 100644 --- a/src/aspire/reconstruction/mean.py +++ b/src/aspire/reconstruction/mean.py @@ -258,7 +258,9 @@ def cb(xk): ) if info != 0: - raise RuntimeError("Unable to converge!") + logger.warning( + f"Conjugate gradient unable to converge after {info} iterations." + ) return x.reshape(self.r, self.basis.count) From 39dc51f891cab89dce139c58f92c7e686ad15565 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 27 Sep 2024 10:13:32 -0400 Subject: [PATCH 416/433] fixup None logic for checkpoint disable --- src/aspire/reconstruction/estimator.py | 9 ++++++--- src/aspire/reconstruction/mean.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/aspire/reconstruction/estimator.py b/src/aspire/reconstruction/estimator.py index c04033e7a0..2bf0ec3366 100644 --- a/src/aspire/reconstruction/estimator.py +++ b/src/aspire/reconstruction/estimator.py @@ -34,9 +34,12 @@ def __init__( `src` during back projection and kernel estimation steps. :param preconditioner: Optional kernel preconditioner (`string`). Currently supported options are "circulant" or None. - :param checkpoint_iterations: Optionally save `cg` estimated `Volume` - instance periodically each `checkpoint_iterations`. - Setting to None disables, otherwise checks for positive integer. + :param checkpoint_iterations: Optionally save `cg` estimated + `basis` coefficients periodically each + `checkpoint_iterations`. Setting to `None` disables, + otherwise checks for positive integer. Note, when + `maxiter` is not `None` and `cg` fails to converge a final + checkpoint will still be written. :param checkpoint_prefix: Optional path prefix for `cg` checkpoint files. If the parent directory does not exist, creation is attempted. `_iter{N}` will be appended to the diff --git a/src/aspire/reconstruction/mean.py b/src/aspire/reconstruction/mean.py index ecfadc9e92..d0cade9754 100644 --- a/src/aspire/reconstruction/mean.py +++ b/src/aspire/reconstruction/mean.py @@ -231,7 +231,7 @@ def cb(xk): # Do checkpoint at `checkpoint_iterations`, _do_checkpoint = ( - self.checkpoint_iterations + self.checkpoint_iterations is not None and (self.i % self.checkpoint_iterations) == 0 ) # or the last iteration when `maxiter` provided. From 293de9f977df38b35518578e7ae6739e19f463f2 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 27 Sep 2024 13:52:20 -0400 Subject: [PATCH 417/433] fixup unittest, no longer raising --- tests/test_mean_estimator.py | 5 +---- tests/test_weighted_mean_estimator.py | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/test_mean_estimator.py b/tests/test_mean_estimator.py index 2650839272..e6b2a2f837 100644 --- a/tests/test_mean_estimator.py +++ b/tests/test_mean_estimator.py @@ -159,10 +159,7 @@ def test_checkpoint(sim, basis, estimator): maxiter=test_iter + 1, checkpoint_prefix=prefix, ) - - # Assert we raise when reading `maxiter`. - with raises(RuntimeError, match="Unable to converge!"): - _ = _estimator.estimate() + _ = _estimator.estimate() # Load the checkpoint coefficients while tmp_input_dir exists. x_chk = np.load(f"{prefix}_iter{test_iter:04d}.npy") diff --git a/tests/test_weighted_mean_estimator.py b/tests/test_weighted_mean_estimator.py index 5d622c3865..eabcd0574f 100644 --- a/tests/test_weighted_mean_estimator.py +++ b/tests/test_weighted_mean_estimator.py @@ -155,9 +155,7 @@ def test_checkpoint(sim, basis, estimator, weights): checkpoint_prefix=prefix, ) - # Assert we raise when reading `maxiter`. - with raises(RuntimeError, match="Unable to converge!"): - _ = _estimator.estimate() + _ = _estimator.estimate() # Load the checkpoint coefficients while tmp_input_dir exists. x_chk = np.load(f"{prefix}_iter{test_iter:04d}.npy") From 1e33ea9198ba5474b35e97404176917ae3d5ce6a Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 1 Oct 2024 15:19:14 -0400 Subject: [PATCH 418/433] Resolve matplotlib warning. --- tests/test_utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index c7617d28a8..040f427758 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -397,6 +397,11 @@ def matplotlib_no_gui(): with warnings.catch_warnings(): warnings.filterwarnings("ignore", r"Matplotlib is currently using agg.*") + # Ignore the specific UserWarning about non-interactive FigureCanvasAgg + warnings.filterwarnings( + "ignore", r"FigureCanvasAgg is non-interactive, and thus cannot be shown" + ) + yield # Explicitly close all figures before making backend changes. From 13d4c6f54517c982864025b7ad5bfdf23a5ed64a Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 1 Oct 2024 15:20:39 -0400 Subject: [PATCH 419/433] Increase FLE test tolerance to 30% --- tests/test_FLEbasis2D.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_FLEbasis2D.py b/tests/test_FLEbasis2D.py index 160f95e1b7..94ea9c4316 100644 --- a/tests/test_FLEbasis2D.py +++ b/tests/test_FLEbasis2D.py @@ -76,7 +76,7 @@ class TestFLEBasis2D(UniversalBasisMixin): if backend_available("cufinufft"): test_eps = 1.15 elif platform.system() == "Darwin": - test_eps = 1.20 + test_eps = 1.30 # check closeness guarantees for fast vs dense matrix method def testFastVDense_T(self, basis): From 5123987dbcd53de9b005cbc89fa3e64426df63e0 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 1 Oct 2024 12:04:31 -0400 Subject: [PATCH 420/433] typo in B0 formula --- src/aspire/abinitio/commonline_sync3n.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index db1dc69c12..7ac94b1eb2 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -714,7 +714,7 @@ def _triangle_scores( * (a + 1) ) # normalization of 2nd component: B = P*N_delta/sum(f), where f is the component formula - B0 = P ** (self.n_img * (self.n_img - 1) * (self.n_img - 2) / 2) / np.sum( + B0 = P * (self.n_img * (self.n_img - 1) * (self.n_img - 2) / 2) / np.sum( ((1 - hist_x) ** b) * np.exp(-b / (1 - x0) * (1 - hist_x)) ) start_values = np.array([B0, P, b, x0], dtype=np.float64) From 599b5f749427d38af6556a6375a3a7fe49eeaa94 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 1 Oct 2024 12:09:04 -0400 Subject: [PATCH 421/433] log diagnotics --- src/aspire/abinitio/commonline_sync3n.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 7ac94b1eb2..3c36f28339 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -714,8 +714,10 @@ def _triangle_scores( * (a + 1) ) # normalization of 2nd component: B = P*N_delta/sum(f), where f is the component formula - B0 = P * (self.n_img * (self.n_img - 1) * (self.n_img - 2) / 2) / np.sum( - ((1 - hist_x) ** b) * np.exp(-b / (1 - x0) * (1 - hist_x)) + B0 = ( + P + * (self.n_img * (self.n_img - 1) * (self.n_img - 2) / 2) + / np.sum(((1 - hist_x) ** b) * np.exp(-b / (1 - x0) * (1 - hist_x))) ) start_values = np.array([B0, P, b, x0], dtype=np.float64) lower_bounds = np.array([0, Pmin**3, 2, 0], dtype=np.float64) @@ -742,6 +744,8 @@ def fun(x, B, P, b, x0, A=A, a=a): P = P ** (1 / 3) sigma = (1 - x0) / peak2sigma + logger.info(f"Estimated CL Errors P,STD:\t{100*P}%\t{sigma}") + # Initialize probability computations # Local histograms analysis A = a + 1 # distribution 1st component normalization factor @@ -768,6 +772,10 @@ def fun(x, B, P, b, x0, A=A, a=a): ) Pij = np.nan_to_num(Pij) + logger.info( + f"Common lines probabilities to be indicative Pij={100*np.mean(Pij)}%" + ) + return P, sigma, Pij, scores_hist ########################################### From dad81b60d7e0bc83088e80be2bbc1c41c9610c3c Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 1 Oct 2024 16:25:24 -0400 Subject: [PATCH 422/433] sanity check curve_fit start values better diagnostics --- src/aspire/abinitio/commonline_sync3n.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 3c36f28339..7d1bd79cbc 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -719,10 +719,18 @@ def _triangle_scores( * (self.n_img * (self.n_img - 1) * (self.n_img - 2) / 2) / np.sum(((1 - hist_x) ** b) * np.exp(-b / (1 - x0) * (1 - hist_x))) ) - start_values = np.array([B0, P, b, x0], dtype=np.float64) + # P must be in lower and upper bounds or `curve_fit` will error + # This was not the case for MATLAB... + P0 = np.clip(P, Pmin**3, Pmax**3) + start_values = np.array([B0, P0, b, x0], dtype=np.float64) lower_bounds = np.array([0, Pmin**3, 2, 0], dtype=np.float64) upper_bounds = np.array([np.inf, Pmax**3, np.inf, 1], dtype=np.float64) + with np.printoptions(precision=2): + logger.info(f"curve_fit lower_bounds:{lower_bounds}") + logger.info(f"curve_fit start_values:{start_values}") + logger.info(f"curve_fit upper_bounds:{upper_bounds}") + # Fit distribution def fun(x, B, P, b, x0, A=A, a=a): """Function to fit. x is data vector.""" @@ -744,7 +752,7 @@ def fun(x, B, P, b, x0, A=A, a=a): P = P ** (1 / 3) sigma = (1 - x0) / peak2sigma - logger.info(f"Estimated CL Errors P,STD:\t{100*P}%\t{sigma}") + logger.info(f"Estimated CL Errors P,STD:\t{100*P:.2f}%\t{sigma:.2f}") # Initialize probability computations # Local histograms analysis @@ -773,7 +781,7 @@ def fun(x, B, P, b, x0, A=A, a=a): Pij = np.nan_to_num(Pij) logger.info( - f"Common lines probabilities to be indicative Pij={100*np.mean(Pij)}%" + f"Common lines probabilities to be indicative Pij={100*np.mean(Pij):.2f}%" ) return P, sigma, Pij, scores_hist From 529bc69c7e38d8d59dee832ce4b366cd09eaa061 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 2 Oct 2024 10:13:03 -0400 Subject: [PATCH 423/433] For now use default initial soln for Swt curve fitting --- src/aspire/abinitio/commonline_sync3n.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 7d1bd79cbc..434f638e62 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -722,7 +722,10 @@ def _triangle_scores( # P must be in lower and upper bounds or `curve_fit` will error # This was not the case for MATLAB... P0 = np.clip(P, Pmin**3, Pmax**3) - start_values = np.array([B0, P0, b, x0], dtype=np.float64) + # Note, MATLAB suggests the following, but I feel it is a bug. + # Will discuss with Yoel about the original code's intent. + # np.array([B0, P0, b, x0], dtype=np.float64) + start_values = None lower_bounds = np.array([0, Pmin**3, 2, 0], dtype=np.float64) upper_bounds = np.array([np.inf, Pmax**3, np.inf, 1], dtype=np.float64) From 7228ee0a8b22c63f38284ab4ccfe14e778da8173 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Wed, 2 Oct 2024 10:14:19 -0400 Subject: [PATCH 424/433] leave matlab based code as comment for now --- src/aspire/abinitio/commonline_sync3n.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/aspire/abinitio/commonline_sync3n.py b/src/aspire/abinitio/commonline_sync3n.py index 434f638e62..6a7e5390d3 100644 --- a/src/aspire/abinitio/commonline_sync3n.py +++ b/src/aspire/abinitio/commonline_sync3n.py @@ -714,14 +714,14 @@ def _triangle_scores( * (a + 1) ) # normalization of 2nd component: B = P*N_delta/sum(f), where f is the component formula - B0 = ( - P - * (self.n_img * (self.n_img - 1) * (self.n_img - 2) / 2) - / np.sum(((1 - hist_x) ** b) * np.exp(-b / (1 - x0) * (1 - hist_x))) - ) + # B0 = ( + # P + # * (self.n_img * (self.n_img - 1) * (self.n_img - 2) / 2) + # / np.sum(((1 - hist_x) ** b) * np.exp(-b / (1 - x0) * (1 - hist_x))) + # ) # P must be in lower and upper bounds or `curve_fit` will error # This was not the case for MATLAB... - P0 = np.clip(P, Pmin**3, Pmax**3) + # P0 = np.clip(P, Pmin**3, Pmax**3) # Note, MATLAB suggests the following, but I feel it is a bug. # Will discuss with Yoel about the original code's intent. # np.array([B0, P0, b, x0], dtype=np.float64) From 98e0bcd1835a96a34c5efa56472c8c4a532ea00c Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 23 Sep 2024 15:48:04 -0400 Subject: [PATCH 425/433] minimal changes to estimate_shifts. --- src/aspire/abinitio/commonline_base.py | 12 +++++++----- src/aspire/utils/coor_trans.py | 2 +- tests/test_orient_sync_voting.py | 16 ++++++++++++---- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/aspire/abinitio/commonline_base.py b/src/aspire/abinitio/commonline_base.py index 33f2a600e9..0f7d675610 100644 --- a/src/aspire/abinitio/commonline_base.py +++ b/src/aspire/abinitio/commonline_base.py @@ -274,8 +274,9 @@ def estimate_shifts(self, equations_factor=1, max_memory=4000): show = False if logging.getLogger().isEnabledFor(logging.DEBUG): show = True - # Negative sign comes from using -i conversion of Fourier transformation - est_shifts = sparse.linalg.lsqr(shift_equations, -shift_b, show=show)[0] + + # Estimate shifts. + est_shifts = sparse.linalg.lsqr(shift_equations, shift_b, show=show)[0] est_shifts = est_shifts.reshape((self.n_img, 2)) return est_shifts @@ -320,6 +321,7 @@ def _get_shift_equations_approx(self, equations_factor=1, max_memory=4000): n_equations = self._estimate_num_shift_equations( n_img, equations_factor, max_memory ) + # Allocate local variables for estimating 2D shifts based on the estimated number # of equations. The shift equations are represented using a sparse matrix, # since each row in the system contains four non-zeros (as it involves @@ -404,13 +406,13 @@ def _get_shift_equations_approx(self, equations_factor=1, max_memory=4000): # Compute the coefficients of the current equation coefs = np.array( [ - np.sin(shift_alpha), np.cos(shift_alpha), - -np.sin(shift_beta), + np.sin(shift_alpha), -np.cos(shift_beta), + -np.sin(shift_beta), ] ) - shift_eq[idx] = -1 * coefs if is_pf_j_flipped else coefs + shift_eq[idx] = [-1, -1, 0, 0] * coefs if is_pf_j_flipped else coefs # create sparse matrix object only containing non-zero elements shift_equations = sparse.csr_matrix( diff --git a/src/aspire/utils/coor_trans.py b/src/aspire/utils/coor_trans.py index f17c23a0f0..b33098d3b4 100644 --- a/src/aspire/utils/coor_trans.py +++ b/src/aspire/utils/coor_trans.py @@ -326,7 +326,7 @@ def common_line_from_rots(r1, r2, ell): ut = np.dot(r2, r1.T) alpha_ij = np.arctan2(ut[2, 0], -ut[2, 1]) + np.pi - alpha_ji = np.arctan2(ut[0, 2], -ut[1, 2]) + np.pi + alpha_ji = np.arctan2(-ut[0, 2], ut[1, 2]) + np.pi ell_ij = alpha_ij * ell / (2 * np.pi) ell_ji = alpha_ji * ell / (2 * np.pi) diff --git a/tests/test_orient_sync_voting.py b/tests/test_orient_sync_voting.py index 3e875e9467..49ffa04904 100644 --- a/tests/test_orient_sync_voting.py +++ b/tests/test_orient_sync_voting.py @@ -106,13 +106,21 @@ def test_estimate_rotations(source_orientation_objs): def test_estimate_shifts(source_orientation_objs): src, orient_est = source_orientation_objs - if src.offsets.all() != 0: - pytest.xfail("Currently failing under non-zero offsets.") + # Assign ground truth rotations. + orient_est.rotations = src.rotations + + # Estimate shifts using ground truth rotations. est_shifts = orient_est.estimate_shifts() - # Assert that estimated shifts are close to src.offsets - assert np.allclose(est_shifts, src.offsets) + # Calculate the mean absolute difference in pixels. + mean_abs_diff = np.mean(abs(src.offsets - est_shifts)) + + # Assert that on average estimated shifts are close to src.offsets + if src.offsets.all() != 0: + np.testing.assert_array_less(mean_abs_diff, 0.35) + else: + np.testing.assert_allclose(mean_abs_diff, 0) def test_estimate_rotations_fuzzy_mask(): From 06cf57cdadd22d5cf39ebc7cc2155a52728ae042 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 24 Sep 2024 10:52:39 -0400 Subject: [PATCH 426/433] clean up indexing --- src/aspire/abinitio/commonline_base.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/aspire/abinitio/commonline_base.py b/src/aspire/abinitio/commonline_base.py index 0f7d675610..c0c3718803 100644 --- a/src/aspire/abinitio/commonline_base.py +++ b/src/aspire/abinitio/commonline_base.py @@ -328,9 +328,9 @@ def _get_shift_equations_approx(self, equations_factor=1, max_memory=4000): # exactly four unknowns). The variables below are used to construct # this sparse system. The k'th non-zero element of the equations matrix # is stored at index (shift_i(k),shift_j(k)). - shift_i = np.zeros(4 * n_equations, dtype=self.dtype) - shift_j = np.zeros(4 * n_equations, dtype=self.dtype) - shift_eq = np.zeros(4 * n_equations, dtype=self.dtype) + shift_i = np.zeros((n_equations, 4), dtype=self.dtype) + shift_j = np.zeros((n_equations, 4), dtype=self.dtype) + shift_eq = np.zeros((n_equations, 4), dtype=self.dtype) shift_b = np.zeros(n_equations, dtype=self.dtype) # Prepare the shift phases to try and generate filter for common-line detection @@ -390,16 +390,14 @@ def _get_shift_equations_approx(self, equations_factor=1, max_memory=4000): sidx = sidx1 if c1[sidx1] > c2[sidx2] else sidx2 dx = -max_shift + sidx * shift_step - # Create a shift equation for the image pair [i,j] - idx = np.arange(4 * shift_eq_idx, 4 * shift_eq_idx + 4) # angle of common ray in image i shift_alpha = c_ij * d_theta # Angle of common ray in image j. shift_beta = c_ji * d_theta # Row index to construct the sparse equations - shift_i[idx] = shift_eq_idx + shift_i[shift_eq_idx] = shift_eq_idx # Columns of the shift variables that correspond to the current pair [i, j] - shift_j[idx] = [2 * i, 2 * i + 1, 2 * j, 2 * j + 1] + shift_j[shift_eq_idx] = [2 * i, 2 * i + 1, 2 * j, 2 * j + 1] # Right hand side of the current equation shift_b[shift_eq_idx] = dx @@ -412,11 +410,13 @@ def _get_shift_equations_approx(self, equations_factor=1, max_memory=4000): -np.sin(shift_beta), ] ) - shift_eq[idx] = [-1, -1, 0, 0] * coefs if is_pf_j_flipped else coefs + shift_eq[shift_eq_idx] = ( + [-1, -1, 0, 0] * coefs if is_pf_j_flipped else coefs + ) # create sparse matrix object only containing non-zero elements shift_equations = sparse.csr_matrix( - (shift_eq, (shift_i, shift_j)), + (shift_eq.flatten(), (shift_i.flatten(), shift_j.flatten())), shape=(n_equations, 2 * n_img), dtype=self.dtype, ) From d71d1bb049b76ad054bc2bf65516634172fec4b0 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Tue, 24 Sep 2024 11:16:44 -0400 Subject: [PATCH 427/433] use mean 2D distance in test. --- tests/test_orient_sync_voting.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_orient_sync_voting.py b/tests/test_orient_sync_voting.py index 49ffa04904..576ca1cee1 100644 --- a/tests/test_orient_sync_voting.py +++ b/tests/test_orient_sync_voting.py @@ -113,14 +113,14 @@ def test_estimate_shifts(source_orientation_objs): # Estimate shifts using ground truth rotations. est_shifts = orient_est.estimate_shifts() - # Calculate the mean absolute difference in pixels. - mean_abs_diff = np.mean(abs(src.offsets - est_shifts)) + # Calculate the mean 2D distance between estimates and ground truth. + mean_dist = np.mean(np.sqrt(np.sum((src.offsets - est_shifts) ** 2, axis=1))) - # Assert that on average estimated shifts are close to src.offsets + # Assert that on average estimated shifts are close (within 0.5 pix) to src.offsets if src.offsets.all() != 0: - np.testing.assert_array_less(mean_abs_diff, 0.35) + np.testing.assert_array_less(mean_dist, 0.5) else: - np.testing.assert_allclose(mean_abs_diff, 0) + np.testing.assert_allclose(mean_dist, 0) def test_estimate_rotations_fuzzy_mask(): From 26f3c8d35018cf16410b43c8642589609befb1e5 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 30 Sep 2024 13:06:56 -0400 Subject: [PATCH 428/433] add more estimate shifts tests. --- tests/test_commonline_sync3n.py | 53 ++++++++++++++++++++++++++++++-- tests/test_orient_sync_voting.py | 22 +++++++++++-- 2 files changed, 70 insertions(+), 5 deletions(-) diff --git a/tests/test_commonline_sync3n.py b/tests/test_commonline_sync3n.py index 6640fa871f..59876df7b3 100644 --- a/tests/test_commonline_sync3n.py +++ b/tests/test_commonline_sync3n.py @@ -17,6 +17,7 @@ OFFSETS = [ 0, + pytest.param(None, marks=pytest.mark.expensive), ] DTYPES = [ @@ -53,7 +54,16 @@ def source_orientation_objs(resolution, offsets, dtype): seed=456, ).cache() - orient_est = CLSync3N(src, S_weighting=True, seed=789) + # Search for common lines over less shifts for 0 offsets. + max_shift = 1 / resolution + shift_step = 1 + if src.offsets.all() != 0: + max_shift = 0.20 + shift_step = 0.25 # Reduce shift steps for non-integer offsets of Simulation. + + orient_est = CLSync3N( + src, max_shift=max_shift, shift_step=shift_step, S_weighting=True, seed=789 + ) return src, orient_est @@ -74,11 +84,48 @@ def test_build_clmatrix(source_orientation_objs): # Check that at least 98% of estimates are within 5 degrees. tol = 0.98 if src.offsets.all() != 0: - # Set tolerance to 95% when using nonzero offsets. - tol = 0.95 + # Set tolerance to 75% when using nonzero offsets. + tol = 0.75 assert within_5 / angle_diffs.size > tol +def test_estimate_shifts_with_gt_rots(source_orientation_objs): + src, orient_est = source_orientation_objs + + # Assign ground truth rotations. + orient_est.rotations = src.rotations + + # Estimate shifts using ground truth rotations. + est_shifts = orient_est.estimate_shifts() + + # Calculate the mean 2D distance between estimates and ground truth. + error = src.offsets - est_shifts + mean_dist = np.hypot(error[:, 0], error[:, 1]).mean() + + # Assert that on average estimated shifts are close (within 0.8 pix) to src.offsets + if src.offsets.all() != 0: + np.testing.assert_array_less(mean_dist, 0.8) + else: + np.testing.assert_allclose(mean_dist, 0) + + +def test_estimate_shifts_with_est_rots(source_orientation_objs): + src, orient_est = source_orientation_objs + + # Estimate shifts using estimated rotations. + est_shifts = orient_est.estimate_shifts() + + # Calculate the mean 2D distance between estimates and ground truth. + error = src.offsets - est_shifts + mean_dist = np.hypot(error[:, 0], error[:, 1]).mean() + + # Assert that on average estimated shifts are close (within 0.8 pix) to src.offsets + if src.offsets.all() != 0: + np.testing.assert_array_less(mean_dist, 0.8) + else: + np.testing.assert_allclose(mean_dist, 0) + + def test_estimate_rotations(source_orientation_objs): src, orient_est = source_orientation_objs diff --git a/tests/test_orient_sync_voting.py b/tests/test_orient_sync_voting.py index 576ca1cee1..24986ce888 100644 --- a/tests/test_orient_sync_voting.py +++ b/tests/test_orient_sync_voting.py @@ -104,7 +104,7 @@ def test_estimate_rotations(source_orientation_objs): mean_aligned_angular_distance(orient_est.rotations, src.rotations, degree_tol=1) -def test_estimate_shifts(source_orientation_objs): +def test_estimate_shifts_with_gt_rots(source_orientation_objs): src, orient_est = source_orientation_objs # Assign ground truth rotations. @@ -114,7 +114,25 @@ def test_estimate_shifts(source_orientation_objs): est_shifts = orient_est.estimate_shifts() # Calculate the mean 2D distance between estimates and ground truth. - mean_dist = np.mean(np.sqrt(np.sum((src.offsets - est_shifts) ** 2, axis=1))) + error = src.offsets - est_shifts + mean_dist = np.hypot(error[:, 0], error[:, 1]).mean() + + # Assert that on average estimated shifts are close (within 0.5 pix) to src.offsets + if src.offsets.all() != 0: + np.testing.assert_array_less(mean_dist, 0.5) + else: + np.testing.assert_allclose(mean_dist, 0) + + +def test_estimate_shifts_with_est_rots(source_orientation_objs): + src, orient_est = source_orientation_objs + + # Estimate shifts using estimated rotations. + est_shifts = orient_est.estimate_shifts() + + # Calculate the mean 2D distance between estimates and ground truth. + error = src.offsets - est_shifts + mean_dist = np.hypot(error[:, 0], error[:, 1]).mean() # Assert that on average estimated shifts are close (within 0.5 pix) to src.offsets if src.offsets.all() != 0: From 21a1eea8c4e0b3abe4e60a312028a9ae379fdb79 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 30 Sep 2024 13:54:20 -0400 Subject: [PATCH 429/433] Module scope. Estimate rotations once per module. Adjust tolerance. --- tests/test_commonline_sync3n.py | 23 ++++++++++++----------- tests/test_orient_sync_voting.py | 15 +++++++++------ 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/tests/test_commonline_sync3n.py b/tests/test_commonline_sync3n.py index 59876df7b3..600f883c2d 100644 --- a/tests/test_commonline_sync3n.py +++ b/tests/test_commonline_sync3n.py @@ -1,3 +1,4 @@ +import copy import os import numpy as np @@ -61,9 +62,10 @@ def source_orientation_objs(resolution, offsets, dtype): max_shift = 0.20 shift_step = 0.25 # Reduce shift steps for non-integer offsets of Simulation. - orient_est = CLSync3N( - src, max_shift=max_shift, shift_step=shift_step, S_weighting=True, seed=789 - ) + orient_est = CLSync3N(src, max_shift=max_shift, shift_step=shift_step, seed=789) + + # Estimate rotations once for all tests. + orient_est.estimate_rotations() return src, orient_est @@ -71,9 +73,6 @@ def source_orientation_objs(resolution, offsets, dtype): def test_build_clmatrix(source_orientation_objs): src, orient_est = source_orientation_objs - # Build clmatrix estimate. - orient_est.build_clmatrix() - gt_clmatrix = rots_to_clmatrix(src.rotations, orient_est.n_theta) angle_diffs = abs(orient_est.clmatrix - gt_clmatrix) * 360 / orient_est.n_theta @@ -93,6 +92,8 @@ def test_estimate_shifts_with_gt_rots(source_orientation_objs): src, orient_est = source_orientation_objs # Assign ground truth rotations. + # Deep copy to prevent altering for other tests. + orient_est = copy.deepcopy(orient_est) orient_est.rotations = src.rotations # Estimate shifts using ground truth rotations. @@ -111,7 +112,6 @@ def test_estimate_shifts_with_gt_rots(source_orientation_objs): def test_estimate_shifts_with_est_rots(source_orientation_objs): src, orient_est = source_orientation_objs - # Estimate shifts using estimated rotations. est_shifts = orient_est.estimate_shifts() @@ -129,9 +129,10 @@ def test_estimate_shifts_with_est_rots(source_orientation_objs): def test_estimate_rotations(source_orientation_objs): src, orient_est = source_orientation_objs - orient_est.estimate_rotations() - # Register estimates to ground truth rotations and compute the # mean angular distance between them (in degrees). - # Assert that mean angular distance is less than 1 degree. - mean_aligned_angular_distance(orient_est.rotations, src.rotations, degree_tol=1) + # Assert that mean angular distance is less than 1 degree (4 with offsets). + tol = 1 + if src.offsets.all() != 0: + tol = 4 + mean_aligned_angular_distance(orient_est.rotations, src.rotations, degree_tol=tol) diff --git a/tests/test_orient_sync_voting.py b/tests/test_orient_sync_voting.py index 24986ce888..85478816cb 100644 --- a/tests/test_orient_sync_voting.py +++ b/tests/test_orient_sync_voting.py @@ -1,3 +1,4 @@ +import copy import os import os.path import tempfile @@ -32,22 +33,22 @@ ] -@pytest.fixture(params=RESOLUTION, ids=lambda x: f"resolution={x}") +@pytest.fixture(params=RESOLUTION, ids=lambda x: f"resolution={x}", scope="module") def resolution(request): return request.param -@pytest.fixture(params=OFFSETS, ids=lambda x: f"offsets={x}") +@pytest.fixture(params=OFFSETS, ids=lambda x: f"offsets={x}", scope="module") def offsets(request): return request.param -@pytest.fixture(params=DTYPES, ids=lambda x: f"dtype={x}") +@pytest.fixture(params=DTYPES, ids=lambda x: f"dtype={x}", scope="module") def dtype(request): return request.param -@pytest.fixture +@pytest.fixture(scope="module") def source_orientation_objs(resolution, offsets, dtype): src = Simulation( n=50, @@ -68,6 +69,9 @@ def source_orientation_objs(resolution, offsets, dtype): src, max_shift=max_shift, shift_step=shift_step, mask=False ) + # Estimate rotations once for all tests. + orient_est.estimate_rotations() + return src, orient_est @@ -96,8 +100,6 @@ def test_build_clmatrix(source_orientation_objs): def test_estimate_rotations(source_orientation_objs): src, orient_est = source_orientation_objs - orient_est.estimate_rotations() - # Register estimates to ground truth rotations and compute the # mean angular distance between them (in degrees). # Assert that mean angular distance is less than 1 degree. @@ -108,6 +110,7 @@ def test_estimate_shifts_with_gt_rots(source_orientation_objs): src, orient_est = source_orientation_objs # Assign ground truth rotations. + # Deep copy to prevent altering for other tests. orient_est.rotations = src.rotations # Estimate shifts using ground truth rotations. From c5772396c57fa1813cb9b95b7773023a7ae0a111 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 30 Sep 2024 14:01:05 -0400 Subject: [PATCH 430/433] One more deepcopy. --- tests/test_orient_sync_voting.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_orient_sync_voting.py b/tests/test_orient_sync_voting.py index 85478816cb..4bea8df6c2 100644 --- a/tests/test_orient_sync_voting.py +++ b/tests/test_orient_sync_voting.py @@ -111,6 +111,7 @@ def test_estimate_shifts_with_gt_rots(source_orientation_objs): # Assign ground truth rotations. # Deep copy to prevent altering for other tests. + orient_est = copy.deepcopy(orient_est) orient_est.rotations = src.rotations # Estimate shifts using ground truth rotations. From f3056c32625e4b5798398886f03f92c8e4b4674e Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 30 Sep 2024 15:56:30 -0400 Subject: [PATCH 431/433] test_coef dtype patch for osx. --- tests/test_coef.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_coef.py b/tests/test_coef.py index ab546d9bac..3ace0ddec5 100644 --- a/tests/test_coef.py +++ b/tests/test_coef.py @@ -48,7 +48,7 @@ def dtype(request): return request.param -@pytest.fixture(params=DTYPES, ids=lambda x: f"dtype={x}", scope="module") +@pytest.fixture(params=DTYPES, ids=lambda x: f"basis_dtype={x}", scope="module") def basis_dtype(request): """ Dtypes for basis @@ -416,11 +416,16 @@ def test_shifts(coef_fixture, basis, rots): shifts = np.column_stack((rots, rots[::-1])) # Compare + min_dtype = ( + np.float32 + if (basis.dtype == np.float32 or coef_fixture.dtype == np.float32) + else np.float64 + ) np.testing.assert_allclose( coef_fixture.shift(shifts), basis.shift(coef_fixture, shifts), rtol=1e-05, - atol=utest_tolerance(basis.dtype), + atol=utest_tolerance(min_dtype), ) From 1d7e33e1052efb37148d3151f55f18bed4d30b30 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 4 Oct 2024 10:34:58 -0400 Subject: [PATCH 432/433] update code cov to token auth --- .github/workflows/workflow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index dd75b0d6c6..33a974b214 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -55,6 +55,8 @@ jobs: run: tox --skip-missing-interpreters false -e py${{ matrix.python-version }}-${{ matrix.pyenv }} - name: Upload Coverage to CodeCov uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} conda-build: needs: check From a01d211b88b095e5cacdd5c6c6e273e6b61f84a0 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 8 Oct 2024 09:31:31 -0400 Subject: [PATCH 433/433] minimal changes to restore simulation gallery for release --- .../simulated_abinitio_pipeline.py | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/gallery/experiments/simulated_abinitio_pipeline.py b/gallery/experiments/simulated_abinitio_pipeline.py index ca0e4fbac5..4638c30716 100644 --- a/gallery/experiments/simulated_abinitio_pipeline.py +++ b/gallery/experiments/simulated_abinitio_pipeline.py @@ -54,13 +54,9 @@ # --------------- # Start with the hi-res volume map EMDB-2660 sourced from EMDB, # https://www.ebi.ac.uk/emdb/EMD-2660, and dowloaded via ASPIRE's downloader utility. -og_v = emdb_2660() +og_v = emdb_2660().astype(np.float64) logger.info("Original volume map data" f" shape: {og_v.shape} dtype:{og_v.dtype}") -logger.info(f"Downsampling to {(img_size,)*3}") -v = og_v.downsample(img_size) -L = v.resolution - # Then create a filter based on that variance # This is an example of a custom noise profile @@ -70,7 +66,7 @@ def noise_function(x, y): # White f1 = noise_variance # Violet-ish - f2 = noise_variance * (x * x + y * y) / L * L + f2 = noise_variance * (x * x + y * y) / img_size * img_size return (alpha * f1 + beta * f2) / 2.0 @@ -78,7 +74,7 @@ def noise_function(x, y): logger.info("Initialize CTF filters.") # Create some CTF effects -pixel_size = 5 * 65 / img_size # Pixel size of the images (in angstroms) +pixel_size = og_v.pixel_size # Pixel size (in angstroms) voltage = 200 # Voltage (in KV) defocus_min = 1.5e4 # Minimum defocus value (in angstroms) defocus_max = 2.5e4 # Maximum defocus value (in angstroms) @@ -94,13 +90,16 @@ def noise_function(x, y): # Finally create the Simulation src = Simulation( - L=v.resolution, n=num_imgs, - vols=v, + vols=og_v, noise_adder=custom_noise, unique_filters=ctf_filters, - dtype=v.dtype, + dtype=np.float64, ) + +# Downsample +src = src.downsample(img_size).cache() + # Peek if interactive: src.images[:10].show() @@ -115,7 +114,7 @@ def noise_function(x, y): # Plot the noise profile for inspection if interactive: - plt.imshow(aiso_noise_estimator.filter.evaluate_grid(L)) + plt.imshow(aiso_noise_estimator.filter.evaluate_grid(img_size)) plt.show() # Peek, what do the whitened images look like...

oYy5HBZLE%%qp zbm`=7E5&(X?3U{urh(2f z&x=plqV*Eyc{P$LRff=vi!pp*$PoPN!Eih|Ob-8Z3*sABhp;oley~SfZOpMup5;xf z;ivC&#fKLx#N+?CbrRiZyxPOpaG7 zO%W%ajAd0b|FN6>U)j+eh|RB9!w(**f+MSa@u}HMagECweD3lL-2PSu?>v2#FAqG) zKMq*QPmtZppRTyX&sp}9uZ%Rs3$rI<%Qd6%DZYU(oU@wWcP^f{YQ4+94|~Zwt#;v` z{g7k&V^1@Fn80keR2UfTdnD;&c7adFXYjYX4bHwfu=&|A2)}L$E4DwNlKRDLs!a`B6x_|S z#BbR=l)x5Q?&nS&wcxLXy6|g{y74QM0(tfJeEy1hJ3rX&DSzdBz4&u=Jmco3u)MpO zG);LPuiM(rU%BUi)jZb>aJ>C^gn1S|X|xOPF4}-46aDc*6%#BoLK)jEG{ynWUU=lC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o`3);qAbBytp7pp#Wdw_or2BJ}{jN zq=f4{S{fM@$H1W%pA>je^WR^>py34d|^;gW}gF(|S>R;A^B%wNrIp5sh&o;JZ`0po-yT{elgAGJMyi1Qam9lR{?x!F-16d1 zX~MDbVJi9;^mCd6Tw3)v_ zYxFqYIX8lzhr@B_=_S$kn{W-9Vdtx=83TK(I# z!)^Q15o`K*hJANH$;BTvaK$C}Sx-$f&YTEE#%jJdnD5GcEFtno1|cKPFLpUX&-=l8t+_!pXzC*aEV zOw>KNj+R4(Sd7Ythx7$~xll+x0xL7QK0yioVg%+KCJ(lZZbaK@>BtZ*Hmy?G;czT& z&O~sW4082-YHd)G_JNGdTV1<$o0{Js@n@zcifPJ}OVtaGm_cbIzZ}rbM!axmCz`96 z!CEV&UP*&(V+OX$HE@^YVW_ME{rwtv%55}l@nip~&f-=CYR-4w#0YM;qvfOysk+~3 zpzxbpw`ej+P>p`goK_(q`De?J@wEh z*HQd=5kA!JhcT{(*ey279}uEIt;HR27V_uED4=K`ict#2%}JdX?=eo73!OA6#-_C# mKFHd^$8HLvUsLtedHSl$-U+}frk!XTzCcTpCH(GUi|KzWL9-VC literal 0 HcmV?d00001 diff --git a/tests/saved_test_data/rln_proj_65_centered.star b/tests/saved_test_data/rln_proj_65_centered.star new file mode 100644 index 0000000000..c1f77e5b7b --- /dev/null +++ b/tests/saved_test_data/rln_proj_65_centered.star @@ -0,0 +1,35 @@ + +# version 30001 + +data_optics + +loop_ +_rlnOpticsGroup #1 +_rlnOpticsGroupName #2 +_rlnVoltage #3 +_rlnSphericalAberration #4 +_rlnImagePixelSize #5 +_rlnImageSize #6 +_rlnImageDimensionality #7 + 1 optics1 300.000000 2.700000 1.000000 65 2 + + +# version 30001 + +data_particles + +loop_ +_rlnAngleRot #1 +_rlnAngleTilt #2 +_rlnAnglePsi #3 +_rlnOriginXAngst #4 +_rlnOriginYAngst #5 +_rlnOpticsGroup #6 +_rlnImageName #7 +_rlnOriginX #8 +_rlnOriginY #9 + 235.820138 113.086030 50.468981 0.000000 0.000000 1 000001@rln_proj_65_centered.mrcs 0.00000 0.000000 + 86.698555 31.958115 139.545228 0.000000 0.000000 1 000002@rln_proj_65_centered.mrcs 0.00000 0.000000 + 48.456166 71.176316 185.304830 0.000000 0.000000 1 000003@rln_proj_65_centered.mrcs 0.00000 0.000000 + 215.714386 105.017323 154.043384 0.000000 0.000000 1 000004@rln_proj_65_centered.mrcs 0.00000 0.000000 + diff --git a/tests/test_relion_interop.py b/tests/test_relion_interop.py index d1e71df674..6a7fa36f96 100644 --- a/tests/test_relion_interop.py +++ b/tests/test_relion_interop.py @@ -4,21 +4,29 @@ import pytest from aspire.source import RelionSource, Simulation +from aspire.utils import utest_tolerance from aspire.volume import Volume DATA_DIR = os.path.join(os.path.dirname(__file__), "saved_test_data") -STARFILE = [ - "rln_proj_65.star", - "rln_proj_64.star", +STARFILE_ODD = [ + "rln_proj_65_centered.star", "rln_proj_65_shifted.star", +] + +STARFILE_EVEN = [ + "rln_proj_64_centered.star", "rln_proj_64_shifted.star", ] -@pytest.fixture(params=STARFILE, scope="module") +@pytest.fixture(params=STARFILE_ODD + STARFILE_EVEN, scope="module") def sources(request): + """ + Initialize RelionSource from starfile and generate corresponding ASPIRE + Simulation source. + """ starfile = os.path.join(DATA_DIR, request.param) rln_src = RelionSource(starfile) @@ -44,6 +52,21 @@ def sources(request): return rln_src, sim_src +@pytest.fixture(params=[STARFILE_ODD, STARFILE_EVEN], scope="module") +def rln_sources(request): + """ + Initialize centered and shifted RelionSource's generated using the + same viewing angles. + """ + starfile_centered = os.path.join(DATA_DIR, request.param[0]) + starfile_shifted = os.path.join(DATA_DIR, request.param[1]) + + rln_src_centered = RelionSource(starfile_centered) + rln_src_shifted = RelionSource(starfile_shifted) + + return rln_src_centered, rln_src_shifted + + def test_projections_relative_error(sources): """Check the relative error between Relion and ASPIRE projection images.""" rln_src, sim_src = sources @@ -73,3 +96,17 @@ def test_projections_frc(sources): # Check that estimated resolution is high (< 2.5 pixels) and correlation is close to 1. np.testing.assert_array_less(res, 2.5) np.testing.assert_array_less(1 - corr[:, -2], 0.025) + + +def test_relion_source_centering(rln_sources): + """Test that centering by using provided Relion shifts works.""" + rln_src_centered, rln_src_shifted = rln_sources + ims_centered = rln_src_centered.images[:] + ims_shifted = rln_src_shifted.images[:] + + offsets = rln_src_shifted.offsets + np.testing.assert_allclose( + ims_centered.asnumpy(), + ims_shifted.shift(-offsets).asnumpy(), + atol=utest_tolerance(rln_src_centered.dtype), + ) From 0a533643ba1125dd0ad2c667de9b1c8f6edc4784 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 18 Jul 2024 09:32:10 -0400 Subject: [PATCH 126/433] newline at end of file --- tests/saved_test_data/rln_proj_64_centered.star | 1 - tests/saved_test_data/rln_proj_65_centered.star | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/saved_test_data/rln_proj_64_centered.star b/tests/saved_test_data/rln_proj_64_centered.star index 001b5b7820..71a5cf8bd1 100644 --- a/tests/saved_test_data/rln_proj_64_centered.star +++ b/tests/saved_test_data/rln_proj_64_centered.star @@ -30,4 +30,3 @@ _rlnImageName #7 86.698555 31.958115 139.545228 0.000000 0.000000 1 000002@rln_proj_64_centered.mrcs 48.456166 71.176316 185.304830 0.000000 0.000000 1 000003@rln_proj_64_centered.mrcs 215.714386 105.017323 154.043384 0.000000 0.000000 1 000004@rln_proj_64_centered.mrcs - \ No newline at end of file diff --git a/tests/saved_test_data/rln_proj_65_centered.star b/tests/saved_test_data/rln_proj_65_centered.star index c1f77e5b7b..1e105ca1dc 100644 --- a/tests/saved_test_data/rln_proj_65_centered.star +++ b/tests/saved_test_data/rln_proj_65_centered.star @@ -32,4 +32,4 @@ _rlnOriginY #9 86.698555 31.958115 139.545228 0.000000 0.000000 1 000002@rln_proj_65_centered.mrcs 0.00000 0.000000 48.456166 71.176316 185.304830 0.000000 0.000000 1 000003@rln_proj_65_centered.mrcs 0.00000 0.000000 215.714386 105.017323 154.043384 0.000000 0.000000 1 000004@rln_proj_65_centered.mrcs 0.00000 0.000000 - + From c1a582b1d214dc266970715ab9a5fd99d017d4fc Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 25 Jul 2024 15:35:00 -0400 Subject: [PATCH 127/433] add comment documenting grid indexing change. --- src/aspire/image/image.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 443a1b6b33..70a907a116 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -509,8 +509,9 @@ def _im_translate(self, shifts): grid_shifted = fft.ifftshift( xp.ceil(xp.arange(-L / 2, L / 2, dtype=self.dtype)) ) - grid_1d = grid_shifted * 2 * xp.pi / L + + # Grid indexing changed to "xy" to match Relion shift conventions. om_x, om_y = xp.meshgrid(grid_1d, grid_1d, indexing="xy") phase_shifts_x = -shifts[:, 0].reshape((n_shifts, 1, 1)) From a1fd2e6a6e73a1d61c0219dbbfcb574c76719a34 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Thu, 25 Jul 2024 15:50:19 -0400 Subject: [PATCH 128/433] tox --- src/aspire/image/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 70a907a116..503cabe34e 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -511,7 +511,7 @@ def _im_translate(self, shifts): ) grid_1d = grid_shifted * 2 * xp.pi / L - # Grid indexing changed to "xy" to match Relion shift conventions. + # Grid indexing changed to "xy" to match Relion shift conventions. om_x, om_y = xp.meshgrid(grid_1d, grid_1d, indexing="xy") phase_shifts_x = -shifts[:, 0].reshape((n_shifts, 1, 1)) From 78ab9b1c7c6f7a91bdc164fec5ca6300b4f75993 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 29 Jul 2024 11:12:01 -0400 Subject: [PATCH 129/433] clarifying comment. --- tests/test_image.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_image.py b/tests/test_image.py index de8375e8de..01ebaa95d5 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -87,7 +87,11 @@ def testImShift(parity, dtype): im1 = im._im_translate(shifts) # test that float input returns the same thing im2 = im.shift(shifts.astype(dtype)) - # ground truth numpy roll + # ground truth numpy roll. + # Note: NumPy axes 0 and 1 correspond to the row and column of an array, + # respectively, which corresponds to the y-axis and x-axis when that array + # represents an image. Since our shifts are (x-shifts, y-shifts), the axis + # parameter for np.roll() must be set to (1, 0) to accomodate. im3 = np.roll(im_np[0, :, :], -shifts, axis=(1, 0)) atol = utest_tolerance(dtype) From 36309ec3da130e129711bec88e55e653d9a0a522 Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 29 Jul 2024 11:14:19 -0400 Subject: [PATCH 130/433] one more clarifying comment. --- tests/test_image.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_image.py b/tests/test_image.py index 01ebaa95d5..688d4169ec 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -116,6 +116,10 @@ def testImShiftStack(parity, dtype): # test that float input returns the same thing im2 = ims.shift(shifts.astype(dtype)) # ground truth numpy roll + # Note: NumPy axes 0 and 1 correspond to the row and column of an array, + # respectively, which corresponds to the y-axis and x-axis when that array + # represents an image. Since our shifts are (x-shifts, y-shifts), the axis + # parameter for np.roll() must be set to (1, 0) to accomodate. im3 = np.array( [np.roll(ims_np[i, :, :], -shifts[i], axis=(1, 0)) for i in range(n)] ) From fdedba0316cb30dda60d18a31e07ad5e59a6ac7d Mon Sep 17 00:00:00 2001 From: Amit Moscovich Date: Mon, 5 Aug 2024 17:20:39 +0300 Subject: [PATCH 131/433] Update wemd.py Mean-subtract the input array to wemd_embed --- src/aspire/operators/wemd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/operators/wemd.py b/src/aspire/operators/wemd.py index 45db7203bb..8b1bfa72ce 100644 --- a/src/aspire/operators/wemd.py +++ b/src/aspire/operators/wemd.py @@ -46,7 +46,7 @@ def wemd_embed(arr, wavelet="coif3", level=None): message="Level value of .* is too high:" " all coefficients will experience boundary effects.", ) - arrdwt = pywt.wavedecn(arr, wavelet, mode="zero", level=level) + arrdwt = pywt.wavedecn(arr-arr.mean(), wavelet, mode="zero", level=level) detail_coefs = arrdwt[1:] assert len(detail_coefs) == level From e1ab705d52e1673941a39624f7948926ea0e754e Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Mon, 5 Aug 2024 10:36:01 -0400 Subject: [PATCH 132/433] minor black style updates --- src/aspire/operators/wemd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/operators/wemd.py b/src/aspire/operators/wemd.py index 8b1bfa72ce..09fd1db563 100644 --- a/src/aspire/operators/wemd.py +++ b/src/aspire/operators/wemd.py @@ -46,7 +46,7 @@ def wemd_embed(arr, wavelet="coif3", level=None): message="Level value of .* is too high:" " all coefficients will experience boundary effects.", ) - arrdwt = pywt.wavedecn(arr-arr.mean(), wavelet, mode="zero", level=level) + arrdwt = pywt.wavedecn(arr - arr.mean(), wavelet, mode="zero", level=level) detail_coefs = arrdwt[1:] assert len(detail_coefs) == level From 4039e173a01e314e5f1e3e830054df70670caf0d Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Tue, 13 Aug 2024 10:32:08 -0400 Subject: [PATCH 133/433] Add guard for fuzzy_mask in CL codes required for all L<20 --- src/aspire/utils/misc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/aspire/utils/misc.py b/src/aspire/utils/misc.py index f72efbaf14..7541bbddf1 100644 --- a/src/aspire/utils/misc.py +++ b/src/aspire/utils/misc.py @@ -294,7 +294,8 @@ def fuzzy_mask(L, dtype, r0=None, risetime=None): if r0 is None: r0 = np.floor(0.45 * L[0]) if risetime is None: - risetime = np.floor(0.05 * L[0]) + # Guard against zero here for small L + risetime = max(np.floor(0.05 * L[0]), 1.0) dim = len(L) axes = ["x"] From 8700091b95efde07cfe6c2e18c85ce8a995075ca Mon Sep 17 00:00:00 2001 From: Josh Carmichael Date: Mon, 22 Jul 2024 14:43:35 -0400 Subject: [PATCH 134/433] 3D downsample: fix centering issue. --- src/aspire/image/image.py | 8 ++- src/aspire/source/simulation.py | 15 ++++-- src/aspire/volume/volume.py | 20 ++++--- .../saved_test_data/rln_proj_64_centered.mrcs | Bin 66560 -> 66560 bytes .../saved_test_data/rln_proj_64_shifted.mrcs | Bin 66560 -> 66560 bytes tests/test_covar2d.py | 4 +- tests/test_downsample.py | 50 +++++++++++++++++- tests/test_relion_interop.py | 7 +-- tests/test_volume.py | 18 +++---- 9 files changed, 94 insertions(+), 28 deletions(-) diff --git a/src/aspire/image/image.py b/src/aspire/image/image.py index 503cabe34e..bd2610a604 100644 --- a/src/aspire/image/image.py +++ b/src/aspire/image/image.py @@ -537,7 +537,7 @@ def size(self): # probably not needed, transition return np.size(self._data) - def backproject(self, rot_matrices, symmetry_group=None): + def backproject(self, rot_matrices, symmetry_group=None, zero_nyquist=False): """ Backproject images along rotations. If a symmetry group is provided, images used in back-projection are duplicated (boosted) for symmetric viewing directions. @@ -547,6 +547,8 @@ def backproject(self, rot_matrices, symmetry_group=None): corresponding to viewing directions. :param symmetry_group: A SymmetryGroup instance or string indicating symmetry, ie. "C3". If supplied, uses symmetry to increase number of images used in back-projection. + :param zero_nyquist: Option to keep or remove Nyquist frequency for even resolution. + Defaults to zero_nyquist=False, keeping the Nyquist frequency. :return: Volume instance corresonding to the backprojected images. """ @@ -569,7 +571,9 @@ def backproject(self, rot_matrices, symmetry_group=None): # Compute Fourier transform of images. im_f = xp.asnumpy(fft.centered_fft2(xp.asarray(self._data))) / (L**2) - if L % 2 == 0: + + # If resolution is even, optionally zero out the nyquist frequency. + if L % 2 == 0 and zero_nyquist is True: im_f[:, 0, :] = 0 im_f[:, :, 0] = 0 diff --git a/src/aspire/source/simulation.py b/src/aspire/source/simulation.py index e2ef10da12..cbc2f37dc6 100644 --- a/src/aspire/source/simulation.py +++ b/src/aspire/source/simulation.py @@ -243,9 +243,10 @@ def projections(self): """ return self._projections_accessor - def _projections(self, indices): + def _projections(self, indices, legacy=False): """ - Accesses and returns projections as an `Image` instance. Called by self._projections_accessor + Accesses and returns projections as an `Image` instance. Called by self._projections_accessor. + For legacy=True we project with zero Nyquist frequency (used in _LegacySimulation). """ im = np.zeros( (len(indices), self._original_L, self._original_L), dtype=self.dtype @@ -257,7 +258,7 @@ def _projections(self, indices): idx_k = np.where(states == k)[0] rot = self.rotations[indices[idx_k], :, :] - im_k = self.vols[k - 1].project(rot_matrices=rot) + im_k = self.vols[k - 1].project(rot_matrices=rot, zero_nyquist=legacy) im[idx_k, :, :] = im_k.asnumpy() return Image(im) @@ -600,3 +601,11 @@ def rots_zyx_to_legacy_aspire(rots): new_rots = rots[:, ::-1] @ flip_xy return new_rots.reshape(og_shape) + + def _projections(self, indices): + """ + Accesses and returns projections as an `Image` instance. Called by self._projections_accessor + + Note: uses Volume.project(zero_nyquist=True) to match legacy projections. + """ + return super()._projections(indices, legacy=True) diff --git a/src/aspire/volume/volume.py b/src/aspire/volume/volume.py index 0f01ef5e61..f6bd6f8dbd 100644 --- a/src/aspire/volume/volume.py +++ b/src/aspire/volume/volume.py @@ -309,7 +309,7 @@ def __rtruediv__(self, otherL): """ return otherL * Volume(1.0 / self._data) - def project(self, rot_matrices): + def project(self, rot_matrices, zero_nyquist=False): """ Using the stack of rot_matrices, project images of Volume. When projecting over a stack of volumes, a singleton Rotation or a Rotation with stack size @@ -318,6 +318,8 @@ def project(self, rot_matrices): and a Rotation stack, the i'th Volume will be projected using the i'th Rotation. :param rot_matrices: Stack of rotations. Rotation or ndarray instance. + :param zero_nyquist: Option to keep or remove Nyquist frequency for even resolution. + Defaults to zero_nyquist=False, keeping the Nyquist frequency. :return: `Image` instance. """ # See Issue #727 @@ -366,7 +368,8 @@ def project(self, rot_matrices): im_f = im_f.reshape(-1, self.resolution, self.resolution) - if self.resolution % 2 == 0: + # If resolution is even, optionally zero out the nyquist frequency. + if self.resolution % 2 == 0 and zero_nyquist is True: im_f[:, 0, :] = 0 im_f[:, :, 0] = 0 @@ -473,7 +476,7 @@ def downsample(self, ds_res, mask=None): v = self.stack_reshape(-1) # take 3D Fourier transform of each volume in the stack - fx = fft.fftshift(fft.fftn(xp.asarray(v._data), axes=(1, 2, 3))) + fx = fft.centered_fftn(xp.asarray(v._data), axes=(1, 2, 3)) # crop each volume to the desired resolution in frequency space fx = crop_pad_3d(fx, ds_res) @@ -483,18 +486,19 @@ def downsample(self, ds_res, mask=None): fx = fx * xp.asarray(mask) # inverse Fourier transform of each volume - out = fft.ifftn(fft.ifftshift(fx), axes=(1, 2, 3)).real + out = fft.centered_ifftn(fx, axes=(1, 2, 3)) out = out.real * (ds_res**3 / self.resolution**3) # returns a new Volume object return self.__class__( - xp.asnumpy(out), symmetry_group=self.symmetry_group + xp.asnumpy(out), + symmetry_group=self.symmetry_group, ).stack_reshape(original_stack_shape) def shift(self): raise NotImplementedError - def rotate(self, rot_matrices, zero_nyquist=True): + def rotate(self, rot_matrices, zero_nyquist=False): """ Rotate volumes, within a fixed grid, by `rot_matrices`. If `rot_matrices` is a single rotation, each volume will be rotated by that rotation. If `rot_matrices` is a stack of @@ -502,7 +506,7 @@ def rotate(self, rot_matrices, zero_nyquist=True): :param rot_matrices: `Rotation` object of length 1 or n_vols. :param zero_nyquist: Option to keep or remove Nyquist frequency for even resolution. - Defaults to zero_nyquist=True, removing the Nyquist frequency. + Defaults to zero_nyquist=False, keeping the Nyquist frequency. :return: `Volume` instance. """ @@ -550,7 +554,7 @@ def rotate(self, rot_matrices, zero_nyquist=True): vol_f = vol_f.reshape(-1, self.resolution, self.resolution, self.resolution) - # If resolution is even, we zero out the nyquist frequency by default. + # If resolution is even, optionally zero out the nyquist frequency. if self.resolution % 2 == 0 and zero_nyquist is True: vol_f[:, 0, :, :] = 0 vol_f[:, :, 0, :] = 0 diff --git a/tests/saved_test_data/rln_proj_64_centered.mrcs b/tests/saved_test_data/rln_proj_64_centered.mrcs index 643647d12fd4601beb8ee83d69ffa3d3b8a1843e..7dc22c9caf448ffa9033e5e43f80a7a493ab0383 100644 GIT binary patch literal 66560 zcmeFY`8QWz_%?1zM1v3&4TMxwhS%AzvzrVVlZvENL?sPMG}qfy#t~Eec#tSDJiLW1CSel z%mDuPHgBNwKad`PlvIf2|Bty+QWXQw{~!Km?0?>q9YFYnQo&}(C;avZpn>lHk>+Hv zXo9tcl+=>yTK<3Lwq)IAzpefg2HK37Mix7KjZDlYOqglPn}~Qb^Zz3={C^+)e>?Dh z&khvW=)zG41eZd@(6sqA+2|4@kqk$brQ?p1+&SiOWYSKk7}Z7imM-r3$Kfcx?z1RC ze7j=Jlp~-Oe+l@4Feu-=1Qy!IlRsVYq^4gU)|;o1nb-BfW$-p|^?6N>7R!*CziUM1 zgIXj@@(j?#Tb5|HLaXH8j#APo{eifIIf`t``?$#kr?{i4OObiU0WL{f7k1>%CA;^F zxZb;d+^p)mlDOA-qA|8MWVDkNM>IOQqutGX;}Ij*f=; z>(|1ljVsKJ>Ys8wv3h7oUjQoU_)j#(S%(``Zi{3Z|8d&G?n)X3X)vnJCyTDngp(6F zu)ePYT_xAZEQMAw(dsa4bWepWl``<$br$Yt9)Ys>5b#`U0G3 zj1DFyqJ@=qD8eIx`zSwz1TO6)9}SHlFDMIKww?ortaH#MGZ~!SevykEdtiok9Jn8e zhI*O=J^qal<5B~KQt<#Io{<;-TDeyq>FD~DPIS8e2imf$0Yxs{hCG-edek@p$v6Jx zdM|Wy^Gy~>{L&QReC$SOGg}CCqWv&r*M6AoEeER-vL#ny?@P2D*AuU-!Q|fTOwy}= zmzWQ>C$VN0#BG;8sql7$($+M1`KJK1@~*?ndS?hTHj-R_e?l_tts>Gj8jGG<6^hdD z3?ef_TS(6CM3}eK6P(rBxVDWp=wRs|E_vo4)H|jgEwet1woX%$99b&QO-yQ#*!zru zx?T+Jul+&SCkxswtK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