MCPcopy Create free account
hub / github.com/dask/dask / func

Function func

dask/array/fft.py:169–212  ·  view source on GitHub ↗
(a, s=None, axes=None, norm=None)

Source from the content-addressed store, hash-verified

167 raise ValueError("Given unknown `kind` %s." % kind)
168
169 def func(a, s=None, axes=None, norm=None):
170 a = asarray(a)
171 if axes is None:
172 if kind.endswith("2"):
173 axes = (-2, -1)
174 elif kind.endswith("n"):
175 if s is None:
176 axes = tuple(range(a.ndim))
177 else:
178 if NUMPY_GE_200:
179 # Match deprecation in numpy
180 warnings.warn(
181 "DeprecationWarning: `axes` should not be `None` "
182 "if `s` is not `None` (Deprecated in NumPy 2.0)",
183 DeprecationWarning,
184 )
185 axes = tuple(range(len(s)))
186 else:
187 axes = (-1,)
188 else:
189 if len(set(axes)) < len(axes):
190 raise ValueError("Duplicate axes not allowed.")
191
192 _dtype = dtype
193 if _dtype is None:
194 sample = np.ones(a.ndim * (8,), dtype=a.dtype)
195 try:
196 _dtype = fft_func(sample, axes=axes, norm=norm).dtype
197 except TypeError:
198 _dtype = fft_func(sample).dtype
199
200 for each_axis in axes:
201 if len(a.chunks[each_axis]) != 1:
202 raise ValueError(chunk_error % (each_axis, a.chunks[each_axis]))
203
204 chunks = out_chunk_fn(a, s, axes)
205
206 args = (s, axes, norm)
207 if kind.endswith("fft"):
208 axis = None if axes is None else axes[0]
209 n = None if s is None else s[0]
210 args = (n, axis, norm)
211
212 return a.map_blocks(fft_func, *args, dtype=_dtype, chunks=chunks)
213
214 if kind.endswith("fft"):
215 _func = func

Callers 15

partial_reduceFunction · 0.70
apply_infer_dtypeFunction · 0.70
_pass_extra_kwargsFunction · 0.70
apply_and_enforceFunction · 0.70
_offsetFunction · 0.70
_parse_wrap_argsFunction · 0.70
_broadcast_trick_innerFunction · 0.70
compute_metaFunction · 0.70
scipy_linalg_safeFunction · 0.70
arg_chunkFunction · 0.70
_prefixscan_combineFunction · 0.70

Calls 4

asarrayFunction · 0.90
setClass · 0.85
onesMethod · 0.45
map_blocksMethod · 0.45

Tested by

no test coverage detected