MCPcopy Create free account
hub / github.com/numpy/numpy / _fromnxfunction_single

Class _fromnxfunction_single

numpy/ma/extras.py:263–278  ·  view source on GitHub ↗

A version of `_fromnxfunction` that is called with a single array argument followed by auxiliary args that are passed verbatim for both the data and mask calls.

Source from the content-addressed store, hash-verified

261
262
263class _fromnxfunction_single(_fromnxfunction):
264 """
265 A version of `_fromnxfunction` that is called with a single array
266 argument followed by auxiliary args that are passed verbatim for
267 both the data and mask calls.
268 """
269 def __call__(self, x, *args, **params):
270 func = getattr(np, self.__name__)
271 if isinstance(x, ndarray):
272 _d = func(x.__array__(), *args, **params)
273 _m = func(getmaskarray(x), *args, **params)
274 return masked_array(_d, mask=_m)
275 else:
276 _d = func(np.asarray(x), *args, **params)
277 _m = func(getmaskarray(x), *args, **params)
278 return masked_array(_d, mask=_m)
279
280
281class _fromnxfunction_seq(_fromnxfunction):

Callers 1

extras.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected