def get_intervals(pcg, transitions=None, interval='RR', resize=None):
"""
Given array transitions and a interval type
computes an array of starting indices and ending indices for that
given type of interval.
Args:
pcg : numpy array
transitions : tuple( numpy array begin, numpy array end)
begin - indices where the intervals start
end - indices where the intervals end
interval : string
Type of interval [RR, S1, Sys, S2, Dia]. Defaults to RR
resize : int
resample the interval to a specified length
Returns:
intervals : list<numpy array>
list of intervals of the specified type
"""
intervals = [pcg[i:j] for i, j in zip(*boundaries(transitions, interval))]
if resize:
intervals = [resample(i, resize) for i in intervals]
return intervals
评论列表
文章目录