Example #1
0
            cntr += 1
    return res
def gen_replicate():
    acc = 0
    cntr = 0
    while cntr < len(sequences):
        r = gen_replicate1()
        if r != None:
            acc += r
            cntr += 1
    return acc / cntr
def gen_replicates():
    return [gen_replicate() for _ in xrange(nr_replicates)]
repl = gen_replicates()
repl.sort()
print "Interfering time per crashing instruction: %f, %f %d" % (common.quantile(repl, 0.05), common.quantile(repl, 0.95), len(sequences))

replicates = [sequences_to_chartset([random.choice(sequences) for _ in xrange(len(sequences))]) for _2 in xrange(nr_replicates)]
(charts, defect_samples, total_samples) = sequences_to_chartset(sequences)

main_fig = common.Figure(time_to_y, y_to_time, [])


output.write("\\begin{tikzpicture}\n")

common.draw_furniture(output, chart_keys, main_fig)
common.draw_pdfs(output, chart_keys, charts, defect_samples, total_samples, replicates, chart_labels, main_fig)

output.write("\\end{tikzpicture}\n")
output.close()
Example #2
0
        charts[ck].samples.sort()
    defect_samples.sort()
    total_samples.sort()
    return (charts, defect_samples, total_samples)

def time_to_y(t):
    return math.log(t / main_fig.mintime) / math.log(main_fig.maxtime / main_fig.mintime) * (main_fig.y_max - main_fig.y_min) + main_fig.y_min
def y_to_time(y):
    return math.e ** ((y - main_fig.y_min) / (main_fig.y_max - main_fig.y_min) * math.log(main_fig.maxtime / main_fig.mintime)) * main_fig.mintime

(charts, defect_samples, total_samples) = sequences_to_chartset(sequences)
def gen_replicate():
    return sum(random.choice(total_samples) for _ in total_samples) / len(total_samples)
replicates = [gen_replicate() for _ in xrange(nr_replicates)]
replicates.sort()
print "Total time: %f, %f, %d" % (common.quantile(replicates, 0.05),
                                  common.quantile(replicates, 0.95),
                                  len(total_samples))
replicates = [sequences_to_chartset([random.choice(sequences) for _ in xrange(len(sequences))]) for _2 in xrange(nr_replicates)]

main_fig = common.Figure(time_to_y, y_to_time, [])
main_fig.nr_time_steps = 100.0
main_fig.kernel_box_height = 1.0
main_fig.figwidth -= 0.3


output.write("\\begin{tikzpicture}\n")

common.draw_furniture(output, chart_keys, main_fig)
common.draw_pdfs(output, chart_keys, charts, defect_samples, total_samples, replicates, chart_labels, main_fig)