from dascore.utils.array import apply_ufunc
import numpy as np
import dascore as dc
patch = dc.get_example_patch()
# Call abs on a patch.
new1 = apply_ufunc(np.abs, patch)
# Add two patches
new2 = apply_ufunc(np.add, patch, patch)
# multiply the patch by 10
new3 = apply_ufunc(np.multiply, patch, 10)apply_ufunc
apply_ufunc(
ufunc ,
*args ,
**kwargs ,
)
Apply a ufunc to one or more patches.
Parameters
| Parameter | Description |
|---|---|
| ufunc | The ufunc to use. |
| *args | Additional positional arguments, can contain patches. |
| **kwargs |
Keyword arguments, can contain patches. out is refused, as isa where mask on element-wise ufuncs; use patch.data for those.
|
Examples
Note