예제 #1
0
    def evaluate_tempo_range(self,
                             seq_length=None,
                             query_duration=None,
                             tempo_range=[1.0],
                             gt_only=True):
        """
        ::

            Loop over tempo range evaluating and integrating results:
             query_duration = fractional seconds (requires adb.delta_time)
              OR seq_length - integer length of query sequence
             tempo_range = list of tempo proportions relative to nominal 1.0
             gt_only = if True, return only ground-truth results otherwise return full database results        
        """
        seq_length = self.set_seq_length(seq_length, query_duration)
        out_ranks = []
        out_dists = []
        for t in tempo_range:
            print "Evaluating tempo: ", t
            # perform full evaluation, gt_only=False, for across-tempo merged ranks of gt in db results
            ranks, dists = self.evaluate(query_duration=query_duration,
                                         tempo=t,
                                         gt_only=False)
            out_ranks.append(ranks)
            out_dists.append(dists)
        out_ranks = pylab.dstack(out_ranks).min(2)  # collapse runs
        out_dists = pylab.dstack(out_dists).min(2)
        if gt_only:
            out_ranks, out_dists = self.reduce_evaluation_to_gt(
                out_ranks, out_dists, query_duration=query_duration)
        return out_ranks, out_dists
def __update_graphics_context__(gc, scatter, pp_spec, manager, first=False):
    """
    function update graphics context of scatter plot based in
    information included in poincare plot specification object
    """
    p = pp_spec  # alias
    m = manager  # alias

    if first and p.level >= 0 and p.inactive_stop >= 0 and p.active_stop >= 0:
        r_points = pl.dstack(
            (p.x_data[p.inactive_stop:p.active_stop],
             p.y_data[p.inactive_stop:p.active_stop]))[0]
        r_points = scatter.map_screen(r_points)
        gc.set_fill_color(m.active_color_as_tuple)
        gc.draw_marker_at_points(r_points, m.active_point_size, CIRCLE)

    if p.inactive_start_2 >= 0 and p.inactive_stop_2 >= 0:
        r_points = pl.dstack(
                (p.x_data[p.inactive_start_2: p.inactive_stop_2],
                 p.y_data[p.inactive_start_2: p.inactive_stop_2]))[0]
        r_points = scatter.map_screen(r_points)
        gc.set_fill_color(m.inactive_color_as_tuple)
        gc.draw_marker_at_points(r_points, m.inactive_point_size, CIRCLE)

    if first and p.level >= 0 and p.inactive_stop >= 0:
        r_points = pl.dstack(
                (p.x_data[: p.inactive_stop],
                 p.y_data[: p.inactive_stop]))[0]
        r_points = scatter.map_screen(r_points)
        gc.set_fill_color(m.inactive_color_as_tuple)
        gc.draw_marker_at_points(r_points, m.inactive_point_size, CIRCLE)
    elif p.inactive_start >= 0 and p.inactive_stop >= 0:
        r_points = pl.dstack(
                    (p.x_data[p.inactive_start: p.inactive_stop],
                     p.y_data[p.inactive_start: p.inactive_stop]))[0]
        r_points = scatter.map_screen(r_points)
        gc.set_fill_color(m.inactive_color_as_tuple)
        gc.draw_marker_at_points(r_points, m.inactive_point_size, CIRCLE)

    if (not first or p.level == 0) \
        and p.active_start >= 0 and p.active_stop >= 0:
        r_points = pl.dstack(
                (p.x_data[p.active_start: p.active_stop],
                 p.y_data[p.active_start: p.active_stop]))[0]
        r_points = scatter.map_screen(r_points)
        gc.set_fill_color(m.active_color_as_tuple)
        gc.draw_marker_at_points(r_points, m.active_point_size, CIRCLE)
예제 #3
0
    def evaluate_tempo_range(self, seq_length=None, query_duration=None, tempo_range=[1.0], gt_only=True):
        """
        ::

            Loop over tempo range evaluating and integrating results:
             query_duration = fractional seconds (requires adb.delta_time)
              OR seq_length - integer length of query sequence
             tempo_range = list of tempo proportions relative to nominal 1.0
             gt_only = if True, return only ground-truth results otherwise return full database results        
        """
        seq_length=self.set_seq_length(seq_length, query_duration)
        out_ranks = []
        out_dists = []
        for t in tempo_range:
            print "Evaluating tempo: ", t
            # perform full evaluation, gt_only=False, for across-tempo merged ranks of gt in db results
            ranks, dists = self.evaluate(query_duration=query_duration, tempo=t, gt_only=False)
            out_ranks.append(ranks)
            out_dists.append(dists)
        out_ranks = pylab.dstack(out_ranks).min(2) # collapse runs
        out_dists = pylab.dstack(out_dists).min(2)
        if gt_only:
            out_ranks, out_dists = self.reduce_evaluation_to_gt(out_ranks, out_dists, query_duration=query_duration)    
        return out_ranks, out_dists