resolve_window

function of dascore.utils.window source

resolve_window(
    patch: Windowed ,
    kwargs: collections.abc.Mapping[str, Any] ,
    samples: bool = False,
    overlap: Any = None,
    step: Any = None,
    default_overlap: collections.abc.Callable[collections.abc.Callable[int, int], int, integer, None] = None,
    allow_multiple: bool = True,
    require_evenly_sampled: bool = True,
    require_odd: bool = False,
    min_samples: int | None[int, None] = 1,
    warn_above: int | None[int, None] = None,
    enforce_lt_coord: bool = False,
)-> ‘Window’

Return the window a call’s dimension keywords describe, in samples.

Parameters

Parameter Description
patch The patch, or anything with its dims and coords – a
PatchMeta serves, so a processor can resolve a window without data.
kwargs Dimension names and the window along each, in coordinate units or,
with samples, in samples. A Quantity keeps its units either way.
samples If True, bare numbers are sample counts.
overlap How far each window reaches into the next: one value for every
dimension, or a mapping of dimension to value. Read like the windows
are, except that a percent is a fraction of that dimension’s window.
step How far each window advances, spelled instead of overlap; the
two are exclusive.
default_overlap What a dimension given no overlap and no step gets: a sample count,
or a callable from the window’s size in samples to one. None leaves
Window.overlap None when nothing was given.
allow_multiple Whether more than one dimension may be windowed.
require_evenly_sampled Whether a windowed coordinate must be evenly sampled. When it need
not be, a window given in samples never consults the coordinate;
one in units cannot be converted without an even step anyway.
require_odd Whether the window must have an odd number of samples. Given in
units, an even count is rounded up; given in samples, refused.
min_samples The fewest samples a window may have along any dimension, or None
for no floor at all.
warn_above Warn when the window’s total sample count – its area – exceeds this.
enforce_lt_coord Whether a window, step, or overlap longer than its coordinate is refused.

Raises

ParameterError For a window which is too small, even when it must be odd, longer than its coordinate when that is refused, or an overlap or step which is negative, leaves no advance, or is given alongside the other. CoordError For a coordinate which is not evenly sampled when that is required.