Skip to content

Commit

Permalink
Remove conversion for real dtypes (#606)
Browse files Browse the repository at this point in the history
* py+cuda: remove conversions for real dtypes

* cu+py: convert warning check to error check

For real dtypes in cufinufft.

* py: remove conversions for real dtypes

* py: convert warning check to error check

For real dtypes in finufft.
  • Loading branch information
janden authored Jan 27, 2025
1 parent 241f8b6 commit 4c949c6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 28 deletions.
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

0 comments on commit 4c949c6

Please sign in to comment.