import dascore as dc
from dascore.proc.impulse import Impulsed
patch = dc.get_example_patch()
out = patch.impulse_window(time=1e-6).pass_filter(time=(1, 20))
same = Impulsed(dc.proc.PassFilter(time=(1, 20)), time=1e-6)(patch)
assert out.equals(same)Impulsed
Impulsed(
*args ,
operation: Any ,
on_unsettled: str = raise,
**kwargs ,
)-> None
Run a linear operation in pieces, each read with the reach it measured.
The operation behind a patch method called on Patch.impulse_window, where the tolerances are described; they are given as keywords, such as time=1e-6.
Parameters
| Parameter | Description |
|---|---|
| operation |
The operation to run, as aPatchProcessor. Itsclass must say it is linear and act the same wherever a patch’scoordinates start ( position_free).
|
| on_unsettled |
What to do when the response along a dimension does not fall under its tolerance within the longest probe: "raise", the default,or "whole", which needs that dimension whole as the operationalone does. |
Examples
Note
- The reach along each dimension is measured by running the operation’s own kernel on an impulse, with the plan it will be run with: it is the smallest distance beyond which the summed absolute response is under the tolerance times the whole, before and after the impulse separately, so a causal filter reaches one way. The probe grows until the reach sits well inside it. The measurement depends on the plan alone and is kept for it.
- Data in memory are computed whole, exactly as the operation alone computes them. A lazy or dask patch is computed a chunk at a time, each chunk read with the measured reach around it and that reach discarded, so it differs from the exact result by at most about the tolerance.
Methods
| Name | Description |
|---|---|
| check | Check the patch for the operation run, then for the window. |
| chunk_contract | Return the measured reach around a chunk; it may be its whole axis. |
| get_metadata | Return the operation’s metadata, and the reach along each axis. |
| halo | Return how far along an axis the kernel reads to fill a sample. |
| kernel | Return the operation’s result on the data’s own backend. |
| model_copy | Copy the model, dropping cached values the update invalidates. |
| new | Create new instance with some attributed updated. |
| numpy_kernel | Return the operation’s result on the data, computed as it computes it. |
| reconcile | Return metadata or a patch holding the final data; default as is. |
| run | Run the operation: check, get_metadata, kernel, reconcile, record. |