Skip to content

Commit

Permalink
py: access private attributes through properties
Browse files Browse the repository at this point in the history
  • Loading branch information
janden committed Jan 27, 2025
1 parent fff1bc4 commit e6cfc03
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions python/finufft/finufft/_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def setpts(self,x=None,y=None,z=None,s=None,t=None,u=None):
points (target for type 3).
"""

real_dtype = _get_real_dtype(self._dtype)
real_dtype = _get_real_dtype(self.dtype)

self._xj = _ensure_array_type(x, "x", real_dtype)
self._yj = _ensure_array_type(y, "y", real_dtype)
Expand All @@ -228,16 +228,16 @@ def setpts(self,x=None,y=None,z=None,s=None,t=None,u=None):
self._u = _ensure_array_type(u, "u", real_dtype)

# valid sizes
dim = self._dim
tp = self._type
dim = self.dim
tp = self.type
(self._nj, self._nk) = valid_setpts(tp, dim, self._xj, self._yj, self._zj, self._s, self._t, self._u)

# call set pts for single prec plan
if self._dim == 1:
if self.dim == 1:
ier = self._setpts(self._inner_plan, self._nj, self._xj, self._yj, self._zj, self._nk, self._s, self._t, self._u)
elif self._dim == 2:
elif self.dim == 2:
ier = self._setpts(self._inner_plan, self._nj, self._yj, self._xj, self._zj, self._nk, self._t, self._s, self._u)
elif self._dim == 3:
elif self.dim == 3:
ier = self._setpts(self._inner_plan, self._nj, self._zj, self._yj, self._xj, self._nk, self._u, self._t, self._s)

if ier != 0:
Expand Down Expand Up @@ -265,17 +265,17 @@ def execute(self,data,out=None):
complex[n_modes], complex[n_tr, n_modes], complex[M], or complex[n_tr, M]: The output array of the transform(s).
"""

_data = _ensure_array_type(data, "data", self._dtype)
_out = _ensure_array_type(out, "out", self._dtype, output=True)
_data = _ensure_array_type(data, "data", self.dtype)
_out = _ensure_array_type(out, "out", self.dtype, output=True)

tp = self._type
n_trans = self._n_trans
tp = self.type
n_trans = self.n_trans
nj = self._nj
nk = self._nk
dim = self._dim
dim = self.dim

if tp==1 or tp==2:
ms, mt, mu = [*self._n_modes, *([1]*(3-len(self._n_modes)))]
ms, mt, mu = [*self.n_modes, *([1]*(3-len(self.n_modes)))]

# input shape and size check
if tp==2:
Expand All @@ -295,11 +295,11 @@ def execute(self,data,out=None):
# allocate out if None
if out is None:
if tp==1:
_out = np.zeros([*data.shape[:-1], *self._n_modes[::-1]], dtype=self._dtype, order='C')
_out = np.zeros([*data.shape[:-1], *self.n_modes[::-1]], dtype=self.dtype, order='C')
if tp==2:
_out = np.zeros([*data.shape[:-dim], nj], dtype=self._dtype, order='C')
_out = np.zeros([*data.shape[:-dim], nj], dtype=self.dtype, order='C')
if tp==3:
_out = np.zeros([*data.shape[:-1], nk], dtype=self._dtype, order='C')
_out = np.zeros([*data.shape[:-1], nk], dtype=self.dtype, order='C')

# call execute based on type and precision type
if tp==1 or tp==3:
Expand Down

0 comments on commit e6cfc03

Please sign in to comment.