lmlib.statespace.cost.map_windows#
- lmlib.statespace.cost.map_windows(windows, ks, K, merge_ks=False, merge_seg=False, fill_value=0)#
Maps the window amplitudes of one or multiple
Segment
to indices ks into a common target output vector of length K.The parameter
windows
is commonly directly the output of one of the following methods:- Parameters
windows –
tuple
(range, tuple)
, as output byCostSegment.windows()
.tuple of shape=(P) of tuples
(range, tuple)
, as output byCompositeCost.windows()
.
ks (array_like of shape=(KS) of ints) – target indices in the target output vector, where to map the windows to
K (int) – Length of target output vector
merge_ks (bool, optional) – If
True
, all windows from different target indicesks
are merged into a single array of lengthK
; if the windows of two target indices overlap, only the window with the larger value remains.merge_seg (bool, optional) – If
True
, all segments P are merged to a single target vector of lengthK
; if the windows of two segments overlap, only window value with the larger value remains.fill_value (scalar or None, optional) – Default value of target output vector elements, when no window is assigned.
- Returns
output –
Dimension KS only exists, if
merge_ks
=False
.Dimension P only exists, if
merge_seg
=False
.
- Return type
ndarray
of shape=([KS,] [P,] K) of floats
KS : number of (time) indices in the list
P : number of segments
K : number of samplesExamples