apply_ufunc

function of dascore.utils.array source

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.

Examples

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)