'Resamples the stats to have a specific number of data points.'

def _Resample(self, stats, target_size):

    t_first = stats[0][0]
    t_last = stats[(-1)][0]
    interval = ((t_last - t_first) / target_size)
    result = []
    result.append([0, 0])
    current_t = t_first
    current_v = 0
    i = 0
    while (i < len(stats)):
        stat_t = stats[i][0]
        stat_v = stats[i][1]
        if (stat_t <= (current_t + interval)):
            current_v = stat_v
            i += 1
        else:
            result.append([(current_t + interval), current_v])
            current_t += interval
    result.append([(current_t + interval), current_v])
    return result
