Exemplo n.º 1
0
def main(args):
    sy.setrecursionlimit(60000)
    check_algorithm(args.algorithm)

    timedata = TimeData()
    timedata.read_time = time.time()
    input_data = read_input_data(args.input_file)
    timedata.read_time = time.time() - timedata.read_time

    upperhull, lowerhull, timedata = algorithms[args.algorithm](input_data, timedata)
    output_data = upperhull + lowerhull
    write_output_data(args.output_file, output_data)

    timedata.input_length = len(input_data)
    timedata.output_length = len(output_data)
    write_timedata(args.timedata_file, timedata)

    make_plot(input_data, upperhull, lowerhull,
        "./plots/plot_%s_%s.png" % (args.algorithm, os.path.splitext(os.path.basename(args.input_file))[0]))
Exemplo n.º 2
0
def main(args):
    timedatas = []
    #read from timedata files
    for inputfilename in args.input_files :
        inputfile = open(inputfilename, 'r')
        lines = inputfile.readlines()
        input_length = output_length = read_time = sort_time = upper_scan_time = lower_scan_time = reverse_time = 0.0
        for line in lines :
            input_length += float(line.split(" ")[0])
            output_length += float(line.split(" ")[1])
            read_time += float(line.split(" ")[2])
            sort_time += float(line.split(" ")[3])
            upper_scan_time += float(line.split(" ")[4])
            lower_scan_time += float(line.split(" ")[5])
            reverse_time += float(line.split(" ")[6])
        #make timedata with mean values of input_length, output_length, ...
        timedata = TimeData()
        timedata.setValues(input_length/len(lines), output_length/len(lines), read_time/len(lines),
            sort_time/len(lines), upper_scan_time/len(lines), lower_scan_time/len(lines), reverse_time/len(lines))
        timedatas.append(timedata)

    make_timeplot(timedatas, "./plots/timeplot_%s.png" %args.input_files[0].split("/")[2].split("_")[0])