pitchscapes.util.sample_discrete_scape

pitchscapes.util.sample_discrete_scape(scape, times=None, start_end_idx=False, center_width=False, start_end_time=False, coords=False, value=True)[source]

Generator that returns values from scape on a discrete time grid. :type scape: :param scape: The scape to sample from. scape[start, end] (for start < end in times) should return the respective value. :type times: :param times: set of valid points in time (optional; required if scape does not have a times attribute) :type start_end_idx: :param start_end_idx: whether to return start and end index of window (default: False) :type center_width: :param center_width: whether to return center and width of window (default: False) :type start_end_time: :param start_end_time: whether to return start and end time of window (default: False) :type coords: :param coords: whether to return the center-width coordinates for plotting (default: False). This is a 4-tuple of pairs with center width coordinates for windows defined by time indices [start, end-1], [start, end], [start+1, end], [start+1,end-1]. If the respective window contains only a single time slot, the last pair is (nan, nan). :type value: :param value: whether to return the value of the scape for the window (default: True) :return: yields a nested tuple ((start_idx, center, start_time), (end_idx, width, end_time), coords, value). Some elements may be omitted (based on start_end_idx, center_width, start_end_time, coords, and value). If the first tuples would be empty, they are entirely omitted instead.