Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove conversion for real dtypes #606

Merged
merged 4 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions python/cufinufft/cufinufft/_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,6 @@ def __init__(self, nufft_type, n_modes, n_trans=1, eps=1e-6, isign=None,
# Setup type bound methods
self.dtype = np.dtype(dtype)

if self.dtype == np.float64:
warnings.warn("Real dtypes are currently deprecated and will be "
"removed in version 2.3. Converting to complex128.",
DeprecationWarning)
self.dtype = np.complex128

if self.dtype == np.float32:
warnings.warn("Real dtypes are currently deprecated and will be "
"removed in version 2.3. Converting to complex64.",
DeprecationWarning)
self.dtype = np.complex64

if self.dtype == np.complex128:
self._make_plan = _make_plan
self._setpts = _set_pts
Expand Down
6 changes: 2 additions & 4 deletions python/cufinufft/tests/test_error_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,8 @@ def test_dtype_errors():
with pytest.raises(TypeError, match="Expected complex64 or complex128") as err:
Plan(1, (8, 8), dtype="uint8")


def test_dtype_warnings():
with pytest.warns(DeprecationWarning, match="Converting to complex64") as record:
with pytest.raises(TypeError, match="Expected complex64 or complex128") as err:
Plan(1, (8, 8), dtype="float32")

with pytest.warns(DeprecationWarning, match="Converting to complex128") as record:
with pytest.raises(TypeError, match="Expected complex64 or complex128") as err:
Plan(1, (8, 8), dtype="float64")
12 changes: 0 additions & 12 deletions python/finufft/finufft/_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,6 @@ def __init__(self,nufft_type,n_modes_or_dim,n_trans=1,eps=1e-6,isign=None,dtype=

dtype = np.dtype(dtype)

if dtype == np.float64:
warnings.warn("Real dtypes are currently deprecated and will be "
"removed in version 2.3. Converting to complex128.",
DeprecationWarning)
dtype = np.complex128

if dtype == np.float32:
warnings.warn("Real dtypes are currently deprecated and will be "
"removed in version 2.3. Converting to complex64.",
DeprecationWarning)
dtype = np.complex64

is_single = is_single_dtype(dtype)

# construct plan based on precision type and eps default value
Expand Down
6 changes: 6 additions & 0 deletions python/finufft/test/test_finufft_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ def test_finufft_plan_errors():
with pytest.raises(RuntimeError, match="must be single or double"):
Plan(1, (8, 8), dtype="uint32")

with pytest.raises(RuntimeError, match="must be single or double"):
Plan(1, (8, 8), dtype="float32")

with pytest.raises(RuntimeError, match="must be single or double"):
Plan(1, (8, 8), dtype="float64")

with pytest.warns(Warning, match="finufft_opts does not have"):
Plan(1, (8, 8), foo="bar")

Expand Down
Loading