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", 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): """ 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}")