import numpy as np
import dascore as dc
from dascore.proc.tile_apply import TileApply
patch = dc.get_example_patch("example_event_2")
out = TileApply(np.positive, time=0.05, distance=50)(patch)
assert out.shape == patch.shapeTileApply
TileApply(
*args ,
function: Callable ,
mode: str = overlap_add,
overlap: Any = None,
step: Any = None,
taper: Any = None,
analysis: Any = None,
fill: Any = None,
samples: bool = False,
engine: str = auto,
**kwargs ,
)-> None
Apply a function to overlapping windows of the patch.
The operation behind Patch.window(...).apply, where its parameters are described; the dimensions to window are given as keywords, such as time=0.5.
Examples
Note
- Tiles start before the data and hold
fillthere, zeros unless one is given, as many whole strides before as it takes for every tile which reaches a sample to exist: none when tiles abut, one stride up to half overlap, more beyond it, which an analysis window’s dual relies on. - The adaptive spectral filter is this with a spectral weighting as
function; seePatch.adaptive_spectral_filter.
Methods
| Name | Description |
|---|---|
| check | Refuse a patch which does not carry what the operation needs. |
| chunk_contract | Return what a chunk of the output needs of the input, or None. |
| get_metadata | Return a stack’s metadata, and the windowed axes, size and stride. |
| halo | Return how far along an axis the kernel reads to fill a sample. |
| kernel | Tile every batch over the windowed axes; blend or stack. |
| model_copy | Copy the model, dropping cached values the update invalidates. |
| new | Create new instance with some attributed updated. |
| reconcile | Return metadata or a patch holding the final data; default as is. |
| run | Run the operation: check, get_metadata, kernel, reconcile, record. |
| window | Return the window in samples. |